file
stringlengths 18
26
| data
stringlengths 3
1.04M
|
---|---|
the_stack_data/165766949.c | #include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <stdint.h>
#include <inttypes.h>
#include <math.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <string.h>
int main (int argc, char** argv){
if(argc<2){
printf("PLEASE ENTER A INPUT FILE\n");
exit(0);
} else {
// printf("APP STARTS-------\n");
char* app = malloc(sizeof(char)*10);
int flag=0;
int status;
char* inputfilename = *(argv+1);
//char* outputfilename = "";
FILE *fp,*fp2;
char* N;
fp = fopen(inputfilename, "r");
while(fp){
printf("ENTER THE NAME OF APP TO RUN\n");
scanf("%s",app);
pid_t pid = getpid();;
char *env1[] = { "PATH=/bin:/sbin", NULL };
if( strcmp(app,"solver")==0 ){
char *argv1[] = { "solver", inputfilename , NULL };
if((pid=fork()==0)){
if(execve(argv1[0], argv1, env1 )<0){
printf("ERROR IN EXECVE\n");
exit(0);
}
} else {
if( waitpid(pid,&status , 0)<0 ){
printf("ERROR IN WAITPID\n");
exit(0);
}
// No zoombie
// system("ps -eo pid,ppid,stat,cmd");
}
}
if( strcmp(app,"trace")==0 ){
char *argv1[] = { "trace", inputfilename , NULL };
if((pid=fork()==0)){
if(execve(argv1[0], argv1, env1 )<0){
printf("ERROR IN EXECVE\n");
exit(0);
}
} else {
if( waitpid(pid,&status , 0)<0 ){
printf("ERROR IN WAITPID\n");
exit(0);
}
// No zoombie
// system("ps -eo pid,ppid,stat,cmd");
}
}
if( strcmp(app,"fib")==0 ){
N = malloc(sizeof(char)*10000000);
fscanf(fp,"%s", N);
char *argv1[] = { "fib", N , NULL };
if((pid=fork()==0)){
if(execve(argv1[0], argv1, env1 )<0){
printf("ERROR IN EXECVE\n");
exit(0);
}
} else {
if( waitpid(pid,&status , 0)<0 ){
printf("ERROR IN WAITPID\n");
exit(0);
}
// No zoombie
// system("ps -eo pid,ppid,stat,cmd");
}
}
if( strcmp(app,"quit")==0 ){
fclose(fp);
free(app);
exit(0);
}
if( strcmp(app,"change")==0 ){
fclose(fp);
printf("PLEASE ENTER A NEW INPUT FILE NAME\n");
scanf("%s",inputfilename);
//printf("NEW INTPUT FILE NAME : %s\n", inputfilename);
fp = fopen(inputfilename, "r");
}
/*
if( (strcmp(app,"solver")==0 ) || strcmp(app,"trace")==0 || ( strcmp(app,"fib")==0 )){
if( waitpid(pid,&status , 0)<0 ){
printf("ERRROR in waitpid\n");
} else {
printf("DONE\n");
}
system("ps -eo pid,ppid,stat,cmd");
}
*/
if( strcmp(app,"fib")==0 ){
free(N);
}
}// while
free(app);
}
printf("FILE DOES NOT EXIST\n");
// printf("ENDDD\n");
return 0;
}
|
the_stack_data/97011761.c | // SPDX-License-Identifier: GPL-2.0
/*
* ARMv6 Performance counter handling code.
*
* Copyright (C) 2009 picoChip Designs, Ltd., Jamie Iles
*
* ARMv6 has 2 configurable performance counters and a single cycle counter.
* They all share a single reset bit but can be written to zero so we can use
* that for a reset.
*
* The counters can't be individually enabled or disabled so when we remove
* one event and replace it with another we could get spurious counts from the
* wrong event. However, we can take advantage of the fact that the
* performance counters can export events to the event bus, and the event bus
* itself can be monitored. This requires that we *don't* export the events to
* the event bus. The procedure for disabling a configurable counter is:
* - change the counter to count the ETMEXTOUT[0] signal (0x20). This
* effectively stops the counter from counting.
* - disable the counter's interrupt generation (each counter has it's
* own interrupt enable bit).
* Once stopped, the counter value can be written as 0 to reset.
*
* To enable a counter:
* - enable the counter's interrupt generation.
* - set the new event type.
*
* Note: the dedicated cycle counter only counts cycles and can't be
* enabled/disabled independently of the others. When we want to disable the
* cycle counter, we have to just disable the interrupt reporting and start
* ignoring that counter. When re-enabling, we have to reset the value and
* enable the interrupt.
*/
#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
#include <asm/cputype.h>
#include <asm/irq_regs.h>
#include <linux/of.h>
#include <linux/perf/arm_pmu.h>
#include <linux/platform_device.h>
enum armv6_perf_types {
ARMV6_PERFCTR_ICACHE_MISS = 0x0,
ARMV6_PERFCTR_IBUF_STALL = 0x1,
ARMV6_PERFCTR_DDEP_STALL = 0x2,
ARMV6_PERFCTR_ITLB_MISS = 0x3,
ARMV6_PERFCTR_DTLB_MISS = 0x4,
ARMV6_PERFCTR_BR_EXEC = 0x5,
ARMV6_PERFCTR_BR_MISPREDICT = 0x6,
ARMV6_PERFCTR_INSTR_EXEC = 0x7,
ARMV6_PERFCTR_DCACHE_HIT = 0x9,
ARMV6_PERFCTR_DCACHE_ACCESS = 0xA,
ARMV6_PERFCTR_DCACHE_MISS = 0xB,
ARMV6_PERFCTR_DCACHE_WBACK = 0xC,
ARMV6_PERFCTR_SW_PC_CHANGE = 0xD,
ARMV6_PERFCTR_MAIN_TLB_MISS = 0xF,
ARMV6_PERFCTR_EXPL_D_ACCESS = 0x10,
ARMV6_PERFCTR_LSU_FULL_STALL = 0x11,
ARMV6_PERFCTR_WBUF_DRAINED = 0x12,
ARMV6_PERFCTR_CPU_CYCLES = 0xFF,
ARMV6_PERFCTR_NOP = 0x20,
};
enum armv6_counters {
ARMV6_CYCLE_COUNTER = 0,
ARMV6_COUNTER0,
ARMV6_COUNTER1,
};
/*
* The hardware events that we support. We do support cache operations but
* we have harvard caches and no way to combine instruction and data
* accesses/misses in hardware.
*/
static const unsigned armv6_perf_map[PERF_COUNT_HW_MAX] = {
PERF_MAP_ALL_UNSUPPORTED,
[PERF_COUNT_HW_CPU_CYCLES] = ARMV6_PERFCTR_CPU_CYCLES,
[PERF_COUNT_HW_INSTRUCTIONS] = ARMV6_PERFCTR_INSTR_EXEC,
[PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV6_PERFCTR_BR_EXEC,
[PERF_COUNT_HW_BRANCH_MISSES] = ARMV6_PERFCTR_BR_MISPREDICT,
[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = ARMV6_PERFCTR_IBUF_STALL,
[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = ARMV6_PERFCTR_LSU_FULL_STALL,
};
static const unsigned armv6_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
[PERF_COUNT_HW_CACHE_OP_MAX]
[PERF_COUNT_HW_CACHE_RESULT_MAX] = {
PERF_CACHE_MAP_ALL_UNSUPPORTED,
/*
* The performance counters don't differentiate between read and write
* accesses/misses so this isn't strictly correct, but it's the best we
* can do. Writes and reads get combined.
*/
[C(L1D)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV6_PERFCTR_DCACHE_ACCESS,
[C(L1D)][C(OP_READ)][C(RESULT_MISS)] = ARMV6_PERFCTR_DCACHE_MISS,
[C(L1D)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV6_PERFCTR_DCACHE_ACCESS,
[C(L1D)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV6_PERFCTR_DCACHE_MISS,
[C(L1I)][C(OP_READ)][C(RESULT_MISS)] = ARMV6_PERFCTR_ICACHE_MISS,
/*
* The ARM performance counters can count micro DTLB misses, micro ITLB
* misses and main TLB misses. There isn't an event for TLB misses, so
* use the micro misses here and if users want the main TLB misses they
* can use a raw counter.
*/
[C(DTLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV6_PERFCTR_DTLB_MISS,
[C(DTLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV6_PERFCTR_DTLB_MISS,
[C(ITLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV6_PERFCTR_ITLB_MISS,
[C(ITLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV6_PERFCTR_ITLB_MISS,
};
enum armv6mpcore_perf_types {
ARMV6MPCORE_PERFCTR_ICACHE_MISS = 0x0,
ARMV6MPCORE_PERFCTR_IBUF_STALL = 0x1,
ARMV6MPCORE_PERFCTR_DDEP_STALL = 0x2,
ARMV6MPCORE_PERFCTR_ITLB_MISS = 0x3,
ARMV6MPCORE_PERFCTR_DTLB_MISS = 0x4,
ARMV6MPCORE_PERFCTR_BR_EXEC = 0x5,
ARMV6MPCORE_PERFCTR_BR_NOTPREDICT = 0x6,
ARMV6MPCORE_PERFCTR_BR_MISPREDICT = 0x7,
ARMV6MPCORE_PERFCTR_INSTR_EXEC = 0x8,
ARMV6MPCORE_PERFCTR_DCACHE_RDACCESS = 0xA,
ARMV6MPCORE_PERFCTR_DCACHE_RDMISS = 0xB,
ARMV6MPCORE_PERFCTR_DCACHE_WRACCESS = 0xC,
ARMV6MPCORE_PERFCTR_DCACHE_WRMISS = 0xD,
ARMV6MPCORE_PERFCTR_DCACHE_EVICTION = 0xE,
ARMV6MPCORE_PERFCTR_SW_PC_CHANGE = 0xF,
ARMV6MPCORE_PERFCTR_MAIN_TLB_MISS = 0x10,
ARMV6MPCORE_PERFCTR_EXPL_MEM_ACCESS = 0x11,
ARMV6MPCORE_PERFCTR_LSU_FULL_STALL = 0x12,
ARMV6MPCORE_PERFCTR_WBUF_DRAINED = 0x13,
ARMV6MPCORE_PERFCTR_CPU_CYCLES = 0xFF,
};
/*
* The hardware events that we support. We do support cache operations but
* we have harvard caches and no way to combine instruction and data
* accesses/misses in hardware.
*/
static const unsigned armv6mpcore_perf_map[PERF_COUNT_HW_MAX] = {
PERF_MAP_ALL_UNSUPPORTED,
[PERF_COUNT_HW_CPU_CYCLES] = ARMV6MPCORE_PERFCTR_CPU_CYCLES,
[PERF_COUNT_HW_INSTRUCTIONS] = ARMV6MPCORE_PERFCTR_INSTR_EXEC,
[PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV6MPCORE_PERFCTR_BR_EXEC,
[PERF_COUNT_HW_BRANCH_MISSES] = ARMV6MPCORE_PERFCTR_BR_MISPREDICT,
[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = ARMV6MPCORE_PERFCTR_IBUF_STALL,
[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = ARMV6MPCORE_PERFCTR_LSU_FULL_STALL,
};
static const unsigned armv6mpcore_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
[PERF_COUNT_HW_CACHE_OP_MAX]
[PERF_COUNT_HW_CACHE_RESULT_MAX] = {
PERF_CACHE_MAP_ALL_UNSUPPORTED,
[C(L1D)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV6MPCORE_PERFCTR_DCACHE_RDACCESS,
[C(L1D)][C(OP_READ)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_DCACHE_RDMISS,
[C(L1D)][C(OP_WRITE)][C(RESULT_ACCESS)] = ARMV6MPCORE_PERFCTR_DCACHE_WRACCESS,
[C(L1D)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_DCACHE_WRMISS,
[C(L1I)][C(OP_READ)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_ICACHE_MISS,
/*
* The ARM performance counters can count micro DTLB misses, micro ITLB
* misses and main TLB misses. There isn't an event for TLB misses, so
* use the micro misses here and if users want the main TLB misses they
* can use a raw counter.
*/
[C(DTLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_DTLB_MISS,
[C(DTLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_DTLB_MISS,
[C(ITLB)][C(OP_READ)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_ITLB_MISS,
[C(ITLB)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV6MPCORE_PERFCTR_ITLB_MISS,
};
static inline unsigned long
armv6_pmcr_read(void)
{
u32 val;
asm volatile("mrc p15, 0, %0, c15, c12, 0" : "=r"(val));
return val;
}
static inline void
armv6_pmcr_write(unsigned long val)
{
asm volatile("mcr p15, 0, %0, c15, c12, 0" : : "r"(val));
}
#define ARMV6_PMCR_ENABLE (1 << 0)
#define ARMV6_PMCR_CTR01_RESET (1 << 1)
#define ARMV6_PMCR_CCOUNT_RESET (1 << 2)
#define ARMV6_PMCR_CCOUNT_DIV (1 << 3)
#define ARMV6_PMCR_COUNT0_IEN (1 << 4)
#define ARMV6_PMCR_COUNT1_IEN (1 << 5)
#define ARMV6_PMCR_CCOUNT_IEN (1 << 6)
#define ARMV6_PMCR_COUNT0_OVERFLOW (1 << 8)
#define ARMV6_PMCR_COUNT1_OVERFLOW (1 << 9)
#define ARMV6_PMCR_CCOUNT_OVERFLOW (1 << 10)
#define ARMV6_PMCR_EVT_COUNT0_SHIFT 20
#define ARMV6_PMCR_EVT_COUNT0_MASK (0xFF << ARMV6_PMCR_EVT_COUNT0_SHIFT)
#define ARMV6_PMCR_EVT_COUNT1_SHIFT 12
#define ARMV6_PMCR_EVT_COUNT1_MASK (0xFF << ARMV6_PMCR_EVT_COUNT1_SHIFT)
#define ARMV6_PMCR_OVERFLOWED_MASK \
(ARMV6_PMCR_COUNT0_OVERFLOW | ARMV6_PMCR_COUNT1_OVERFLOW | \
ARMV6_PMCR_CCOUNT_OVERFLOW)
static inline int
armv6_pmcr_has_overflowed(unsigned long pmcr)
{
return pmcr & ARMV6_PMCR_OVERFLOWED_MASK;
}
static inline int
armv6_pmcr_counter_has_overflowed(unsigned long pmcr,
enum armv6_counters counter)
{
int ret = 0;
if (ARMV6_CYCLE_COUNTER == counter)
ret = pmcr & ARMV6_PMCR_CCOUNT_OVERFLOW;
else if (ARMV6_COUNTER0 == counter)
ret = pmcr & ARMV6_PMCR_COUNT0_OVERFLOW;
else if (ARMV6_COUNTER1 == counter)
ret = pmcr & ARMV6_PMCR_COUNT1_OVERFLOW;
else
WARN_ONCE(1, "invalid counter number (%d)\n", counter);
return ret;
}
static inline u32 armv6pmu_read_counter(struct perf_event *event)
{
struct hw_perf_event *hwc = &event->hw;
int counter = hwc->idx;
unsigned long value = 0;
if (ARMV6_CYCLE_COUNTER == counter)
asm volatile("mrc p15, 0, %0, c15, c12, 1" : "=r"(value));
else if (ARMV6_COUNTER0 == counter)
asm volatile("mrc p15, 0, %0, c15, c12, 2" : "=r"(value));
else if (ARMV6_COUNTER1 == counter)
asm volatile("mrc p15, 0, %0, c15, c12, 3" : "=r"(value));
else
WARN_ONCE(1, "invalid counter number (%d)\n", counter);
return value;
}
static inline void armv6pmu_write_counter(struct perf_event *event, u32 value)
{
struct hw_perf_event *hwc = &event->hw;
int counter = hwc->idx;
if (ARMV6_CYCLE_COUNTER == counter)
asm volatile("mcr p15, 0, %0, c15, c12, 1" : : "r"(value));
else if (ARMV6_COUNTER0 == counter)
asm volatile("mcr p15, 0, %0, c15, c12, 2" : : "r"(value));
else if (ARMV6_COUNTER1 == counter)
asm volatile("mcr p15, 0, %0, c15, c12, 3" : : "r"(value));
else
WARN_ONCE(1, "invalid counter number (%d)\n", counter);
}
static void armv6pmu_enable_event(struct perf_event *event)
{
unsigned long val, mask, evt, flags;
struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
struct hw_perf_event *hwc = &event->hw;
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
int idx = hwc->idx;
if (ARMV6_CYCLE_COUNTER == idx) {
mask = 0;
evt = ARMV6_PMCR_CCOUNT_IEN;
} else if (ARMV6_COUNTER0 == idx) {
mask = ARMV6_PMCR_EVT_COUNT0_MASK;
evt = (hwc->config_base << ARMV6_PMCR_EVT_COUNT0_SHIFT) |
ARMV6_PMCR_COUNT0_IEN;
} else if (ARMV6_COUNTER1 == idx) {
mask = ARMV6_PMCR_EVT_COUNT1_MASK;
evt = (hwc->config_base << ARMV6_PMCR_EVT_COUNT1_SHIFT) |
ARMV6_PMCR_COUNT1_IEN;
} else {
WARN_ONCE(1, "invalid counter number (%d)\n", idx);
return;
}
/*
* Mask out the current event and set the counter to count the event
* that we're interested in.
*/
raw_spin_lock_irqsave(&events->pmu_lock, flags);
val = armv6_pmcr_read();
val &= ~mask;
val |= evt;
armv6_pmcr_write(val);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
}
static irqreturn_t
armv6pmu_handle_irq(struct arm_pmu *cpu_pmu)
{
unsigned long pmcr = armv6_pmcr_read();
struct perf_sample_data data;
struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events);
struct pt_regs *regs;
int idx;
if (!armv6_pmcr_has_overflowed(pmcr))
return IRQ_NONE;
regs = get_irq_regs();
/*
* The interrupts are cleared by writing the overflow flags back to
* the control register. All of the other bits don't have any effect
* if they are rewritten, so write the whole value back.
*/
armv6_pmcr_write(pmcr);
for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
struct perf_event *event = cpuc->events[idx];
struct hw_perf_event *hwc;
/* Ignore if we don't have an event. */
if (!event)
continue;
/*
* We have a single interrupt for all counters. Check that
* each counter has overflowed before we process it.
*/
if (!armv6_pmcr_counter_has_overflowed(pmcr, idx))
continue;
hwc = &event->hw;
armpmu_event_update(event);
perf_sample_data_init(&data, 0, hwc->last_period);
if (!armpmu_event_set_period(event))
continue;
if (perf_event_overflow(event, &data, regs))
cpu_pmu->disable(event);
}
/*
* Handle the pending perf events.
*
* Note: this call *must* be run with interrupts disabled. For
* platforms that can have the PMU interrupts raised as an NMI, this
* will not work.
*/
irq_work_run();
return IRQ_HANDLED;
}
static void armv6pmu_start(struct arm_pmu *cpu_pmu)
{
unsigned long flags, val;
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
raw_spin_lock_irqsave(&events->pmu_lock, flags);
val = armv6_pmcr_read();
val |= ARMV6_PMCR_ENABLE;
armv6_pmcr_write(val);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
}
static void armv6pmu_stop(struct arm_pmu *cpu_pmu)
{
unsigned long flags, val;
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
raw_spin_lock_irqsave(&events->pmu_lock, flags);
val = armv6_pmcr_read();
val &= ~ARMV6_PMCR_ENABLE;
armv6_pmcr_write(val);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
}
static int
armv6pmu_get_event_idx(struct pmu_hw_events *cpuc,
struct perf_event *event)
{
struct hw_perf_event *hwc = &event->hw;
/* Always place a cycle counter into the cycle counter. */
if (ARMV6_PERFCTR_CPU_CYCLES == hwc->config_base) {
if (test_and_set_bit(ARMV6_CYCLE_COUNTER, cpuc->used_mask))
return -EAGAIN;
return ARMV6_CYCLE_COUNTER;
} else {
/*
* For anything other than a cycle counter, try and use
* counter0 and counter1.
*/
if (!test_and_set_bit(ARMV6_COUNTER1, cpuc->used_mask))
return ARMV6_COUNTER1;
if (!test_and_set_bit(ARMV6_COUNTER0, cpuc->used_mask))
return ARMV6_COUNTER0;
/* The counters are all in use. */
return -EAGAIN;
}
}
static void armv6pmu_disable_event(struct perf_event *event)
{
unsigned long val, mask, evt, flags;
struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
struct hw_perf_event *hwc = &event->hw;
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
int idx = hwc->idx;
if (ARMV6_CYCLE_COUNTER == idx) {
mask = ARMV6_PMCR_CCOUNT_IEN;
evt = 0;
} else if (ARMV6_COUNTER0 == idx) {
mask = ARMV6_PMCR_COUNT0_IEN | ARMV6_PMCR_EVT_COUNT0_MASK;
evt = ARMV6_PERFCTR_NOP << ARMV6_PMCR_EVT_COUNT0_SHIFT;
} else if (ARMV6_COUNTER1 == idx) {
mask = ARMV6_PMCR_COUNT1_IEN | ARMV6_PMCR_EVT_COUNT1_MASK;
evt = ARMV6_PERFCTR_NOP << ARMV6_PMCR_EVT_COUNT1_SHIFT;
} else {
WARN_ONCE(1, "invalid counter number (%d)\n", idx);
return;
}
/*
* Mask out the current event and set the counter to count the number
* of ETM bus signal assertion cycles. The external reporting should
* be disabled and so this should never increment.
*/
raw_spin_lock_irqsave(&events->pmu_lock, flags);
val = armv6_pmcr_read();
val &= ~mask;
val |= evt;
armv6_pmcr_write(val);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
}
static void armv6mpcore_pmu_disable_event(struct perf_event *event)
{
unsigned long val, mask, flags, evt = 0;
struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
struct hw_perf_event *hwc = &event->hw;
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
int idx = hwc->idx;
if (ARMV6_CYCLE_COUNTER == idx) {
mask = ARMV6_PMCR_CCOUNT_IEN;
} else if (ARMV6_COUNTER0 == idx) {
mask = ARMV6_PMCR_COUNT0_IEN;
} else if (ARMV6_COUNTER1 == idx) {
mask = ARMV6_PMCR_COUNT1_IEN;
} else {
WARN_ONCE(1, "invalid counter number (%d)\n", idx);
return;
}
/*
* Unlike UP ARMv6, we don't have a way of stopping the counters. We
* simply disable the interrupt reporting.
*/
raw_spin_lock_irqsave(&events->pmu_lock, flags);
val = armv6_pmcr_read();
val &= ~mask;
val |= evt;
armv6_pmcr_write(val);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
}
static int armv6_map_event(struct perf_event *event)
{
return armpmu_map_event(event, &armv6_perf_map,
&armv6_perf_cache_map, 0xFF);
}
static void armv6pmu_init(struct arm_pmu *cpu_pmu)
{
cpu_pmu->handle_irq = armv6pmu_handle_irq;
cpu_pmu->enable = armv6pmu_enable_event;
cpu_pmu->disable = armv6pmu_disable_event;
cpu_pmu->read_counter = armv6pmu_read_counter;
cpu_pmu->write_counter = armv6pmu_write_counter;
cpu_pmu->get_event_idx = armv6pmu_get_event_idx;
cpu_pmu->start = armv6pmu_start;
cpu_pmu->stop = armv6pmu_stop;
cpu_pmu->map_event = armv6_map_event;
cpu_pmu->num_events = 3;
cpu_pmu->max_period = (1LLU << 32) - 1;
}
static int armv6_1136_pmu_init(struct arm_pmu *cpu_pmu)
{
armv6pmu_init(cpu_pmu);
cpu_pmu->name = "armv6_1136";
return 0;
}
static int armv6_1156_pmu_init(struct arm_pmu *cpu_pmu)
{
armv6pmu_init(cpu_pmu);
cpu_pmu->name = "armv6_1156";
return 0;
}
static int armv6_1176_pmu_init(struct arm_pmu *cpu_pmu)
{
armv6pmu_init(cpu_pmu);
cpu_pmu->name = "armv6_1176";
return 0;
}
/*
* ARMv6mpcore is almost identical to single core ARMv6 with the exception
* that some of the events have different enumerations and that there is no
* *hack* to stop the programmable counters. To stop the counters we simply
* disable the interrupt reporting and update the event. When unthrottling we
* reset the period and enable the interrupt reporting.
*/
static int armv6mpcore_map_event(struct perf_event *event)
{
return armpmu_map_event(event, &armv6mpcore_perf_map,
&armv6mpcore_perf_cache_map, 0xFF);
}
static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu)
{
cpu_pmu->name = "armv6_11mpcore";
cpu_pmu->handle_irq = armv6pmu_handle_irq;
cpu_pmu->enable = armv6pmu_enable_event;
cpu_pmu->disable = armv6mpcore_pmu_disable_event;
cpu_pmu->read_counter = armv6pmu_read_counter;
cpu_pmu->write_counter = armv6pmu_write_counter;
cpu_pmu->get_event_idx = armv6pmu_get_event_idx;
cpu_pmu->start = armv6pmu_start;
cpu_pmu->stop = armv6pmu_stop;
cpu_pmu->map_event = armv6mpcore_map_event;
cpu_pmu->num_events = 3;
cpu_pmu->max_period = (1LLU << 32) - 1;
return 0;
}
static const struct of_device_id armv6_pmu_of_device_ids[] = {
{.compatible = "arm,arm11mpcore-pmu", .data = armv6mpcore_pmu_init},
{.compatible = "arm,arm1176-pmu", .data = armv6_1176_pmu_init},
{.compatible = "arm,arm1136-pmu", .data = armv6_1136_pmu_init},
{ /* sentinel value */ }
};
static const struct pmu_probe_info armv6_pmu_probe_table[] = {
ARM_PMU_PROBE(ARM_CPU_PART_ARM1136, armv6_1136_pmu_init),
ARM_PMU_PROBE(ARM_CPU_PART_ARM1156, armv6_1156_pmu_init),
ARM_PMU_PROBE(ARM_CPU_PART_ARM1176, armv6_1176_pmu_init),
ARM_PMU_PROBE(ARM_CPU_PART_ARM11MPCORE, armv6mpcore_pmu_init),
{ /* sentinel value */ }
};
static int armv6_pmu_device_probe(struct platform_device *pdev)
{
return arm_pmu_device_probe(pdev, armv6_pmu_of_device_ids,
armv6_pmu_probe_table);
}
static struct platform_driver armv6_pmu_driver = {
.driver = {
.name = "armv6-pmu",
.of_match_table = armv6_pmu_of_device_ids,
},
.probe = armv6_pmu_device_probe,
};
builtin_platform_driver(armv6_pmu_driver);
#endif /* CONFIG_CPU_V6 || CONFIG_CPU_V6K */
|
the_stack_data/159515487.c | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <time.h>
int global_inc = 0;
void *global_increment(void *limit);
int main(int argc, char **argv)
{
if (argc != 2) {
printf("Error: wrong number of arguements!\n");
exit(EXIT_FAILURE);
}
char *endp;
int limitcount = strtol(argv[1], &endp, 10);
if (*endp != '\0') {
printf("Error: wrong arguement format!\n");
exit(EXIT_FAILURE);
}
pthread_t thread0, thread1;
clock_t time_begin = clock();
pthread_create(&thread0, NULL, &global_increment, &limitcount);
pthread_create(&thread1, NULL, &global_increment, &limitcount);
pthread_join(thread0, NULL);
pthread_join(thread1, NULL);
clock_t time_end = clock();
printf("Counted value using 2 threads: %i\nTime spent: %li us\n",
global_inc, (time_end - time_begin)/(CLOCKS_PER_SEC/1000000));
exit(EXIT_SUCCESS);
}
void *global_increment(void *limit)
{
int limitcount = *((int*) limit);
for (int i = 0; i < limitcount; i++) {
global_inc++;
}
pthread_exit(0);
}
|
the_stack_data/87639049.c | int main(void) {
int x, y;
return 0;
}
|
the_stack_data/274032.c | #include <stdio.h>
int
main (int argc, char **argv)
{
printf("Hello World.\n");
return 0;
}
|
the_stack_data/115545.c | int switch_dead_code();
int main()
{
return !(switch_dead_code() == 8);
} |
the_stack_data/132203.c | #include <stdio.h>
#include <stdarg.h>
void printints(int args, ...)
{
va_list ap;
va_start(ap, args);
int i;
for (i = 0; i < args; i++)
{
printf("argument: %i\n", va_arg(ap, int));
}
va_end(ap);
return;
}
int main(void)
{
printints(5, 2, 4, 5, 293, 9);
return 0;
}
|
the_stack_data/43886951.c | /*QUESTÃO 01: Faça um programa que leia
um número inteiro x e, em seguida, solicite
ao usuário outros 50 valores inteiros. Ao
final, o programa deve exibir o total de
múltiplos de x fornecidos.
*/
#include <stdio.h>
int main() {
int i,inteiro,testaMultiplo,totalDeMultiplos=0;
printf("digite um número inteiro\n>");
scanf("%d", &inteiro);
for(i=1;i<=50;i++) {
testaMultiplo=0;
printf("\n(%d/50)digite um valor inteiro: ", i);
scanf("%d", &testaMultiplo);
if( (testaMultiplo%inteiro) == 0) {
totalDeMultiplos++;
printf("édivisível");
}
}
printf("Destes valores inteiros, %d são divisíveis pelo primeiro número inteiro", totalDeMultiplos);
}
|
the_stack_data/64201459.c | #include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#define MAX_ORPHANS 2000
#define OUT 0
#define IN_SHORT 1
#define IN_LONG 2
#define IN_STRING 3
#define IN_CHAR 4
int main()
{
int c, p, i;
bool in_string = false, in_char = false;
int status = OUT;
int orphans_count = 0;
char orphans[MAX_ORPHANS];
#define wrapper_count 3
char openers[] = {'(', '[', '{'};
char closers[] = {')', ']', '}'};
while ((c = getchar()) != EOF) {
if (status == IN_SHORT) {
if (c == '\n')
status = OUT;
} else if (status == IN_LONG) {
if (c == '/' && p == '*') {
c = '\0';
status = OUT;
}
} else if (status == IN_STRING) {
if (c == '"' && p != '\\')
status = OUT;
} else if (status == IN_CHAR) {
if (c == '\'' && p != '\\')
status = OUT;
} else {
if (c == '/') {
if (p == '/')
status = IN_SHORT;
} else if (c == '*') {
if (p == '/')
status = IN_LONG;
} else if (c == '"') {
if (p != '\\')
status = IN_STRING;
} else if (c == '\'') {
if (p != '\\')
status = IN_CHAR;
} else {
bool found = false;
for (i = 0; i < wrapper_count; ++i) {
if (c == closers[i]) {
found = true;
if (openers[i] == orphans[orphans_count - 1]) {
orphans_count--;
} else {
printf("Unmatched %c\n", c);
exit(0);
}
}
}
if (!found)
for (i = 0; i < wrapper_count; ++i) {
if (c == openers[i]) {
orphans[orphans_count++] = c;
break;
}
}
}
}
p = c;
}
if (orphans_count > 0) {
printf("Unmatched %c\n", orphans[orphans_count - 1]);
}
return 0;
}
|
the_stack_data/150140110.c | #include <unistd.h>
#include <signal.h>
#include <stdio.h>
void printsigset(const sigset_t *set)
{
int i=0;
for (i=1;i<=64;i++){
if (i==3) putchar(' ');
if (sigismember(set,i)==1)
putchar('1');
else
putchar('0');
}
puts("");
}
void handler(int sig)
{
if(sig==SIGTSTP) printf("hello SIGTSTP\n");
if(sig==SIGINT) printf("hello SIGINT\n");
sleep(5);
sigset_t st;
sigpending(&st);
printsigset(&st);
}
int main()
{
printf("i m %d\n",getpid());
struct sigaction act,oldact;
act.sa_handler = handler;
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask,SIGINT);
act.sa_flags=0;
sigprocmask(SIG_BLOCK,&act.sa_mask,NULL);
sigaction(SIGTSTP,&act,&oldact);
sigaction(SIGINT,&act,&oldact);
while(1){
write(STDOUT_FILENO,".",1);
pause();
}
}
|
the_stack_data/594269.c | /*
* Fallbacks for debugging functions when running on Windows
*
* Copyright 2019 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef _WIN32
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DECLARE_DEBUG_CHANNEL(pid);
WINE_DECLARE_DEBUG_CHANNEL(timestamp);
WINE_DECLARE_DEBUG_CHANNEL(microsecs);
static const char * (__cdecl *p__wine_dbg_strdup)( const char *str );
static int (__cdecl *p__wine_dbg_output)( const char *str );
static unsigned char (__cdecl *p__wine_dbg_get_channel_flags)( struct __wine_debug_channel *channel );
static int (__cdecl *p__wine_dbg_header)( enum __wine_debug_class cls,
struct __wine_debug_channel *channel,
const char *function );
static const char * const debug_classes[] = { "fixme", "err", "warn", "trace" };
static unsigned char default_flags = (1 << __WINE_DBCL_ERR) | (1 << __WINE_DBCL_FIXME);
static int nb_debug_options = -1;
static int options_size;
static struct __wine_debug_channel *debug_options;
static DWORD partial_line_tid; /* id of the last thread to output a partial line */
static void load_func( void **func, const char *name, void *def )
{
if (!*func)
{
DWORD err = GetLastError();
HMODULE module = GetModuleHandleA( "ntdll.dll" );
void *proc = GetProcAddress( module, name );
InterlockedExchangePointer( func, proc ? proc : def );
SetLastError( err );
}
}
#define LOAD_FUNC(name) load_func( (void **)&p ## name, #name, fallback ## name )
/* add a new debug option at the end of the option list */
static void add_option( const char *name, unsigned char set, unsigned char clear )
{
int min = 0, max = nb_debug_options - 1, pos, res;
if (!name[0]) /* "all" option */
{
default_flags = (default_flags & ~clear) | set;
return;
}
if (strlen(name) >= sizeof(debug_options[0].name)) return;
while (min <= max)
{
pos = (min + max) / 2;
res = strcmp( name, debug_options[pos].name );
if (!res)
{
debug_options[pos].flags = (debug_options[pos].flags & ~clear) | set;
return;
}
if (res < 0) max = pos - 1;
else min = pos + 1;
}
if (nb_debug_options >= options_size)
{
options_size = max( options_size * 2, 16 );
debug_options = heap_realloc( debug_options, options_size * sizeof(debug_options[0]) );
}
pos = min;
if (pos < nb_debug_options) memmove( &debug_options[pos + 1], &debug_options[pos],
(nb_debug_options - pos) * sizeof(debug_options[0]) );
strcpy( debug_options[pos].name, name );
debug_options[pos].flags = (default_flags & ~clear) | set;
nb_debug_options++;
}
/* parse a set of debugging option specifications and add them to the option list */
static void parse_options( const char *str )
{
char *opt, *next, *options;
unsigned int i;
if (!(options = _strdup(str))) return;
for (opt = options; opt; opt = next)
{
const char *p;
unsigned char set = 0, clear = 0;
if ((next = strchr( opt, ',' ))) *next++ = 0;
p = opt + strcspn( opt, "+-" );
if (!p[0]) p = opt; /* assume it's a debug channel name */
if (p > opt)
{
for (i = 0; i < ARRAY_SIZE(debug_classes); i++)
{
int len = strlen(debug_classes[i]);
if (len != (p - opt)) continue;
if (!memcmp( opt, debug_classes[i], len )) /* found it */
{
if (*p == '+') set |= 1 << i;
else clear |= 1 << i;
break;
}
}
if (i == ARRAY_SIZE(debug_classes)) /* bad class name, skip it */
continue;
}
else
{
if (*p == '-') clear = ~0;
else set = ~0;
}
if (*p == '+' || *p == '-') p++;
if (!p[0]) continue;
if (!strcmp( p, "all" ))
default_flags = (default_flags & ~clear) | set;
else
add_option( p, set, clear );
}
free( options );
}
/* initialize all options at startup */
static void init_options(void)
{
char *wine_debug = getenv("WINEDEBUG");
nb_debug_options = 0;
if (wine_debug) parse_options( wine_debug );
}
/* FIXME: this is not 100% thread-safe */
static const char * __cdecl fallback__wine_dbg_strdup( const char *str )
{
static char *list[32];
static int pos;
char *ret = strdup( str );
int idx;
idx = InterlockedIncrement( &pos ) % ARRAY_SIZE(list);
free( InterlockedExchangePointer( (void **)&list[idx], ret ));
return ret;
}
static int __cdecl fallback__wine_dbg_output( const char *str )
{
size_t len = strlen( str );
if (!len) return 0;
InterlockedExchange( (LONG *)&partial_line_tid, str[len - 1] != '\n' ? GetCurrentThreadId() : 0 );
return fwrite( str, 1, len, stderr );
}
static int __cdecl fallback__wine_dbg_header( enum __wine_debug_class cls,
struct __wine_debug_channel *channel,
const char *function )
{
char buffer[200], *pos = buffer;
if (!(__wine_dbg_get_channel_flags( channel ) & (1 << cls))) return -1;
/* skip header if partial line and no other thread came in between */
if (partial_line_tid == GetCurrentThreadId()) return 0;
if (TRACE_ON(microsecs))
{
LARGE_INTEGER counter, frequency, microsecs;
NtQueryPerformanceCounter( &counter, &frequency );
microsecs.QuadPart = counter.QuadPart * 1000000 / frequency.QuadPart;
pos += sprintf( pos, "%3u.%06u:", (unsigned int)(microsecs.QuadPart / 1000000), (unsigned int)(microsecs.QuadPart % 1000000) );
}
else if (TRACE_ON(timestamp))
{
ULONG ticks = GetTickCount();
pos += sprintf( pos, "%3u.%03u:", ticks / 1000, ticks % 1000 );
}
if (TRACE_ON(pid)) pos += sprintf( pos, "%04x:", GetCurrentProcessId() );
pos += sprintf( pos, "%04x:", GetCurrentThreadId() );
if (function && cls < ARRAY_SIZE( debug_classes ))
snprintf( pos, sizeof(buffer) - (pos - buffer), "%s:%s:%s ",
debug_classes[cls], channel->name, function );
return fwrite( buffer, 1, strlen(buffer), stderr );
}
static unsigned char __cdecl fallback__wine_dbg_get_channel_flags( struct __wine_debug_channel *channel )
{
int min, max, pos, res;
if (nb_debug_options == -1) init_options();
min = 0;
max = nb_debug_options - 1;
while (min <= max)
{
pos = (min + max) / 2;
res = strcmp( channel->name, debug_options[pos].name );
if (!res) return debug_options[pos].flags;
if (res < 0) max = pos - 1;
else min = pos + 1;
}
/* no option for this channel */
if (channel->flags & (1 << __WINE_DBCL_INIT)) channel->flags = default_flags;
return default_flags;
}
const char * __cdecl __wine_dbg_strdup( const char *str )
{
LOAD_FUNC( __wine_dbg_strdup );
return p__wine_dbg_strdup( str );
}
int __cdecl __wine_dbg_output( const char *str )
{
LOAD_FUNC( __wine_dbg_output );
return p__wine_dbg_output( str );
}
unsigned char __cdecl __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel )
{
LOAD_FUNC( __wine_dbg_get_channel_flags );
return p__wine_dbg_get_channel_flags( channel );
}
int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
const char *function )
{
LOAD_FUNC( __wine_dbg_header );
return p__wine_dbg_header( cls, channel, function );
}
#endif /* _WIN32 */
|
the_stack_data/150141298.c | /* This testcase is part of GDB, the GNU debugger.
Copyright 2009-2019 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
extern int foo ();
int main_global = 44;
int bar ()
{
int a_local = 45;
static int a_static = 46;
return main_global + a_local + a_static; /* break here */
}
int main ()
{
bar ();
return foo ();
}
|
the_stack_data/1152316.c | #include <stdio.h>
#include <stdlib.h>
int main(){
setbuf(stdout, 0x0);
setbuf(stderr, 0x0);
puts("Gets is very secure. You may see other sources tell you otherwise, but they are wrong.");
puts("Geeksforgeeks says gets is insecure. G4g also says graph coloring can be solved in O(n).");
puts("Wikipedia says gets is insecure. Anyone can write anything on wikipedia, it is unreliable.");
puts("The linux docs say gets is insecure. No one reads the linux docs except stuck up nerds.");
puts("My compiler warned me gets is insecure. My compiler also can't add semicolons automatically");
puts("Hopefully you can see that gets is in fact secure, and all who tell you otherwise are lying.\n");
puts("Are you starting to understand?");
long debug = 0;
char buf[0x20];
gets(buf);
if(strcmp(buf, "Yes") == 0){
puts("I'm glad you understand.");
if(debug == 0xdeadbeef){
FILE *f = fopen("flag.txt","r");
if(f == NULL){
puts("Something is wrong. Please contact Rythm.");
exit(1);
}
fgets(buf, 0x20, f);
puts("Debug info:");
puts(buf);
}
}else{
puts("Think Mark, think! Gets is secure!");
}
return 0;
}
|
the_stack_data/178265753.c | /* Exercise 5-15. Add the option -f to fold upper and lower case together, so
* that case distinctions are not made during sorting; for example, a and A
* compare equal. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXLEN 200
#define MAXLINES 5000
#define BUFSIZE 10000
#define NUMERIC 1
#define REVERSE 2
#define FOLD 4
static char g_buffer[BUFSIZE];
static char *g_next = g_buffer;
static char *lineptr[MAXLINES];
static int g_options = 0;
int readlines(char *lineptr[], int nlines);
void writelines(char *lineptr[], int nlines);
void qsort_(void *lineptr[], int left, int right, int (*comp)(void *, void *));
int numcmp(const char *, const char *);
int rstrcmp(const char *, const char *);
int rchacmp(const char *, const char *);
int main(int argc, char *argv[])
{
int nlines;
for (int i = 1; i < argc; ++i) {
if (argv[i][0] == '-')
for (int j = 1; argv[i][j] != '\0'; ++j) {
switch (argv[i][j]) {
case 'n':
g_options |= NUMERIC;
break;
case 'r':
g_options |= REVERSE;
break;
case 'f':
g_options |= FOLD;
break;
default:
fprintf(stderr, "unknown option %c\n", argv[i][j]);
break;
}
}
}
fprintf(stderr, "numeric = %d, reverse = %d, fold = %d\n",
g_options & NUMERIC, g_options & REVERSE, g_options & FOLD);
if ((nlines = readlines(lineptr, MAXLINES)) >= 0) {
int (*fp)(const char *, const char *);
if (g_options & NUMERIC)
fp = numcmp;
else if (g_options & FOLD)
fp = rchacmp;
else
fp = rstrcmp;
qsort_((void **)lineptr, 0, nlines - 1, (int (*)(void *, void *))fp);
writelines(lineptr, nlines);
return 0;
}
else {
printf("intput too big to sort\n");
return 1;
}
}
int (*rev(int (*f)(void *, void *), int r))(void *, void *) {}
void qsort_(void *v[], int left, int right, int (*comp)(void *, void *))
{
int i, last;
void swap(void *v[], int, int);
if (left >= right)
return;
swap(v, left, (left + right) / 2);
last = left;
for (i = left + 1; i <= right; ++i)
if ((*comp)(v[i], v[left]) < 0)
swap(v, ++last, i);
swap(v, left, last);
qsort_(v, left, last - 1, comp);
qsort_(v, last + 1, right, comp);
}
void swap(void *v[], int i, int j)
{
int *t;
t = v[i];
v[i] = v[j];
v[j] = t;
}
int numcmp(const char *s, const char *t)
{
double a = atof(s);
double b = atof(t);
int res = (a > b) - (a < b);
if (g_options & REVERSE)
return -res;
else
return res;
}
int rstrcmp(const char *s, const char *t)
{
if (g_options & REVERSE)
return strcmp(t, s);
else
return strcmp(s, t);
}
int tolower_(unsigned char c)
{
if ('A' <= c && c <= 'Z')
return c - 'A' + 'a';
else
return c;
}
int rchacmp(const char *s, const char *t)
{
unsigned char a, b;
int res;
while (1) {
a = tolower_(*(const unsigned char *)s++);
b = tolower_(*(const unsigned char *)t++);
if (a != b || a == '\0') {
res = a - b;
break;
}
}
if (g_options & REVERSE)
return -res;
else
return res;
}
void *alloc(int nb)
{
if (g_next + nb <= g_buffer + BUFSIZE) {
void *res = g_next;
g_next += nb;
return res;
}
else
return NULL;
}
void afree(void *p)
{
if (!p)
return;
if (g_buffer <= (char *)p && (char *)p < g_next)
g_next = p;
}
int getline_(char s[], int lim)
{
int c, i;
i = 0;
while (--lim > 0 && (c = getchar()) != EOF && c != '\n')
s[i++] = c;
if (c == '\n')
s[i++] = c;
s[i] = '\0';
return i;
}
int readlines(char *lineptr[], int maxlines)
{
int len, nlines;
char *p, line[MAXLEN];
nlines = 0;
while ((len = getline_(line, MAXLEN)) > 0)
if (nlines >= maxlines || (p = alloc(len)) == NULL)
return -1;
else {
line[len - 1] = '\0';
strcpy(p, line);
lineptr[nlines++] = p;
}
return nlines;
}
void writelines(char *lineptr[], int nlines)
{
int i;
for (i = 0; i < nlines; ++i)
printf("%s\n", lineptr[i]);
}
|
the_stack_data/45451320.c | // SPDX-License-Identifier: GPL-2.0
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main( int argc, const char * argv [] )
{
const char * varname;
int i = 0;
int c;
int id = 0;
if(argv[1] && strcmp(argv[1],"-i")==0)
{
argv++;
argc--;
id=1;
}
if(argc==1)
{
fprintf(stderr, "bin2hex: [-i] firmware\n");
exit(1);
}
varname = argv[1];
printf( "/* automatically generated by bin2hex */\n" );
printf( "static unsigned char %s [] %s =\n{\n", varname , id?"__initdata":"");
while ( ( c = getchar( ) ) != EOF )
{
if ( i != 0 && i % 10 == 0 )
printf( "\n" );
printf( "0x%02lx,", c & 0xFFl );
i++;
}
printf( "};\nstatic int %sLen = %d;\n", varname, i );
return 0;
}
|
the_stack_data/24576.c | /* compress.c -- compress a memory buffer
* Copyright (C) 1995-2005 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id: compress.c 8481 2011-02-27 15:50:40Z manolo $ */
#define ZLIB_INTERNAL
#include "zlib.h"
/* ===========================================================================
Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit. sourceLen is the byte
length of the source buffer. Upon entry, destLen is the total size of the
destination buffer, which must be at least 0.1% larger than sourceLen plus
12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
int level;
{
z_stream stream;
int err;
stream.next_in = (Bytef*)source;
stream.avail_in = (uInt)sourceLen;
#ifdef MAXSEG_64K
/* Check for source > 64K on 16-bit machine: */
if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
#endif
stream.next_out = dest;
stream.avail_out = (uInt)*destLen;
if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
stream.opaque = (voidpf)0;
err = deflateInit(&stream, level);
if (err != Z_OK) return err;
err = deflate(&stream, Z_FINISH);
if (err != Z_STREAM_END) {
deflateEnd(&stream);
return err == Z_OK ? Z_BUF_ERROR : err;
}
*destLen = stream.total_out;
err = deflateEnd(&stream);
return err;
}
/* ===========================================================================
*/
int ZEXPORT compress (dest, destLen, source, sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
{
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
}
/* ===========================================================================
If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated.
*/
uLong ZEXPORT compressBound (sourceLen)
uLong sourceLen;
{
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13;
}
|
the_stack_data/764935.c | void ft_sort_int_tab(int *tab, int size)
{
int mov;
int i;
int i2;
i = 0;
while (i++ < size)
{
i2 = 0;
while (++i2 < size)
{
if (tab[i2 - 1] > tab[i2])
{
mov = tab[i2 - 1];
tab[i2 - 1] = tab[i2];
tab[i2] = mov;
}
}
}
}
|
the_stack_data/67326032.c | static int IsPrime(long n)
{
int i;
if(n == 1)
return 0;
if(n < 4)
return 1;
if((n & 1) == 0)
return 0;
for(i = 3; i * i <= n; i += 2)
{
if((n % i) == 0) return 0;
}
return 1;
}
int CountPrime(long low, long high)
{
long entry;
int count = 0;
for(entry = low; entry <= high; entry++)
{
count += IsPrime(entry);
}
return count;
}
|
the_stack_data/69521.c | int main()
{
int a = 0;
int *b = &a;
return b;
}
|
the_stack_data/31386957.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
typedef int Data;
typedef struct _node
{
struct _node* left;
Data d;
struct _node* right;
} Node;
typedef struct _tree
{
struct _node* root;
int count;
} Tree;
bool initTree(Tree* tr)
{
tr->root = NULL;
tr->count = 0;
return true;
}
Node* getNode(const Data d)
{
Node* newNode = (Node*)malloc(sizeof(Node));
newNode->d = d;
newNode->left = newNode->right = NULL;
return newNode;
}
bool isInternal(const Node* node)
{
return node->left || node->right ? true : false;
}
Node* searchNode(Node* node, const Data d)
{
// 선위 순회
Node* cur = NULL;
if (node->d == d)
return node;
if (isInternal(node))
{
if (node->left && !cur) cur = searchNode(node->left, d);
if (node->right&& !cur) cur = searchNode(node->right, d);
}
return cur;
}
bool makeNode(Tree* tr, const Data d, const Data left, const Data right)
{
Node* pos = NULL;
if (!tr->root)
{
pos = getNode(d);
if (!pos) return false;
tr->root = pos;
tr->count++;
}
else
pos = searchNode(tr->root, d);
if (left)
{
pos->left = getNode(left);
if (!pos) return false;
tr->count++;
}
if (right)
{
pos->right = getNode(right);
if (!pos) return false;
tr->count++;
}
return true;
}
bool freeTree(Node* node)
{
if (isInternal(node))
{
if (node->left) freeTree(node->left);
if (node->right) freeTree(node->right);
}
free(node);
return true;
}
bool goDestNode(Node* node, char* script)
{
char* pos = script;
size_t len = strlen(script);
for (; pos <= script + len; pos++)
{
printf(" %d", node->d);
switch (*pos)
{
case 'L':
node = node->left;
break;
case 'R':
node = node->right;
}
}
putchar('\n');
return true;
}
int main(void)
{
int it;
int nodeNum, leftNode, rightNode;
char input[101];
Tree tr;
initTree(&tr);
scanf("%d", &it);
for (int i = 0; i < it; i++)
{
scanf("%d %d %d", &nodeNum, &leftNode, &rightNode);
makeNode(&tr, nodeNum, leftNode, rightNode);
}
scanf("%d", &it);
getchar();
for (int i = 0; i < it; i++)
{
scanf("%[^\n]", input);
getchar();
goDestNode(tr.root, input);
}
freeTree(tr.root);
return 0;
} |
the_stack_data/175143324.c | /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* util/support/base64.c - base64 encoder and decoder */
/*
* Copyright (c) 1995-2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
//#include <k5-platform.h>
//#include <k5-base64.h>
#include <string.h>
#include <stdlib.h>
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t)((size_t)0 - 1))
#endif
static const char base64_chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
char *
k5_base64_encode(const void *data, size_t len)
{
char *s, *p;
size_t i;
unsigned int c;
const unsigned char *q;
if (len > SIZE_MAX / 4)
return NULL;
p = s = malloc(len * 4 / 3 + 4);
if (p == NULL)
return NULL;
q = (const unsigned char *)data;
for (i = 0; i < len;) {
c = q[i++];
c *= 256;
if (i < len)
c += q[i];
i++;
c *= 256;
if (i < len)
c += q[i];
i++;
p[0] = base64_chars[(c & 0x00fc0000) >> 18];
p[1] = base64_chars[(c & 0x0003f000) >> 12];
p[2] = base64_chars[(c & 0x00000fc0) >> 6];
p[3] = base64_chars[(c & 0x0000003f) >> 0];
if (i > len)
p[3] = '=';
if (i > len + 1)
p[2] = '=';
p += 4;
}
*p = '\0';
return s;
}
#define DECODE_ERROR 0xffffffff
/* Decode token, which must be four bytes long. */
static unsigned int
decode_token(const char *token)
{
int i, marker = 0;
unsigned int val = 0;
const char *p;
for (i = 0; i < 4; i++) {
val *= 64;
if (token[i] == '=') {
marker++;
} else if (marker > 0) {
return DECODE_ERROR;
} else {
p = strchr(base64_chars, token[i]);
if (p == NULL)
return DECODE_ERROR;
val += p - base64_chars;
}
}
if (marker > 2)
return DECODE_ERROR;
return (marker << 24) | val;
}
void *
k5_base64_decode(const char *str, size_t *len_out)
{
unsigned char *data, *q;
unsigned int val, marker;
size_t len;
*len_out = SIZE_MAX;
/* Allocate the output buffer. */
len = strlen(str);
if (len % 4)
return NULL;
q = data = malloc(len / 4 * 3);
if (data == NULL) {
*len_out = 0;
return NULL;
}
/* Decode the string. */
for (; *str != '\0'; str += 4) {
val = decode_token(str);
if (val == DECODE_ERROR) {
free(data);
return NULL;
}
marker = (val >> 24) & 0xff;
*q++ = (val >> 16) & 0xff;
if (marker < 2)
*q++ = (val >> 8) & 0xff;
if (marker < 1)
*q++ = val & 0xff;
}
*len_out = q - data;
return data;
}
|
the_stack_data/852482.c | #include <stdio.h>
int main(int argc, char **argv)
{
int x = 10;
int *point = &x;
int deref = *point;
printf("\nVariable x is currently %d. *point is %d.\n\n", x, deref);
*point = 20;
int dereftwo = *point;
printf("After assigning 20 to the address referenced by point, *point is now %d.\n\n", dereftwo);
printf("x is now %d.\n\n", x);
}
|
the_stack_data/237643323.c | /* whale book - figure 8.1 */
/*
* clang -c -emit-llvm file.c
* opt -mem2reg -simplifycfg
*
*/
int goo(int m, int i);
int foo(int n) {
int i = 0, j;
if (n == 1)
i = 2;
while (n > 0) {
j = i + 1;
n = goo(n, i);
}
return j;
}
|
the_stack_data/61074021.c | int main(){
int a;
int b;
a = 10;
b = a / 0;
return b;
}
|
the_stack_data/111079128.c | /********************************************************************************************************
* @file sampleGatewayEpCfg.c
*
* @brief This is the source file for sampleGatewayEpCfg
*
* @author Zigbee Group
* @date 2021
*
* @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK")
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************************************/
#if (__PROJECT_TL_GW__)
/**********************************************************************
* INCLUDES
*/
#include "tl_common.h"
#include "zcl_include.h"
#include "sampleGateway.h"
/**********************************************************************
* LOCAL CONSTANTS
*/
#ifndef ZCL_BASIC_MFG_NAME
#define ZCL_BASIC_MFG_NAME {6,'T','E','L','I','N','K'}
#endif
#ifndef ZCL_BASIC_MODEL_ID
#define ZCL_BASIC_MODEL_ID {8,'T','L','S','R','8','2','x','x'}
#endif
/**********************************************************************
* TYPEDEFS
*/
/**********************************************************************
* GLOBAL VARIABLES
*/
/**
* @brief Definition for Incoming cluster / Sever Cluster
*/
const u16 sampleGW_inClusterList[] =
{
ZCL_CLUSTER_GEN_BASIC,
ZCL_CLUSTER_GEN_IDENTIFY,
#ifdef ZCL_OTA
ZCL_CLUSTER_OTA,
#endif
};
/**
* @brief Definition for Outgoing cluster / Client Cluster
*/
const u16 sampleGW_outClusterList[] =
{
#ifdef ZCL_GROUP
ZCL_CLUSTER_GEN_GROUPS,
#endif
#ifdef ZCL_SCENE
ZCL_CLUSTER_GEN_SCENES,
#endif
#ifdef ZCL_ON_OFF
ZCL_CLUSTER_GEN_ON_OFF,
#endif
#ifdef ZCL_LEVEL_CTRL
ZCL_CLUSTER_GEN_LEVEL_CONTROL,
#endif
#ifdef ZCL_LIGHT_COLOR_CONTROL
ZCL_CLUSTER_LIGHTING_COLOR_CONTROL,
#endif
#ifdef ZCL_DOOR_LOCK
ZCL_CLUSTER_CLOSURES_DOOR_LOCK,
#endif
#ifdef ZCL_TEMPERATURE_MEASUREMENT
ZCL_CLUSTER_MS_TEMPERATURE_MEASUREMENT,
#endif
#ifdef ZCL_IAS_ZONE
ZCL_CLUSTER_SS_IAS_ZONE,
#endif
#ifdef ZCL_POLL_CTRL
ZCL_CLUSTER_GEN_POLL_CONTROL,
#endif
};
/**
* @brief Definition for Server cluster number and Client cluster number
*/
#define SAMPLEGW_IN_CLUSTER_NUM (sizeof(sampleGW_inClusterList)/sizeof(sampleGW_inClusterList[0]))
#define SAMPLEGW_OUT_CLUSTER_NUM (sizeof(sampleGW_outClusterList)/sizeof(sampleGW_outClusterList[0]))
/**
* @brief Definition for simple description for HA profile
*/
const af_simple_descriptor_t sampleGW_simpleDesc =
{
HA_PROFILE_ID, /* Application profile identifier */
HA_DEV_HOME_GATEWAY, /* Application device identifier */
SAMPLE_GW_ENDPOINT, /* Endpoint */
0, /* Application device version */
0, /* Reserved */
SAMPLEGW_IN_CLUSTER_NUM, /* Application input cluster count */
SAMPLEGW_OUT_CLUSTER_NUM, /* Application output cluster count */
(u16 *)sampleGW_inClusterList, /* Application input cluster list */
(u16 *)sampleGW_outClusterList, /* Application output cluster list */
};
#if AF_TEST_ENABLE
/**
* @brief Definition for Incoming cluster / Sever Cluster
*/
const u16 sampleTest_inClusterList[] =
{
ZCL_CLUSTER_TELINK_SDK_TEST_REQ,
ZCL_CLUSTER_TELINK_SDK_TEST_RSP,
ZCL_CLUSTER_TELINK_SDK_TEST_CLEAR_REQ,
ZCL_CLUSTER_TELINK_SDK_TEST_CLEAR_RSP,
};
/**
* @brief Definition for Outgoing cluster / Client Cluster
*/
const u16 sampleTest_outClusterList[] =
{
ZCL_CLUSTER_TELINK_SDK_TEST_REQ,
ZCL_CLUSTER_TELINK_SDK_TEST_RSP,
ZCL_CLUSTER_TELINK_SDK_TEST_CLEAR_REQ,
ZCL_CLUSTER_TELINK_SDK_TEST_CLEAR_RSP,
};
/**
* @brief Definition for Server cluster number and Client cluster number
*/
#define SAMPLE_TEST_IN_CLUSTER_NUM (sizeof(sampleTest_inClusterList)/sizeof(sampleTest_inClusterList[0]))
#define SAMPLE_TEST_OUT_CLUSTER_NUM (sizeof(sampleTest_outClusterList)/sizeof(sampleTest_outClusterList[0]))
/**
* @brief Definition for simple description for HA profile
*/
const af_simple_descriptor_t sampleTestDesc =
{
HA_PROFILE_ID, /* Application profile identifier */
HA_DEV_HOME_GATEWAY, /* Application device identifier */
SAMPLE_TEST_ENDPOINT, /* Endpoint */
0, /* Application device version */
0, /* Reserved */
SAMPLE_TEST_IN_CLUSTER_NUM, /* Application input cluster count */
SAMPLE_TEST_OUT_CLUSTER_NUM, /* Application output cluster count */
(u16 *)sampleTest_inClusterList, /* Application input cluster list */
(u16 *)sampleTest_outClusterList, /* Application output cluster list */
};
#endif /* AF_TEST_ENABLE */
/* Basic */
zcl_basicAttr_t g_zcl_basicAttrs =
{
.zclVersion = 0x03,
.appVersion = 0x00,
.stackVersion = 0x02,
.hwVersion = 0x00,
.manuName = ZCL_BASIC_MFG_NAME,
.modelId = ZCL_BASIC_MODEL_ID,
.powerSource = POWER_SOURCE_MAINS_1_PHASE,
.deviceEnable = TRUE,
};
const zclAttrInfo_t basic_attrTbl[] =
{
{ ZCL_ATTRID_BASIC_ZCL_VER, ZCL_DATA_TYPE_UINT8, ACCESS_CONTROL_READ, (u8*)&g_zcl_basicAttrs.zclVersion},
{ ZCL_ATTRID_BASIC_APP_VER, ZCL_DATA_TYPE_UINT8, ACCESS_CONTROL_READ, (u8*)&g_zcl_basicAttrs.appVersion},
{ ZCL_ATTRID_BASIC_STACK_VER, ZCL_DATA_TYPE_UINT8, ACCESS_CONTROL_READ, (u8*)&g_zcl_basicAttrs.stackVersion},
{ ZCL_ATTRID_BASIC_HW_VER, ZCL_DATA_TYPE_UINT8, ACCESS_CONTROL_READ, (u8*)&g_zcl_basicAttrs.hwVersion},
{ ZCL_ATTRID_BASIC_MFR_NAME, ZCL_DATA_TYPE_CHAR_STR, ACCESS_CONTROL_READ, (u8*)g_zcl_basicAttrs.manuName},
{ ZCL_ATTRID_BASIC_MODEL_ID, ZCL_DATA_TYPE_CHAR_STR, ACCESS_CONTROL_READ, (u8*)g_zcl_basicAttrs.modelId},
{ ZCL_ATTRID_BASIC_POWER_SOURCE, ZCL_DATA_TYPE_ENUM8, ACCESS_CONTROL_READ, (u8*)&g_zcl_basicAttrs.powerSource},
{ ZCL_ATTRID_BASIC_DEV_ENABLED, ZCL_DATA_TYPE_BOOLEAN, ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE, (u8*)&g_zcl_basicAttrs.deviceEnable},
{ ZCL_ATTRID_GLOBAL_CLUSTER_REVISION, ZCL_DATA_TYPE_UINT16, ACCESS_CONTROL_READ, (u8*)&zcl_attr_global_clusterRevision},
};
#define ZCL_BASIC_ATTR_NUM sizeof(basic_attrTbl) / sizeof(zclAttrInfo_t)
/* Identify */
zcl_identifyAttr_t g_zcl_identifyAttrs =
{
.identifyTime = 0x0000,
};
const zclAttrInfo_t identify_attrTbl[] =
{
{ ZCL_ATTRID_IDENTIFY_TIME, ZCL_DATA_TYPE_UINT16, ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE, (u8*)&g_zcl_identifyAttrs.identifyTime },
{ ZCL_ATTRID_GLOBAL_CLUSTER_REVISION, ZCL_DATA_TYPE_UINT16, ACCESS_CONTROL_READ, (u8*)&zcl_attr_global_clusterRevision},
};
#define ZCL_IDENTIFY_ATTR_NUM sizeof(identify_attrTbl) / sizeof(zclAttrInfo_t)
/**
* @brief Definition for simple GW ZCL specific cluster
*/
const zcl_specClusterInfo_t g_sampleGwClusterList[] =
{
{ZCL_CLUSTER_GEN_BASIC, MANUFACTURER_CODE_NONE, ZCL_BASIC_ATTR_NUM, basic_attrTbl, zcl_basic_register, sampleGW_basicCb},
{ZCL_CLUSTER_GEN_IDENTIFY, MANUFACTURER_CODE_NONE, ZCL_IDENTIFY_ATTR_NUM, identify_attrTbl, zcl_identify_register, sampleGW_identifyCb},
#ifdef ZCL_GROUP
{ZCL_CLUSTER_GEN_GROUPS, MANUFACTURER_CODE_NONE, 0, NULL, zcl_group_register, sampleGW_groupCb},
#endif
#ifdef ZCL_SCENE
{ZCL_CLUSTER_GEN_SCENES, MANUFACTURER_CODE_NONE, 0, NULL, zcl_scene_register, sampleGW_sceneCb},
#endif
#ifdef ZCL_DOOR_LOCK
{ZCL_CLUSTER_CLOSURES_DOOR_LOCK, MANUFACTURER_CODE_NONE, 0, NULL, zcl_doorLock_register, &sampleGW_doorLockCb},
#endif
#ifdef ZCL_TEMPERATURE_MEASUREMENT
{ZCL_CLUSTER_MS_TEMPERATURE_MEASUREMENT, MANUFACTURER_CODE_NONE, 0, NULL, zcl_temperature_measurement_register, NULL},
#endif
#ifdef ZCL_IAS_ZONE
{ZCL_CLUSTER_SS_IAS_ZONE, MANUFACTURER_CODE_NONE, 0, NULL, zcl_iasZone_register, &sampleGW_iasZoneCb},
#endif
#ifdef ZCL_POLL_CTRL
{ZCL_CLUSTER_GEN_POLL_CONTROL, MANUFACTURER_CODE_NONE, 0, NULL, zcl_pollCtrl_register, &sampleGW_pollCtrlCb},
#endif
};
u8 SAMPLE_GW_CB_CLUSTER_NUM = (sizeof(g_sampleGwClusterList)/sizeof(g_sampleGwClusterList[0]));
/**********************************************************************
* FUNCTIONS
*/
#endif /* __PROJECT_TL_GW__ */
|
the_stack_data/26825.c | const char net_sfc_efx_pmd_info[] __attribute__((used)) = "PMD_INFO_STRING= {\"name\" : \"net_sfc_efx\", \"params\" : \"rx_datapath=[efx|ef10|ef10_essb] tx_datapath=[efx|ef10|ef10_simple] perf_profile=[auto|throughput|low-latency] fw_variant=[dont-care|full-feature|ultra-low-latency|capture-packed-stream|dpdk] rxd_wait_timeout_ns=<long> stats_update_period_ms=<long>\", \"kmod\" : \"* igb_uio | uio_pci_generic | vfio-pci\", \"pci_ids\" : [[6436, 2307, 65535, 65535],[6436, 6403, 65535, 65535],[6436, 2339, 65535, 65535],[6436, 6435, 65535, 65535],[6436, 2563, 65535, 65535],[6436, 6659, 65535, 65535],[6436, 2819, 65535, 65535],[6436, 6915, 65535, 65535] ]}";
|
the_stack_data/89067.c | // RUN: %clang_cc1 -triple i386-unknown-unknown -O1 -emit-llvm -o - %s | FileCheck %s
// CHECK-LABEL: define{{.*}} i32 @f0
// CHECK: ret i32 1
// CHECK-LABEL: define{{.*}} i32 @f1
// CHECK: ret i32 1
// CHECK-LABEL: define{{.*}} i32 @f2
// CHECK: ret i32 1
// <rdr://6115726>
int f0(void) {
int x;
unsigned short n = 1;
int *a = &x;
int *b = &x;
a = a - n;
b -= n;
return a == b;
}
int f1(int *a) {
long b = a - (int*) 1;
a -= (int*) 1;
return b == (long) a;
}
int f2(long n) {
int *b = n + (int*) 1;
n += (int*) 1;
return b == (int*) n;
}
|
the_stack_data/154826731.c | /* Copyright 2010-2017 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
extern void lib (void);
int
main (void)
{
lib ();
return 0;
}
|
the_stack_data/656191.c | #include <stdio.h>
#include <stdlib.h> /* for exit */
#include <unistd.h> /* for open/close.. */
#include <fcntl.h> /* for O_RDONLY */
#include <sys/ioctl.h> /* for ioctl*/
#include <sys/types.h> /* for lseek() */
#include <linux/fb.h> /*for fb_var_screeninfo, FBIOGET_VSCREENINFO*/
#define FBDEVFILE "/dev/fb2"
typedef unsigned char ubyte;
//색 정보를 16bit로 변환해 주는 함수
unsigned short makepixel(ubyte r, ubyte g, ubyte b)
{
return (unsigned short)(((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3));
}
int main()
{
int fbfd;
int ret;
struct fb_var_screeninfo fbvar;
unsigned short pixel;
int offset; //frame buffer driver file point를 얻는다.
int vertical;
int horizontal;
fbfd = open(FBDEVFILE, O_RDWR);
if (fbfd < 0)
{
perror("fbdevopen");
exit(1);
}
// 커널로부터 LCD에 관한 정보를 fbvar에 저장한다.
ret = ioctl(fbfd, FBIOGET_VSCREENINFO, &fbvar);
if (ret < 0)
{
perror("fbdevioctl");
exit(1);
}
if (fbvar.bits_per_pixel != 16)
{ //bpp가 16bit인지 check
perror(" bpp is not 16\n ");
exit(1);
}
//white점을 (50,50)에 찍는다.
offset = 50 * fbvar.xres * (16 / 8) + 50 * (16 / 8);
if (lseek(fbfd, offset, SEEK_SET) < 0)
{ //file pointer를 맨 앞에서 offset만큼 옮김
perror("fbdevlseek");
exit(1);
}
pixel = makepixel(255, 255, 255); /*white pixel */
write(fbfd, &pixel, 2); /*write 2byte(16 bit)*/
for (vertical = 0; vertical < 100; ++vertical)
{
for (horizontal = 0; horizontal < 100; ++horizontal)
{
offset = (100 + vertical) * fbvar.xres * (16 / 8) + (100 + horizontal) * (16 / 8);
if (lseek(fbfd, offset, SEEK_SET) < 0)
{
perror("fbdevlseek");
exit(1);
}
pixel = makepixel(255, 255, 255);
write(fbfd, &pixel, 2);
}
}
close(fbfd);
return 0;
} // end of main
|
the_stack_data/62636450.c | /* */
#include<stdio.h>
#include<math.h>
double area (double, double, double);
main()
{
double a, b, c, d, e, f, g, s1, s2, s3, s;
printf("aを入力:", a);
scanf("%lf", &a);
printf("bを入力:", b);
scanf("%lf", &b);
printf("cを入力:", c);
scanf("%lf", &c);
printf("dを入力:", d);
scanf("%lf", &d);
printf("eを入力:", e);
scanf("%lf", &e);
printf("fを入力:", f);
scanf("%lf", &f);
printf("gを入力:", g);
scanf("%lf", &g);
s1 = area(a, b, c);
s2 = area(b, d, e);
s3 = area(e, f, g);
s = s1 + s2 + s3;
printf("5角形の面積=%.2f\n", s);
}
double area(double x, double y, double z)
{
double p, s;
p = ( x + y + z ) / 2;
s = sqrt( p * (p - x) * (p - y) * (p - z) );
return s;
}
|
the_stack_data/1101185.c | #include <stdio.h>
#include <string.h>
int main()
{
int n, i, j,k,x,y,max=-1,length=0, matrix[10][10];
char s[10][100];
scanf("%d", &n);
for (i=0; i<n; i++)
{
scanf("%s", s[i]);
length+=strnlen(s[i],1000);
}
for (i=0; i<n; i++)
{
for (j=0; j<n; j++)
matrix[i][j]=prefix(s[i], s[j]);
}
for (i=1; i<n; i++)
{
for (j=0; j<n; j++)
for (k=0; k<n; k++)
{
if (matrix[j][k]> max)
{
max= matrix[j][k];
x=j; y=k;
}
}
for (j=0; j<n; j++)
{
matrix[j][j]=0;
matrix[x][j]=0;
matrix[j][y]=0;
}
length-=max;
max=0;
}
printf("%d", length);
return 0;
}
int prefix( char *s1, char *s2)
{
int k=0, max=-1,i,j,lengths1, lengths2;
if (strcmp(s1, s2) == 0) return 0;
else if (strcmp(s1, s2) < 0)
{
lengths1=strnlen(s1,1000);
lengths2=strnlen(s2,1000);
for (i=0; i<lengths2; i++)
{
for (j=0; j<lengths2-i; j++)
if (s1[lengths1-lengths2+i+j]==s2[j]) k++;
else
{
k=0;
break;
}
if (k>max) max=k;
k=0;
}
return max;
}
else
{
lengths1=strnlen(s1,1000);
for (i=0; i<lengths1; i++)
{
for (j=0; j<lengths1-i; j++)
if (s1[i+j]==s2[j]) k++;
else
{
k=0;
break;
}
if (k>max) max=k;
k=0;
}
return max;
}
} |
the_stack_data/117816.c | /* $Xorg: CrPixFBit.c,v 1.4 2001/02/09 02:03:51 xorgcvs Exp $ */
/*
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/lib/Xmu/CrPixFBit.c,v 1.6 2001/01/17 19:42:53 dawes Exp $ */
/*
* This file contains miscellaneous utility routines and is not part of the
* Xlib standard.
*/
/*
* Public entry points:
*
* XmuCreatePixmapFromBitmap make a pixmap from a bitmap
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <X11/Xos.h>
#include <X11/Xlib.h>
#include <X11/Xmu/Drawing.h>
Pixmap
XmuCreatePixmapFromBitmap(Display *dpy, Drawable d, Pixmap bitmap,
unsigned int width, unsigned int height,
unsigned int depth,
unsigned long fore, unsigned long back)
/*
* dpy - connection to X server
* d - drawable indicating screen
* bitmap - single plane pixmap
* width, height - dimensions of bitmap and pixmap
* depth - depth of pixmap to create
* fore, back - colors to use
*/
{
Pixmap pixmap;
pixmap = XCreatePixmap (dpy, d, width, height, depth);
if (pixmap != None) {
GC gc;
XGCValues xgcv;
xgcv.foreground = fore;
xgcv.background = back;
xgcv.graphics_exposures = False;
gc = XCreateGC (dpy, d,
(GCForeground | GCBackground | GCGraphicsExposures),
&xgcv);
if (gc) {
XCopyPlane (dpy, bitmap, pixmap, gc, 0, 0, width, height, 0, 0, 1);
XFreeGC (dpy, gc);
} else {
XFreePixmap (dpy, pixmap);
pixmap = None;
}
}
return pixmap;
}
|
the_stack_data/39969.c | #if defined(__mips_hard_float)
#include <stdio.h>
int main ()
{
int out [] = {0, 0};
unsigned long long in [] = {0x405EE0A3D70A3D71ULL, 0x3FF0000000000000ULL};
__asm__ volatile("cfc1 $a1, $31" "\n\t"
"ldc1 $f0, 0(%0)" "\n\t"
"ctc1 $zero, $31" "\n\t"
"round.w.d $f0, $f0" "\n\t"
"cfc1 $a2, $31" "\n\t"
"sw $a2, 0(%1)" "\n\t"
"ldc1 $f0, 8(%0)" "\n\t"
"ctc1 $zero, $31" "\n\t"
"round.w.d $f0, $f0" "\n\t"
"cfc1 $a2, $31" "\n\t"
"sw $a2, 4(%1)" "\n\t"
"ctc1 $a1, $31" "\n\t"
:
: "r" (in), "r" (out)
: "a1", "a2", "t0", "$f0", "$f1"
);
printf("FCSR::1: 0x%x, 2: 0x%x\n", out[0], out[1]);
return 0;
}
#else
int main() {
return 0;
}
#endif
|
the_stack_data/982433.c | const unsigned char Pods_AdMateVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:Pods_AdMate PROJECT:Pods-1" "\n"; const double Pods_AdMateVersionNumber __attribute__ ((used)) = (double)1.;
|
the_stack_data/170453746.c | // RUN: mlir-clang %s %stdinclude --function=set -S | FileCheck %s
// RUN: mlir-clang %s %stdinclude --function=set -S --memref-fullrank | FileCheck %s --check-prefix=FULLRANK
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
/* Array initialization. */
void set (int path[20])
{
int i = 0;
while (1) {
path[i] = 3;
i++;
if (i == 20) break;
}
//path[0][1] = 2;
}
// TODO consider making into for
// CHECK: func @set(%arg0: memref<?xi32>)
// CHECK-DAG: %c0_i32 = arith.constant 0 : i32
// CHECK-DAG: %c1_i32 = arith.constant 1 : i32
// CHECK-DAG: %c3_i32 = arith.constant 3 : i32
// CHECK-DAG: %c20_i32 = arith.constant 20 : i32
// CHECK-DAG: %true = arith.constant true
// CHECK-NEXT: %0 = scf.while (%arg1 = %c0_i32, %arg2 = %true) : (i32, i1) -> i32 {
// CHECK-NEXT: scf.condition(%arg2) %arg1 : i32
// CHECK-NEXT: } do {
// CHECK-NEXT: ^bb0(%arg1: i32): // no predecessors
// CHECK-NEXT: %1 = arith.index_cast %arg1 : i32 to index
// CHECK-NEXT: memref.store %c3_i32, %arg0[%1] : memref<?xi32>
// CHECK-NEXT: %2 = arith.addi %arg1, %c1_i32 : i32
// CHECK-NEXT: %3 = arith.cmpi ne, %2, %c20_i32 : i32
// CHECK-NEXT: scf.yield %2, %3 : i32, i1
// CHECK-NEXT: }
// CHECK-NEXT: return
// CHECK-NEXT: }
// FULLRANK: func @set(%{{.*}}: memref<20xi32>)
|
the_stack_data/158512.c | #include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
void finish(int sig){
exit(0);
}
void *Thread2(){
while(1){
sleep(1);
printf("Thread Two\n");
}
}
void *Thread1(void *arg){
int count = 1;
while(1){
sleep(1);
printf("Thread One\n");
if(count == 10){
kill(getpid(),SIGALRM);
}else{
count++;
}
}
}
int main(){
int rc;
pthread_t tid1, tid2;
if(rc = pthread_create(&tid1, NULL, Thread1, NULL) != 0){
perror("Pthread Error: Cant make thread One.\n");
}
if(rc = pthread_create(&tid2, NULL, Thread2, NULL) != 0){
perror("Pthread Error: Cant make thread Two.\n");
}
while(1){
sleep(1);
printf("original thread\n");
signal(SIGALRM, finish);
}
} |
the_stack_data/145451846.c | /* Copyright (C) 2000-2020 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
unsigned short
__udivmodhi4(unsigned short num, unsigned short den, int modwanted)
{
unsigned short bit = 1;
unsigned short res = 0;
while (den < num && bit && !(den & (1U<<15)))
{
den <<=1;
bit <<=1;
}
while (bit)
{
if (num >= den)
{
num -= den;
res |= bit;
}
bit >>=1;
den >>=1;
}
if (modwanted) return num;
return res;
}
|
the_stack_data/115764330.c | /* This testcase is part of GDB, the GNU debugger.
Copyright 2014-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define SIZE 5
void
foo (int n, int vla_ptr[n])
{
return; /* foo_bp */
}
void
bar (int *vla_ptr)
{
return; /* bar_bp */
}
void
vla_func (int n)
{
int vla[n];
typedef int typedef_vla[n];
typedef_vla td_vla;
int i;
for (i = 0; i < n; i++)
{
vla[i] = 2+i;
td_vla[i] = 4+i;
}
foo(n, vla);
bar(vla);
return; /* vla_func_bp */
}
int
main (void)
{
vla_func(SIZE);
return 0;
}
|
the_stack_data/665364.c | #include <stdio.h>
int main()
{
int i, j, k;
int a[3][3], b[3][3], c[3][3];
printf("Enter elements of first matrix:\n");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
scanf("%d", &a[i][j]);
}
}
printf("Enter elements of second matrix:\n");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
scanf("%d", &b[i][j]);
}
}
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
c[i][j] = 0;
for (k = 0; k < 3; k++)
{
c[i][j] += a[i][k] * b[j][k];
}
}
}
printf("Multiplied: \n");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
printf("%d\t", c[i][j]);
}
printf("\n");
}
return 0;
}
|
the_stack_data/104827219.c | #include <stdint.h>
// Final unpack length: 336
// Decoded length: 84 (first four bytes of buffer)
const uint8_t editOpModeCharsPackedBMP[88] =
{
0x00,0x00,0x00,0x54,0x95,0x69,0x7D,0x65,0x55,0xD7,0xD7,0x5E,0x5E,0xFA,0xF9,0x56,
0x97,0xD6,0x5E,0xBD,0x79,0x69,0x57,0xEB,0xFE,0x5A,0x59,0x79,0x75,0x55,0xD7,0xD7,
0x5E,0x5E,0xFA,0xF5,0xA5,0x95,0x97,0x55,0x5D,0x75,0x75,0xE5,0xEF,0xAF,0x95,0x69,
0x7D,0x65,0xE5,0xD7,0x97,0x95,0x7E,0xBF,0xE5,0x56,0x97,0xD6,0x55,0x7D,0x7F,0xE5,
0xEA,0xAF,0xAA,0x95,0x59,0x7F,0xF9,0x56,0xAB,0xD6,0x55,0x7E,0xFF,0xE5,0x55,0xAD,
0x7F,0xA5,0xEA,0x97,0xAA,0x5E,0xAA,0xFA
};
// Final unpack length: 11000
// Decoded length: 2750 (first four bytes of buffer)
const u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,0xFF,0xFF,0xFF
};
// Final unpack length: 11000
// Decoded length: 2750 (first four bytes of buffer)
const uint8_t editOpScreen2PackedBMP[1502] =
{
0x00,0x00,0x0A,0xBE,0xCC,0x2D,0x55,0x65,0x55,0x55,0x56,0x6A,0xCC,0x2C,0xAA,0xB6,
0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,
0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,
0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,
0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,
0xAA,0xAA,0xAB,0xBF,0xCC,0x2C,0xFF,0xFB,0xFF,0xFF,0xFF,0xCC,0x16,0x55,0x95,0xCC,
0x09,0x55,0x56,0xCC,0x0A,0x55,0x65,0x55,0x55,0x56,0x6A,0xCC,0x15,0xAA,0xDA,0xCC,
0x09,0xAA,0xAB,0x6A,0xCC,0x09,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x15,0xAA,0xDA,
0xCC,0x09,0xAA,0xAB,0x6A,0xCC,0x09,0xAA,0xB6,0xAA,0xAA,0xAB,0x69,0x55,0xA5,0x55,
0xA5,0x5A,0x95,0x69,0x55,0xA5,0x56,0xA9,0x6A,0xCC,0x09,0xAA,0xDA,0x55,0x69,0x55,
0x65,0xAA,0x95,0x56,0x55,0x59,0x55,0x6B,0x6A,0xAA,0x96,0x96,0x95,0x69,0x6A,0xA5,
0xAA,0xAA,0xAA,0xB6,0xAA,0xFA,0xAB,0x69,0x7D,0x65,0xFF,0xD7,0xD6,0x5F,0x59,0x7D,
0x65,0xF5,0xA9,0x7A,0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,0xAD,0xAA,0xAA,0xB6,0xAA,0xAA,0xAB,0xBF,0xCC,0x15,0xFF,0xEF,0xCC,0x0A,
0xFF,0xBF,0xCC,0x04,0xFF,0xBF,0xFF,0xFE,0xFF,0xFF,0xFB,0xFF,0xFF,0xFF
};
// Final unpack length: 11000
// Decoded length: 2750 (first four bytes of buffer)
const uint8_t editOpScreen3PackedBMP[1736] =
{
0x00,0x00,0x0A,0xBE,0xCC,0x2D,0x55,0x65,0x55,0x55,0x56,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,
0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,
0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,
0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,
0xAA,0xAA,0xAB,0xBF,0xCC,0x2C,0xFF,0xFB,0xFF,0xFF,0xFF,0xCC,0x0A,0x55,0x65,0xCC,0x0A,0x55,0x95,0xCC,
0x05,0x55,0x56,0xCC,0x08,0x55,0x56,0x55,0x55,0x59,0x55,0x55,0x65,0x55,0x55,0x56,0x6A,0xCC,0x09,0xAA,
0xB6,0xCC,0x0A,0xAA,0xDA,0xCC,0x05,0xAA,0xAB,0x6A,0xCC,0x07,0xAA,0xAB,0x6A,0xAA,0xAD,0xAA,0xAA,0xB6,
0xAA,0xAA,0xAB,0x6A,0xCC,0x09,0xAA,0xB6,0xCC,0x0A,0xAA,0xDA,0xCC,0x05,0xAA,0xAB,0x6A,0xCC,0x07,0xAA,
0xAB,0x6A,0x9A,0xAD,0xA9,0x5A,0xB6,0xAA,0xAA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F,0xAF,
0xBE,0xAA,0xDA,0xAA,0xBE,0xAB,0xFE,0xBF,0xFE,0xAB,0x6A,0xCC,0x07,0xAA,0xAB,0x6A,0xBF,0xAD,0xAA,0xBA,
0xB6,0xAB,0xFF,0xEB,0x6A,0xCC,0x09,0xAA,0xB6,0xCC,0x0A,0xAA,0xDA,0xCC,0x05,0xAA,0xAB,0x6A,0xCC,0x07,
0xAA,0xAB,0x6A,0xAA,0xAD,0xAA,0xAA,0xB6,0xAA,0xAA,0xAB,0xBF,0xCC,0x09,0xFF,0xFB,0xCC,0x0A,0xFF,0xEF,
0xCC,0x06,0xFF,0xBF,0xCC,0x08,0xFF,0xBF,0xFF,0xFE,0xFF,0xFF,0xFB,0xFF,0xFF,0xFF
};
// Final unpack length: 11000
// Decoded length: 2750 (first four bytes of buffer)
const uint8_t editOpScreen4PackedBMP[1713] =
{
0x00,0x00,0x0A,0xBE,0xCC,0x2D,0x55,0x65,0x55,0x55,0x56,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,
0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,
0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,
0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,0xAA,0xAA,0xAB,0x6A,0xCC,0x2C,0xAA,0xB6,
0xAA,0xAA,0xAB,0xBF,0xCC,0x2C,0xFF,0xFB,0xFF,0xFF,0xFF,0xCC,0x0A,0x55,0x65,0xCC,0x08,0x55,0x95,0xCC,
0x09,0x55,0x56,0xCC,0x06,0x55,0x56,0x55,0x55,0x59,0x55,0x55,0x65,0x55,0x55,0x56,0x6A,0xCC,0x09,0xAA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xFF,0xEF,0xFF,0xBE,0xBE,0xBF,0xFA,0xBE,0xAF,0xAF,0xB6,0xCC,0x08,0xAA,0xDA,0xFA,0xFA,0xFF,0xAF,
0xAF,0xAF,0xFA,0xFA,0xFA,0xAA,0xAB,0x6A,0xCC,0x05,0xAA,0xAB,0x6A,0xBF,0xAD,0xAA,0xBA,0xB6,0xAB,0xFF,
0xEB,0x6A,0xCC,0x09,0xAA,0xB6,0xCC,0x08,0xAA,0xDA,0xCC,0x09,0xAA,0xAB,0x6A,0xCC,0x05,0xAA,0xAB,0x6A,
0xAA,0xAD,0xAA,0xAA,0xB6,0xAA,0xAA,0xAB,0xBF,0xCC,0x09,0xFF,0xFB,0xCC,0x08,0xFF,0xEF,0xCC,0x0A,0xFF,
0xBF,0xCC,0x06,0xFF,0xBF,0xFF,0xFE,0xFF,0xFF,0xFB,0xFF,0xFF,0xFF
};
|
the_stack_data/45698.c | #include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
typedef char bool;
#define true 1
#define false 0
const char hex_table[16] ={ '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f' };
void output_in_hex(FILE* file, const u_int8_t* data, const size_t size) {
for (size_t i = 0; i < size; i++) {
fprintf(file, "%c%c", hex_table[(data[i]>>4) & 0xf], hex_table[(data[i]>>0) & 0xf]);
}
}
bool check_if_hex(const char* string) {
int i = 0;
while (string[i] != 0) {
const char c = string[i];
if (!((c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f') || (c >= '0' && c <= '9'))) return false;
i++;
}
return (i % 2 == 0);
}
void hex_to_bytes(u_int8_t* output, const char* input) {
int i = 0;
char c = 0;
u_int8_t b = 0;
while (input[i + 0] != 0 && input[i + 1] != 0) {
b = 0;
c = input[i + 0];
if (c >= 'A' && c <='F') b |= (c - 'A' + 0xa) << 4;
else if (c >= 'a' && c <='f') b |= (c - 'a' + 0xa) << 4;
else if (c >= '0' && c <='9') b |= (c - '0' + 0x0) << 4;
c = input[i + 1];
if (c >= 'A' && c <='F') b |= (c - 'A' + 0xa) << 0;
else if (c >= 'a' && c <='f') b |= (c - 'a' + 0xa) << 0;
else if (c >= '0' && c <='9') b |= (c - '0' + 0x0) << 0;
output[i >> 1] = b;
i += 2;
}
}
bool rgn_32_bytes(uint8_t *rng_bytes_out) {
fprintf(stderr, "Reminder: these keys use /dev/urandom entropy, which might be insufficient.\n");
fprintf(stderr, "While reportedly good on modern OS, strongly suggest coding to your system-specific CSRNG instead.\n");
FILE* f = fopen("/dev/urandom", "rb");
size_t n_bytes_read = fread(rng_bytes_out, 1, 32, f);
fclose(f);
if (n_bytes_read == 32) {
return true;
} else {
return false;
}
}
|
the_stack_data/92327909.c | /* Generated by CIL v. 1.7.0 */
/* print_CIL_Input is false */
struct _IO_FILE;
struct timeval;
extern float strtof(char const *str , char const *endptr ) ;
extern void signal(int sig , void *func ) ;
typedef struct _IO_FILE FILE;
extern int atoi(char const *s ) ;
extern double strtod(char const *str , char const *endptr ) ;
extern int fclose(void *stream ) ;
extern void *fopen(char const *filename , char const *mode ) ;
extern void abort() ;
extern void exit(int status ) ;
extern int raise(int sig ) ;
extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ;
extern int strcmp(char const *a , char const *b ) ;
extern int rand() ;
extern unsigned long strtoul(char const *str , char const *endptr , int base ) ;
void RandomFunc(unsigned long input[1] , unsigned long output[1] ) ;
extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ;
extern int gettimeofday(struct timeval *tv , void *tz , ...) ;
extern int printf(char const *format , ...) ;
int main(int argc , char *argv[] ) ;
void megaInit(void) ;
extern unsigned long strlen(char const *s ) ;
extern long strtol(char const *str , char const *endptr , int base ) ;
extern unsigned long strnlen(char const *s , unsigned long maxlen ) ;
extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ;
struct timeval {
long tv_sec ;
long tv_usec ;
};
extern void *malloc(unsigned long size ) ;
extern int scanf(char const *format , ...) ;
int main(int argc , char *argv[] )
{
unsigned long input[1] ;
unsigned long output[1] ;
int randomFuns_i5 ;
unsigned long randomFuns_value6 ;
int randomFuns_main_i7 ;
{
megaInit();
if (argc != 2) {
printf("Call this program with %i arguments\n", 1);
exit(-1);
} else {
}
randomFuns_i5 = 0;
while (randomFuns_i5 < 1) {
randomFuns_value6 = strtoul(argv[randomFuns_i5 + 1], 0, 10);
input[randomFuns_i5] = randomFuns_value6;
randomFuns_i5 ++;
}
RandomFunc(input, output);
if (output[0] == 780878230UL) {
printf("You win!\n");
} else {
}
randomFuns_main_i7 = 0;
while (randomFuns_main_i7 < 1) {
printf("%lu\n", output[randomFuns_main_i7]);
randomFuns_main_i7 ++;
}
}
}
void megaInit(void)
{
{
}
}
void RandomFunc(unsigned long input[1] , unsigned long output[1] )
{
unsigned long state[1] ;
unsigned long local2 ;
unsigned long local1 ;
{
state[0UL] = (input[0UL] + 51238316UL) + 274866410UL;
local1 = 0UL;
while (local1 < 1UL) {
local2 = 0UL;
while (local2 < 1UL) {
if (state[0UL] != local2 - local1) {
}
local2 ++;
}
local1 += 2UL;
}
output[0UL] = state[0UL] + 454761159UL;
}
}
|
the_stack_data/83710.c | #include <stdio.h>
#include <string.h>
int chkserial(char *s)
{
char buffer[16];
strcpy(buffer, s);
return strcmp(buffer, "cs727827");
}
void fullversion()
{
printf("Thanks for purchasing! Enjoy the full-version software!\n");
}
void trialversion()
{
printf("This is a trial version. Please purchase the full version to enable all features!\n");
}
int main(int argc, char **argv)
{
char buf[512];
FILE *f = fopen(argv[1], "r");
fread(buf, 512, 1, f);
printf("buf: %s\n", buf);
fullversion();
// if (chkserial(buf) == 0)
// fullversion();
// else
// trialversion();
return 0;
}
|
the_stack_data/50137178.c | #include <stdio.h>
#include <pthread.h>
__thread int my_thread_local = 0xdeadbeef;
int main () {
printf("my_thread_local: %d @ %p\n", my_thread_local, &my_thread_local);
}
|
the_stack_data/107952769.c | /**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Benchmark `exp`.
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <sys/time.h>
#define NAME "exp"
#define ITERATIONS 1000000
#define REPEATS 3
/**
* Prints the TAP version.
*/
void print_version() {
printf( "TAP version 13\n" );
}
/**
* Prints the TAP summary.
*
* @param total total number of tests
* @param passing total number of passing tests
*/
void print_summary( int total, int passing ) {
printf( "#\n" );
printf( "1..%d\n", total ); // TAP plan
printf( "# total %d\n", total );
printf( "# pass %d\n", passing );
printf( "#\n" );
printf( "# ok\n" );
}
/**
* Prints benchmarks results.
*
* @param elapsed elapsed time in seconds
*/
void print_results( double elapsed ) {
double rate = (double)ITERATIONS / elapsed;
printf( " ---\n" );
printf( " iterations: %d\n", ITERATIONS );
printf( " elapsed: %0.9f\n", elapsed );
printf( " rate: %0.9f\n", rate );
printf( " ...\n" );
}
/**
* Returns a clock time.
*
* @return clock time
*/
double tic() {
struct timeval now;
gettimeofday( &now, NULL );
return (double)now.tv_sec + (double)now.tv_usec/1.0e6;
}
/**
* Generates a random double on the interval [0,1].
*
* @return random double
*/
double rand_double() {
int r = rand();
return (double)r / ( (double)RAND_MAX + 1.0 );
}
/**
* Runs a benchmark.
*
* @return elapsed time in seconds
*/
double benchmark() {
double elapsed;
double x;
double y;
double t;
int i;
t = tic();
for ( i = 0; i < ITERATIONS; i++ ) {
x = ( 100.0*rand_double() ) - 50.0;
y = exp( x );
if ( y != y ) {
printf( "should not return NaN\n" );
break;
}
}
elapsed = tic() - t;
if ( y != y ) {
printf( "should not return NaN\n" );
}
return elapsed;
}
/**
* Main execution sequence.
*/
int main( void ) {
double elapsed;
int i;
// Use the current time to seed the random number generator:
srand( time( NULL ) );
print_version();
for ( i = 0; i < REPEATS; i++ ) {
printf( "# c::%s\n", NAME );
elapsed = benchmark();
print_results( elapsed );
printf( "ok %d benchmark finished\n", i+1 );
}
print_summary( REPEATS, REPEATS );
}
|
the_stack_data/82498.c | #include <stdio.h>
#include <stdlib.h>
void pausar() {
printf("\n Pressione alguma tecla para continuar...");
getch();
}
int main(){
int matriz100x100[100][100], ctLinha, ctColuna, escolha;
ctLinha=1; ctColuna=1;
for(ctLinha=0; ctLinha<100; ctLinha++){
for(ctColuna=0; ctColuna<100; ctColuna++){
matriz100x100[ctLinha][ctColuna] = ctLinha + 1;
}
}
printf("Escolha uma linha da matriz: ");
scanf("%d", &escolha);
for(ctColuna=0; ctColuna<100; ctColuna++){
printf("%d", matriz100x100[escolha-1][ctColuna]);
}
pausar();
return(0);
}
|
the_stack_data/44510.c | #include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_BLOCK_SIZE ((size_t)127)
#define BUF_SIZE 4096
typedef enum __honk_compress_state_t__
{
HONK_COMPRESS_STATE_RLE,
HONK_COMPRESS_STATE_BLOCK
} honk_compress_state_t;
typedef enum __honk_decompress_state_t__
{
HONK_DECOMPRESS_STATE_STATUS,
HONK_DECOMPRESS_STATE_RLE,
HONK_DECOMPRESS_STATE_BLOCK
} honk_decompress_state_t;
//Get stdin, opened in binary mode:
static FILE* get_stdin_binary(void);
//Get stdout, opened in binary mode:
static FILE* get_stdout_binary(void);
//Write a single byte to the output:
static void write_byte(FILE* output, uint8_t new_byte);
//Write a status byte to the output:
static void write_status_byte(FILE* output, bool is_rle, size_t bytes_count);
//Write a RLE run (status byte + content byte):
static void write_rle_run(FILE* output, uint8_t byte, size_t count);
//Write a block (status byte + block bytes):
static void write_block(FILE* output, const uint8_t* block, size_t count);
static FILE* get_stdin_binary(void)
{
//For our dearest Windows users ... binary != text for you!
#ifdef WIN32
_setmode(STDIN_FILENO, _O_BINARY);
#endif
return stdin;
}
static FILE* get_stdout_binary(void)
{
//See get_stdin_binary() ...
#ifdef WIN32
_setmode(STDOUT_FILENO, _O_BINARY);
#endif
return stdout;
}
static void write_byte(FILE* output, uint8_t new_byte)
{
if (fputc((int)new_byte, output) == EOF)
{
fprintf(stderr, "Error while writing to output file descriptor.\n");
exit(EXIT_FAILURE);
}
}
static void write_status_byte(FILE* output, bool is_rle, size_t bytes_count)
{
uint8_t status_byte = (uint8_t)bytes_count;
if (is_rle)
{
status_byte |= (1 << 7);
}
write_byte(output, status_byte);
}
static void write_rle_run(FILE* output, uint8_t byte, size_t count)
{
//Write the status byte:
write_status_byte(output, true, count);
//Write the RLE content once:
write_byte(output, byte);
}
static void write_block(FILE* output, const uint8_t* block, size_t count)
{
//Write the status byte:
write_status_byte(output, false, count);
//Flush the block via fwrite():
if (fwrite(block, 1, count, output) != count)
{
fprintf(stderr, "Error while writing to output file descriptor.\n");
exit(EXIT_FAILURE);
}
}
static void honk_compress(FILE* input, FILE* output)
{
//Start in the (empty) block state:
honk_compress_state_t state = HONK_COMPRESS_STATE_BLOCK;
size_t count = 0;
uint8_t last_byte = 0;
uint8_t block[MAX_BLOCK_SIZE];
//Read the input file block-wise and process each byte:
uint8_t buf[BUF_SIZE];
size_t bytes_count;
while ((bytes_count = fread(buf, 1, BUF_SIZE, input)) > 0)
{
//Process the new bytes:
for (size_t i = 0; i < bytes_count; i++)
{
uint8_t new_byte = buf[i];
switch (state)
{
case HONK_COMPRESS_STATE_RLE:
//If we see another byte, the RLE must be closed and we move to the block state:
if (new_byte != last_byte)
{
//Write run:
write_rle_run(output, last_byte, count);
//Change state:
last_byte = new_byte;
block[0] = new_byte;
count = 1;
state = HONK_COMPRESS_STATE_BLOCK;
}
else
{
//Increment the number of bytes.
//Is the RLE full?
if (++count == MAX_BLOCK_SIZE)
{
//Write run:
write_rle_run(output, last_byte, MAX_BLOCK_SIZE);
//Move to the (empty) block state:
count = 0;
state = HONK_COMPRESS_STATE_BLOCK;
}
}
break;
case HONK_COMPRESS_STATE_BLOCK:
//If we see the same byte twice, the block must be closed and we move to RLE:
if ((count > 0) && (new_byte == last_byte))
{
//The last byte is *not* part of the block:
size_t actual_bytes_count = count - 1;
//Write block:
if (actual_bytes_count > 0)
{
write_block(output, block, actual_bytes_count);
}
//Change state:
count = 2;
state = HONK_COMPRESS_STATE_RLE;
}
else
{
//Add the new byte to the block and increment the number of bytes:
block[count] = new_byte;
//Is the block full?
if (++count == MAX_BLOCK_SIZE)
{
//Write block:
write_block(output, block, MAX_BLOCK_SIZE);
//Stay in the (empty) block state:
count = 0;
}
else
{
//Remember the new byte:
last_byte = new_byte;
}
}
break;
}
}
}
//Write the last block if necessary:
switch (state)
{
case HONK_COMPRESS_STATE_RLE:
//Write run:
write_rle_run(output, last_byte, count);
break;
case HONK_COMPRESS_STATE_BLOCK:
//Write block:
if (count > 0)
{
write_block(output, block, count);
}
break;
}
}
static void honk_decompress(FILE* input, FILE* output)
{
//Start in the status state:
honk_decompress_state_t state = HONK_DECOMPRESS_STATE_STATUS;
size_t count = 0;
//Read the input file block-wise and process each byte:
uint8_t buf[BUF_SIZE];
size_t bytes_count;
while ((bytes_count = fread(buf, 1, BUF_SIZE, input)) > 0)
{
//Process the new bytes:
for (size_t i = 0; i < bytes_count; i++)
{
uint8_t new_byte = buf[i];
switch (state)
{
case HONK_DECOMPRESS_STATE_STATUS:
//Read the block count:
count = (size_t)(new_byte & 0x7F);
//RLE or block?
if (new_byte & (1 << 7))
{
//If the length of the RLE would be 0, we read one byte that will be repeated 0 times (quite pointless).
state = HONK_DECOMPRESS_STATE_RLE;
}
else
{
//If the length of the block would be 0, we stay in HONK_DECOMPRESS_STATE_STATUS.
if (count > 0)
{
state = HONK_DECOMPRESS_STATE_BLOCK;
}
}
break;
case HONK_DECOMPRESS_STATE_RLE:
//Write n instances of our byte and move back to status state:
for (size_t i = 0; i < count; i++)
{
write_byte(output, new_byte);
}
state = HONK_DECOMPRESS_STATE_STATUS;
break;
case HONK_DECOMPRESS_STATE_BLOCK:
//Write the new byte and reduce the count.
//If all bytes of the block are read / written, we move back to status state.
write_byte(output, new_byte);
if (--count == 0)
{
state = HONK_DECOMPRESS_STATE_STATUS;
}
break;
}
}
}
//Validate the state:
if (state != HONK_DECOMPRESS_STATE_STATUS)
{
fprintf(stderr, "Error while decompressing: Bad format\n");
exit(EXIT_FAILURE);
}
}
int main(int argc, char** argv)
{
//Compression / Decompression?
bool is_compress_mode = true;
//Check parameters:
for (int i = 1; i < argc; i++)
{
const char* arg = argv[i];
if (strcmp(arg, "-d") == 0)
{
is_compress_mode = false;
break;
}
}
//Get file pointers to stdin and stdout:
FILE* input = get_stdin_binary();
FILE* output = get_stdout_binary();
//Compress / Decompress:
if (is_compress_mode)
{
honk_compress(input, output);
}
else
{
honk_decompress(input, output);
}
//Did we leave the loop because of a read error?
if (ferror(input))
{
fprintf(stderr, "Error while reading from input file descriptor.\n");
exit(EXIT_FAILURE);
}
//Close the streams:
fclose(input);
fclose(output);
return 0;
}
|
the_stack_data/63256.c | #include <stdio.h>
void starp(int l)
{
if (l == 0)
{
return;
}
starp(l - 1);
int i;
for (i = 0; i < l; i++)
{
printf("*");
}
printf("\n");
}
int main(int argc, char const *argv[])
{
starp(10);
return 0;
}
|
the_stack_data/29825386.c |
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/time.h>
#include <time.h>
#include <wait.h>
/* bogus loop
*
*/
long long i;
void do_loop(long long count)
{
int a = 1, b = 1, c;
for (i=0; i<count; i++)
{
c = b + a;
a = b;
b = c;
}
}
long long time_loop(long long count)
{
struct timeval tv1, tv2;
long long dur;
gettimeofday(&tv1, NULL);
do_loop(count);
gettimeofday(&tv2, NULL);
dur = (tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec);
return dur;
}
long long get_min_duration(long long dur)
{
long long count = 1;
while ( time_loop(count) < dur )
count *= 2;
return count;
}
long long j;
void sigsegv_cb(int sig)
{
j=i;
}
int main(int argc, char **argv)
{
long long count = get_min_duration(150000);
signal(SIGSEGV, sigsegv_cb);
pid_t pid = fork();
if (pid)
{
do_loop(count);
kill(pid, SIGSEGV);
wait(NULL);
}
else
{
do_loop(count * 2);
printf("%lld\n", j);
}
}
|
the_stack_data/54824104.c | void main(void) {
int i;
i = 0;
while (i < 10) {
output(i);
i = i + 1;
}
} |
the_stack_data/193893250.c | /* Test program for non-stop debugging.
Copyright 1996-2019 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
int exit_first_thread = 0;
void break_at_me (int id, int i)
{
}
void *
worker (void *arg)
{
int id = *(int *)arg;
int i = 0;
/* When gdb is running, it sets hidden breakpoints in the thread
library. The signals caused by these hidden breakpoints can
cause system calls such as 'sleep' to return early. Pay attention
to the return value from 'sleep' to get the full sleep. */
for (;;++i)
{
int unslept = 1;
while (unslept > 0)
unslept = sleep (unslept);
if (exit_first_thread && id == 0)
return NULL;
break_at_me (id, i);
}
}
pthread_t
create_thread (int id)
{
pthread_t tid;
/* This memory will be leaked, we don't care for a test. */
int *id2 = malloc (sizeof (int));
*id2 = id;
if (pthread_create (&tid, NULL, worker, (void *) id2))
{
perror ("pthread_create 1");
exit (1);
}
return tid;
}
int
main (int argc, char *argv[])
{
pthread_t tid;
create_thread (0);
sleep (1);
tid = create_thread (1);
pthread_join (tid, NULL);
return 0;
}
|
the_stack_data/152265.c | /* Generated by CIL v. 1.7.0 */
/* print_CIL_Input is false */
struct _IO_FILE;
struct timeval;
extern void signal(int sig , void *func ) ;
extern float strtof(char const *str , char const *endptr ) ;
typedef struct _IO_FILE FILE;
extern int atoi(char const *s ) ;
extern double strtod(char const *str , char const *endptr ) ;
extern int fclose(void *stream ) ;
extern void *fopen(char const *filename , char const *mode ) ;
extern void abort() ;
extern void exit(int status ) ;
extern int raise(int sig ) ;
extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ;
extern int strcmp(char const *a , char const *b ) ;
extern int rand() ;
extern unsigned long strtoul(char const *str , char const *endptr , int base ) ;
void RandomFunc(unsigned long input[1] , unsigned long output[1] ) ;
extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ;
extern int gettimeofday(struct timeval *tv , void *tz , ...) ;
extern int printf(char const *format , ...) ;
int main(int argc , char *argv[] ) ;
void megaInit(void) ;
extern unsigned long strlen(char const *s ) ;
extern long strtol(char const *str , char const *endptr , int base ) ;
extern unsigned long strnlen(char const *s , unsigned long maxlen ) ;
extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ;
struct timeval {
long tv_sec ;
long tv_usec ;
};
extern void *malloc(unsigned long size ) ;
extern int scanf(char const *format , ...) ;
int main(int argc , char *argv[] )
{
unsigned long input[1] ;
unsigned long output[1] ;
int randomFuns_i5 ;
unsigned long randomFuns_value6 ;
int randomFuns_main_i7 ;
{
megaInit();
if (argc != 2) {
printf("Call this program with %i arguments\n", 1);
exit(-1);
} else {
}
randomFuns_i5 = 0;
while (randomFuns_i5 < 1) {
randomFuns_value6 = strtoul(argv[randomFuns_i5 + 1], 0, 10);
input[randomFuns_i5] = randomFuns_value6;
randomFuns_i5 ++;
}
RandomFunc(input, output);
if (output[0] == 968801766UL) {
printf("You win!\n");
} else {
}
randomFuns_main_i7 = 0;
while (randomFuns_main_i7 < 1) {
printf("%lu\n", output[randomFuns_main_i7]);
randomFuns_main_i7 ++;
}
}
}
void RandomFunc(unsigned long input[1] , unsigned long output[1] )
{
unsigned long state[1] ;
{
state[0UL] = input[0UL] ^ 700325083UL;
if ((state[0UL] >> 4UL) & 1UL) {
state[0UL] <<= ((state[0UL] >> 3UL) & 7UL) | 1UL;
}
output[0UL] = state[0UL] | 293908934UL;
}
}
void megaInit(void)
{
{
}
}
|
the_stack_data/14958.c | /* $OpenBSD: strtol.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
/*
* Convert a string to a long integer.
*
* Ignores `locale' stuff. Assumes that the upper and lower case
* alphabets and digits are each contiguous.
*/
long
strtol(const char *nptr, char **endptr, int base)
{
const char *s;
long acc, cutoff;
int c;
int neg, any, cutlim;
/*
* Skip white space and pick up leading +/- sign if any.
* If base is 0, allow 0x for hex and 0 for octal, else
* assume decimal; if base is already 16, allow 0x.
*/
s = nptr;
do {
c = (unsigned char) *s++;
} while (isspace(c));
if (c == '-') {
neg = 1;
c = *s++;
} else {
neg = 0;
if (c == '+')
c = *s++;
}
if ((base == 0 || base == 16) &&
c == '0' && (*s == 'x' || *s == 'X')) {
c = s[1];
s += 2;
base = 16;
}
if (base == 0)
base = c == '0' ? 8 : 10;
/*
* Compute the cutoff value between legal numbers and illegal
* numbers. That is the largest legal value, divided by the
* base. An input number that is greater than this value, if
* followed by a legal input character, is too big. One that
* is equal to this value may be valid or not; the limit
* between valid and invalid numbers is then based on the last
* digit. For instance, if the range for longs is
* [-2147483648..2147483647] and the input base is 10,
* cutoff will be set to 214748364 and cutlim to either
* 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated
* a value > 214748364, or equal but the next digit is > 7 (or 8),
* the number is too big, and we will return a range error.
*
* Set any if any `digits' consumed; make it negative to indicate
* overflow.
*/
cutoff = neg ? LONG_MIN : LONG_MAX;
cutlim = cutoff % base;
cutoff /= base;
if (neg) {
if (cutlim > 0) {
cutlim -= base;
cutoff += 1;
}
cutlim = -cutlim;
}
for (acc = 0, any = 0;; c = (unsigned char) *s++) {
if (isdigit(c))
c -= '0';
else if (isalpha(c))
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
else
break;
if (c >= base)
break;
if (any < 0)
continue;
if (neg) {
if (acc < cutoff || (acc == cutoff && c > cutlim)) {
any = -1;
acc = LONG_MIN;
errno = ERANGE;
} else {
any = 1;
acc *= base;
acc -= c;
}
} else {
if (acc > cutoff || (acc == cutoff && c > cutlim)) {
any = -1;
acc = LONG_MAX;
errno = ERANGE;
} else {
any = 1;
acc *= base;
acc += c;
}
}
}
if (endptr != 0)
*endptr = (char *) (any ? s - 1 : nptr);
return (acc);
}
|
the_stack_data/57951474.c | typedef int ptrdiff_t;
typedef unsigned int size_t;
typedef unsigned int wchar_t;
typedef struct {
long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));
long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
} max_align_t;
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short int __int16_t;
typedef short unsigned int __uint16_t;
typedef long int __int32_t;
typedef long unsigned int __uint32_t;
typedef long long int __int64_t;
typedef long long unsigned int __uint64_t;
typedef signed char __int_least8_t;
typedef unsigned char __uint_least8_t;
typedef short int __int_least16_t;
typedef short unsigned int __uint_least16_t;
typedef long int __int_least32_t;
typedef long unsigned int __uint_least32_t;
typedef long long int __int_least64_t;
typedef long long unsigned int __uint_least64_t;
typedef int __intptr_t;
typedef unsigned int __uintptr_t;
typedef int _LOCK_T;
typedef int _LOCK_RECURSIVE_T;
typedef long __blkcnt_t;
typedef long __blksize_t;
typedef __uint64_t __fsblkcnt_t;
typedef __uint32_t __fsfilcnt_t;
typedef long _off_t;
typedef int __pid_t;
typedef short __dev_t;
typedef unsigned short __uid_t;
typedef unsigned short __gid_t;
typedef __uint32_t __id_t;
typedef unsigned short __ino_t;
typedef __uint32_t __mode_t;
__extension__ typedef long long _off64_t;
typedef _off_t __off_t;
typedef _off64_t __loff_t;
typedef long __key_t;
typedef long _fpos_t;
typedef unsigned int __size_t;
typedef signed int _ssize_t;
typedef _ssize_t __ssize_t;
typedef unsigned int wint_t;
typedef struct
{
int __count;
union
{
wint_t __wch;
unsigned char __wchb[4];
} __value;
} _mbstate_t;
typedef _LOCK_RECURSIVE_T _flock_t;
typedef void *_iconv_t;
typedef unsigned long __clock_t;
typedef long __time_t;
typedef unsigned long __clockid_t;
typedef unsigned long __timer_t;
typedef __uint8_t __sa_family_t;
typedef __uint32_t __socklen_t;
typedef unsigned short __nlink_t;
typedef long __suseconds_t;
typedef unsigned long __useconds_t;
typedef char * __va_list;
typedef unsigned long __ULong;
struct _reent;
struct __locale_t;
struct _Bigint
{
struct _Bigint *_next;
int _k, _maxwds, _sign, _wds;
__ULong _x[1];
};
struct __tm
{
int __tm_sec;
int __tm_min;
int __tm_hour;
int __tm_mday;
int __tm_mon;
int __tm_year;
int __tm_wday;
int __tm_yday;
int __tm_isdst;
};
struct _on_exit_args {
void * _fnargs[32];
void * _dso_handle[32];
__ULong _fntypes;
__ULong _is_cxa;
};
struct _atexit {
struct _atexit *_next;
int _ind;
void (*_fns[32])(void);
struct _on_exit_args _on_exit_args;
};
struct __sbuf {
unsigned char *_base;
int _size;
};
struct __sFILE {
unsigned char *_p;
int _r;
int _w;
short _flags;
short _file;
struct __sbuf _bf;
int _lbfsize;
void * _cookie;
int (* _read) (struct _reent *, void *, char *, int)
;
int (* _write) (struct _reent *, void *, const char *, int)
;
_fpos_t (* _seek) (struct _reent *, void *, _fpos_t, int);
int (* _close) (struct _reent *, void *);
struct __sbuf _ub;
unsigned char *_up;
int _ur;
unsigned char _ubuf[3];
unsigned char _nbuf[1];
struct __sbuf _lb;
int _blksize;
_off_t _offset;
struct _reent *_data;
_flock_t _lock;
_mbstate_t _mbstate;
int _flags2;
};
typedef struct __sFILE __FILE;
struct _glue
{
struct _glue *_next;
int _niobs;
__FILE *_iobs;
};
struct _rand48 {
unsigned short _seed[3];
unsigned short _mult[3];
unsigned short _add;
};
struct _reent
{
int _errno;
__FILE *_stdin, *_stdout, *_stderr;
int _inc;
char _emergency[25];
int _unspecified_locale_info;
struct __locale_t *_locale;
int __sdidinit;
void (* __cleanup) (struct _reent *);
struct _Bigint *_result;
int _result_k;
struct _Bigint *_p5s;
struct _Bigint **_freelist;
int _cvtlen;
char *_cvtbuf;
union
{
struct
{
unsigned int _unused_rand;
char * _strtok_last;
char _asctime_buf[26];
struct __tm _localtime_buf;
int _gamma_signgam;
__extension__ unsigned long long _rand_next;
struct _rand48 _r48;
_mbstate_t _mblen_state;
_mbstate_t _mbtowc_state;
_mbstate_t _wctomb_state;
char _l64a_buf[8];
char _signal_buf[24];
int _getdate_err;
_mbstate_t _mbrlen_state;
_mbstate_t _mbrtowc_state;
_mbstate_t _mbsrtowcs_state;
_mbstate_t _wcrtomb_state;
_mbstate_t _wcsrtombs_state;
int _h_errno;
} _reent;
struct
{
unsigned char * _nextf[30];
unsigned int _nmalloc[30];
} _unused;
} _new;
struct _atexit *_atexit;
struct _atexit _atexit0;
void (**(_sig_func))(int);
struct _glue __sglue;
__FILE __sf[3];
};
extern struct _reent *_impure_ptr ;
extern struct _reent *const _global_impure_ptr ;
void _reclaim_reent (struct _reent *);
struct __locale_t;
typedef struct __locale_t *locale_t;
void * memchr (const void *, int, size_t);
int memcmp (const void *, const void *, size_t);
void * memcpy (void * restrict, const void * restrict, size_t);
void * memmove (void *, const void *, size_t);
void * memset (void *, int, size_t);
char *strcat (char *restrict, const char *restrict);
char *strchr (const char *, int);
int strcmp (const char *, const char *);
int strcoll (const char *, const char *);
char *strcpy (char *restrict, const char *restrict);
size_t strcspn (const char *, const char *);
char *strerror (int);
size_t strlen (const char *);
char *strncat (char *restrict, const char *restrict, size_t);
int strncmp (const char *, const char *, size_t);
char *strncpy (char *restrict, const char *restrict, size_t);
char *strpbrk (const char *, const char *);
char *strrchr (const char *, int);
size_t strspn (const char *, const char *);
char *strstr (const char *, const char *);
char *strtok (char *restrict, const char *restrict);
size_t strxfrm (char *restrict, const char *restrict, size_t);
int strcoll_l (const char *, const char *, locale_t);
char *strerror_l (int, locale_t);
size_t strxfrm_l (char *restrict, const char *restrict, size_t, locale_t);
char *strtok_r (char *restrict, const char *restrict, char **restrict);
int bcmp (const void *, const void *, size_t);
void bcopy (const void *, void *, size_t);
void bzero (void *, size_t);
void explicit_bzero (void *, size_t);
int timingsafe_bcmp (const void *, const void *, size_t);
int timingsafe_memcmp (const void *, const void *, size_t);
int ffs (int);
char *index (const char *, int);
void * memccpy (void * restrict, const void * restrict, int, size_t);
char *rindex (const char *, int);
char *stpcpy (char *restrict, const char *restrict);
char *stpncpy (char *restrict, const char *restrict, size_t);
int strcasecmp (const char *, const char *);
char *strdup (const char *);
char *_strdup_r (struct _reent *, const char *);
char *strndup (const char *, size_t);
char *_strndup_r (struct _reent *, const char *, size_t);
int strerror_r (int, char *, size_t)
__asm__ ("" "__xpg_strerror_r")
;
char * _strerror_r (struct _reent *, int, int, int *);
size_t strlcat (char *, const char *, size_t);
size_t strlcpy (char *, const char *, size_t);
int strncasecmp (const char *, const char *, size_t);
size_t strnlen (const char *, size_t);
char *strsep (char **, const char *);
char *strlwr (char *);
char *strupr (char *);
char *strsignal (int __signo);
typedef __int8_t int8_t ;
typedef __uint8_t uint8_t ;
typedef __int16_t int16_t ;
typedef __uint16_t uint16_t ;
typedef __int32_t int32_t ;
typedef __uint32_t uint32_t ;
typedef __int64_t int64_t ;
typedef __uint64_t uint64_t ;
typedef __intptr_t intptr_t;
typedef __uintptr_t uintptr_t;
typedef __int_least8_t int_least8_t;
typedef __uint_least8_t uint_least8_t;
typedef __int_least16_t int_least16_t;
typedef __uint_least16_t uint_least16_t;
typedef __int_least32_t int_least32_t;
typedef __uint_least32_t uint_least32_t;
typedef __int_least64_t int_least64_t;
typedef __uint_least64_t uint_least64_t;
typedef int int_fast8_t;
typedef unsigned int uint_fast8_t;
typedef int int_fast16_t;
typedef unsigned int uint_fast16_t;
typedef int int_fast32_t;
typedef unsigned int uint_fast32_t;
typedef long long int int_fast64_t;
typedef long long unsigned int uint_fast64_t;
typedef long long int intmax_t;
typedef long long unsigned int uintmax_t;
typedef signed char s8_t;
typedef signed short s16_t;
typedef signed int s32_t;
typedef signed long long s64_t;
typedef unsigned char u8_t;
typedef unsigned short u16_t;
typedef unsigned int u32_t;
typedef unsigned long long u64_t;
struct _snode {
struct _snode *next;
};
typedef struct _snode sys_snode_t;
struct _slist {
sys_snode_t *head;
sys_snode_t *tail;
};
typedef struct _slist sys_slist_t;
static inline void sys_slist_init(sys_slist_t *list)
{
list->head =
((void *)0)
;
list->tail =
((void *)0)
;
}
static inline
_Bool
sys_slist_is_empty(sys_slist_t *list)
{
return (!list->head);
}
static inline sys_snode_t *sys_slist_peek_head(sys_slist_t *list)
{
return list->head;
}
static inline sys_snode_t *sys_slist_peek_tail(sys_slist_t *list)
{
return list->tail;
}
static inline sys_snode_t *sys_slist_peek_next_no_check(sys_snode_t *node)
{
return node->next;
}
static inline sys_snode_t *sys_slist_peek_next(sys_snode_t *node)
{
return node ? sys_slist_peek_next_no_check(node) :
((void *)0)
;
}
static inline void sys_slist_prepend(sys_slist_t *list,
sys_snode_t *node)
{
node->next = list->head;
list->head = node;
if (!list->tail) {
list->tail = list->head;
}
}
static inline void sys_slist_append(sys_slist_t *list,
sys_snode_t *node)
{
node->next =
((void *)0)
;
if (!list->tail) {
list->tail = node;
list->head = node;
} else {
list->tail->next = node;
list->tail = node;
}
}
static inline void sys_slist_append_list(sys_slist_t *list,
void *head, void *tail)
{
if (!list->tail) {
list->head = (sys_snode_t *)head;
list->tail = (sys_snode_t *)tail;
} else {
list->tail->next = (sys_snode_t *)head;
list->tail = (sys_snode_t *)tail;
}
}
static inline void sys_slist_merge_slist(sys_slist_t *list,
sys_slist_t *list_to_append)
{
sys_slist_append_list(list, list_to_append->head,
list_to_append->tail);
sys_slist_init(list_to_append);
}
static inline void sys_slist_insert(sys_slist_t *list,
sys_snode_t *prev,
sys_snode_t *node)
{
if (!prev) {
sys_slist_prepend(list, node);
} else if (!prev->next) {
sys_slist_append(list, node);
} else {
node->next = prev->next;
prev->next = node;
}
}
static inline sys_snode_t *sys_slist_get_not_empty(sys_slist_t *list)
{
sys_snode_t *node = list->head;
list->head = node->next;
if (list->tail == node) {
list->tail = list->head;
}
return node;
}
static inline sys_snode_t *sys_slist_get(sys_slist_t *list)
{
return sys_slist_is_empty(list) ?
((void *)0)
: sys_slist_get_not_empty(list);
}
static inline void sys_slist_remove(sys_slist_t *list,
sys_snode_t *prev_node,
sys_snode_t *node)
{
if (!prev_node) {
list->head = node->next;
if (list->tail == node) {
list->tail = list->head;
}
} else {
prev_node->next = node->next;
if (list->tail == node) {
list->tail = prev_node;
}
}
node->next =
((void *)0)
;
}
static inline
_Bool
sys_slist_find_and_remove(sys_slist_t *list,
sys_snode_t *node)
{
sys_snode_t *prev =
((void *)0)
;
sys_snode_t *test;
for (test = sys_slist_peek_head(list); test; test = sys_slist_peek_next(test)) {
if (test == node) {
sys_slist_remove(list, prev, node);
return
1
;
}
prev = test;
}
return
0
;
}
struct _dnode {
union {
struct _dnode *head;
struct _dnode *next;
};
union {
struct _dnode *tail;
struct _dnode *prev;
};
};
typedef struct _dnode sys_dlist_t;
typedef struct _dnode sys_dnode_t;
static inline void sys_dlist_init(sys_dlist_t *list)
{
list->head = (sys_dnode_t *)list;
list->tail = (sys_dnode_t *)list;
}
static inline int sys_dlist_is_head(sys_dlist_t *list, sys_dnode_t *node)
{
return list->head == node;
}
static inline int sys_dlist_is_tail(sys_dlist_t *list, sys_dnode_t *node)
{
return list->tail == node;
}
static inline int sys_dlist_is_empty(sys_dlist_t *list)
{
return list->head == list;
}
static inline int sys_dlist_has_multiple_nodes(sys_dlist_t *list)
{
return list->head != list->tail;
}
static inline sys_dnode_t *sys_dlist_peek_head(sys_dlist_t *list)
{
return sys_dlist_is_empty(list) ?
((void *)0)
: list->head;
}
static inline sys_dnode_t *sys_dlist_peek_head_not_empty(sys_dlist_t *list)
{
return list->head;
}
static inline sys_dnode_t *sys_dlist_peek_next_no_check(sys_dlist_t *list,
sys_dnode_t *node)
{
return (node == list->tail) ?
((void *)0)
: node->next;
}
static inline sys_dnode_t *sys_dlist_peek_next(sys_dlist_t *list,
sys_dnode_t *node)
{
return node ? sys_dlist_peek_next_no_check(list, node) :
((void *)0)
;
}
static inline sys_dnode_t *sys_dlist_peek_tail(sys_dlist_t *list)
{
return sys_dlist_is_empty(list) ?
((void *)0)
: list->tail;
}
static inline void sys_dlist_append(sys_dlist_t *list, sys_dnode_t *node)
{
node->next = list;
node->prev = list->tail;
list->tail->next = node;
list->tail = node;
}
static inline void sys_dlist_prepend(sys_dlist_t *list, sys_dnode_t *node)
{
node->next = list->head;
node->prev = list;
list->head->prev = node;
list->head = node;
}
static inline void sys_dlist_insert_after(sys_dlist_t *list,
sys_dnode_t *insert_point, sys_dnode_t *node)
{
if (!insert_point) {
sys_dlist_prepend(list, node);
} else {
node->next = insert_point->next;
node->prev = insert_point;
insert_point->next->prev = node;
insert_point->next = node;
}
}
static inline void sys_dlist_insert_before(sys_dlist_t *list,
sys_dnode_t *insert_point, sys_dnode_t *node)
{
if (!insert_point) {
sys_dlist_append(list, node);
} else {
node->prev = insert_point->prev;
node->next = insert_point;
insert_point->prev->next = node;
insert_point->prev = node;
}
}
static inline void sys_dlist_insert_at(sys_dlist_t *list, sys_dnode_t *node,
int (*cond)(sys_dnode_t *, void *), void *data)
{
if (sys_dlist_is_empty(list)) {
sys_dlist_append(list, node);
} else {
sys_dnode_t *pos = sys_dlist_peek_head(list);
while (pos && !cond(pos, data)) {
pos = sys_dlist_peek_next(list, pos);
}
sys_dlist_insert_before(list, pos, node);
}
}
static inline void sys_dlist_remove(sys_dnode_t *node)
{
node->prev->next = node->next;
node->next->prev = node->prev;
}
static inline sys_dnode_t *sys_dlist_get(sys_dlist_t *list)
{
sys_dnode_t *node;
if (sys_dlist_is_empty(list)) {
return
((void *)0)
;
}
node = list->head;
sys_dlist_remove(node);
return node;
}
extern unsigned int aos_log_level;
static inline unsigned int aos_log_get_level(void)
{
return aos_log_level;
}
enum log_level_bit {
AOS_LL_V_NONE_BIT = -1,
AOS_LL_V_FATAL_BIT,
AOS_LL_V_ERROR_BIT,
AOS_LL_V_WARN_BIT,
AOS_LL_V_INFO_BIT,
AOS_LL_V_DEBUG_BIT,
AOS_LL_V_MAX_BIT
};
typedef __uint8_t u_int8_t;
typedef __uint16_t u_int16_t;
typedef __uint32_t u_int32_t;
typedef __uint64_t u_int64_t;
typedef int register_t;
typedef unsigned long __sigset_t;
typedef __suseconds_t suseconds_t;
typedef long time_t;
struct timeval {
time_t tv_sec;
suseconds_t tv_usec;
};
struct timespec {
time_t tv_sec;
long tv_nsec;
};
struct itimerspec {
struct timespec it_interval;
struct timespec it_value;
};
typedef __sigset_t sigset_t;
typedef unsigned long fd_mask;
typedef struct _types_fd_set {
fd_mask fds_bits[(((64)+(((sizeof (fd_mask) * 8))-1))/((sizeof (fd_mask) * 8)))];
} _types_fd_set;
int select (int __n, _types_fd_set *__readfds, _types_fd_set *__writefds, _types_fd_set *__exceptfds, struct timeval *__timeout)
;
int pselect (int __n, _types_fd_set *__readfds, _types_fd_set *__writefds, _types_fd_set *__exceptfds, const struct timespec *__timeout, const sigset_t *__set)
;
typedef __uint32_t in_addr_t;
typedef __uint16_t in_port_t;
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef __blkcnt_t blkcnt_t;
typedef __blksize_t blksize_t;
typedef unsigned long clock_t;
typedef long daddr_t;
typedef char * caddr_t;
typedef __fsblkcnt_t fsblkcnt_t;
typedef __fsfilcnt_t fsfilcnt_t;
typedef __id_t id_t;
typedef __ino_t ino_t;
typedef __off_t off_t;
typedef __dev_t dev_t;
typedef __uid_t uid_t;
typedef __gid_t gid_t;
typedef __pid_t pid_t;
typedef __key_t key_t;
typedef _ssize_t ssize_t;
typedef __mode_t mode_t;
typedef __nlink_t nlink_t;
typedef __clockid_t clockid_t;
typedef __timer_t timer_t;
typedef __useconds_t useconds_t;
typedef __int64_t sbintime_t;
typedef struct {
void *hdl;
} aos_hdl_t;
typedef aos_hdl_t aos_task_t;
typedef aos_hdl_t aos_mutex_t;
typedef aos_hdl_t aos_sem_t;
typedef aos_hdl_t aos_queue_t;
typedef aos_hdl_t aos_timer_t;
typedef aos_hdl_t aos_work_t;
typedef aos_hdl_t aos_event_t;
typedef struct {
void *hdl;
void *stk;
} aos_workqueue_t;
typedef unsigned int aos_task_key_t;
void aos_reboot(void);
int aos_get_hz(void);
const char *aos_version_get(void);
int aos_task_new(const char *name, void (*fn)(void *), void *arg, int stack_size);
int aos_task_new_ext(aos_task_t *task, const char *name, void (*fn)(void *), void *arg,
int stack_size, int prio);
void aos_task_exit(int code);
const char *aos_task_name(void);
int aos_task_key_create(aos_task_key_t *key);
void aos_task_key_delete(aos_task_key_t key);
int aos_task_setspecific(aos_task_key_t key, void *vp);
void *aos_task_getspecific(aos_task_key_t key);
int aos_mutex_new(aos_mutex_t *mutex);
void aos_mutex_free(aos_mutex_t *mutex);
int aos_mutex_lock(aos_mutex_t *mutex, unsigned int timeout);
int aos_mutex_unlock(aos_mutex_t *mutex);
int aos_mutex_is_valid(aos_mutex_t *mutex);
int aos_sem_new(aos_sem_t *sem, int count);
void aos_sem_free(aos_sem_t *sem);
int aos_sem_wait(aos_sem_t *sem, unsigned int timeout);
void aos_sem_signal(aos_sem_t *sem);
int aos_sem_is_valid(aos_sem_t *sem);
void aos_sem_signal_all(aos_sem_t *sem);
int aos_event_new(aos_event_t *event, unsigned int flags);
void aos_event_free(aos_event_t *event);
int aos_event_get(aos_event_t *event, unsigned int flags, unsigned char opt,
unsigned int *actl_flags, unsigned int timeout);
int aos_event_set(aos_event_t *event, unsigned int flags, unsigned char opt);
int aos_queue_new(aos_queue_t *queue, void *buf, unsigned int size, int max_msg);
void aos_queue_free(aos_queue_t *queue);
int aos_queue_send(aos_queue_t *queue, void *msg, unsigned int size);
int aos_queue_recv(aos_queue_t *queue, unsigned int ms, void *msg, unsigned int *size);
int aos_queue_is_valid(aos_queue_t *queue);
void *aos_queue_buf_ptr(aos_queue_t *queue);
int aos_timer_new(aos_timer_t *timer, void (*fn)(void *, void *),
void *arg, int ms, int repeat);
int aos_timer_new_ext(aos_timer_t *timer, void (*fn)(void *, void *),
void *arg, int ms, int repeat, unsigned char auto_run);
void aos_timer_free(aos_timer_t *timer);
int aos_timer_start(aos_timer_t *timer);
int aos_timer_stop(aos_timer_t *timer);
int aos_timer_change(aos_timer_t *timer, int ms);
int aos_workqueue_create(aos_workqueue_t *workqueue, int pri, int stack_size);
int aos_work_init(aos_work_t *work, void (*fn)(void *), void *arg, int dly);
void aos_work_destroy(aos_work_t *work);
int aos_work_run(aos_workqueue_t *workqueue, aos_work_t *work);
int aos_work_sched(aos_work_t *work);
int aos_work_cancel(aos_work_t *work);
void *aos_realloc(void *mem, unsigned int size);
void *aos_malloc(unsigned int size);
void *aos_zalloc(unsigned int size);
void aos_alloc_trace(void *addr, size_t allocator);
void aos_free(void *mem);
long long aos_now(void);
long long aos_now_ms(void);
void aos_msleep(int ms);
void aos_init(void);
void aos_start(void);
extern int csp_printf(const char *fmt, ...);
int csp_printf(const char *fmt, ...);
typedef enum {
AOS_LL_NONE,
AOS_LL_FATAL,
AOS_LL_ERROR,
AOS_LL_WARN,
AOS_LL_INFO,
AOS_LL_DEBUG,
} aos_log_level_t;
extern unsigned int aos_log_level;
static inline int aos_get_log_level(void)
{
return aos_log_level;
}
void aos_set_log_level(aos_log_level_t log_level);
void __assert (const char *, int, const char *) __attribute__ ((__noreturn__))
;
void __assert_func (const char *, int, const char *, const char *) __attribute__ ((__noreturn__))
;
typedef char name_t;
typedef uint32_t sem_count_t;
typedef uint32_t cpu_stack_t;
typedef uint32_t hr_timer_t;
typedef uint32_t lr_timer_t;
typedef uint32_t mutex_nested_t;
typedef uint8_t suspend_nested_t;
typedef uint64_t ctx_switch_t;
typedef uint32_t cpu_cpsr_t;
typedef aos_queue_t _queue_t;
typedef aos_sem_t _sem_t;
typedef aos_task_t _task_t;
typedef cpu_stack_t _stack_element_t;
typedef aos_mutex_t _mutex_t;
enum {
LOG_LEVEL_NONE = 0,
LOG_LEVEL_FATAL,
LOG_LEVEL_ERROR,
LOG_LEVEL_WARN,
LOG_LEVEL_INFO,
LOG_LEVEL_DEBUG,
LOG_LEVEL_MAX_BIT
};
typedef sys_dlist_t _wait_q_t;
struct k_queue {
_queue_t *_queue;
sys_dlist_t poll_events;
};
extern void k_queue_init(struct k_queue *queue);
extern void k_queue_cancel_wait(struct k_queue *queue);
extern void k_queue_append(struct k_queue *queue, void *data);
extern void k_queue_prepend(struct k_queue *queue, void *data);
extern void k_queue_insert(struct k_queue *queue, void *prev, void *data);
extern void k_queue_append_list(struct k_queue *queue, void *head, void *tail);
extern void *k_queue_get(struct k_queue *queue, s32_t timeout);
extern int k_queue_is_empty(struct k_queue *queue);
struct k_lifo {
struct k_queue _queue;
};
struct k_fifo {
struct k_queue _queue;
};
struct k_sem {
_sem_t sem;
sys_dlist_t poll_events;
};
int k_sem_init(struct k_sem *sem, unsigned int initial_count, unsigned int limit);
int k_sem_take(struct k_sem *sem, uint32_t timeout);
int k_sem_give(struct k_sem *sem);
int k_sem_delete(struct k_sem *sem);
unsigned int k_sem_count_get(struct k_sem *sem);
struct k_mutex {
_mutex_t mutex;
sys_dlist_t poll_events;
};
typedef void (*k_timer_handler_t)(void *timer, void *args);
typedef struct k_timer {
aos_timer_t timer;
k_timer_handler_t handler;
void *args;
uint32_t timeout;
uint32_t start_ms;
} k_timer_t;
void k_timer_init(k_timer_t *timer, k_timer_handler_t handle, void *args);
void k_timer_start(k_timer_t *timer, uint32_t timeout);
void k_timer_stop(k_timer_t *timer);
int64_t k_uptime_get();
inline u32_t k_uptime_get_32(void)
{
return (u32_t)aos_now_ms();
}
struct k_thread {
_task_t task;
};
typedef _stack_element_t k_thread_stack_t;
inline void k_call_stacks_analyze(void) { }
static inline char *K_THREAD_STACK_BUFFER(k_thread_stack_t *sym)
{
return (char *)sym;
}
typedef void (*k_thread_entry_t)(void *p1, void *p2, void *p3);
int k_thread_create(struct k_thread *new_thread, k_thread_stack_t *stack,
size_t stack_size, k_thread_entry_t entry,
void *p1, void *p2, void *p3,
int prio, u32_t options, s32_t delay);
int k_yield();
unsigned int irq_lock();
void irq_unlock(unsigned int key);
typedef int atomic_t;
typedef atomic_t atomic_val_t;
extern int atomic_cas(atomic_t *target, atomic_val_t old_value,
atomic_val_t new_value);
extern atomic_val_t atomic_add(atomic_t *target, atomic_val_t value);
extern atomic_val_t atomic_sub(atomic_t *target, atomic_val_t value);
extern atomic_val_t atomic_inc(atomic_t *target);
extern atomic_val_t atomic_dec(atomic_t *target);
extern atomic_val_t atomic_get(const atomic_t *target);
extern atomic_val_t atomic_set(atomic_t *target, atomic_val_t value);
extern atomic_val_t atomic_clear(atomic_t *target);
extern atomic_val_t atomic_or(atomic_t *target, atomic_val_t value);
extern atomic_val_t atomic_xor(atomic_t *target, atomic_val_t value);
extern atomic_val_t atomic_and(atomic_t *target, atomic_val_t value);
extern atomic_val_t atomic_nand(atomic_t *target, atomic_val_t value);
static inline int atomic_test_bit(const atomic_t *target, int bit)
{
atomic_val_t val = atomic_get(((target) + ((bit) / (sizeof(atomic_val_t) * 8))));
return (1 & (val >> (bit & ((sizeof(atomic_val_t) * 8) - 1))));
}
static inline int atomic_test_and_clear_bit(atomic_t *target, int bit)
{
atomic_val_t mask = (1 << ((bit) & ((sizeof(atomic_val_t) * 8) - 1)));
atomic_val_t old;
old = atomic_and(((target) + ((bit) / (sizeof(atomic_val_t) * 8))), ~mask);
return (old & mask) != 0;
}
static inline int atomic_test_and_set_bit(atomic_t *target, int bit)
{
atomic_val_t mask = (1 << ((bit) & ((sizeof(atomic_val_t) * 8) - 1)));
atomic_val_t old;
old = atomic_or(((target) + ((bit) / (sizeof(atomic_val_t) * 8))), mask);
return (old & mask) != 0;
}
static inline void atomic_clear_bit(atomic_t *target, int bit)
{
atomic_val_t mask = (1 << ((bit) & ((sizeof(atomic_val_t) * 8) - 1)));
atomic_and(((target) + ((bit) / (sizeof(atomic_val_t) * 8))), ~mask);
}
static inline void atomic_set_bit(atomic_t *target, int bit)
{
atomic_val_t mask = (1 << ((bit) & ((sizeof(atomic_val_t) * 8) - 1)));
atomic_or(((target) + ((bit) / (sizeof(atomic_val_t) * 8))), mask);
}
struct k_work_q {
struct k_fifo fifo;
};
int k_work_q_start();
enum {
K_WORK_STATE_PENDING,
};
struct k_work;
typedef void (*k_work_handler_t)(struct k_work *work);
struct k_work {
void *_reserved;
k_work_handler_t handler;
atomic_t flags[1];
};
int k_work_init(struct k_work *work, k_work_handler_t handler);
void k_work_submit(struct k_work *work);
struct k_delayed_work {
struct k_work work;
struct k_work_q *work_q;
k_timer_t timer;
};
void k_delayed_work_init(struct k_delayed_work *work, k_work_handler_t handler);
int k_delayed_work_submit(struct k_delayed_work *work, uint32_t delay);
int k_delayed_work_cancel(struct k_delayed_work *work);
s32_t k_delayed_work_remaining_get(struct k_delayed_work *work);
enum _poll_types_bits {
_POLL_TYPE_IGNORE,
_POLL_TYPE_SIGNAL,
_POLL_TYPE_SEM_AVAILABLE,
_POLL_TYPE_DATA_AVAILABLE,
_POLL_NUM_TYPES
};
enum _poll_states_bits {
_POLL_STATE_NOT_READY,
_POLL_STATE_SIGNALED,
_POLL_STATE_SEM_AVAILABLE,
_POLL_STATE_DATA_AVAILABLE,
_POLL_NUM_STATES
};
struct k_poll_event {
sys_dnode_t _node;
struct _poller *poller;
u32_t tag:8;
u32_t type:_POLL_NUM_TYPES;
u32_t state:_POLL_NUM_STATES;
u32_t mode:1;
u32_t unused:(32 - (0 + 8 + _POLL_NUM_TYPES + _POLL_NUM_STATES + 1 ));
union {
void *obj;
struct k_poll_signal *signal;
struct k_sem *sem;
struct k_fifo *fifo;
struct k_queue *queue;
};
};
struct k_poll_signal {
sys_dlist_t poll_events;
unsigned int signaled;
int result;
};
extern int k_poll_signal(struct k_poll_signal *signal, int result);
extern int k_poll(struct k_poll_event *events, int num_events, s32_t timeout);
extern void k_poll_event_init(struct k_poll_event *event, u32_t type, int mode, void *obj);
enum k_poll_modes {
K_POLL_MODE_NOTIFY_ONLY = 0,
K_POLL_NUM_MODES
};
void k_sleep(s32_t duration);
unsigned int find_msb_set(u32_t op);
unsigned int find_lsb_set(u32_t op);
static inline int is_power_of_two(unsigned int x)
{
return (x != 0) && !(x & (x - 1));
}
static inline s64_t arithmetic_shift_right(s64_t value, u8_t shift)
{
s64_t sign_ext;
if (shift == 0) {
return value;
}
sign_ext = (value >> 63) & 1;
sign_ext = -sign_ext;
return (value >> shift) | (sign_ext << (64 - shift));
}
typedef struct {
u8_t val[6];
} bt_addr_t;
typedef struct {
u8_t type;
bt_addr_t a;
} bt_addr_le_t;
static inline int bt_addr_cmp(const bt_addr_t *a, const bt_addr_t *b)
{
return memcmp(a, b, sizeof(*a));
}
static inline int bt_addr_le_cmp(const bt_addr_le_t *a, const bt_addr_le_t *b)
{
return memcmp(a, b, sizeof(*a));
}
static inline void bt_addr_copy(bt_addr_t *dst, const bt_addr_t *src)
{
memcpy(dst, src, sizeof(*dst));
}
static inline void bt_addr_le_copy(bt_addr_le_t *dst, const bt_addr_le_t *src)
{
memcpy(dst, src, sizeof(*dst));
}
int bt_addr_le_create_nrpa(bt_addr_le_t *addr);
int bt_addr_le_create_static(bt_addr_le_t *addr);
static inline
_Bool
bt_addr_le_is_rpa(const bt_addr_le_t *addr)
{
if (addr->type != 0x01) {
return
0
;
}
return (((&addr->a)->val[5] & 0xc0) == 0x40);
}
static inline
_Bool
bt_addr_le_is_identity(const bt_addr_le_t *addr)
{
if (addr->type == 0x00) {
return
1
;
}
return (((&addr->a)->val[5] & 0xc0) == 0xc0);
}
struct bt_hci_evt_hdr {
u8_t evt;
u8_t len;
}
__attribute__((__packed__))
;
struct bt_hci_acl_hdr {
u16_t handle;
u16_t len;
}
__attribute__((__packed__))
;
struct bt_hci_cmd_hdr {
u16_t opcode;
u8_t param_len;
}
__attribute__((__packed__))
;
struct bt_hci_op_inquiry {
u8_t lap[3];
u8_t length;
u8_t num_rsp;
}
__attribute__((__packed__))
;
struct bt_hci_cp_connect {
bt_addr_t bdaddr;
u16_t packet_type;
u8_t pscan_rep_mode;
u8_t reserved;
u16_t clock_offset;
u8_t allow_role_switch;
}
__attribute__((__packed__))
;
struct bt_hci_cp_disconnect {
u16_t handle;
u8_t reason;
}
__attribute__((__packed__))
;
struct bt_hci_cp_connect_cancel {
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_rp_connect_cancel {
u8_t status;
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_cp_accept_conn_req {
bt_addr_t bdaddr;
u8_t role;
}
__attribute__((__packed__))
;
struct bt_hci_cp_setup_sync_conn {
u16_t handle;
u32_t tx_bandwidth;
u32_t rx_bandwidth;
u16_t max_latency;
u16_t content_format;
u8_t retrans_effort;
u16_t pkt_type;
}
__attribute__((__packed__))
;
struct bt_hci_cp_accept_sync_conn_req {
bt_addr_t bdaddr;
u32_t tx_bandwidth;
u32_t rx_bandwidth;
u16_t max_latency;
u16_t content_format;
u8_t retrans_effort;
u16_t pkt_type;
}
__attribute__((__packed__))
;
struct bt_hci_cp_reject_conn_req {
bt_addr_t bdaddr;
u8_t reason;
}
__attribute__((__packed__))
;
struct bt_hci_cp_link_key_reply {
bt_addr_t bdaddr;
u8_t link_key[16];
}
__attribute__((__packed__))
;
struct bt_hci_cp_link_key_neg_reply {
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_cp_pin_code_reply {
bt_addr_t bdaddr;
u8_t pin_len;
u8_t pin_code[16];
}
__attribute__((__packed__))
;
struct bt_hci_rp_pin_code_reply {
u8_t status;
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_cp_pin_code_neg_reply {
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_rp_pin_code_neg_reply {
u8_t status;
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_cp_auth_requested {
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_cp_set_conn_encrypt {
u16_t handle;
u8_t encrypt;
}
__attribute__((__packed__))
;
struct bt_hci_cp_remote_name_request {
bt_addr_t bdaddr;
u8_t pscan_rep_mode;
u8_t reserved;
u16_t clock_offset;
}
__attribute__((__packed__))
;
struct bt_hci_cp_remote_name_cancel {
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_rp_remote_name_cancel {
u8_t status;
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_cp_read_remote_features {
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_cp_read_remote_ext_features {
u16_t handle;
u8_t page;
}
__attribute__((__packed__))
;
struct bt_hci_cp_read_remote_version_info {
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_cp_io_capability_reply {
bt_addr_t bdaddr;
u8_t capability;
u8_t oob_data;
u8_t authentication;
}
__attribute__((__packed__))
;
struct bt_hci_cp_user_confirm_reply {
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_rp_user_confirm_reply {
u8_t status;
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_cp_user_passkey_reply {
bt_addr_t bdaddr;
u32_t passkey;
}
__attribute__((__packed__))
;
struct bt_hci_cp_user_passkey_neg_reply {
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_cp_io_capability_neg_reply {
bt_addr_t bdaddr;
u8_t reason;
}
__attribute__((__packed__))
;
struct bt_hci_cp_set_event_mask {
u8_t events[8];
}
__attribute__((__packed__))
;
struct bt_hci_write_local_name {
u8_t local_name[248];
}
__attribute__((__packed__))
;
struct bt_hci_cp_read_tx_power_level {
u16_t handle;
u8_t type;
}
__attribute__((__packed__))
;
struct bt_hci_rp_read_tx_power_level {
u8_t status;
u16_t handle;
s8_t tx_power_level;
}
__attribute__((__packed__))
;
struct bt_hci_cp_set_ctl_to_host_flow {
u8_t flow_enable;
}
__attribute__((__packed__))
;
struct bt_hci_cp_host_buffer_size {
u16_t acl_mtu;
u8_t sco_mtu;
u16_t acl_pkts;
u16_t sco_pkts;
}
__attribute__((__packed__))
;
struct bt_hci_handle_count {
u16_t handle;
u16_t count;
}
__attribute__((__packed__))
;
struct bt_hci_cp_host_num_completed_packets {
u8_t num_handles;
struct bt_hci_handle_count h[0];
}
__attribute__((__packed__))
;
struct bt_hci_cp_write_inquiry_mode {
u8_t mode;
}
__attribute__((__packed__))
;
struct bt_hci_cp_write_ssp_mode {
u8_t mode;
}
__attribute__((__packed__))
;
struct bt_hci_cp_set_event_mask_page_2 {
u8_t events_page_2[8];
}
__attribute__((__packed__))
;
struct bt_hci_cp_write_le_host_supp {
u8_t le;
u8_t simul;
}
__attribute__((__packed__))
;
struct bt_hci_cp_write_sc_host_supp {
u8_t sc_support;
}
__attribute__((__packed__))
;
struct bt_hci_cp_read_auth_payload_timeout {
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_rp_read_auth_payload_timeout {
u8_t status;
u16_t handle;
u16_t auth_payload_timeout;
}
__attribute__((__packed__))
;
struct bt_hci_cp_write_auth_payload_timeout {
u16_t handle;
u16_t auth_payload_timeout;
}
__attribute__((__packed__))
;
struct bt_hci_rp_write_auth_payload_timeout {
u8_t status;
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_rp_read_local_version_info {
u8_t status;
u8_t hci_version;
u16_t hci_revision;
u8_t lmp_version;
u16_t manufacturer;
u16_t lmp_subversion;
}
__attribute__((__packed__))
;
struct bt_hci_rp_read_supported_commands {
u8_t status;
u8_t commands[64];
}
__attribute__((__packed__))
;
struct bt_hci_cp_read_local_ext_features {
u8_t page;
};
struct bt_hci_rp_read_local_ext_features {
u8_t status;
u8_t page;
u8_t max_page;
u8_t ext_features[8];
}
__attribute__((__packed__))
;
struct bt_hci_rp_read_local_features {
u8_t status;
u8_t features[8];
}
__attribute__((__packed__))
;
struct bt_hci_rp_read_buffer_size {
u8_t status;
u16_t acl_max_len;
u8_t sco_max_len;
u16_t acl_max_num;
u16_t sco_max_num;
}
__attribute__((__packed__))
;
struct bt_hci_rp_read_bd_addr {
u8_t status;
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_cp_read_rssi {
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_rp_read_rssi {
u8_t status;
u16_t handle;
s8_t rssi;
}
__attribute__((__packed__))
;
struct bt_hci_cp_read_encryption_key_size {
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_rp_read_encryption_key_size {
u8_t status;
u16_t handle;
u8_t key_size;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_event_mask {
u8_t events[8];
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_buffer_size {
u8_t status;
u16_t le_max_len;
u8_t le_max_num;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_local_features {
u8_t status;
u8_t features[8];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_random_address {
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_adv_param {
u16_t min_interval;
u16_t max_interval;
u8_t type;
u8_t own_addr_type;
bt_addr_le_t direct_addr;
u8_t channel_map;
u8_t filter_policy;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_chan_tx_power {
u8_t status;
s8_t tx_power_level;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_adv_data {
u8_t len;
u8_t data[31];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_scan_rsp_data {
u8_t len;
u8_t data[31];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_adv_enable {
u8_t enable;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_scan_param {
u8_t scan_type;
u16_t interval;
u16_t window;
u8_t addr_type;
u8_t filter_policy;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_scan_enable {
u8_t enable;
u8_t filter_dup;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_create_conn {
u16_t scan_interval;
u16_t scan_window;
u8_t filter_policy;
bt_addr_le_t peer_addr;
u8_t own_addr_type;
u16_t conn_interval_min;
u16_t conn_interval_max;
u16_t conn_latency;
u16_t supervision_timeout;
u16_t min_ce_len;
u16_t max_ce_len;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_wl_size {
u8_t status;
u8_t wl_size;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_add_dev_to_wl {
bt_addr_le_t addr;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_rem_dev_from_wl {
bt_addr_le_t addr;
}
__attribute__((__packed__))
;
struct hci_cp_le_conn_update {
u16_t handle;
u16_t conn_interval_min;
u16_t conn_interval_max;
u16_t conn_latency;
u16_t supervision_timeout;
u16_t min_ce_len;
u16_t max_ce_len;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_host_chan_classif {
u8_t ch_map[5];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_read_chan_map {
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_chan_map {
u8_t status;
u16_t handle;
u8_t ch_map[5];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_read_remote_features {
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_encrypt {
u8_t key[16];
u8_t plaintext[16];
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_encrypt {
u8_t status;
u8_t enc_data[16];
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_rand {
u8_t status;
u8_t rand[8];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_start_encryption {
u16_t handle;
u64_t rand;
u16_t ediv;
u8_t ltk[16];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_ltk_req_reply {
u16_t handle;
u8_t ltk[16];
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_ltk_req_reply {
u8_t status;
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_ltk_req_neg_reply {
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_ltk_req_neg_reply {
u8_t status;
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_supp_states {
u8_t status;
u8_t le_states[8];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_rx_test {
u8_t rx_ch;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_tx_test {
u8_t tx_ch;
u8_t test_data_len;
u8_t pkt_payload;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_test_end {
u8_t status;
u16_t rx_pkt_count;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_conn_param_req_reply {
u16_t handle;
u16_t interval_min;
u16_t interval_max;
u16_t latency;
u16_t timeout;
u16_t min_ce_len;
u16_t max_ce_len;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_conn_param_req_reply {
u8_t status;
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_conn_param_req_neg_reply {
u16_t handle;
u8_t reason;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_conn_param_req_neg_reply {
u8_t status;
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_data_len {
u16_t handle;
u16_t tx_octets;
u16_t tx_time;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_set_data_len {
u8_t status;
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_default_data_len {
u8_t status;
u16_t max_tx_octets;
u16_t max_tx_time;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_write_default_data_len {
u16_t max_tx_octets;
u16_t max_tx_time;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_generate_dhkey {
u8_t key[64];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_add_dev_to_rl {
bt_addr_le_t peer_id_addr;
u8_t peer_irk[16];
u8_t local_irk[16];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_rem_dev_from_rl {
bt_addr_le_t peer_id_addr;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_rl_size {
u8_t status;
u8_t rl_size;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_read_peer_rpa {
bt_addr_le_t peer_id_addr;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_peer_rpa {
u8_t status;
bt_addr_t peer_rpa;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_read_local_rpa {
bt_addr_le_t peer_id_addr;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_local_rpa {
u8_t status;
bt_addr_t local_rpa;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_addr_res_enable {
u8_t enable;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_rpa_timeout {
u16_t rpa_timeout;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_max_data_len {
u8_t status;
u16_t max_tx_octets;
u16_t max_tx_time;
u16_t max_rx_octets;
u16_t max_rx_time;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_read_phy {
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_phy {
u8_t status;
u16_t handle;
u8_t tx_phy;
u8_t rx_phy;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_default_phy {
u8_t all_phys;
u8_t tx_phys;
u8_t rx_phys;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_phy {
u16_t handle;
u8_t all_phys;
u8_t tx_phys;
u8_t rx_phys;
u16_t phy_opts;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_enh_rx_test {
u8_t rx_ch;
u8_t phy;
u8_t mod_index;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_enh_tx_test {
u8_t tx_ch;
u8_t test_data_len;
u8_t pkt_payload;
u8_t phy;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_adv_set_random_addr {
u8_t handle;
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_ext_adv_param {
u8_t handle;
u16_t props;
u8_t prim_min_interval[3];
u8_t prim_max_interval[3];
u8_t prim_channel_map;
u8_t own_addr_type;
bt_addr_le_t peer_addr;
u8_t filter_policy;
s8_t tx_power;
u8_t prim_adv_phy;
u8_t sec_adv_max_skip;
u8_t sec_adv_phy;
u8_t sid;
u8_t scan_req_notify_enable;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_set_ext_adv_param {
u8_t status;
s8_t tx_power;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_ext_adv_data {
u8_t handle;
u8_t op;
u8_t frag_pref;
u8_t len;
u8_t data[251];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_ext_scan_rsp_data {
u8_t handle;
u8_t op;
u8_t frag_pref;
u8_t len;
u8_t data[251];
}
__attribute__((__packed__))
;
struct bt_hci_ext_adv_set {
u8_t handle;
u16_t duration;
u8_t max_ext_adv_evts;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_ext_adv_enable {
u8_t enable;
u8_t set_num;
struct bt_hci_ext_adv_set s[0];
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_max_adv_data_len {
u8_t status;
u16_t max_adv_data_len;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_num_adv_sets {
u8_t status;
u8_t num_sets;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_remove_adv_set {
u8_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_per_adv_param {
u8_t handle;
u16_t min_interval;
u16_t max_interval;
u16_t props;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_per_adv_data {
u8_t handle;
u8_t op;
u8_t len;
u8_t data[251];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_per_adv_enable {
u8_t enable;
u8_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_ext_scan_phy {
u8_t type;
u16_t interval;
u16_t window;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_ext_scan_param {
u8_t own_addr_type;
u8_t filter_policy;
u8_t phys;
struct bt_hci_ext_scan_phy p[0];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_ext_scan_enable {
u8_t enable;
u8_t filter_dup;
u16_t duration;
u16_t period;
}
__attribute__((__packed__))
;
struct bt_hci_ext_conn_phy {
u16_t interval;
u16_t window;
u16_t conn_interval_min;
u16_t conn_interval_max;
u16_t conn_latency;
u16_t supervision_timeout;
u16_t min_ce_len;
u16_t max_ce_len;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_ext_create_conn {
u8_t filter_policy;
u8_t own_addr_type;
bt_addr_le_t peer_addr;
u8_t phys;
struct bt_hci_ext_conn_phy p[0];
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_per_adv_create_sync {
u8_t filter_policy;
u8_t sid;
bt_addr_le_t addr;
u16_t skip;
u16_t sync_timeout;
u8_t unused;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_per_adv_terminate_sync {
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_add_dev_to_per_adv_list {
bt_addr_le_t addr;
u8_t sid;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_rem_dev_from_per_adv_list {
bt_addr_le_t addr;
u8_t sid;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_per_adv_list_size {
u8_t status;
u8_t list_size;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_tx_power {
u8_t status;
s8_t min_tx_power;
s8_t max_tx_power;
}
__attribute__((__packed__))
;
struct bt_hci_rp_le_read_rf_path_comp {
u8_t status;
s16_t tx_path_comp;
s16_t rx_path_comp;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_write_rf_path_comp {
s16_t tx_path_comp;
s16_t rx_path_comp;
}
__attribute__((__packed__))
;
struct bt_hci_cp_le_set_privacy_mode {
bt_addr_le_t id_addr;
u8_t mode;
}
__attribute__((__packed__))
;
struct bt_hci_evt_inquiry_complete {
u8_t status;
}
__attribute__((__packed__))
;
struct bt_hci_evt_conn_complete {
u8_t status;
u16_t handle;
bt_addr_t bdaddr;
u8_t link_type;
u8_t encr_enabled;
}
__attribute__((__packed__))
;
struct bt_hci_evt_conn_request {
bt_addr_t bdaddr;
u8_t dev_class[3];
u8_t link_type;
}
__attribute__((__packed__))
;
struct bt_hci_evt_disconn_complete {
u8_t status;
u16_t handle;
u8_t reason;
}
__attribute__((__packed__))
;
struct bt_hci_evt_auth_complete {
u8_t status;
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_evt_remote_name_req_complete {
u8_t status;
bt_addr_t bdaddr;
u8_t name[248];
}
__attribute__((__packed__))
;
struct bt_hci_evt_encrypt_change {
u8_t status;
u16_t handle;
u8_t encrypt;
}
__attribute__((__packed__))
;
struct bt_hci_evt_remote_features {
u8_t status;
u16_t handle;
u8_t features[8];
}
__attribute__((__packed__))
;
struct bt_hci_evt_remote_version_info {
u8_t status;
u16_t handle;
u8_t version;
u16_t manufacturer;
u16_t subversion;
}
__attribute__((__packed__))
;
struct bt_hci_evt_cmd_complete {
u8_t ncmd;
u16_t opcode;
}
__attribute__((__packed__))
;
struct bt_hci_evt_cc_status {
u8_t status;
}
__attribute__((__packed__))
;
struct bt_hci_evt_cmd_status {
u8_t status;
u8_t ncmd;
u16_t opcode;
}
__attribute__((__packed__))
;
struct bt_hci_evt_role_change {
u8_t status;
bt_addr_t bdaddr;
u8_t role;
}
__attribute__((__packed__))
;
struct bt_hci_evt_num_completed_packets {
u8_t num_handles;
struct bt_hci_handle_count h[0];
}
__attribute__((__packed__))
;
struct bt_hci_evt_pin_code_req {
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_evt_link_key_req {
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_evt_link_key_notify {
bt_addr_t bdaddr;
u8_t link_key[16];
u8_t key_type;
}
__attribute__((__packed__))
;
struct bt_hci_evt_data_buf_overflow {
u8_t link_type;
}
__attribute__((__packed__))
;
struct bt_hci_evt_inquiry_result_with_rssi {
bt_addr_t addr;
u8_t pscan_rep_mode;
u8_t reserved;
u8_t cod[3];
u16_t clock_offset;
s8_t rssi;
}
__attribute__((__packed__))
;
struct bt_hci_evt_remote_ext_features {
u8_t status;
u16_t handle;
u8_t page;
u8_t max_page;
u8_t features[8];
}
__attribute__((__packed__))
;
struct bt_hci_evt_sync_conn_complete {
u8_t status;
u16_t handle;
bt_addr_t bdaddr;
u8_t link_type;
u8_t tx_interval;
u8_t retansmission_window;
u16_t rx_pkt_length;
u16_t tx_pkt_length;
u8_t air_mode;
}
__attribute__((__packed__))
;
struct bt_hci_evt_extended_inquiry_result {
u8_t num_reports;
bt_addr_t addr;
u8_t pscan_rep_mode;
u8_t reserved;
u8_t cod[3];
u16_t clock_offset;
s8_t rssi;
u8_t eir[240];
}
__attribute__((__packed__))
;
struct bt_hci_evt_encrypt_key_refresh_complete {
u8_t status;
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_evt_io_capa_req {
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_evt_io_capa_resp {
bt_addr_t bdaddr;
u8_t capability;
u8_t oob_data;
u8_t authentication;
}
__attribute__((__packed__))
;
struct bt_hci_evt_user_confirm_req {
bt_addr_t bdaddr;
u32_t passkey;
}
__attribute__((__packed__))
;
struct bt_hci_evt_user_passkey_req {
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_evt_ssp_complete {
u8_t status;
bt_addr_t bdaddr;
}
__attribute__((__packed__))
;
struct bt_hci_evt_user_passkey_notify {
bt_addr_t bdaddr;
u32_t passkey;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_meta_event {
u8_t subevent;
}
__attribute__((__packed__))
;
struct bt_hci_evt_auth_payload_timeout_exp {
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_conn_complete {
u8_t status;
u16_t handle;
u8_t role;
bt_addr_le_t peer_addr;
u16_t interval;
u16_t latency;
u16_t supv_timeout;
u8_t clock_accuracy;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_advertising_info {
u8_t evt_type;
bt_addr_le_t addr;
u8_t length;
u8_t data[0];
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_advertising_report {
u8_t num_reports;
struct bt_hci_evt_le_advertising_info adv_info[0];
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_conn_update_complete {
u8_t status;
u16_t handle;
u16_t interval;
u16_t latency;
u16_t supv_timeout;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_remote_feat_complete {
u8_t status;
u16_t handle;
u8_t features[8];
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_ltk_request {
u16_t handle;
u64_t rand;
u16_t ediv;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_conn_param_req {
u16_t handle;
u16_t interval_min;
u16_t interval_max;
u16_t latency;
u16_t timeout;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_data_len_change {
u16_t handle;
u16_t max_tx_octets;
u16_t max_tx_time;
u16_t max_rx_octets;
u16_t max_rx_time;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_p256_public_key_complete {
u8_t status;
u8_t key[64];
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_generate_dhkey_complete {
u8_t status;
u8_t dhkey[32];
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_enh_conn_complete {
u8_t status;
u16_t handle;
u8_t role;
bt_addr_le_t peer_addr;
bt_addr_t local_rpa;
bt_addr_t peer_rpa;
u16_t interval;
u16_t latency;
u16_t supv_timeout;
u8_t clock_accuracy;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_direct_adv_info {
u8_t evt_type;
bt_addr_le_t addr;
bt_addr_le_t dir_addr;
s8_t rssi;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_direct_adv_report {
u8_t num_reports;
struct bt_hci_evt_le_direct_adv_info direct_adv_info[0];
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_phy_update_complete {
u8_t status;
u16_t handle;
u8_t tx_phy;
u8_t rx_phy;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_ext_advertising_info {
u8_t evt_type;
bt_addr_le_t addr;
u8_t prim_phy;
u8_t sec_phy;
u8_t sid;
s8_t tx_power;
s8_t rssi;
u16_t interval;
bt_addr_le_t direct_addr;
u8_t length;
u8_t data[0];
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_ext_advertising_report {
u8_t num_reports;
struct bt_hci_evt_le_ext_advertising_info adv_info[0];
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_per_adv_sync_established {
u8_t status;
u16_t handle;
u8_t sid;
bt_addr_le_t adv_addr;
u8_t phy;
u16_t interval;
u8_t clock_accuracy;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_per_advertising_report {
u16_t handle;
s8_t tx_power;
s8_t rssi;
u8_t unused;
u8_t data_status;
u8_t length;
u8_t data[0];
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_per_adv_sync_lost {
u16_t handle;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_per_adv_set_terminated {
u8_t status;
u8_t adv_handle;
u16_t conn_handle;
u8_t num_completed_ext_adv_evts;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_scan_req_received {
u8_t handle;
bt_addr_le_t addr;
}
__attribute__((__packed__))
;
struct bt_hci_evt_le_chan_sel_algo {
u16_t handle;
u8_t chan_sel_algo;
}
__attribute__((__packed__))
;
u8_t util_ones_count_get(u8_t *octets, u8_t octets_len);
struct pdu_adv_payload_adv_ind {
u8_t addr[6];
u8_t data[31];
}
__attribute__((__packed__))
;
struct pdu_adv_payload_direct_ind {
u8_t adv_addr[6];
u8_t tgt_addr[6];
}
__attribute__((__packed__))
;
struct pdu_adv_payload_scan_rsp {
u8_t addr[6];
u8_t data[31];
}
__attribute__((__packed__))
;
struct pdu_adv_payload_scan_req {
u8_t scan_addr[6];
u8_t adv_addr[6];
}
__attribute__((__packed__))
;
struct pdu_adv_payload_connect_ind {
u8_t init_addr[6];
u8_t adv_addr[6];
struct {
u8_t access_addr[4];
u8_t crc_init[3];
u8_t win_size;
u16_t win_offset;
u16_t interval;
u16_t latency;
u16_t timeout;
u8_t chan_map[5];
u8_t hop:5;
u8_t sca:3;
}
__attribute__((__packed__))
lldata;
}
__attribute__((__packed__))
;
enum pdu_adv_type {
PDU_ADV_TYPE_ADV_IND = 0x00,
PDU_ADV_TYPE_DIRECT_IND = 0x01,
PDU_ADV_TYPE_NONCONN_IND = 0x02,
PDU_ADV_TYPE_SCAN_REQ = 0x03,
PDU_ADV_TYPE_AUX_SCAN_REQ = PDU_ADV_TYPE_SCAN_REQ,
PDU_ADV_TYPE_SCAN_RSP = 0x04,
PDU_ADV_TYPE_CONNECT_IND = 0x05,
PDU_ADV_TYPE_AUX_CONNECT_REQ = PDU_ADV_TYPE_CONNECT_IND,
PDU_ADV_TYPE_SCAN_IND = 0x06,
PDU_ADV_TYPE_EXT_IND = 0x07,
PDU_ADV_TYPE_AUX_ADV_IND = PDU_ADV_TYPE_EXT_IND,
PDU_ADV_TYPE_AUX_SCAN_RSP = PDU_ADV_TYPE_EXT_IND,
PDU_ADV_TYPE_AUX_SYNC_IND = PDU_ADV_TYPE_EXT_IND,
PDU_ADV_TYPE_AUX_CHAIN_IND = PDU_ADV_TYPE_EXT_IND,
PDU_ADV_TYPE_AUX_CONNECT_RSP = 0x08,
}
__attribute__((__packed__))
;
struct pdu_adv {
u8_t type:4;
u8_t rfu:1;
u8_t chan_sel:1;
u8_t tx_addr:1;
u8_t rx_addr:1;
u8_t len:8;
union {
struct pdu_adv_payload_adv_ind adv_ind;
struct pdu_adv_payload_direct_ind direct_ind;
struct pdu_adv_payload_scan_req scan_req;
struct pdu_adv_payload_scan_rsp scan_rsp;
struct pdu_adv_payload_connect_ind connect_ind;
}
__attribute__((__packed__))
payload;
}
__attribute__((__packed__))
;
enum pdu_data_llid {
PDU_DATA_LLID_RESV = 0x00,
PDU_DATA_LLID_DATA_CONTINUE = 0x01,
PDU_DATA_LLID_DATA_START = 0x02,
PDU_DATA_LLID_CTRL = 0x03,
};
enum pdu_data_llctrl_type {
PDU_DATA_LLCTRL_TYPE_CONN_UPDATE_IND = 0x00,
PDU_DATA_LLCTRL_TYPE_CHAN_MAP_IND = 0x01,
PDU_DATA_LLCTRL_TYPE_TERMINATE_IND = 0x02,
PDU_DATA_LLCTRL_TYPE_ENC_REQ = 0x03,
PDU_DATA_LLCTRL_TYPE_ENC_RSP = 0x04,
PDU_DATA_LLCTRL_TYPE_START_ENC_REQ = 0x05,
PDU_DATA_LLCTRL_TYPE_START_ENC_RSP = 0x06,
PDU_DATA_LLCTRL_TYPE_UNKNOWN_RSP = 0x07,
PDU_DATA_LLCTRL_TYPE_FEATURE_REQ = 0x08,
PDU_DATA_LLCTRL_TYPE_FEATURE_RSP = 0x09,
PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_REQ = 0x0A,
PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP = 0x0B,
PDU_DATA_LLCTRL_TYPE_VERSION_IND = 0x0C,
PDU_DATA_LLCTRL_TYPE_REJECT_IND = 0x0D,
PDU_DATA_LLCTRL_TYPE_SLAVE_FEATURE_REQ = 0x0E,
PDU_DATA_LLCTRL_TYPE_CONN_PARAM_REQ = 0x0F,
PDU_DATA_LLCTRL_TYPE_CONN_PARAM_RSP = 0x10,
PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND = 0x11,
PDU_DATA_LLCTRL_TYPE_PING_REQ = 0x12,
PDU_DATA_LLCTRL_TYPE_PING_RSP = 0x13,
PDU_DATA_LLCTRL_TYPE_LENGTH_REQ = 0x14,
PDU_DATA_LLCTRL_TYPE_LENGTH_RSP = 0x15,
PDU_DATA_LLCTRL_TYPE_PHY_REQ = 0x16,
PDU_DATA_LLCTRL_TYPE_PHY_RSP = 0x17,
PDU_DATA_LLCTRL_TYPE_PHY_UPD_IND = 0x18,
PDU_DATA_LLCTRL_TYPE_MIN_USED_CHAN_IND = 0x19,
};
struct pdu_data_llctrl_conn_update_ind {
u8_t win_size;
u16_t win_offset;
u16_t interval;
u16_t latency;
u16_t timeout;
u16_t instant;
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_chan_map_ind {
u8_t chm[5];
u16_t instant;
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_terminate_ind {
u8_t error_code;
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_enc_req {
u8_t rand[8];
u8_t ediv[2];
u8_t skdm[8];
u8_t ivm[4];
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_enc_rsp {
u8_t skds[8];
u8_t ivs[4];
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_unknown_rsp {
u8_t type;
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_feature_req {
u8_t features[8];
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_feature_rsp {
u8_t features[8];
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_version_ind {
u8_t version_number;
u16_t company_id;
u16_t sub_version_number;
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_reject_ind {
u8_t error_code;
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_conn_param_req {
u16_t interval_min;
u16_t interval_max;
u16_t latency;
u16_t timeout;
u8_t preferred_periodicity;
u16_t reference_conn_event_count;
u16_t offset0;
u16_t offset1;
u16_t offset2;
u16_t offset3;
u16_t offset4;
u16_t offset5;
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_conn_param_rsp {
u16_t interval_min;
u16_t interval_max;
u16_t latency;
u16_t timeout;
u8_t preferred_periodicity;
u16_t reference_conn_event_count;
u16_t offset0;
u16_t offset1;
u16_t offset2;
u16_t offset3;
u16_t offset4;
u16_t offset5;
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_reject_ext_ind {
u8_t reject_opcode;
u8_t error_code;
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_length_req_rsp {
u16_t max_rx_octets;
u16_t max_rx_time;
u16_t max_tx_octets;
u16_t max_tx_time;
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_phy_req_rsp {
u8_t tx_phys;
u8_t rx_phys;
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_phy_upd_ind {
u8_t m_to_s_phy;
u8_t s_to_m_phy;
u16_t instant;
}
__attribute__((__packed__))
;
struct pdu_data_llctrl_min_used_chans_ind {
u8_t phys;
u8_t min_used_chans;
}
__attribute__((__packed__))
;
struct pdu_data_llctrl {
u8_t opcode;
union {
struct pdu_data_llctrl_conn_update_ind conn_update_ind;
struct pdu_data_llctrl_chan_map_ind chan_map_ind;
struct pdu_data_llctrl_terminate_ind terminate_ind;
struct pdu_data_llctrl_enc_req enc_req;
struct pdu_data_llctrl_enc_rsp enc_rsp;
struct pdu_data_llctrl_unknown_rsp unknown_rsp;
struct pdu_data_llctrl_feature_req feature_req;
struct pdu_data_llctrl_feature_rsp feature_rsp;
struct pdu_data_llctrl_version_ind version_ind;
struct pdu_data_llctrl_reject_ind reject_ind;
struct pdu_data_llctrl_feature_req slave_feature_req;
struct pdu_data_llctrl_conn_param_req conn_param_req;
struct pdu_data_llctrl_conn_param_rsp conn_param_rsp;
struct pdu_data_llctrl_reject_ext_ind reject_ext_ind;
struct pdu_data_llctrl_length_req_rsp length_req;
struct pdu_data_llctrl_length_req_rsp length_rsp;
struct pdu_data_llctrl_phy_req_rsp phy_req;
struct pdu_data_llctrl_phy_req_rsp phy_rsp;
struct pdu_data_llctrl_phy_upd_ind phy_upd_ind;
struct pdu_data_llctrl_min_used_chans_ind min_used_chans_ind;
}
__attribute__((__packed__))
ctrldata;
}
__attribute__((__packed__))
;
struct pdu_data {
u8_t ll_id:2;
u8_t nesn:1;
u8_t sn:1;
u8_t md:1;
u8_t rfu:3;
u8_t len:8;
u8_t resv:8;
union {
u8_t lldata[1];
struct pdu_data_llctrl llctrl;
}
__attribute__((__packed__))
payload;
}
__attribute__((__packed__))
;
struct radio_adv_data {
u8_t data[2][(
__builtin_offsetof (
struct pdu_adv
,
payload
)
+ 37)];
u8_t first;
u8_t last;
};
struct radio_pdu_node_tx {
void *next;
u8_t pdu_data[1];
};
enum radio_pdu_node_rx_type {
NODE_RX_TYPE_NONE,
NODE_RX_TYPE_DC_PDU,
NODE_RX_TYPE_REPORT,
NODE_RX_TYPE_CONNECTION,
NODE_RX_TYPE_TERMINATE,
NODE_RX_TYPE_CONN_UPDATE,
NODE_RX_TYPE_ENC_REFRESH,
NODE_RX_TYPE_CHAN_SEL_ALGO,
NODE_RX_TYPE_PHY_UPDATE,
};
struct radio_le_conn_cmplt {
u8_t status;
u8_t role;
u8_t peer_addr_type;
u8_t peer_addr[6];
u16_t interval;
u16_t latency;
u16_t timeout;
u8_t mca;
}
__attribute__((__packed__))
;
struct radio_le_conn_update_cmplt {
u8_t status;
u16_t interval;
u16_t latency;
u16_t timeout;
}
__attribute__((__packed__))
;
struct radio_le_chan_sel_algo {
u8_t chan_sel_algo;
}
__attribute__((__packed__))
;
struct radio_le_phy_upd_cmplt {
u8_t status;
u8_t tx;
u8_t rx;
}
__attribute__((__packed__))
;
struct radio_pdu_node_rx_hdr {
union {
sys_snode_t node;
void *next;
void *link;
u8_t packet_release_last;
} onion;
enum radio_pdu_node_rx_type type;
u16_t handle;
};
struct radio_pdu_node_rx {
struct radio_pdu_node_rx_hdr hdr;
u8_t pdu_data[1];
};
u32_t radio_init(void *hf_clock, u8_t sca, u8_t connection_count_max,
u8_t rx_count_max, u8_t tx_count_max,
u16_t packet_data_octets_max,
u16_t packet_tx_data_size, u8_t *mem_radio,
u16_t mem_size);
struct device *radio_hf_clock_get(void);
void radio_ticks_active_to_start_set(u32_t ticks_active_to_start);
struct radio_adv_data *radio_adv_data_get(void);
struct radio_adv_data *radio_scan_data_get(void);
u32_t radio_adv_enable(u16_t interval, u8_t chan_map, u8_t filter_policy,
u8_t rl_idx);
u32_t radio_adv_disable(void);
u32_t radio_adv_is_enabled(void);
u32_t radio_adv_filter_pol_get(void);
u32_t radio_scan_enable(u8_t type, u8_t init_addr_type, u8_t *init_addr,
u16_t interval, u16_t window, u8_t filter_policy,
u8_t rpa_gen, u8_t rl_idx);
u32_t radio_scan_disable(void);
u32_t radio_scan_is_enabled(void);
u32_t radio_scan_filter_pol_get(void);
u32_t radio_connect_enable(u8_t adv_addr_type, u8_t *adv_addr,
u16_t interval, u16_t latency,
u16_t timeout);
u8_t radio_rx_get(struct radio_pdu_node_rx **radio_pdu_node_rx,
u16_t *handle);
void radio_rx_dequeue(void);
void radio_rx_mem_release(struct radio_pdu_node_rx **radio_pdu_node_rx);
u8_t radio_rx_fc_set(u16_t handle, u8_t fc);
u8_t radio_rx_fc_get(u16_t *handle);
struct radio_pdu_node_tx *radio_tx_mem_acquire(void);
void radio_tx_mem_release(struct radio_pdu_node_tx *pdu_data_node_tx);
u32_t radio_tx_mem_enqueue(u16_t handle,
struct radio_pdu_node_tx *pdu_data_node_tx);
extern void radio_active_callback(u8_t active);
extern void radio_event_callback(void);
extern void ll_adv_scan_state_cb(u8_t bm);
int ll_init(struct k_sem *sem_rx);
void ll_reset(void);
void ll_radio_state_abort(void);
u32_t ll_radio_state_is_idle(void);
u8_t *ll_addr_get(u8_t addr_type, u8_t *p_bdaddr);
void ll_addr_set(u8_t addr_type, u8_t const *const p_bdaddr);
u32_t ll_adv_params_set(u16_t interval, u8_t adv_type,
u8_t own_addr_type, u8_t direct_addr_type,
u8_t const *const direct_addr, u8_t chan_map,
u8_t filter_policy);
void ll_adv_data_set(u8_t len, u8_t const *const p_data);
void ll_scan_data_set(u8_t len, u8_t const *const p_data);
u32_t ll_adv_enable(u8_t enable);
u32_t ll_scan_params_set(u8_t type, u16_t interval, u16_t window,
u8_t own_addr_type, u8_t filter_policy);
u32_t ll_scan_enable(u8_t enable);
u32_t ll_wl_size_get(void);
u32_t ll_wl_clear(void);
u32_t ll_wl_add(bt_addr_le_t *addr);
u32_t ll_wl_remove(bt_addr_le_t *addr);
void ll_rl_id_addr_get(u8_t rl_idx, u8_t *id_addr_type, u8_t *id_addr);
u32_t ll_rl_size_get(void);
u32_t ll_rl_clear(void);
u32_t ll_rl_add(bt_addr_le_t *id_addr, const u8_t pirk[16],
const u8_t lirk[16]);
u32_t ll_rl_remove(bt_addr_le_t *id_addr);
void ll_rl_crpa_set(u8_t id_addr_type, u8_t *id_addr, u8_t rl_idx, u8_t *crpa);
u32_t ll_rl_crpa_get(bt_addr_le_t *id_addr, bt_addr_t *crpa);
u32_t ll_rl_lrpa_get(bt_addr_le_t *id_addr, bt_addr_t *lrpa);
u32_t ll_rl_enable(u8_t enable);
void ll_rl_timeout_set(u16_t timeout);
u32_t ll_priv_mode_set(bt_addr_le_t *id_addr, u8_t mode);
u32_t ll_create_connection(u16_t scan_interval, u16_t scan_window,
u8_t filter_policy, u8_t peer_addr_type,
u8_t *p_peer_addr, u8_t own_addr_type,
u16_t interval, u16_t latency,
u16_t timeout);
u32_t ll_connect_disable(void);
u32_t ll_conn_update(u16_t handle, u8_t cmd, u8_t status,
u16_t interval, u16_t latency,
u16_t timeout);
u32_t ll_chm_update(u8_t *chm);
u32_t ll_chm_get(u16_t handle, u8_t *chm);
u32_t ll_enc_req_send(u16_t handle, u8_t *rand, u8_t *ediv,
u8_t *ltk);
u32_t ll_start_enc_req_send(u16_t handle, u8_t err_code,
u8_t const *const ltk);
u32_t ll_feature_req_send(u16_t handle);
u32_t ll_version_ind_send(u16_t handle);
u32_t ll_terminate_ind_send(u16_t handle, u8_t reason);
void ll_timeslice_ticker_id_get(u8_t * const instance_index, u8_t * const user_id);
u32_t ll_rssi_get(u16_t handle, u8_t *rssi);
u32_t ll_tx_power_level_get(u16_t handle, u8_t type, s8_t *tx_power_level);
void ll_tx_power_get(s8_t *min, s8_t *max);
u32_t ll_phy_get(u16_t handle, u8_t *tx, u8_t *rx);
u32_t ll_phy_default_set(u8_t tx, u8_t rx);
u32_t ll_phy_req_send(u16_t handle, u8_t tx, u8_t flags, u8_t rx);
typedef enum {
Reset_IRQn = -15,
NonMaskableInt_IRQn = -14,
HardFault_IRQn = -13,
MemoryManagement_IRQn = -12,
BusFault_IRQn = -11,
UsageFault_IRQn = -10,
SVCall_IRQn = -5,
DebugMonitor_IRQn = -4,
PendSV_IRQn = -2,
SysTick_IRQn = -1,
POWER_CLOCK_IRQn = 0,
RADIO_IRQn = 1,
UARTE0_UART0_IRQn = 2,
SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn= 3,
SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn= 4,
NFCT_IRQn = 5,
GPIOTE_IRQn = 6,
SAADC_IRQn = 7,
TIMER0_IRQn = 8,
TIMER1_IRQn = 9,
TIMER2_IRQn = 10,
RTC0_IRQn = 11,
TEMP_IRQn = 12,
RNG_IRQn = 13,
ECB_IRQn = 14,
CCM_AAR_IRQn = 15,
WDT_IRQn = 16,
RTC1_IRQn = 17,
QDEC_IRQn = 18,
COMP_LPCOMP_IRQn = 19,
SWI0_EGU0_IRQn = 20,
SWI1_EGU1_IRQn = 21,
SWI2_EGU2_IRQn = 22,
SWI3_EGU3_IRQn = 23,
SWI4_EGU4_IRQn = 24,
SWI5_EGU5_IRQn = 25,
TIMER3_IRQn = 26,
TIMER4_IRQn = 27,
PWM0_IRQn = 28,
PDM_IRQn = 29,
MWU_IRQn = 32,
PWM1_IRQn = 33,
PWM2_IRQn = 34,
SPIM2_SPIS2_SPI2_IRQn = 35,
RTC2_IRQn = 36,
I2S_IRQn = 37,
FPU_IRQn = 38,
USBD_IRQn = 39,
UARTE1_IRQn = 40,
QSPI_IRQn = 41,
CRYPTOCELL_IRQn = 42,
PWM3_IRQn = 45,
SPIM3_IRQn = 47
} IRQn_Type;
__attribute__( ( always_inline ) ) static inline void __enable_irq(void)
{
__asm volatile ("cpsie i" : : : "memory");
}
__attribute__( ( always_inline ) ) static inline void __disable_irq(void)
{
__asm volatile ("cpsid i" : : : "memory");
}
__attribute__( ( always_inline ) ) static inline uint32_t __get_CONTROL(void)
{
uint32_t result;
__asm volatile ("MRS %0, control" : "=r" (result) );
return(result);
}
__attribute__( ( always_inline ) ) static inline void __set_CONTROL(uint32_t control)
{
__asm volatile ("MSR control, %0" : : "r" (control) : "memory");
}
__attribute__( ( always_inline ) ) static inline uint32_t __get_IPSR(void)
{
uint32_t result;
__asm volatile ("MRS %0, ipsr" : "=r" (result) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __get_APSR(void)
{
uint32_t result;
__asm volatile ("MRS %0, apsr" : "=r" (result) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __get_xPSR(void)
{
uint32_t result;
__asm volatile ("MRS %0, xpsr" : "=r" (result) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __get_PSP(void)
{
register uint32_t result;
__asm volatile ("MRS %0, psp\n" : "=r" (result) );
return(result);
}
__attribute__( ( always_inline ) ) static inline void __set_PSP(uint32_t topOfProcStack)
{
__asm volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp");
}
__attribute__( ( always_inline ) ) static inline uint32_t __get_MSP(void)
{
register uint32_t result;
__asm volatile ("MRS %0, msp\n" : "=r" (result) );
return(result);
}
__attribute__( ( always_inline ) ) static inline void __set_MSP(uint32_t topOfMainStack)
{
__asm volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp");
}
__attribute__( ( always_inline ) ) static inline uint32_t __get_PRIMASK(void)
{
uint32_t result;
__asm volatile ("MRS %0, primask" : "=r" (result) );
return(result);
}
__attribute__( ( always_inline ) ) static inline void __set_PRIMASK(uint32_t priMask)
{
__asm volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
}
__attribute__( ( always_inline ) ) static inline void __enable_fault_irq(void)
{
__asm volatile ("cpsie f" : : : "memory");
}
__attribute__( ( always_inline ) ) static inline void __disable_fault_irq(void)
{
__asm volatile ("cpsid f" : : : "memory");
}
__attribute__( ( always_inline ) ) static inline uint32_t __get_BASEPRI(void)
{
uint32_t result;
__asm volatile ("MRS %0, basepri" : "=r" (result) );
return(result);
}
__attribute__( ( always_inline ) ) static inline void __set_BASEPRI(uint32_t value)
{
__asm volatile ("MSR basepri, %0" : : "r" (value) : "memory");
}
__attribute__( ( always_inline ) ) static inline void __set_BASEPRI_MAX(uint32_t value)
{
__asm volatile ("MSR basepri_max, %0" : : "r" (value) : "memory");
}
__attribute__( ( always_inline ) ) static inline uint32_t __get_FAULTMASK(void)
{
uint32_t result;
__asm volatile ("MRS %0, faultmask" : "=r" (result) );
return(result);
}
__attribute__( ( always_inline ) ) static inline void __set_FAULTMASK(uint32_t faultMask)
{
__asm volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
}
__attribute__( ( always_inline ) ) static inline uint32_t __get_FPSCR(void)
{
return(0);
}
__attribute__( ( always_inline ) ) static inline void __set_FPSCR(uint32_t fpscr)
{
}
__attribute__((always_inline)) static inline void __NOP(void)
{
__asm volatile ("nop");
}
__attribute__((always_inline)) static inline void __WFI(void)
{
__asm volatile ("wfi");
}
__attribute__((always_inline)) static inline void __WFE(void)
{
__asm volatile ("wfe");
}
__attribute__((always_inline)) static inline void __SEV(void)
{
__asm volatile ("sev");
}
__attribute__((always_inline)) static inline void __ISB(void)
{
__asm volatile ("isb 0xF":::"memory");
}
__attribute__((always_inline)) static inline void __DSB(void)
{
__asm volatile ("dsb 0xF":::"memory");
}
__attribute__((always_inline)) static inline void __DMB(void)
{
__asm volatile ("dmb 0xF":::"memory");
}
__attribute__((always_inline)) static inline uint32_t __REV(uint32_t value)
{
return __builtin_bswap32(value);
}
__attribute__((always_inline)) static inline uint32_t __REV16(uint32_t value)
{
uint32_t result;
__asm volatile ("rev16 %0, %1" : "=r" (result) : "r" (value) );
return(result);
}
__attribute__((always_inline)) static inline int32_t __REVSH(int32_t value)
{
return (short)__builtin_bswap16(value);
}
__attribute__((always_inline)) static inline uint32_t __ROR(uint32_t op1, uint32_t op2)
{
return (op1 >> op2) | (op1 << (32U - op2));
}
__attribute__((always_inline)) static inline uint32_t __RBIT(uint32_t value)
{
uint32_t result;
__asm volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
return(result);
}
__attribute__((always_inline)) static inline uint8_t __LDREXB(volatile uint8_t *addr)
{
uint32_t result;
__asm volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) );
return ((uint8_t) result);
}
__attribute__((always_inline)) static inline uint16_t __LDREXH(volatile uint16_t *addr)
{
uint32_t result;
__asm volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) );
return ((uint16_t) result);
}
__attribute__((always_inline)) static inline uint32_t __LDREXW(volatile uint32_t *addr)
{
uint32_t result;
__asm volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) );
return(result);
}
__attribute__((always_inline)) static inline uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)
{
uint32_t result;
__asm volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) );
return(result);
}
__attribute__((always_inline)) static inline uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)
{
uint32_t result;
__asm volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) );
return(result);
}
__attribute__((always_inline)) static inline uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)
{
uint32_t result;
__asm volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
return(result);
}
__attribute__((always_inline)) static inline void __CLREX(void)
{
__asm volatile ("clrex" ::: "memory");
}
__attribute__((always_inline)) static inline uint32_t __RRX(uint32_t value)
{
uint32_t result;
__asm volatile ("rrx %0, %1" : "=r" (result) : "r" (value) );
return(result);
}
__attribute__((always_inline)) static inline uint8_t __LDRBT(volatile uint8_t *addr)
{
uint32_t result;
__asm volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*addr) );
return ((uint8_t) result);
}
__attribute__((always_inline)) static inline uint16_t __LDRHT(volatile uint16_t *addr)
{
uint32_t result;
__asm volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*addr) );
return ((uint16_t) result);
}
__attribute__((always_inline)) static inline uint32_t __LDRT(volatile uint32_t *addr)
{
uint32_t result;
__asm volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*addr) );
return(result);
}
__attribute__((always_inline)) static inline void __STRBT(uint8_t value, volatile uint8_t *addr)
{
__asm volatile ("strbt %1, %0" : "=Q" (*addr) : "r" ((uint32_t)value) );
}
__attribute__((always_inline)) static inline void __STRHT(uint16_t value, volatile uint16_t *addr)
{
__asm volatile ("strht %1, %0" : "=Q" (*addr) : "r" ((uint32_t)value) );
}
__attribute__((always_inline)) static inline void __STRT(uint32_t value, volatile uint32_t *addr)
{
__asm volatile ("strt %1, %0" : "=Q" (*addr) : "r" (value) );
}
__attribute__( ( always_inline ) ) static inline uint32_t __SADD8(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __QADD8(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SHADD8(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UADD8(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UQADD8(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UHADD8(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SSUB8(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __QSUB8(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SHSUB8(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __USUB8(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UQSUB8(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UHSUB8(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SADD16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __QADD16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SHADD16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UADD16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UQADD16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UHADD16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SSUB16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __QSUB16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SHSUB16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __USUB16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UQSUB16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UHSUB16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SASX(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __QASX(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SHASX(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UASX(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UQASX(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UHASX(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SSAX(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __QSAX(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SHSAX(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __USAX(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UQSAX(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UHSAX(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __USAD8(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3)
{
uint32_t result;
__asm volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UXTB16(uint32_t op1)
{
uint32_t result;
__asm volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1));
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __UXTAB16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SXTB16(uint32_t op1)
{
uint32_t result;
__asm volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1));
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SXTAB16(uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SMUAD (uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SMUADX (uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3)
{
uint32_t result;
__asm volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3)
{
uint32_t result;
__asm volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc)
{
union llreg_u{
uint32_t w32[2];
uint64_t w64;
} llr;
llr.w64 = acc;
__asm volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
return(llr.w64);
}
__attribute__( ( always_inline ) ) static inline uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc)
{
union llreg_u{
uint32_t w32[2];
uint64_t w64;
} llr;
llr.w64 = acc;
__asm volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
return(llr.w64);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SMUSD (uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SMUSDX (uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3)
{
uint32_t result;
__asm volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3)
{
uint32_t result;
__asm volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc)
{
union llreg_u{
uint32_t w32[2];
uint64_t w64;
} llr;
llr.w64 = acc;
__asm volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
return(llr.w64);
}
__attribute__( ( always_inline ) ) static inline uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc)
{
union llreg_u{
uint32_t w32[2];
uint64_t w64;
} llr;
llr.w64 = acc;
__asm volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
return(llr.w64);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SEL (uint32_t op1, uint32_t op2)
{
uint32_t result;
__asm volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline int32_t __QADD( int32_t op1, int32_t op2)
{
int32_t result;
__asm volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline int32_t __QSUB( int32_t op1, int32_t op2)
{
int32_t result;
__asm volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
return(result);
}
__attribute__( ( always_inline ) ) static inline uint32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3)
{
int32_t result;
__asm volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) );
return(result);
}
typedef union
{
struct
{
uint32_t _reserved0:16;
uint32_t GE:4;
uint32_t _reserved1:7;
uint32_t Q:1;
uint32_t V:1;
uint32_t C:1;
uint32_t Z:1;
uint32_t N:1;
} b;
uint32_t w;
} APSR_Type;
typedef union
{
struct
{
uint32_t ISR:9;
uint32_t _reserved0:23;
} b;
uint32_t w;
} IPSR_Type;
typedef union
{
struct
{
uint32_t ISR:9;
uint32_t _reserved0:7;
uint32_t GE:4;
uint32_t _reserved1:4;
uint32_t T:1;
uint32_t IT:2;
uint32_t Q:1;
uint32_t V:1;
uint32_t C:1;
uint32_t Z:1;
uint32_t N:1;
} b;
uint32_t w;
} xPSR_Type;
typedef union
{
struct
{
uint32_t nPRIV:1;
uint32_t SPSEL:1;
uint32_t FPCA:1;
uint32_t _reserved0:29;
} b;
uint32_t w;
} CONTROL_Type;
typedef struct
{
volatile uint32_t ISER[8U];
uint32_t RESERVED0[24U];
volatile uint32_t ICER[8U];
uint32_t RSERVED1[24U];
volatile uint32_t ISPR[8U];
uint32_t RESERVED2[24U];
volatile uint32_t ICPR[8U];
uint32_t RESERVED3[24U];
volatile uint32_t IABR[8U];
uint32_t RESERVED4[56U];
volatile uint8_t IP[240U];
uint32_t RESERVED5[644U];
volatile uint32_t STIR;
} NVIC_Type;
typedef struct
{
volatile const uint32_t CPUID;
volatile uint32_t ICSR;
volatile uint32_t VTOR;
volatile uint32_t AIRCR;
volatile uint32_t SCR;
volatile uint32_t CCR;
volatile uint8_t SHP[12U];
volatile uint32_t SHCSR;
volatile uint32_t CFSR;
volatile uint32_t HFSR;
volatile uint32_t DFSR;
volatile uint32_t MMFAR;
volatile uint32_t BFAR;
volatile uint32_t AFSR;
volatile const uint32_t PFR[2U];
volatile const uint32_t DFR;
volatile const uint32_t ADR;
volatile const uint32_t MMFR[4U];
volatile const uint32_t ISAR[5U];
uint32_t RESERVED0[5U];
volatile uint32_t CPACR;
} SCB_Type;
typedef struct
{
uint32_t RESERVED0[1U];
volatile const uint32_t ICTR;
volatile uint32_t ACTLR;
} SCnSCB_Type;
typedef struct
{
volatile uint32_t CTRL;
volatile uint32_t LOAD;
volatile uint32_t VAL;
volatile const uint32_t CALIB;
} SysTick_Type;
typedef struct
{
volatile union
{
volatile uint8_t u8;
volatile uint16_t u16;
volatile uint32_t u32;
} PORT [32U];
uint32_t RESERVED0[864U];
volatile uint32_t TER;
uint32_t RESERVED1[15U];
volatile uint32_t TPR;
uint32_t RESERVED2[15U];
volatile uint32_t TCR;
uint32_t RESERVED3[29U];
volatile uint32_t IWR;
volatile const uint32_t IRR;
volatile uint32_t IMCR;
uint32_t RESERVED4[43U];
volatile uint32_t LAR;
volatile const uint32_t LSR;
uint32_t RESERVED5[6U];
volatile const uint32_t PID4;
volatile const uint32_t PID5;
volatile const uint32_t PID6;
volatile const uint32_t PID7;
volatile const uint32_t PID0;
volatile const uint32_t PID1;
volatile const uint32_t PID2;
volatile const uint32_t PID3;
volatile const uint32_t CID0;
volatile const uint32_t CID1;
volatile const uint32_t CID2;
volatile const uint32_t CID3;
} ITM_Type;
typedef struct
{
volatile uint32_t CTRL;
volatile uint32_t CYCCNT;
volatile uint32_t CPICNT;
volatile uint32_t EXCCNT;
volatile uint32_t SLEEPCNT;
volatile uint32_t LSUCNT;
volatile uint32_t FOLDCNT;
volatile const uint32_t PCSR;
volatile uint32_t COMP0;
volatile uint32_t MASK0;
volatile uint32_t FUNCTION0;
uint32_t RESERVED0[1U];
volatile uint32_t COMP1;
volatile uint32_t MASK1;
volatile uint32_t FUNCTION1;
uint32_t RESERVED1[1U];
volatile uint32_t COMP2;
volatile uint32_t MASK2;
volatile uint32_t FUNCTION2;
uint32_t RESERVED2[1U];
volatile uint32_t COMP3;
volatile uint32_t MASK3;
volatile uint32_t FUNCTION3;
} DWT_Type;
typedef struct
{
volatile uint32_t SSPSR;
volatile uint32_t CSPSR;
uint32_t RESERVED0[2U];
volatile uint32_t ACPR;
uint32_t RESERVED1[55U];
volatile uint32_t SPPR;
uint32_t RESERVED2[131U];
volatile const uint32_t FFSR;
volatile uint32_t FFCR;
volatile const uint32_t FSCR;
uint32_t RESERVED3[759U];
volatile const uint32_t TRIGGER;
volatile const uint32_t FIFO0;
volatile const uint32_t ITATBCTR2;
uint32_t RESERVED4[1U];
volatile const uint32_t ITATBCTR0;
volatile const uint32_t FIFO1;
volatile uint32_t ITCTRL;
uint32_t RESERVED5[39U];
volatile uint32_t CLAIMSET;
volatile uint32_t CLAIMCLR;
uint32_t RESERVED7[8U];
volatile const uint32_t DEVID;
volatile const uint32_t DEVTYPE;
} TPI_Type;
typedef struct
{
volatile const uint32_t TYPE;
volatile uint32_t CTRL;
volatile uint32_t RNR;
volatile uint32_t RBAR;
volatile uint32_t RASR;
volatile uint32_t RBAR_A1;
volatile uint32_t RASR_A1;
volatile uint32_t RBAR_A2;
volatile uint32_t RASR_A2;
volatile uint32_t RBAR_A3;
volatile uint32_t RASR_A3;
} MPU_Type;
typedef struct
{
uint32_t RESERVED0[1U];
volatile uint32_t FPCCR;
volatile uint32_t FPCAR;
volatile uint32_t FPDSCR;
volatile const uint32_t MVFR0;
volatile const uint32_t MVFR1;
} FPU_Type;
typedef struct
{
volatile uint32_t DHCSR;
volatile uint32_t DCRSR;
volatile uint32_t DCRDR;
volatile uint32_t DEMCR;
} CoreDebug_Type;
static inline void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
{
uint32_t reg_value;
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);
reg_value = ((SCB_Type *) ((0xE000E000UL) + 0x0D00UL) )->AIRCR;
reg_value &= ~((uint32_t)((0xFFFFUL << 16U) | (7UL << 8U)));
reg_value = (reg_value |
((uint32_t)0x5FAUL << 16U) |
(PriorityGroupTmp << 8U) );
((SCB_Type *) ((0xE000E000UL) + 0x0D00UL) )->AIRCR = reg_value;
}
static inline uint32_t NVIC_GetPriorityGrouping(void)
{
return ((uint32_t)((((SCB_Type *) ((0xE000E000UL) + 0x0D00UL) )->AIRCR & (7UL << 8U)) >> 8U));
}
static inline void NVIC_EnableIRQ(IRQn_Type IRQn)
{
((NVIC_Type *) ((0xE000E000UL) + 0x0100UL) )->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
}
static inline void NVIC_DisableIRQ(IRQn_Type IRQn)
{
((NVIC_Type *) ((0xE000E000UL) + 0x0100UL) )->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
}
static inline uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
{
return((uint32_t)(((((NVIC_Type *) ((0xE000E000UL) + 0x0100UL) )->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
}
static inline void NVIC_SetPendingIRQ(IRQn_Type IRQn)
{
((NVIC_Type *) ((0xE000E000UL) + 0x0100UL) )->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
}
static inline void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
{
((NVIC_Type *) ((0xE000E000UL) + 0x0100UL) )->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
}
static inline uint32_t NVIC_GetActive(IRQn_Type IRQn)
{
return((uint32_t)(((((NVIC_Type *) ((0xE000E000UL) + 0x0100UL) )->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
}
static inline void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
{
if ((int32_t)(IRQn) < 0)
{
((SCB_Type *) ((0xE000E000UL) + 0x0D00UL) )->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - 3)) & (uint32_t)0xFFUL);
}
else
{
((NVIC_Type *) ((0xE000E000UL) + 0x0100UL) )->IP[((uint32_t)(int32_t)IRQn)] = (uint8_t)((priority << (8U - 3)) & (uint32_t)0xFFUL);
}
}
static inline uint32_t NVIC_GetPriority(IRQn_Type IRQn)
{
if ((int32_t)(IRQn) < 0)
{
return(((uint32_t)((SCB_Type *) ((0xE000E000UL) + 0x0D00UL) )->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] >> (8U - 3)));
}
else
{
return(((uint32_t)((NVIC_Type *) ((0xE000E000UL) + 0x0100UL) )->IP[((uint32_t)(int32_t)IRQn)] >> (8U - 3)));
}
}
static inline uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
{
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);
uint32_t PreemptPriorityBits;
uint32_t SubPriorityBits;
PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(3)) ? (uint32_t)(3) : (uint32_t)(7UL - PriorityGroupTmp);
SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(3)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(3));
return (
((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
);
}
static inline void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
{
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);
uint32_t PreemptPriorityBits;
uint32_t SubPriorityBits;
PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(3)) ? (uint32_t)(3) : (uint32_t)(7UL - PriorityGroupTmp);
SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(3)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(3));
*pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
*pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
}
static inline void NVIC_SystemReset(void)
{
__DSB();
((SCB_Type *) ((0xE000E000UL) + 0x0D00UL) )->AIRCR = (uint32_t)((0x5FAUL << 16U) |
(((SCB_Type *) ((0xE000E000UL) + 0x0D00UL) )->AIRCR & (7UL << 8U)) |
(1UL << 2U) );
__DSB();
for (;;)
{
__NOP();
}
}
static inline uint32_t SysTick_Config(uint32_t ticks)
{
if ((ticks - 1UL) > (0xFFFFFFUL ))
{
return (1UL);
}
((SysTick_Type *) ((0xE000E000UL) + 0x0010UL) )->LOAD = (uint32_t)(ticks - 1UL);
NVIC_SetPriority (SysTick_IRQn, (1UL << 3) - 1UL);
((SysTick_Type *) ((0xE000E000UL) + 0x0010UL) )->VAL = 0UL;
((SysTick_Type *) ((0xE000E000UL) + 0x0010UL) )->CTRL = (1UL << 2U) |
(1UL << 1U) |
(1UL );
return (0UL);
}
extern volatile int32_t ITM_RxBuffer;
static inline uint32_t ITM_SendChar (uint32_t ch)
{
if (((((ITM_Type *) (0xE0000000UL) )->TCR & (1UL )) != 0UL) &&
((((ITM_Type *) (0xE0000000UL) )->TER & 1UL ) != 0UL) )
{
while (((ITM_Type *) (0xE0000000UL) )->PORT[0U].u32 == 0UL)
{
__NOP();
}
((ITM_Type *) (0xE0000000UL) )->PORT[0U].u8 = (uint8_t)ch;
}
return (ch);
}
static inline int32_t ITM_ReceiveChar (void)
{
int32_t ch = -1;
if (ITM_RxBuffer != 0x5AA55AA5U)
{
ch = ITM_RxBuffer;
ITM_RxBuffer = 0x5AA55AA5U;
}
return (ch);
}
static inline int32_t ITM_CheckChar (void)
{
if (ITM_RxBuffer == 0x5AA55AA5U)
{
return (0);
}
else
{
return (1);
}
}
extern uint32_t SystemCoreClock;
extern void SystemInit (void);
extern void SystemCoreClockUpdate (void);
typedef struct {
volatile const uint32_t PART;
volatile const uint32_t VARIANT;
volatile const uint32_t PACKAGE;
volatile const uint32_t RAM;
volatile const uint32_t FLASH;
volatile uint32_t UNUSED0[3];
} FICR_INFO_Type;
typedef struct {
volatile const uint32_t A0;
volatile const uint32_t A1;
volatile const uint32_t A2;
volatile const uint32_t A3;
volatile const uint32_t A4;
volatile const uint32_t A5;
volatile const uint32_t B0;
volatile const uint32_t B1;
volatile const uint32_t B2;
volatile const uint32_t B3;
volatile const uint32_t B4;
volatile const uint32_t B5;
volatile const uint32_t T0;
volatile const uint32_t T1;
volatile const uint32_t T2;
volatile const uint32_t T3;
volatile const uint32_t T4;
} FICR_TEMP_Type;
typedef struct {
volatile const uint32_t TAGHEADER0;
volatile const uint32_t TAGHEADER1;
volatile const uint32_t TAGHEADER2;
volatile const uint32_t TAGHEADER3;
} FICR_NFC_Type;
typedef struct {
volatile uint32_t POWER;
volatile uint32_t POWERSET;
volatile uint32_t POWERCLR;
volatile const uint32_t RESERVED0;
} POWER_RAM_Type;
typedef struct {
volatile uint32_t RTS;
volatile uint32_t TXD;
volatile uint32_t CTS;
volatile uint32_t RXD;
} UARTE_PSEL_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
} UARTE_RXD_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
} UARTE_TXD_Type;
typedef struct {
volatile uint32_t RTS;
volatile uint32_t TXD;
volatile uint32_t CTS;
volatile uint32_t RXD;
} UART_PSEL_Type;
typedef struct {
volatile uint32_t SCK;
volatile uint32_t MOSI;
volatile uint32_t MISO;
volatile uint32_t CSN;
} SPIM_PSEL_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
volatile uint32_t LIST;
} SPIM_RXD_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
volatile uint32_t LIST;
} SPIM_TXD_Type;
typedef struct {
volatile uint32_t RXDELAY;
volatile uint32_t CSNDUR;
} SPIM_IFTIMING_Type;
typedef struct {
volatile uint32_t SCK;
volatile uint32_t MISO;
volatile uint32_t MOSI;
volatile uint32_t CSN;
} SPIS_PSEL_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
} SPIS_RXD_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
} SPIS_TXD_Type;
typedef struct {
volatile uint32_t SCL;
volatile uint32_t SDA;
} TWIM_PSEL_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
volatile uint32_t LIST;
} TWIM_RXD_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
volatile uint32_t LIST;
} TWIM_TXD_Type;
typedef struct {
volatile uint32_t SCL;
volatile uint32_t SDA;
} TWIS_PSEL_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
} TWIS_RXD_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
} TWIS_TXD_Type;
typedef struct {
volatile uint32_t SCK;
volatile uint32_t MOSI;
volatile uint32_t MISO;
} SPI_PSEL_Type;
typedef struct {
volatile uint32_t SCL;
volatile uint32_t SDA;
} TWI_PSEL_Type;
typedef struct {
volatile uint32_t RX;
} NFCT_FRAMESTATUS_Type;
typedef struct {
volatile uint32_t FRAMECONFIG;
volatile uint32_t AMOUNT;
} NFCT_TXD_Type;
typedef struct {
volatile uint32_t FRAMECONFIG;
volatile const uint32_t AMOUNT;
} NFCT_RXD_Type;
typedef struct {
volatile uint32_t LIMITH;
volatile uint32_t LIMITL;
} SAADC_EVENTS_CH_Type;
typedef struct {
volatile uint32_t PSELP;
volatile uint32_t PSELN;
volatile uint32_t CONFIG;
volatile uint32_t LIMIT;
} SAADC_CH_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
} SAADC_RESULT_Type;
typedef struct {
volatile uint32_t LED;
volatile uint32_t A;
volatile uint32_t B;
} QDEC_PSEL_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t CNT;
volatile uint32_t REFRESH;
volatile uint32_t ENDDELAY;
volatile const uint32_t RESERVED1[4];
} PWM_SEQ_Type;
typedef struct {
volatile uint32_t OUT[4];
} PWM_PSEL_Type;
typedef struct {
volatile uint32_t CLK;
volatile uint32_t DIN;
} PDM_PSEL_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
} PDM_SAMPLE_Type;
typedef struct {
volatile uint32_t ADDR;
volatile uint32_t SIZE;
volatile uint32_t PERM;
volatile uint32_t UNUSED0;
} ACL_ACL_Type;
typedef struct {
volatile uint32_t EN;
volatile uint32_t DIS;
} PPI_TASKS_CHG_Type;
typedef struct {
volatile uint32_t EEP;
volatile uint32_t TEP;
} PPI_CH_Type;
typedef struct {
volatile uint32_t TEP;
} PPI_FORK_Type;
typedef struct {
volatile uint32_t WA;
volatile uint32_t RA;
} MWU_EVENTS_REGION_Type;
typedef struct {
volatile uint32_t WA;
volatile uint32_t RA;
} MWU_EVENTS_PREGION_Type;
typedef struct {
volatile uint32_t SUBSTATWA;
volatile uint32_t SUBSTATRA;
} MWU_PERREGION_Type;
typedef struct {
volatile uint32_t START;
volatile uint32_t END;
volatile const uint32_t RESERVED2[2];
} MWU_REGION_Type;
typedef struct {
volatile const uint32_t START;
volatile const uint32_t END;
volatile uint32_t SUBS;
volatile const uint32_t RESERVED3;
} MWU_PREGION_Type;
typedef struct {
volatile uint32_t MODE;
volatile uint32_t RXEN;
volatile uint32_t TXEN;
volatile uint32_t MCKEN;
volatile uint32_t MCKFREQ;
volatile uint32_t RATIO;
volatile uint32_t SWIDTH;
volatile uint32_t ALIGN;
volatile uint32_t FORMAT;
volatile uint32_t CHANNELS;
} I2S_CONFIG_Type;
typedef struct {
volatile uint32_t PTR;
} I2S_RXD_Type;
typedef struct {
volatile uint32_t PTR;
} I2S_TXD_Type;
typedef struct {
volatile uint32_t MAXCNT;
} I2S_RXTXD_Type;
typedef struct {
volatile uint32_t MCK;
volatile uint32_t SCK;
volatile uint32_t LRCK;
volatile uint32_t SDIN;
volatile uint32_t SDOUT;
} I2S_PSEL_Type;
typedef struct {
volatile const uint32_t EPIN[8];
volatile const uint32_t RESERVED4;
volatile const uint32_t EPOUT[8];
} USBD_HALTED_Type;
typedef struct {
volatile uint32_t EPOUT[8];
volatile const uint32_t ISOOUT;
} USBD_SIZE_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
volatile const uint32_t RESERVED5[2];
} USBD_EPIN_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
} USBD_ISOIN_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
volatile const uint32_t RESERVED6[2];
} USBD_EPOUT_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t MAXCNT;
volatile const uint32_t AMOUNT;
} USBD_ISOOUT_Type;
typedef struct {
volatile uint32_t SRC;
volatile uint32_t DST;
volatile uint32_t CNT;
} QSPI_READ_Type;
typedef struct {
volatile uint32_t DST;
volatile uint32_t SRC;
volatile uint32_t CNT;
} QSPI_WRITE_Type;
typedef struct {
volatile uint32_t PTR;
volatile uint32_t LEN;
} QSPI_ERASE_Type;
typedef struct {
volatile uint32_t SCK;
volatile uint32_t CSN;
volatile const uint32_t RESERVED7;
volatile uint32_t IO0;
volatile uint32_t IO1;
volatile uint32_t IO2;
volatile uint32_t IO3;
} QSPI_PSEL_Type;
typedef struct {
volatile const uint32_t RESERVED0[4];
volatile const uint32_t CODEPAGESIZE;
volatile const uint32_t CODESIZE;
volatile const uint32_t RESERVED1[18];
volatile const uint32_t DEVICEID[2];
volatile const uint32_t RESERVED2[6];
volatile const uint32_t ER[4];
volatile const uint32_t IR[4];
volatile const uint32_t DEVICEADDRTYPE;
volatile const uint32_t DEVICEADDR[2];
volatile const uint32_t RESERVED3[21];
FICR_INFO_Type INFO;
volatile const uint32_t RESERVED4[185];
FICR_TEMP_Type TEMP;
volatile const uint32_t RESERVED5[2];
FICR_NFC_Type NFC;
} NRF_FICR_Type;
typedef struct {
volatile uint32_t UNUSED0;
volatile uint32_t UNUSED1;
volatile uint32_t UNUSED2;
volatile const uint32_t RESERVED0;
volatile uint32_t UNUSED3;
volatile uint32_t NRFFW[15];
volatile uint32_t NRFHW[12];
volatile uint32_t CUSTOMER[32];
volatile const uint32_t RESERVED1[64];
volatile uint32_t PSELRESET[2];
volatile uint32_t APPROTECT;
volatile uint32_t NFCPINS;
volatile uint32_t DEBUGCTRL;
volatile const uint32_t RESERVED2[59];
volatile uint32_t DCDCDRIVE0;
volatile uint32_t REGOUT0;
} NRF_UICR_Type;
typedef struct {
volatile const uint32_t RESERVED0[30];
volatile uint32_t TASKS_CONSTLAT;
volatile uint32_t TASKS_LOWPWR;
volatile const uint32_t RESERVED1[34];
volatile uint32_t EVENTS_POFWARN;
volatile const uint32_t RESERVED2[2];
volatile uint32_t EVENTS_SLEEPENTER;
volatile uint32_t EVENTS_SLEEPEXIT;
volatile uint32_t EVENTS_USBDETECTED;
volatile uint32_t EVENTS_USBREMOVED;
volatile uint32_t EVENTS_USBPWRRDY;
volatile const uint32_t RESERVED3[119];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED4[61];
volatile uint32_t RESETREAS;
volatile const uint32_t RESERVED5[9];
volatile const uint32_t RAMSTATUS;
volatile const uint32_t RESERVED6[3];
volatile const uint32_t USBREGSTATUS;
volatile const uint32_t RESERVED7[49];
volatile uint32_t SYSTEMOFF;
volatile const uint32_t RESERVED8[3];
volatile uint32_t POFCON;
volatile const uint32_t RESERVED9[2];
volatile uint32_t GPREGRET;
volatile uint32_t GPREGRET2;
volatile const uint32_t RESERVED10[21];
volatile uint32_t DCDCEN;
volatile const uint32_t RESERVED11;
volatile uint32_t DCDCEN0;
volatile const uint32_t RESERVED12[47];
volatile const uint32_t MAINREGSTATUS;
volatile const uint32_t RESERVED13[175];
POWER_RAM_Type RAM[9];
} NRF_POWER_Type;
typedef struct {
volatile uint32_t TASKS_HFCLKSTART;
volatile uint32_t TASKS_HFCLKSTOP;
volatile uint32_t TASKS_LFCLKSTART;
volatile uint32_t TASKS_LFCLKSTOP;
volatile uint32_t TASKS_CAL;
volatile uint32_t TASKS_CTSTART;
volatile uint32_t TASKS_CTSTOP;
volatile const uint32_t RESERVED0[57];
volatile uint32_t EVENTS_HFCLKSTARTED;
volatile uint32_t EVENTS_LFCLKSTARTED;
volatile const uint32_t RESERVED1;
volatile uint32_t EVENTS_DONE;
volatile uint32_t EVENTS_CTTO;
volatile const uint32_t RESERVED2[5];
volatile uint32_t EVENTS_CTSTARTED;
volatile uint32_t EVENTS_CTSTOPPED;
volatile const uint32_t RESERVED3[117];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED4[63];
volatile const uint32_t HFCLKRUN;
volatile const uint32_t HFCLKSTAT;
volatile const uint32_t RESERVED5;
volatile const uint32_t LFCLKRUN;
volatile const uint32_t LFCLKSTAT;
volatile const uint32_t LFCLKSRCCOPY;
volatile const uint32_t RESERVED6[62];
volatile uint32_t LFCLKSRC;
volatile const uint32_t RESERVED7[3];
volatile uint32_t HFXODEBOUNCE;
volatile const uint32_t RESERVED8[3];
volatile uint32_t CTIV;
volatile const uint32_t RESERVED9[8];
volatile uint32_t TRACECONFIG;
volatile const uint32_t RESERVED10[21];
volatile uint32_t LFRCMODE;
} NRF_CLOCK_Type;
typedef struct {
volatile uint32_t TASKS_TXEN;
volatile uint32_t TASKS_RXEN;
volatile uint32_t TASKS_START;
volatile uint32_t TASKS_STOP;
volatile uint32_t TASKS_DISABLE;
volatile uint32_t TASKS_RSSISTART;
volatile uint32_t TASKS_RSSISTOP;
volatile uint32_t TASKS_BCSTART;
volatile uint32_t TASKS_BCSTOP;
volatile uint32_t TASKS_EDSTART;
volatile uint32_t TASKS_EDSTOP;
volatile uint32_t TASKS_CCASTART;
volatile uint32_t TASKS_CCASTOP;
volatile const uint32_t RESERVED0[51];
volatile uint32_t EVENTS_READY;
volatile uint32_t EVENTS_ADDRESS;
volatile uint32_t EVENTS_PAYLOAD;
volatile uint32_t EVENTS_END;
volatile uint32_t EVENTS_DISABLED;
volatile uint32_t EVENTS_DEVMATCH;
volatile uint32_t EVENTS_DEVMISS;
volatile uint32_t EVENTS_RSSIEND;
volatile const uint32_t RESERVED1[2];
volatile uint32_t EVENTS_BCMATCH;
volatile const uint32_t RESERVED2;
volatile uint32_t EVENTS_CRCOK;
volatile uint32_t EVENTS_CRCERROR;
volatile uint32_t EVENTS_FRAMESTART;
volatile uint32_t EVENTS_EDEND;
volatile uint32_t EVENTS_EDSTOPPED;
volatile uint32_t EVENTS_CCAIDLE;
volatile uint32_t EVENTS_CCABUSY;
volatile uint32_t EVENTS_CCASTOPPED;
volatile uint32_t EVENTS_RATEBOOST;
volatile uint32_t EVENTS_TXREADY;
volatile uint32_t EVENTS_RXREADY;
volatile uint32_t EVENTS_MHRMATCH;
volatile const uint32_t RESERVED3[3];
volatile uint32_t EVENTS_PHYEND;
volatile const uint32_t RESERVED4[36];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED5[64];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED6[61];
volatile const uint32_t CRCSTATUS;
volatile const uint32_t RESERVED7;
volatile const uint32_t RXMATCH;
volatile const uint32_t RXCRC;
volatile const uint32_t DAI;
volatile const uint32_t PDUSTAT;
volatile const uint32_t RESERVED8[59];
volatile uint32_t PACKETPTR;
volatile uint32_t FREQUENCY;
volatile uint32_t TXPOWER;
volatile uint32_t MODE;
volatile uint32_t PCNF0;
volatile uint32_t PCNF1;
volatile uint32_t BASE0;
volatile uint32_t BASE1;
volatile uint32_t PREFIX0;
volatile uint32_t PREFIX1;
volatile uint32_t TXADDRESS;
volatile uint32_t RXADDRESSES;
volatile uint32_t CRCCNF;
volatile uint32_t CRCPOLY;
volatile uint32_t CRCINIT;
volatile const uint32_t RESERVED9;
volatile uint32_t TIFS;
volatile const uint32_t RSSISAMPLE;
volatile const uint32_t RESERVED10;
volatile const uint32_t STATE;
volatile uint32_t DATAWHITEIV;
volatile const uint32_t RESERVED11[2];
volatile uint32_t BCC;
volatile const uint32_t RESERVED12[39];
volatile uint32_t DAB[8];
volatile uint32_t DAP[8];
volatile uint32_t DACNF;
volatile uint32_t MHRMATCHCONF;
volatile uint32_t MHRMATCHMAS;
volatile const uint32_t RESERVED13;
volatile uint32_t MODECNF0;
volatile const uint32_t RESERVED14[3];
volatile uint32_t SFD;
volatile uint32_t EDCNT;
volatile uint32_t EDSAMPLE;
volatile uint32_t CCACTRL;
volatile const uint32_t RESERVED15[611];
volatile uint32_t POWER;
} NRF_RADIO_Type;
typedef struct {
volatile uint32_t TASKS_STARTRX;
volatile uint32_t TASKS_STOPRX;
volatile uint32_t TASKS_STARTTX;
volatile uint32_t TASKS_STOPTX;
volatile const uint32_t RESERVED0[7];
volatile uint32_t TASKS_FLUSHRX;
volatile const uint32_t RESERVED1[52];
volatile uint32_t EVENTS_CTS;
volatile uint32_t EVENTS_NCTS;
volatile uint32_t EVENTS_RXDRDY;
volatile const uint32_t RESERVED2;
volatile uint32_t EVENTS_ENDRX;
volatile const uint32_t RESERVED3[2];
volatile uint32_t EVENTS_TXDRDY;
volatile uint32_t EVENTS_ENDTX;
volatile uint32_t EVENTS_ERROR;
volatile const uint32_t RESERVED4[7];
volatile uint32_t EVENTS_RXTO;
volatile const uint32_t RESERVED5;
volatile uint32_t EVENTS_RXSTARTED;
volatile uint32_t EVENTS_TXSTARTED;
volatile const uint32_t RESERVED6;
volatile uint32_t EVENTS_TXSTOPPED;
volatile const uint32_t RESERVED7[41];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED8[63];
volatile uint32_t INTEN;
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED9[93];
volatile uint32_t ERRORSRC;
volatile const uint32_t RESERVED10[31];
volatile uint32_t ENABLE;
volatile const uint32_t RESERVED11;
UARTE_PSEL_Type PSEL;
volatile const uint32_t RESERVED12[3];
volatile uint32_t BAUDRATE;
volatile const uint32_t RESERVED13[3];
UARTE_RXD_Type RXD;
volatile const uint32_t RESERVED14;
UARTE_TXD_Type TXD;
volatile const uint32_t RESERVED15[7];
volatile uint32_t CONFIG;
} NRF_UARTE_Type;
typedef struct {
volatile uint32_t TASKS_STARTRX;
volatile uint32_t TASKS_STOPRX;
volatile uint32_t TASKS_STARTTX;
volatile uint32_t TASKS_STOPTX;
volatile const uint32_t RESERVED0[3];
volatile uint32_t TASKS_SUSPEND;
volatile const uint32_t RESERVED1[56];
volatile uint32_t EVENTS_CTS;
volatile uint32_t EVENTS_NCTS;
volatile uint32_t EVENTS_RXDRDY;
volatile const uint32_t RESERVED2[4];
volatile uint32_t EVENTS_TXDRDY;
volatile const uint32_t RESERVED3;
volatile uint32_t EVENTS_ERROR;
volatile const uint32_t RESERVED4[7];
volatile uint32_t EVENTS_RXTO;
volatile const uint32_t RESERVED5[46];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED6[64];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED7[93];
volatile uint32_t ERRORSRC;
volatile const uint32_t RESERVED8[31];
volatile uint32_t ENABLE;
volatile const uint32_t RESERVED9;
UART_PSEL_Type PSEL;
volatile const uint32_t RXD;
volatile uint32_t TXD;
volatile const uint32_t RESERVED10;
volatile uint32_t BAUDRATE;
volatile const uint32_t RESERVED11[17];
volatile uint32_t CONFIG;
} NRF_UART_Type;
typedef struct {
volatile const uint32_t RESERVED0[4];
volatile uint32_t TASKS_START;
volatile uint32_t TASKS_STOP;
volatile const uint32_t RESERVED1;
volatile uint32_t TASKS_SUSPEND;
volatile uint32_t TASKS_RESUME;
volatile const uint32_t RESERVED2[56];
volatile uint32_t EVENTS_STOPPED;
volatile const uint32_t RESERVED3[2];
volatile uint32_t EVENTS_ENDRX;
volatile const uint32_t RESERVED4;
volatile uint32_t EVENTS_END;
volatile const uint32_t RESERVED5;
volatile uint32_t EVENTS_ENDTX;
volatile const uint32_t RESERVED6[10];
volatile uint32_t EVENTS_STARTED;
volatile const uint32_t RESERVED7[44];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED8[64];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED9[61];
volatile uint32_t STALLSTAT;
volatile const uint32_t RESERVED10[63];
volatile uint32_t ENABLE;
volatile const uint32_t RESERVED11;
SPIM_PSEL_Type PSEL;
volatile const uint32_t RESERVED12[3];
volatile uint32_t FREQUENCY;
volatile const uint32_t RESERVED13[3];
SPIM_RXD_Type RXD;
SPIM_TXD_Type TXD;
volatile uint32_t CONFIG;
volatile const uint32_t RESERVED14[2];
SPIM_IFTIMING_Type IFTIMING;
volatile uint32_t CSNPOL;
volatile uint32_t PSELDCX;
volatile uint32_t DCXCNT;
volatile const uint32_t RESERVED15[19];
volatile uint32_t ORC;
} NRF_SPIM_Type;
typedef struct {
volatile const uint32_t RESERVED0[9];
volatile uint32_t TASKS_ACQUIRE;
volatile uint32_t TASKS_RELEASE;
volatile const uint32_t RESERVED1[54];
volatile uint32_t EVENTS_END;
volatile const uint32_t RESERVED2[2];
volatile uint32_t EVENTS_ENDRX;
volatile const uint32_t RESERVED3[5];
volatile uint32_t EVENTS_ACQUIRED;
volatile const uint32_t RESERVED4[53];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED5[64];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED6[61];
volatile const uint32_t SEMSTAT;
volatile const uint32_t RESERVED7[15];
volatile uint32_t STATUS;
volatile const uint32_t RESERVED8[47];
volatile uint32_t ENABLE;
volatile const uint32_t RESERVED9;
SPIS_PSEL_Type PSEL;
volatile const uint32_t RESERVED10[7];
SPIS_RXD_Type RXD;
volatile const uint32_t RESERVED11;
SPIS_TXD_Type TXD;
volatile const uint32_t RESERVED12;
volatile uint32_t CONFIG;
volatile const uint32_t RESERVED13;
volatile uint32_t DEF;
volatile const uint32_t RESERVED14[24];
volatile uint32_t ORC;
} NRF_SPIS_Type;
typedef struct {
volatile uint32_t TASKS_STARTRX;
volatile const uint32_t RESERVED0;
volatile uint32_t TASKS_STARTTX;
volatile const uint32_t RESERVED1[2];
volatile uint32_t TASKS_STOP;
volatile const uint32_t RESERVED2;
volatile uint32_t TASKS_SUSPEND;
volatile uint32_t TASKS_RESUME;
volatile const uint32_t RESERVED3[56];
volatile uint32_t EVENTS_STOPPED;
volatile const uint32_t RESERVED4[7];
volatile uint32_t EVENTS_ERROR;
volatile const uint32_t RESERVED5[8];
volatile uint32_t EVENTS_SUSPENDED;
volatile uint32_t EVENTS_RXSTARTED;
volatile uint32_t EVENTS_TXSTARTED;
volatile const uint32_t RESERVED6[2];
volatile uint32_t EVENTS_LASTRX;
volatile uint32_t EVENTS_LASTTX;
volatile const uint32_t RESERVED7[39];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED8[63];
volatile uint32_t INTEN;
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED9[110];
volatile uint32_t ERRORSRC;
volatile const uint32_t RESERVED10[14];
volatile uint32_t ENABLE;
volatile const uint32_t RESERVED11;
TWIM_PSEL_Type PSEL;
volatile const uint32_t RESERVED12[5];
volatile uint32_t FREQUENCY;
volatile const uint32_t RESERVED13[3];
TWIM_RXD_Type RXD;
TWIM_TXD_Type TXD;
volatile const uint32_t RESERVED14[13];
volatile uint32_t ADDRESS;
} NRF_TWIM_Type;
typedef struct {
volatile const uint32_t RESERVED0[5];
volatile uint32_t TASKS_STOP;
volatile const uint32_t RESERVED1;
volatile uint32_t TASKS_SUSPEND;
volatile uint32_t TASKS_RESUME;
volatile const uint32_t RESERVED2[3];
volatile uint32_t TASKS_PREPARERX;
volatile uint32_t TASKS_PREPARETX;
volatile const uint32_t RESERVED3[51];
volatile uint32_t EVENTS_STOPPED;
volatile const uint32_t RESERVED4[7];
volatile uint32_t EVENTS_ERROR;
volatile const uint32_t RESERVED5[9];
volatile uint32_t EVENTS_RXSTARTED;
volatile uint32_t EVENTS_TXSTARTED;
volatile const uint32_t RESERVED6[4];
volatile uint32_t EVENTS_WRITE;
volatile uint32_t EVENTS_READ;
volatile const uint32_t RESERVED7[37];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED8[63];
volatile uint32_t INTEN;
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED9[113];
volatile uint32_t ERRORSRC;
volatile const uint32_t MATCH;
volatile const uint32_t RESERVED10[10];
volatile uint32_t ENABLE;
volatile const uint32_t RESERVED11;
TWIS_PSEL_Type PSEL;
volatile const uint32_t RESERVED12[9];
TWIS_RXD_Type RXD;
volatile const uint32_t RESERVED13;
TWIS_TXD_Type TXD;
volatile const uint32_t RESERVED14[14];
volatile uint32_t ADDRESS[2];
volatile const uint32_t RESERVED15;
volatile uint32_t CONFIG;
volatile const uint32_t RESERVED16[10];
volatile uint32_t ORC;
} NRF_TWIS_Type;
typedef struct {
volatile const uint32_t RESERVED0[66];
volatile uint32_t EVENTS_READY;
volatile const uint32_t RESERVED1[126];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED2[125];
volatile uint32_t ENABLE;
volatile const uint32_t RESERVED3;
SPI_PSEL_Type PSEL;
volatile const uint32_t RESERVED4;
volatile const uint32_t RXD;
volatile uint32_t TXD;
volatile const uint32_t RESERVED5;
volatile uint32_t FREQUENCY;
volatile const uint32_t RESERVED6[11];
volatile uint32_t CONFIG;
} NRF_SPI_Type;
typedef struct {
volatile uint32_t TASKS_STARTRX;
volatile const uint32_t RESERVED0;
volatile uint32_t TASKS_STARTTX;
volatile const uint32_t RESERVED1[2];
volatile uint32_t TASKS_STOP;
volatile const uint32_t RESERVED2;
volatile uint32_t TASKS_SUSPEND;
volatile uint32_t TASKS_RESUME;
volatile const uint32_t RESERVED3[56];
volatile uint32_t EVENTS_STOPPED;
volatile uint32_t EVENTS_RXDREADY;
volatile const uint32_t RESERVED4[4];
volatile uint32_t EVENTS_TXDSENT;
volatile const uint32_t RESERVED5;
volatile uint32_t EVENTS_ERROR;
volatile const uint32_t RESERVED6[4];
volatile uint32_t EVENTS_BB;
volatile const uint32_t RESERVED7[3];
volatile uint32_t EVENTS_SUSPENDED;
volatile const uint32_t RESERVED8[45];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED9[64];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED10[110];
volatile uint32_t ERRORSRC;
volatile const uint32_t RESERVED11[14];
volatile uint32_t ENABLE;
volatile const uint32_t RESERVED12;
TWI_PSEL_Type PSEL;
volatile const uint32_t RESERVED13[2];
volatile const uint32_t RXD;
volatile uint32_t TXD;
volatile const uint32_t RESERVED14;
volatile uint32_t FREQUENCY;
volatile const uint32_t RESERVED15[24];
volatile uint32_t ADDRESS;
} NRF_TWI_Type;
typedef struct {
volatile uint32_t TASKS_ACTIVATE;
volatile uint32_t TASKS_DISABLE;
volatile uint32_t TASKS_SENSE;
volatile uint32_t TASKS_STARTTX;
volatile const uint32_t RESERVED0[3];
volatile uint32_t TASKS_ENABLERXDATA;
volatile const uint32_t RESERVED1;
volatile uint32_t TASKS_GOIDLE;
volatile uint32_t TASKS_GOSLEEP;
volatile const uint32_t RESERVED2[53];
volatile uint32_t EVENTS_READY;
volatile uint32_t EVENTS_FIELDDETECTED;
volatile uint32_t EVENTS_FIELDLOST;
volatile uint32_t EVENTS_TXFRAMESTART;
volatile uint32_t EVENTS_TXFRAMEEND;
volatile uint32_t EVENTS_RXFRAMESTART;
volatile uint32_t EVENTS_RXFRAMEEND;
volatile uint32_t EVENTS_ERROR;
volatile const uint32_t RESERVED3[2];
volatile uint32_t EVENTS_RXERROR;
volatile uint32_t EVENTS_ENDRX;
volatile uint32_t EVENTS_ENDTX;
volatile const uint32_t RESERVED4;
volatile uint32_t EVENTS_AUTOCOLRESSTARTED;
volatile const uint32_t RESERVED5[3];
volatile uint32_t EVENTS_COLLISION;
volatile uint32_t EVENTS_SELECTED;
volatile uint32_t EVENTS_STARTED;
volatile const uint32_t RESERVED6[43];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED7[63];
volatile uint32_t INTEN;
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED8[62];
volatile uint32_t ERRORSTATUS;
volatile const uint32_t RESERVED9;
NFCT_FRAMESTATUS_Type FRAMESTATUS;
volatile const uint32_t NFCTAGSTATE;
volatile const uint32_t RESERVED10[10];
volatile const uint32_t FIELDPRESENT;
volatile const uint32_t RESERVED11[49];
volatile uint32_t FRAMEDELAYMIN;
volatile uint32_t FRAMEDELAYMAX;
volatile uint32_t FRAMEDELAYMODE;
volatile uint32_t PACKETPTR;
volatile uint32_t MAXLEN;
NFCT_TXD_Type TXD;
NFCT_RXD_Type RXD;
volatile const uint32_t RESERVED12[26];
volatile uint32_t NFCID1_LAST;
volatile uint32_t NFCID1_2ND_LAST;
volatile uint32_t NFCID1_3RD_LAST;
volatile uint32_t AUTOCOLRESCONFIG;
volatile uint32_t SENSRES;
volatile uint32_t SELRES;
} NRF_NFCT_Type;
typedef struct {
volatile uint32_t TASKS_OUT[8];
volatile const uint32_t RESERVED0[4];
volatile uint32_t TASKS_SET[8];
volatile const uint32_t RESERVED1[4];
volatile uint32_t TASKS_CLR[8];
volatile const uint32_t RESERVED2[32];
volatile uint32_t EVENTS_IN[8];
volatile const uint32_t RESERVED3[23];
volatile uint32_t EVENTS_PORT;
volatile const uint32_t RESERVED4[97];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED5[129];
volatile uint32_t CONFIG[8];
} NRF_GPIOTE_Type;
typedef struct {
volatile uint32_t TASKS_START;
volatile uint32_t TASKS_SAMPLE;
volatile uint32_t TASKS_STOP;
volatile uint32_t TASKS_CALIBRATEOFFSET;
volatile const uint32_t RESERVED0[60];
volatile uint32_t EVENTS_STARTED;
volatile uint32_t EVENTS_END;
volatile uint32_t EVENTS_DONE;
volatile uint32_t EVENTS_RESULTDONE;
volatile uint32_t EVENTS_CALIBRATEDONE;
volatile uint32_t EVENTS_STOPPED;
SAADC_EVENTS_CH_Type EVENTS_CH[8];
volatile const uint32_t RESERVED1[106];
volatile uint32_t INTEN;
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED2[61];
volatile const uint32_t STATUS;
volatile const uint32_t RESERVED3[63];
volatile uint32_t ENABLE;
volatile const uint32_t RESERVED4[3];
SAADC_CH_Type CH[8];
volatile const uint32_t RESERVED5[24];
volatile uint32_t RESOLUTION;
volatile uint32_t OVERSAMPLE;
volatile uint32_t SAMPLERATE;
volatile const uint32_t RESERVED6[12];
SAADC_RESULT_Type RESULT;
} NRF_SAADC_Type;
typedef struct {
volatile uint32_t TASKS_START;
volatile uint32_t TASKS_STOP;
volatile uint32_t TASKS_COUNT;
volatile uint32_t TASKS_CLEAR;
volatile uint32_t TASKS_SHUTDOWN;
volatile const uint32_t RESERVED0[11];
volatile uint32_t TASKS_CAPTURE[6];
volatile const uint32_t RESERVED1[58];
volatile uint32_t EVENTS_COMPARE[6];
volatile const uint32_t RESERVED2[42];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED3[64];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED4[126];
volatile uint32_t MODE;
volatile uint32_t BITMODE;
volatile const uint32_t RESERVED5;
volatile uint32_t PRESCALER;
volatile const uint32_t RESERVED6[11];
volatile uint32_t CC[6];
} NRF_TIMER_Type;
typedef struct {
volatile uint32_t TASKS_START;
volatile uint32_t TASKS_STOP;
volatile uint32_t TASKS_CLEAR;
volatile uint32_t TASKS_TRIGOVRFLW;
volatile const uint32_t RESERVED0[60];
volatile uint32_t EVENTS_TICK;
volatile uint32_t EVENTS_OVRFLW;
volatile const uint32_t RESERVED1[14];
volatile uint32_t EVENTS_COMPARE[4];
volatile const uint32_t RESERVED2[109];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED3[13];
volatile uint32_t EVTEN;
volatile uint32_t EVTENSET;
volatile uint32_t EVTENCLR;
volatile const uint32_t RESERVED4[110];
volatile const uint32_t COUNTER;
volatile uint32_t PRESCALER;
volatile const uint32_t RESERVED5[13];
volatile uint32_t CC[4];
} NRF_RTC_Type;
typedef struct {
volatile uint32_t TASKS_START;
volatile uint32_t TASKS_STOP;
volatile const uint32_t RESERVED0[62];
volatile uint32_t EVENTS_DATARDY;
volatile const uint32_t RESERVED1[128];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED2[127];
volatile const int32_t TEMP;
volatile const uint32_t RESERVED3[5];
volatile uint32_t A0;
volatile uint32_t A1;
volatile uint32_t A2;
volatile uint32_t A3;
volatile uint32_t A4;
volatile uint32_t A5;
volatile const uint32_t RESERVED4[2];
volatile uint32_t B0;
volatile uint32_t B1;
volatile uint32_t B2;
volatile uint32_t B3;
volatile uint32_t B4;
volatile uint32_t B5;
volatile const uint32_t RESERVED5[2];
volatile uint32_t T0;
volatile uint32_t T1;
volatile uint32_t T2;
volatile uint32_t T3;
volatile uint32_t T4;
} NRF_TEMP_Type;
typedef struct {
volatile uint32_t TASKS_START;
volatile uint32_t TASKS_STOP;
volatile const uint32_t RESERVED0[62];
volatile uint32_t EVENTS_VALRDY;
volatile const uint32_t RESERVED1[63];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED2[64];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED3[126];
volatile uint32_t CONFIG;
volatile const uint32_t VALUE;
} NRF_RNG_Type;
typedef struct {
volatile uint32_t TASKS_STARTECB;
volatile uint32_t TASKS_STOPECB;
volatile const uint32_t RESERVED0[62];
volatile uint32_t EVENTS_ENDECB;
volatile uint32_t EVENTS_ERRORECB;
volatile const uint32_t RESERVED1[127];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED2[126];
volatile uint32_t ECBDATAPTR;
} NRF_ECB_Type;
typedef struct {
volatile uint32_t TASKS_KSGEN;
volatile uint32_t TASKS_CRYPT;
volatile uint32_t TASKS_STOP;
volatile uint32_t TASKS_RATEOVERRIDE;
volatile const uint32_t RESERVED0[60];
volatile uint32_t EVENTS_ENDKSGEN;
volatile uint32_t EVENTS_ENDCRYPT;
volatile uint32_t EVENTS_ERROR;
volatile const uint32_t RESERVED1[61];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED2[64];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED3[61];
volatile const uint32_t MICSTATUS;
volatile const uint32_t RESERVED4[63];
volatile uint32_t ENABLE;
volatile uint32_t MODE;
volatile uint32_t CNFPTR;
volatile uint32_t INPTR;
volatile uint32_t OUTPTR;
volatile uint32_t SCRATCHPTR;
volatile uint32_t MAXPACKETSIZE;
volatile uint32_t RATEOVERRIDE;
} NRF_CCM_Type;
typedef struct {
volatile uint32_t TASKS_START;
volatile const uint32_t RESERVED0;
volatile uint32_t TASKS_STOP;
volatile const uint32_t RESERVED1[61];
volatile uint32_t EVENTS_END;
volatile uint32_t EVENTS_RESOLVED;
volatile uint32_t EVENTS_NOTRESOLVED;
volatile const uint32_t RESERVED2[126];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED3[61];
volatile const uint32_t STATUS;
volatile const uint32_t RESERVED4[63];
volatile uint32_t ENABLE;
volatile uint32_t NIRK;
volatile uint32_t IRKPTR;
volatile const uint32_t RESERVED5;
volatile uint32_t ADDRPTR;
volatile uint32_t SCRATCHPTR;
} NRF_AAR_Type;
typedef struct {
volatile uint32_t TASKS_START;
volatile const uint32_t RESERVED0[63];
volatile uint32_t EVENTS_TIMEOUT;
volatile const uint32_t RESERVED1[128];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED2[61];
volatile const uint32_t RUNSTATUS;
volatile const uint32_t REQSTATUS;
volatile const uint32_t RESERVED3[63];
volatile uint32_t CRV;
volatile uint32_t RREN;
volatile uint32_t CONFIG;
volatile const uint32_t RESERVED4[60];
volatile uint32_t RR[8];
} NRF_WDT_Type;
typedef struct {
volatile uint32_t TASKS_START;
volatile uint32_t TASKS_STOP;
volatile uint32_t TASKS_READCLRACC;
volatile uint32_t TASKS_RDCLRACC;
volatile uint32_t TASKS_RDCLRDBL;
volatile const uint32_t RESERVED0[59];
volatile uint32_t EVENTS_SAMPLERDY;
volatile uint32_t EVENTS_REPORTRDY;
volatile uint32_t EVENTS_ACCOF;
volatile uint32_t EVENTS_DBLRDY;
volatile uint32_t EVENTS_STOPPED;
volatile const uint32_t RESERVED1[59];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED2[64];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED3[125];
volatile uint32_t ENABLE;
volatile uint32_t LEDPOL;
volatile uint32_t SAMPLEPER;
volatile const int32_t SAMPLE;
volatile uint32_t REPORTPER;
volatile const int32_t ACC;
volatile const int32_t ACCREAD;
QDEC_PSEL_Type PSEL;
volatile uint32_t DBFEN;
volatile const uint32_t RESERVED4[5];
volatile uint32_t LEDPRE;
volatile const uint32_t ACCDBL;
volatile const uint32_t ACCDBLREAD;
} NRF_QDEC_Type;
typedef struct {
volatile uint32_t TASKS_START;
volatile uint32_t TASKS_STOP;
volatile uint32_t TASKS_SAMPLE;
volatile const uint32_t RESERVED0[61];
volatile uint32_t EVENTS_READY;
volatile uint32_t EVENTS_DOWN;
volatile uint32_t EVENTS_UP;
volatile uint32_t EVENTS_CROSS;
volatile const uint32_t RESERVED1[60];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED2[63];
volatile uint32_t INTEN;
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED3[61];
volatile const uint32_t RESULT;
volatile const uint32_t RESERVED4[63];
volatile uint32_t ENABLE;
volatile uint32_t PSEL;
volatile uint32_t REFSEL;
volatile uint32_t EXTREFSEL;
volatile const uint32_t RESERVED5[8];
volatile uint32_t TH;
volatile uint32_t MODE;
volatile uint32_t HYST;
} NRF_COMP_Type;
typedef struct {
volatile uint32_t TASKS_START;
volatile uint32_t TASKS_STOP;
volatile uint32_t TASKS_SAMPLE;
volatile const uint32_t RESERVED0[61];
volatile uint32_t EVENTS_READY;
volatile uint32_t EVENTS_DOWN;
volatile uint32_t EVENTS_UP;
volatile uint32_t EVENTS_CROSS;
volatile const uint32_t RESERVED1[60];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED2[64];
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED3[61];
volatile const uint32_t RESULT;
volatile const uint32_t RESERVED4[63];
volatile uint32_t ENABLE;
volatile uint32_t PSEL;
volatile uint32_t REFSEL;
volatile uint32_t EXTREFSEL;
volatile const uint32_t RESERVED5[4];
volatile uint32_t ANADETECT;
volatile const uint32_t RESERVED6[5];
volatile uint32_t HYST;
} NRF_LPCOMP_Type;
typedef struct {
volatile const uint32_t UNUSED;
} NRF_SWI_Type;
typedef struct {
volatile uint32_t TASKS_TRIGGER[16];
volatile const uint32_t RESERVED0[48];
volatile uint32_t EVENTS_TRIGGERED[16];
volatile const uint32_t RESERVED1[112];
volatile uint32_t INTEN;
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
} NRF_EGU_Type;
typedef struct {
volatile const uint32_t RESERVED0;
volatile uint32_t TASKS_STOP;
volatile uint32_t TASKS_SEQSTART[2];
volatile uint32_t TASKS_NEXTSTEP;
volatile const uint32_t RESERVED1[60];
volatile uint32_t EVENTS_STOPPED;
volatile uint32_t EVENTS_SEQSTARTED[2];
volatile uint32_t EVENTS_SEQEND[2];
volatile uint32_t EVENTS_PWMPERIODEND;
volatile uint32_t EVENTS_LOOPSDONE;
volatile const uint32_t RESERVED2[56];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED3[63];
volatile uint32_t INTEN;
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED4[125];
volatile uint32_t ENABLE;
volatile uint32_t MODE;
volatile uint32_t COUNTERTOP;
volatile uint32_t PRESCALER;
volatile uint32_t DECODER;
volatile uint32_t LOOP;
volatile const uint32_t RESERVED5[2];
PWM_SEQ_Type SEQ[2];
PWM_PSEL_Type PSEL;
} NRF_PWM_Type;
typedef struct {
volatile uint32_t TASKS_START;
volatile uint32_t TASKS_STOP;
volatile const uint32_t RESERVED0[62];
volatile uint32_t EVENTS_STARTED;
volatile uint32_t EVENTS_STOPPED;
volatile uint32_t EVENTS_END;
volatile const uint32_t RESERVED1[125];
volatile uint32_t INTEN;
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED2[125];
volatile uint32_t ENABLE;
volatile uint32_t PDMCLKCTRL;
volatile uint32_t MODE;
volatile const uint32_t RESERVED3[3];
volatile uint32_t GAINL;
volatile uint32_t GAINR;
volatile uint32_t RATIO;
volatile const uint32_t RESERVED4[7];
PDM_PSEL_Type PSEL;
volatile const uint32_t RESERVED5[6];
PDM_SAMPLE_Type SAMPLE;
} NRF_PDM_Type;
typedef struct {
volatile const uint32_t RESERVED0[256];
volatile const uint32_t READY;
volatile const uint32_t RESERVED1;
volatile const uint32_t READYNEXT;
volatile const uint32_t RESERVED2[62];
volatile uint32_t CONFIG;
union {
volatile uint32_t ERASEPAGE;
volatile uint32_t ERASEPCR1;
};
volatile uint32_t ERASEALL;
volatile uint32_t ERASEPCR0;
volatile uint32_t ERASEUICR;
volatile const uint32_t RESERVED3[10];
volatile uint32_t ICACHECNF;
volatile const uint32_t RESERVED4;
volatile uint32_t IHIT;
volatile uint32_t IMISS;
} NRF_NVMC_Type;
typedef struct {
volatile const uint32_t RESERVED0[512];
ACL_ACL_Type ACL[8];
} NRF_ACL_Type;
typedef struct {
PPI_TASKS_CHG_Type TASKS_CHG[6];
volatile const uint32_t RESERVED0[308];
volatile uint32_t CHEN;
volatile uint32_t CHENSET;
volatile uint32_t CHENCLR;
volatile const uint32_t RESERVED1;
PPI_CH_Type CH[20];
volatile const uint32_t RESERVED2[148];
volatile uint32_t CHG[6];
volatile const uint32_t RESERVED3[62];
PPI_FORK_Type FORK[32];
} NRF_PPI_Type;
typedef struct {
volatile const uint32_t RESERVED0[64];
MWU_EVENTS_REGION_Type EVENTS_REGION[4];
volatile const uint32_t RESERVED1[16];
MWU_EVENTS_PREGION_Type EVENTS_PREGION[2];
volatile const uint32_t RESERVED2[100];
volatile uint32_t INTEN;
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED3[5];
volatile uint32_t NMIEN;
volatile uint32_t NMIENSET;
volatile uint32_t NMIENCLR;
volatile const uint32_t RESERVED4[53];
MWU_PERREGION_Type PERREGION[2];
volatile const uint32_t RESERVED5[64];
volatile uint32_t REGIONEN;
volatile uint32_t REGIONENSET;
volatile uint32_t REGIONENCLR;
volatile const uint32_t RESERVED6[57];
MWU_REGION_Type REGION[4];
volatile const uint32_t RESERVED7[32];
MWU_PREGION_Type PREGION[2];
} NRF_MWU_Type;
typedef struct {
volatile uint32_t TASKS_START;
volatile uint32_t TASKS_STOP;
volatile const uint32_t RESERVED0[63];
volatile uint32_t EVENTS_RXPTRUPD;
volatile uint32_t EVENTS_STOPPED;
volatile const uint32_t RESERVED1[2];
volatile uint32_t EVENTS_TXPTRUPD;
volatile const uint32_t RESERVED2[122];
volatile uint32_t INTEN;
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED3[125];
volatile uint32_t ENABLE;
I2S_CONFIG_Type CONFIG;
volatile const uint32_t RESERVED4[3];
I2S_RXD_Type RXD;
volatile const uint32_t RESERVED5;
I2S_TXD_Type TXD;
volatile const uint32_t RESERVED6[3];
I2S_RXTXD_Type RXTXD;
volatile const uint32_t RESERVED7[3];
I2S_PSEL_Type PSEL;
} NRF_I2S_Type;
typedef struct {
volatile const uint32_t UNUSED;
} NRF_FPU_Type;
typedef struct {
volatile const uint32_t RESERVED0;
volatile uint32_t TASKS_STARTEPIN[8];
volatile uint32_t TASKS_STARTISOIN;
volatile uint32_t TASKS_STARTEPOUT[8];
volatile uint32_t TASKS_STARTISOOUT;
volatile uint32_t TASKS_EP0RCVOUT;
volatile uint32_t TASKS_EP0STATUS;
volatile uint32_t TASKS_EP0STALL;
volatile uint32_t TASKS_DPDMDRIVE;
volatile uint32_t TASKS_DPDMNODRIVE;
volatile const uint32_t RESERVED1[40];
volatile uint32_t EVENTS_USBRESET;
volatile uint32_t EVENTS_STARTED;
volatile uint32_t EVENTS_ENDEPIN[8];
volatile uint32_t EVENTS_EP0DATADONE;
volatile uint32_t EVENTS_ENDISOIN;
volatile uint32_t EVENTS_ENDEPOUT[8];
volatile uint32_t EVENTS_ENDISOOUT;
volatile uint32_t EVENTS_SOF;
volatile uint32_t EVENTS_USBEVENT;
volatile uint32_t EVENTS_EP0SETUP;
volatile uint32_t EVENTS_EPDATA;
volatile uint32_t EVENTS_ACCESSFAULT;
volatile const uint32_t RESERVED2[38];
volatile uint32_t SHORTS;
volatile const uint32_t RESERVED3[63];
volatile uint32_t INTEN;
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED4[61];
volatile uint32_t EVENTCAUSE;
volatile const uint32_t BUSSTATE;
volatile const uint32_t RESERVED5[6];
USBD_HALTED_Type HALTED;
volatile const uint32_t RESERVED6;
volatile uint32_t EPSTATUS;
volatile uint32_t EPDATASTATUS;
volatile const uint32_t USBADDR;
volatile const uint32_t RESERVED7[3];
volatile const uint32_t BMREQUESTTYPE;
volatile const uint32_t BREQUEST;
volatile const uint32_t WVALUEL;
volatile const uint32_t WVALUEH;
volatile const uint32_t WINDEXL;
volatile const uint32_t WINDEXH;
volatile const uint32_t WLENGTHL;
volatile const uint32_t WLENGTHH;
USBD_SIZE_Type SIZE;
volatile const uint32_t RESERVED8[15];
volatile uint32_t ENABLE;
volatile uint32_t USBPULLUP;
volatile uint32_t DPDMVALUE;
volatile uint32_t DTOGGLE;
volatile uint32_t EPINEN;
volatile uint32_t EPOUTEN;
volatile uint32_t EPSTALL;
volatile uint32_t ISOSPLIT;
volatile const uint32_t FRAMECNTR;
volatile const uint32_t RESERVED9[2];
volatile uint32_t LOWPOWER;
volatile uint32_t ISOINCONFIG;
volatile const uint32_t RESERVED10[51];
USBD_EPIN_Type EPIN[8];
USBD_ISOIN_Type ISOIN;
volatile const uint32_t RESERVED11[21];
USBD_EPOUT_Type EPOUT[8];
USBD_ISOOUT_Type ISOOUT;
} NRF_USBD_Type;
typedef struct {
volatile uint32_t TASKS_ACTIVATE;
volatile uint32_t TASKS_READSTART;
volatile uint32_t TASKS_WRITESTART;
volatile uint32_t TASKS_ERASESTART;
volatile uint32_t TASKS_DEACTIVATE;
volatile const uint32_t RESERVED0[59];
volatile uint32_t EVENTS_READY;
volatile const uint32_t RESERVED1[127];
volatile uint32_t INTEN;
volatile uint32_t INTENSET;
volatile uint32_t INTENCLR;
volatile const uint32_t RESERVED2[125];
volatile uint32_t ENABLE;
QSPI_READ_Type READ;
QSPI_WRITE_Type WRITE;
QSPI_ERASE_Type ERASE;
QSPI_PSEL_Type PSEL;
volatile uint32_t XIPOFFSET;
volatile uint32_t IFCONFIG0;
volatile const uint32_t RESERVED3[46];
volatile uint32_t IFCONFIG1;
volatile const uint32_t STATUS;
volatile const uint32_t RESERVED4[3];
volatile uint32_t DPMDUR;
volatile const uint32_t RESERVED5[3];
volatile uint32_t ADDRCONF;
volatile const uint32_t RESERVED6[3];
volatile uint32_t CINSTRCONF;
volatile uint32_t CINSTRDAT0;
volatile uint32_t CINSTRDAT1;
volatile uint32_t IFTIMING;
} NRF_QSPI_Type;
typedef struct {
volatile const uint32_t RESERVED0[321];
volatile uint32_t OUT;
volatile uint32_t OUTSET;
volatile uint32_t OUTCLR;
volatile const uint32_t IN;
volatile uint32_t DIR;
volatile uint32_t DIRSET;
volatile uint32_t DIRCLR;
volatile uint32_t LATCH;
volatile uint32_t DETECTMODE;
volatile const uint32_t RESERVED1[118];
volatile uint32_t PIN_CNF[32];
} NRF_GPIO_Type;
typedef struct {
volatile const uint32_t RESERVED0[320];
volatile uint32_t ENABLE;
} NRF_CRYPTOCELL_Type;
static inline unsigned int gcc_current_sp(void)
{
register unsigned sp __asm("sp");
return sp;
}
struct ll_filter {
u8_t enable_bitmask;
u8_t addr_type_bitmask;
u8_t bdaddr[8][6];
};
void ll_filter_reset(
_Bool
init);
void ll_filters_adv_update(u8_t adv_fp);
void ll_filters_scan_update(u8_t scan_fp);
struct ll_filter *ctrl_filter_get(
_Bool
whitelist);
bt_addr_t *ctrl_lrpa_get(u8_t rl_idx);
u8_t *ctrl_irks_get(u8_t *count);
u8_t ctrl_rl_idx(
_Bool
whitelist, u8_t devmatch_id);
u8_t ctrl_rl_irk_idx(u8_t irkmatch_id);
_Bool
ctrl_irk_whitelisted(u8_t rl_idx);
_Bool
ctrl_rl_enabled(void);
void ll_rl_rpa_update(
_Bool
timeout);
u8_t ll_rl_find(u8_t id_addr_type, u8_t *id_addr, u8_t *free);
_Bool
ctrl_rl_addr_allowed(u8_t id_addr_type, u8_t *id_addr, u8_t *rl_idx);
_Bool
ctrl_rl_addr_resolve(u8_t id_addr_type, u8_t *id_addr, u8_t rl_idx);
_Bool
ctrl_rl_idx_allowed(u8_t irkmatch_ok, u8_t rl_idx);
void ll_rl_pdu_adv_update(u8_t idx, struct pdu_adv *pdu);
struct ll_adv_set {
u8_t chan_map:3;
u8_t filter_policy:2;
u16_t interval;
};
struct ll_adv_set *ll_adv_set_get(void);
static struct ll_adv_set ll_adv;
struct ll_adv_set *ll_adv_set_get(void)
{
return &ll_adv;
}
u32_t ll_adv_params_set(u16_t interval, u8_t adv_type,
u8_t own_addr_type, u8_t direct_addr_type,
u8_t const *const direct_addr, u8_t chan_map,
u8_t filter_policy)
{
u8_t const pdu_adv_type[] = {PDU_ADV_TYPE_ADV_IND,
PDU_ADV_TYPE_DIRECT_IND,
PDU_ADV_TYPE_SCAN_IND,
PDU_ADV_TYPE_NONCONN_IND,
PDU_ADV_TYPE_DIRECT_IND};
struct radio_adv_data *radio_adv_data;
struct pdu_adv *pdu;
if (radio_adv_is_enabled()) {
return 0x0c;
}
if (adv_type != 0x01) {
ll_adv.interval = interval;
} else {
ll_adv.interval = 0;
}
ll_adv.chan_map = chan_map;
ll_adv.filter_policy = filter_policy;
radio_adv_data = radio_adv_data_get();
pdu = (struct pdu_adv *)&radio_adv_data->data[radio_adv_data->last][0];
pdu->type = pdu_adv_type[adv_type];
pdu->rfu = 0;
if (1 &&
((pdu->type == PDU_ADV_TYPE_ADV_IND) ||
(pdu->type == PDU_ADV_TYPE_DIRECT_IND))) {
pdu->chan_sel = 1;
} else {
pdu->chan_sel = 0;
}
pdu->tx_addr = own_addr_type & 0x1;
pdu->rx_addr = 0;
if (pdu->type == PDU_ADV_TYPE_DIRECT_IND) {
pdu->rx_addr = direct_addr_type;
memcpy(&pdu->payload.direct_ind.tgt_addr[0], direct_addr,
6);
pdu->len = sizeof(struct pdu_adv_payload_direct_ind);
} else if (pdu->len == 0) {
pdu->len = 6;
}
radio_adv_data = radio_scan_data_get();
pdu = (struct pdu_adv *)&radio_adv_data->data[radio_adv_data->last][0];
pdu->type = PDU_ADV_TYPE_SCAN_RSP;
pdu->rfu = 0;
pdu->chan_sel = 0;
pdu->tx_addr = own_addr_type & 0x1;
pdu->rx_addr = 0;
if (pdu->len == 0) {
pdu->len = 6;
}
return 0;
}
void ll_adv_data_set(u8_t len, u8_t const *const data)
{
struct radio_adv_data *radio_adv_data;
struct pdu_adv *prev;
struct pdu_adv *pdu;
u8_t last;
radio_adv_data = radio_adv_data_get();
prev = (struct pdu_adv *)&radio_adv_data->data[radio_adv_data->last][0];
if ((prev->type == PDU_ADV_TYPE_DIRECT_IND) ||
(0 &&
(prev->type == PDU_ADV_TYPE_EXT_IND))) {
return;
}
if (radio_adv_data->first == radio_adv_data->last) {
last = radio_adv_data->last + 1;
if (last == 2) {
last = 0;
}
} else {
last = radio_adv_data->last;
}
pdu = (struct pdu_adv *)&radio_adv_data->data[last][0];
pdu->type = prev->type;
pdu->rfu = 0;
if (1) {
pdu->chan_sel = prev->chan_sel;
} else {
pdu->chan_sel = 0;
}
pdu->tx_addr = prev->tx_addr;
pdu->rx_addr = prev->rx_addr;
memcpy(&pdu->payload.adv_ind.addr[0],
&prev->payload.adv_ind.addr[0], 6);
memcpy(&pdu->payload.adv_ind.data[0], data, len);
pdu->len = 6 + len;
radio_adv_data->last = last;
}
void ll_scan_data_set(u8_t len, u8_t const *const data)
{
struct radio_adv_data *radio_scan_data;
struct pdu_adv *prev;
struct pdu_adv *pdu;
u8_t last;
radio_scan_data = radio_scan_data_get();
if (radio_scan_data->first == radio_scan_data->last) {
last = radio_scan_data->last + 1;
if (last == 2) {
last = 0;
}
} else {
last = radio_scan_data->last;
}
prev = (struct pdu_adv *)
&radio_scan_data->data[radio_scan_data->last][0];
pdu = (struct pdu_adv *)&radio_scan_data->data[last][0];
pdu->type = PDU_ADV_TYPE_SCAN_RSP;
pdu->rfu = 0;
pdu->chan_sel = 0;
pdu->tx_addr = prev->tx_addr;
pdu->rx_addr = 0;
pdu->len = 6 + len;
memcpy(&pdu->payload.scan_rsp.addr[0],
&prev->payload.scan_rsp.addr[0], 6);
memcpy(&pdu->payload.scan_rsp.data[0], data, len);
radio_scan_data->last = last;
}
u32_t ll_adv_enable(u8_t enable)
{
struct radio_adv_data *radio_scan_data;
struct radio_adv_data *radio_adv_data;
u8_t rl_idx = 0xFF;
struct pdu_adv *pdu_scan;
struct pdu_adv *pdu_adv;
u32_t status;
if (!enable) {
return radio_adv_disable();
} else if (radio_adv_is_enabled()) {
return 0;
}
radio_adv_data = radio_adv_data_get();
radio_scan_data = radio_scan_data_get();
pdu_adv = (struct pdu_adv *)&radio_adv_data->data
[radio_adv_data->last][0];
pdu_scan = (struct pdu_adv *)&radio_scan_data->data
[radio_scan_data->last][0];
if (0) {
} else {
_Bool
priv =
0
;
if (!priv) {
memcpy(&pdu_adv->payload.adv_ind.addr[0],
ll_addr_get(pdu_adv->tx_addr,
((void *)0)
), 6);
memcpy(&pdu_scan->payload.scan_rsp.addr[0],
ll_addr_get(pdu_adv->tx_addr,
((void *)0)
), 6);
}
}
status = radio_adv_enable(ll_adv.interval, ll_adv.chan_map,
ll_adv.filter_policy, rl_idx);
return status;
}
|
the_stack_data/1265393.c | /*******************************************************************************
* Copyright (c) 2010-2017 Analog Devices, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Modified versions of the software must be conspicuously marked as such.
* - This software is licensed solely and exclusively for use with processors
* manufactured by or for Analog Devices, Inc.
* - This software may not be combined or merged with other code in any manner
* that would cause the software to become subject to terms and conditions
* which differ from those listed here.
* - Neither the name of Analog Devices, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* - The use of this software may or may not infringe the patent rights of one
* or more patent holders. This license does not release you from the
* requirement that you obtain separate licenses from these patent holders
* to use this software.
*
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-
* INFRINGEMENT, TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF
* CLAIMS OF INTELLECTUAL PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#if defined(DEVICE_TRNG)
#include <stdlib.h>
#include <drivers/rng/adi_rng.h>
#include <drivers/pwr/adi_pwr.h>
#include "adi_rng_def.h"
#include "cmsis.h"
#include "trng_api.h"
#include "objects.h"
// Sampling counter values
// Prescaler: 0 - 10
// LenReload: 0 - 4095
#define TRNG_CNT_VAL 4095
#define TRNG_PRESCALER 2
/* RNG Device memory */
static uint8_t RngDevMem[ADI_RNG_MEMORY_SIZE];
void trng_init(trng_t *obj)
{
ADI_RNG_HANDLE RNGhDevice;
// Open the device
adi_rng_Open(0,RngDevMem,sizeof(RngDevMem),&RNGhDevice);
// Set sample length for the H/W RN accumulator
adi_rng_SetSampleLen(RNGhDevice, TRNG_PRESCALER, TRNG_CNT_VAL);
// Disable buffering - single byte generation only
adi_rng_EnableBuffering(RNGhDevice, false);
// Enable the TRNG
adi_rng_Enable(RNGhDevice, true);
// Save device handle
obj->RNGhDevice = RNGhDevice;
}
void trng_free(trng_t *obj)
{
ADI_RNG_HANDLE RNGhDevice = obj->RNGhDevice;
adi_rng_Enable(RNGhDevice, false);
adi_rng_Close(RNGhDevice);
}
int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_length)
{
ADI_RNG_HANDLE RNGhDevice = obj->RNGhDevice;
bool bRNGRdy, bStuck;
uint32_t i;
volatile uint32_t nRandomNum;
ADI_RNG_RESULT result;
ADI_RNG_DEV_TYPE *pDevice = (ADI_RNG_DEV_TYPE*)RNGhDevice;
for (i = 0; i < length; i++) {
// Loop until the device has data to be read
do {
result = adi_rng_GetRdyStatus(RNGhDevice, &bRNGRdy);
if (result != ADI_RNG_SUCCESS) {
return -1;
}
} while (!bRNGRdy);
// Check the STUCK bit to make sure the oscillator output isn't stuck
result = adi_rng_GetStuckStatus(RNGhDevice, &bStuck);
// If the stuck bit is set, this means there may be a problem with RNG hardware,
// exit with an error
if ( (result != ADI_RNG_SUCCESS) || ((result == ADI_RNG_SUCCESS) && (bStuck)) ) {
// Clear the STUCK bit by writing a 1 to it
pDevice->pRNG->STAT |= BITM_RNG_STAT_STUCK;
return -1;
}
// Read the RNG
result = adi_rng_GetRngData(RNGhDevice, (uint32_t*)(&nRandomNum));
if (result != ADI_RNG_SUCCESS) {
return -1;
}
// Save the output
output[i] = (uint8_t)(nRandomNum & 0xFF);
}
*output_length = length;
// Clear nRandomNum on the stack before exiting
nRandomNum = 0;
return 0;
}
#endif
|
the_stack_data/192330907.c | #include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/stat.h>
char *__randname(char *);
char *mkdtemp(char *template)
{
size_t l = strlen(template);
int retries = 100;
if (l<6 || memcmp(template+l-6, "XXXXXX", 6)) {
errno = EINVAL;
return 0;
}
do {
__randname(template+l-6);
if (!mkdir(template, 0700)) return template;
} while (--retries && errno == EEXIST);
memcpy(template+l-6, "XXXXXX", 6);
return 0;
}
|
the_stack_data/70451173.c | #include <stdio.h>
#include <stdlib.h>
/*
* Counting Sort
*
* Stable version.
*
*/
int main(int argc, char const *argv[])
{
int b[] = {10, 9, 1, 44, 67, 100, 56, 7, 2, 44, 99, 54, 99, 34, 400, 93, 123, 400};
int size = sizeof(b)/sizeof(b[0]);
int count[500] = {0};
for (int i = 0; i < size; ++i)
{
count[b[i]]++;
}
// for (int i = 0; i < 500; ++i)
// {
// printf("%d ", count[i]);
// }
for (int i = 1; i < 500; ++i)
{
count[i] += count[i-1];
}
// for (int i = 0; i < 500; ++i)
// {
// printf("%d ", count[i]);
// }
int res[size];
for (int i = size - 1; i >= 0; --i)
{
res[count[b[i]]] = b[i];
count[b[i]]--;
}
for (int i = 1; i <= size; ++i)
{
printf("%d ", res[i]);
}
printf("\n");
return 0;
}
|
the_stack_data/97014000.c | #include <stdio.h>
int main()
{
int arr[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20};
int *aptr = arr;
/* This gives us an idea of the memory map */
printf("arr %p\n", arr);
printf("aptr %p\n", aptr);
printf("arr[1] %p\n", &arr[1]);
printf("arr[2] %p\n", &arr[2]);
printf("&aptr %p\n", &aptr);
/* end memory map */
++aptr;
printf("*aptr %i\n", *aptr);
printf("aptr %p\n", aptr);
// Command being executed is *aptr++
printf("*aptr++ %i\n", *aptr++);
printf("aptr %p\n", aptr);
// // Command being executed is *++aptr
printf("*++aptr %i\n", *++aptr);
printf("aptr %p\n", aptr);
*aptr += 1;
printf("*aptr %i\n", *aptr);
printf("aptr %p\n", aptr);
// // Command being executed is *(aptr+1)
printf("*(aptr+1) %i\n", *(aptr+1));
*(arr+2) = *aptr+100;
printf("*(arr+2) %i\n", *(arr+2));
//
aptr = arr + 5;
printf("*aptr %i\n", *aptr);
printf("aptr %p\n", aptr);
*(arr+2) =*aptr +5;
printf("*arr[2] %i\n", arr[2]);
aptr = (arr + 10);
printf("aptr %p\n", aptr);
printf("*aptr %i\n", *aptr);
//*aptr + 4 = *arr+2;
return 0;
}
|
the_stack_data/82949433.c | /* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <sys/syscall.h>
#if defined __NR_sched_setaffinity && defined __USE_GNU
# include <sched.h>
# include <sys/types.h>
# include <string.h>
# include <unistd.h>
# include <alloca.h>
# define __NR___syscall_sched_setaffinity __NR_sched_setaffinity
static __always_inline _syscall3(int, __syscall_sched_setaffinity, __kernel_pid_t, pid,
size_t, cpusetsize, const cpu_set_t *, cpuset)
static size_t __kernel_cpumask_size;
int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset)
{
size_t cnt;
int res;
size_t psize = 128;
void *p = alloca (psize);
if (unlikely (__kernel_cpumask_size == 0)) {
INTERNAL_SYSCALL_DECL (err);
while (res = INTERNAL_SYSCALL (sched_getaffinity, err, 3, getpid (),
psize, p),
INTERNAL_SYSCALL_ERROR_P (res, err)
&& INTERNAL_SYSCALL_ERRNO (res, err) == EINVAL)
p = extend_alloca (p, psize, 2 * psize);
if (res == 0 || INTERNAL_SYSCALL_ERROR_P (res, err)) {
__set_errno (INTERNAL_SYSCALL_ERRNO (res, err));
return -1;
}
__kernel_cpumask_size = res;
}
/* We now know the size of the kernel cpumask_t. Make sure the user
does not request to set a bit beyond that. */
for (cnt = __kernel_cpumask_size; cnt < cpusetsize; ++cnt)
if (((char *) cpuset)[cnt] != '\0') {
/* Found a nonzero byte. This means the user request cannot be
fulfilled. */
__set_errno (EINVAL);
return -1;
}
return __syscall_sched_setaffinity(pid, cpusetsize, cpuset);
}
#endif
|
the_stack_data/291215.c | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *name;
int size;
void (*(*_vtable)[])();
} metadata;
typedef struct {
metadata *clazz;
} object;
object *alloc(metadata *clazz) {
object *p = calloc(1, clazz->size); // wipe to 0s
p->clazz = clazz;
return p;
}
// D e f i n e C l a s s Animal
typedef struct {
metadata *clazz;
int ID;
} Animal;
void (*Animal_vtable[])() = {
};
metadata Animal_metadata = {"Animal", sizeof(Animal), &Animal_vtable};
// D e f i n e C l a s s Dog
typedef struct {
metadata *clazz;
int ID;
} Dog;
void (*Dog_vtable[])() = {
};
metadata Dog_metadata = {"Dog", sizeof(Dog), &Dog_vtable};
// D e f i n e C l a s s Pekinese
typedef struct {
metadata *clazz;
int ID;
} Pekinese;
void (*Pekinese_vtable[])() = {
};
metadata Pekinese_metadata = {"Pekinese", sizeof(Pekinese), &Pekinese_vtable};
int main(int argc, char *argv[])
{
Pekinese * d;
d = ((Pekinese *)alloc(&Pekinese_metadata));
d->ID = 5;
printf("%d\n", d->ID);
return 0;
} |
the_stack_data/1808.c | // RUN: clang %S/../Inputs/test-2.c -o %t.so --target=%arm_triple -fuse-ld=lld -shared
// RUN: llvm-mctoll -d %t.so
// RUN: clang -o %t1 %s %t-dis.ll -mx32
// RUN: %t1 2>&1 | FileCheck %s
// CHECK: test_2_func result 7
#include <stdio.h>
extern long test_2_func(int a, long b);
int main() {
printf("test_2_func result %ld\n", test_2_func(2, 3));
return 0;
}
|
the_stack_data/17783.c | #include "stdio.h"
long long x = 2;
long long y = 3;
long long z = 1;
long long r;
int main() {
if (x > y)
{
if (x > z)
r = x;
else
r = z;
} else {
if (y > z)
r = y;
else
r = z;
}
printf("%d\n", r);
return 0;
}
|
the_stack_data/138574.c | #include <stdio.h>
#include <stdlib.h>
struct Node
{
int data;
struct Node *next;
}*first=NULL;
void create(int A[],int n)
{
int i;
struct Node *t,*last;
first=(struct Node *)malloc(sizeof(struct Node));
first->data=A[0];
first->next=NULL;
last=first;
for(i=1;i<n;i++) {
t=(struct Node*)malloc(sizeof(struct Node));
t->data=A[i];
t->next=NULL;
last->next=t;
last=t;
}
}
void Display(struct Node *p)
{
while(p!=NULL) {
printf("%d ",p->data);
p=p->next;
}
}
void RDisplay(struct Node *p)
{
if(p!=NULL) {
RDisplay(p->next);
printf("%d ",p->data);
}
}
int main()
{
struct Node *temp;
int A[]={3,5,7,10,25,8,32,2};
create(A,8);
Display(first);
return 0;
}
|
the_stack_data/32951087.c | /* $OpenBSD: auth2-gss.c,v 1.22 2015/01/19 20:07:45 markus Exp $ */
/*
* Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef GSSAPI
#include <sys/types.h>
#include "xmalloc.h"
#include "key.h"
#include "hostfile.h"
#include "auth.h"
#include "ssh2.h"
#include "log.h"
#include "dispatch.h"
#include "buffer.h"
#include "servconf.h"
#include "packet.h"
#include "ssh-gss.h"
#include "monitor_wrap.h"
extern ServerOptions options;
static int input_gssapi_token(int type, u_int32_t plen, void *ctxt);
static int input_gssapi_mic(int type, u_int32_t plen, void *ctxt);
static int input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt);
static int input_gssapi_errtok(int, u_int32_t, void *);
/*
* We only support those mechanisms that we know about (ie ones that we know
* how to check local user kuserok and the like)
*/
static int
userauth_gssapi(Authctxt *authctxt)
{
gss_OID_desc goid = {0, NULL};
Gssctxt *ctxt = NULL;
int mechs;
int present;
OM_uint32 ms;
u_int len;
u_char *doid = NULL;
if (!authctxt->valid || authctxt->user == NULL)
return (0);
mechs = packet_get_int();
if (mechs == 0) {
debug("Mechanism negotiation is not supported");
return (0);
}
do {
mechs--;
free(doid);
present = 0;
doid = packet_get_string(&len);
if (len > 2 && doid[0] == SSH_GSS_OIDTYPE &&
doid[1] == len - 2) {
goid.elements = doid + 2;
goid.length = len - 2;
ssh_gssapi_test_oid_supported(&ms, &goid, &present);
} else {
logit("Badly formed OID received");
}
} while (mechs > 0 && !present);
if (!present) {
free(doid);
authctxt->server_caused_failure = 1;
return (0);
}
if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, &goid)))) {
if (ctxt != NULL)
ssh_gssapi_delete_ctx(&ctxt);
free(doid);
authctxt->server_caused_failure = 1;
return (0);
}
authctxt->methoddata = (void *)ctxt;
packet_start(SSH2_MSG_USERAUTH_GSSAPI_RESPONSE);
/* Return the OID that we received */
packet_put_string(doid, len);
packet_send();
free(doid);
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_TOKEN, &input_gssapi_token);
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_ERRTOK, &input_gssapi_errtok);
authctxt->postponed = 1;
return (0);
}
static int
input_gssapi_token(int type, u_int32_t plen, void *ctxt)
{
Authctxt *authctxt = ctxt;
Gssctxt *gssctxt;
gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER;
gss_buffer_desc recv_tok;
OM_uint32 maj_status, min_status, flags;
u_int len;
if (authctxt == NULL || (authctxt->methoddata == NULL && !use_privsep))
fatal("No authentication or GSSAPI context");
gssctxt = authctxt->methoddata;
recv_tok.value = packet_get_string(&len);
recv_tok.length = len; /* u_int vs. size_t */
packet_check_eom();
maj_status = PRIVSEP(ssh_gssapi_accept_ctx(gssctxt, &recv_tok,
&send_tok, &flags));
free(recv_tok.value);
if (GSS_ERROR(maj_status)) {
if (send_tok.length != 0) {
packet_start(SSH2_MSG_USERAUTH_GSSAPI_ERRTOK);
packet_put_string(send_tok.value, send_tok.length);
packet_send();
}
authctxt->postponed = 0;
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
userauth_finish(authctxt, 0, "gssapi-with-mic", NULL);
} else {
if (send_tok.length != 0) {
packet_start(SSH2_MSG_USERAUTH_GSSAPI_TOKEN);
packet_put_string(send_tok.value, send_tok.length);
packet_send();
}
if (maj_status == GSS_S_COMPLETE) {
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
if (flags & GSS_C_INTEG_FLAG)
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC,
&input_gssapi_mic);
else
dispatch_set(
SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE,
&input_gssapi_exchange_complete);
}
}
gss_release_buffer(&min_status, &send_tok);
return 0;
}
static int
input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
{
Authctxt *authctxt = ctxt;
Gssctxt *gssctxt;
gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER;
gss_buffer_desc recv_tok;
OM_uint32 maj_status;
u_int len;
if (authctxt == NULL || (authctxt->methoddata == NULL && !use_privsep))
fatal("No authentication or GSSAPI context");
gssctxt = authctxt->methoddata;
recv_tok.value = packet_get_string(&len);
recv_tok.length = len;
packet_check_eom();
/* Push the error token into GSSAPI to see what it says */
maj_status = PRIVSEP(ssh_gssapi_accept_ctx(gssctxt, &recv_tok,
&send_tok, NULL));
free(recv_tok.value);
/* We can't return anything to the client, even if we wanted to */
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_ERRTOK, NULL);
/* The client will have already moved on to the next auth */
gss_release_buffer(&maj_status, &send_tok);
return 0;
}
/*
* This is called when the client thinks we've completed authentication.
* It should only be enabled in the dispatch handler by the function above,
* which only enables it once the GSSAPI exchange is complete.
*/
static int
input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt)
{
Authctxt *authctxt = ctxt;
int authenticated;
if (authctxt == NULL || (authctxt->methoddata == NULL && !use_privsep))
fatal("No authentication or GSSAPI context");
/*
* We don't need to check the status, because we're only enabled in
* the dispatcher once the exchange is complete
*/
packet_check_eom();
authenticated = PRIVSEP(ssh_gssapi_userok(authctxt->user));
authctxt->postponed = 0;
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_ERRTOK, NULL);
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL);
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL);
userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL);
return 0;
}
static int
input_gssapi_mic(int type, u_int32_t plen, void *ctxt)
{
Authctxt *authctxt = ctxt;
Gssctxt *gssctxt;
int authenticated = 0;
Buffer b;
gss_buffer_desc mic, gssbuf;
u_int len;
if (authctxt == NULL || (authctxt->methoddata == NULL && !use_privsep))
fatal("No authentication or GSSAPI context");
gssctxt = authctxt->methoddata;
mic.value = packet_get_string(&len);
mic.length = len;
ssh_gssapi_buildmic(&b, authctxt->user, authctxt->service,
"gssapi-with-mic");
gssbuf.value = buffer_ptr(&b);
gssbuf.length = buffer_len(&b);
if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gssctxt, &gssbuf, &mic))))
authenticated = PRIVSEP(ssh_gssapi_userok(authctxt->user));
else
logit("GSSAPI MIC check failed");
buffer_free(&b);
free(mic.value);
authctxt->postponed = 0;
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_ERRTOK, NULL);
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL);
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL);
userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL);
return 0;
}
Authmethod method_gssapi = {
"gssapi-with-mic",
userauth_gssapi,
&options.gss_authentication
};
#endif
|
the_stack_data/190768064.c | #include <stdio.h>
#include <stdlib.h>
void greska()
{
fprintf(stderr,"-1\n");
exit(EXIT_FAILURE);
}
//1 5 3 2 4
int poredi_rastuce(int a, int b)
{
if(a<b)
return 1;
else return 0;
}
int poredi_opadajuce(int a, int b) {
if(a>b)
return 1;
else return 0;
}
void insertion_sort(int * A, int n, int (*poredi)(int,int) )
{
int i,j;
for(i=1; i<n; i++) {
for(j=i; j>0 && (*poredi)(A[j],A[j-1]); j--) {
int tmp = A[j-1];
A[j-1] = A[j];
A[j] = tmp;
}
}
}
int nadji_min(int * A, int n, int (*poredi)(int,int)) //max za opadajuci
{
int i;
int m = A[0];
int m_koef = 0;
for(i=0; i<n; i++) {
if((*poredi)(A[i],m)) {
m = A[i];
m_koef = i;
}
}
return m_koef;
}
void razmeni (int * A, int n, int m)
{
int temp = A[0];
A[0] = A[m];
A[m] = temp;
}
//1 5 9 8 2
//1 5 9 8 2
//l d
//1 5 9 8 2
void selection_sort(int * A, int n, int (*poredi)(int,int))
{
if(n == 1)
return;
int min = nadji_min(A,n,poredi);
razmeni(A,n,min);
selection_sort(A+1, n-1,poredi);
}
// 1 4 2 3 5
void merge(int * A, int n1, int * B, int n2, int * P, int (*poredi)(int,int))
{
int i=0, j=0,k=0;
while(i<n1 && j<n2) {
if((*poredi)(A[i],B[j]))
P[k++] = A[i++];
else
P[k++] = B[j++];
}
while(i<n1)
P[k++] = A[i++];
while(j < n2)
P[k++] = B[j++];
}
void merge_sort(int * A, int l, int d, int * pom, int (*poredi)(int,int))
{
if(l>=d)
return;
int n = d - l + 1;
int s = l + n/2;
int n1 = s - l; int n2 = n - n1;
merge_sort(A, l,s-1, pom,poredi);
merge_sort(A,s,d,pom,poredi );
merge(A+l, n1, A+s, n2, pom,poredi);
int i,j;
for(i=l,j=0; i<=d; i++,j++)
A[i] = pom[j];
}
// 2 4 4 7 5 3 2 3 5 6 7 9 3
//
int particionisanje(int * A, int l, int d, int (*poredi)(int,int))
{
int pivot = A[l];
while(l<d) {
while((*poredi)(A[d],pivot) == 0 && l<d) {
d--;
}
if(l != d) {
A[l++] = A[d];
}
while((*poredi)(pivot,A[l]) == 0 && l<d) {
l++;
}
if(l != d) {
A[d--] = A[l];
}
}
A[l] = pivot;
return l;
}
void quick_sort(int * A, int l, int d, int (*poredi)(int,int))
{
if(l>=d)
return;
int poz_pivota = particionisanje(A,l,d,poredi);
quick_sort(A,l, poz_pivota - 1,poredi);
quick_sort(A, poz_pivota+1, d,poredi);
}
int porednjenje_rastuce(const void *a, const void * b)
{
int a1 = *(int *)a;
int b1 = *(int *)b;
if(a1<b1)
return -1;
if(a1>b1)
return 1;
return 0;
}
int porednjenje_opadajuce(const void *a, const void * b)
{
int a1 = *(int *)a;
int b1 = *(int *)b;
if(a1>b1)
return -1;
if(a1<b1)
return 1;
return 0;
}
int main ()
{
int n;
int *A,*p;
int i;
scanf("%d", &n);
if(n<1)
greska();
A = malloc(n * sizeof(int));
if(A == NULL)
greska();
p= malloc(n * sizeof(int));
if(p == NULL)
greska();
for(i=0; i<n; i++)
scanf("%d", &A[i]);
//insertion_sort(A,n,&poredi_opadajuce);
//selection_sort(A,n,&poredi_rastuce);
//merge_sort(A,0,n-1,p,&poredi_rastuce);
//quick_sort(A,0,n-1,&poredi_opadajuce);
qsort(A,n, sizeof(int), &porednjenje_opadajuce);
for(i=0; i<n; i++)
printf("%d ", A[i]);
printf("\n");
free(A);
free(p);
return 0;
}
|
the_stack_data/148578367.c | #include <stdio.h>
int main()
{
int n = 5;
for(int i = 1; i <= n; i++) {
for(int j = 1; j < n; j++) {
if(i == 1 || i + j == n + 1)
printf("7 ");
else
printf(" ");
}
printf("\n");
}
return 0;
} |
the_stack_data/242329620.c | #include<stdio.h>
int main()
{
char *p = "hello World\n";
char *q = p;
printf("%s\n", q);
return 0;
}
|
the_stack_data/100141438.c | #include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <openssl/sha.h>
#include <openssl/rand.h>
#include <time.h>
#define SERVER_ADDR "127.0.0.1"
#define SERVER_PORT 8080
#define BUF_SIZE 32
void xor(unsigned char result[],unsigned char x[],unsigned char y[],int len);
void add(unsigned char result[],unsigned char x[],unsigned char y[],int len);
void show(unsigned char s[],int len);
int transfer_first(int sock,unsigned char A1[]);
int transfer_n(int sock,unsigned char An[],clock_t *sock_clock);
int main(void) {
int sock;
struct sockaddr_in addr;
FILE *file;
int i,cnt=0;
unsigned char A1[BUF_SIZE] = {0};
unsigned char An[BUF_SIZE] = {0};
clock_t s_clock,e_clock,sum_clock = 0,sock_clock = 0;
//---------------------------------------------
/* ソケットを作成*/
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == -1) {
printf("socket error\n");
return -1;
}
/* 構造体を全て0にセット */
memset(&addr, 0, sizeof(struct sockaddr_in));
/* サーバーのIPアドレスとポートの情報を設定*/
addr.sin_family = AF_INET;
addr.sin_port = htons((unsigned short)SERVER_PORT);
addr.sin_addr.s_addr = inet_addr(SERVER_ADDR);
/* サーバーに接続要求送信 */
printf("接続を開始します...\n");
if (connect(sock, (struct sockaddr*)&addr, sizeof(struct sockaddr_in)) == -1) {
printf("connect error\n");
close(sock);
return -1;
}
printf("接続が完了しました!\n");
//---------------------------------------------
printf("---初回登録---\n");
/* 初回登録時の接続済のソケットでデータのやり取り */
transfer_first(sock,A1);
for(i = 0;i < BUF_SIZE;i++){
An[i] = A1[i];
}
/* ソケット通信をクローズ */
close(sock);
printf("---N回目認証---\n");
while(cnt !=1000){
//ソケットを作成
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == -1) {
printf("socket error\n");
return -1;
}
//構造体を全て0にセット
memset(&addr, 0, sizeof(struct sockaddr_in));
//サーバーのIPアドレスとポートの情報を設定
addr.sin_family = AF_INET;
addr.sin_port = htons((unsigned short)SERVER_PORT);
addr.sin_addr.s_addr = inet_addr(SERVER_ADDR);
/* サーバーに接続要求送信 */
printf("接続を開始します...\n");
if (connect(sock, (struct sockaddr*)&addr, sizeof(struct sockaddr_in)) == -1) {
printf("connect error\n");
close(sock);
return -1;
}
printf("接続が完了しました!\n");
printf("cnt:%d\n",cnt);
//---------------------------------------------
s_clock = clock();
/* N回目認証時の接続済のソケットでデータのやり取り */
transfer_n(sock,An,&sock_clock);
e_clock = clock();
sum_clock += (e_clock - s_clock);
/* ソケット通信をクローズ */
close(sock);
cnt++;
}
printf("cnt:%d, sum_clock :%f\n",cnt,(double)(sum_clock)/CLOCKS_PER_SEC);
printf("cnt:%d, sock_clock:%f\n",cnt,(double)(sock_clock)/CLOCKS_PER_SEC);
printf("cnt:%d, sock-sum :%f\n",cnt,(double)(sum_clock - sock_clock)/CLOCKS_PER_SEC);
return 0;
}
void xor(unsigned char result[],unsigned char x[],unsigned char y[],int len){
int i;
for(i=0;i< len;i++){
result[i] = x[i] ^ y[i];
}
}
void add(unsigned char result[],unsigned char x[],unsigned char y[],int len){
int i;
for(i=0;i< len;i++){
result[i] = x[i] + y[i];
}
}
void show(unsigned char s[],int len){
int i;
for(i=0;i< len;i++){
printf("%02X",s[i]);
}
printf("\n");
}
int transfer_first(int sock,unsigned char A1[]) {
int recv_size, send_size,i;
unsigned char recv_buf[BUF_SIZE];
char send_buf;
FILE *fp;
/* クライアントから文字列を受信 */
recv_size = recv(sock, recv_buf, BUF_SIZE, 0);
if (recv_size == -1) {
printf("recv error\n");
return 0;
}
if (recv_size == 0) {
/* 受信サイズが0の場合は相手が接続閉じていると判断 */
printf("connection ended\n");
return 0;
}
//A1
for(i = 0;i < BUF_SIZE;i++){
A1[i] = recv_buf[i];
}
//-------------------------------------------
/* 接続終了を表す0を送信 */
send_buf = 0;
send_size = send(sock, &send_buf, 1, 0);
if (send_size == -1) {
printf("send error\n");
return 0;
}
printf("接続を終了しました\n");
return 0;
}
int transfer_n(int sock,unsigned char An[],clock_t *sock_clock) {
int recv_size, send_size,i;
unsigned char recv_buf[BUF_SIZE]={0};
unsigned char send_buf[BUF_SIZE]={0};
unsigned char An_next[BUF_SIZE] ={0};
unsigned char alpha[BUF_SIZE] ={0};
unsigned char beta[BUF_SIZE] ={0};
FILE *fp;
clock_t s_time,e_time;
//----------receve alpha----------
// serverから文字列を受信
s_time = clock();
recv_size = recv(sock, recv_buf, BUF_SIZE, 0);
if (recv_size == -1) {
printf("recv error\n");
return 0;
}
if (recv_size == 0) {
// 受信サイズが0の場合は相手が接続閉じていると判断
printf("connection ended\n");
return 0;
}
e_time = clock();
*sock_clock += (e_time - s_time);
//alpha
for(i = 0;i < BUF_SIZE;i++){
alpha[i] = recv_buf[i];
}
//----------make beta----------
xor(An_next,alpha,An,BUF_SIZE);
add(beta,An_next,An,BUF_SIZE);
//print
/*
printf("An = ");
show(An,BUF_SIZE);
printf("An+1 = ");
show(An_next,BUF_SIZE);
printf("alpha = ");
show(alpha,BUF_SIZE);
printf("beta? = ");
show(beta,BUF_SIZE);
*/
//----------send beta---------
s_time = clock();
for(i = 0;i < BUF_SIZE;i++){
send_buf[i] = beta[i];
}
send_size = send(sock, send_buf, BUF_SIZE, 0);
if (send_size == -1) {
printf("send error\n");
return -1;
}
e_time = clock();
*sock_clock += (e_time - s_time);
for(i = 0;i < BUF_SIZE;i++){
An[i] = An_next[i];
}
printf("接続を終了しました\n");
return 0;
}
|
the_stack_data/145453515.c | extern void __VERIFIER_error() __attribute__ ((__noreturn__));
void __VERIFIER_assert(int cond) { if(!(cond)) { ERROR: __VERIFIER_error(); } }
#define N 75
int main( ) {
int a[N];
int i;
int r = 1;
for ( i = 1 ; i < N && r ; i++ ) {
int j;
for ( j = i-1 ; j >= 0 && r ; j-- ) {
if ( a[i] == a[j] ) {
r = 1;
}
}
}
if ( r ) {
int x;
int y;
for ( x = 0 ; x < N ; x++ ) {
for ( y = x+1 ; y < N ; y++ ) {
__VERIFIER_assert( a[x] != a[y] );
}
}
}
return 0;
}
|
the_stack_data/1096614.c | #include <stdlib.h>
#include <stdio.h>
int main() {
printf("%ld\n", atol("123a"));
printf("%ld\n", atol("a123"));
printf("%ld\n", atol("a123a"));
}
|
the_stack_data/46843.c | #include <stdio.h>
int quant(int dados[], int N){
int aux, count, contador = 0;
for(int t = 1; t < N; t++){
for(int i = 0; i < N - 1; i++){
if(dados[i] > dados[i + 1]){
aux = dados[i];
dados[i] = dados[i + 1];
dados[i + 1] = aux;
}
}
}
count = dados[0];
for(int i = 0; i <= N; i++){
if(count == dados[i]){
contador++;
}
else{
printf("%d aparece %d vez(es)\n", count, contador);
contador = 1;
count = dados[i];
}
}
return 0;
}
int main(void){
int N;
scanf("%d", &N);
int dados[N];
for(int i = 0; i < N; i++){
scanf("%d", &dados[i]);
}
quant(dados, N);
return 0;
} |
the_stack_data/73576518.c | # include <stdio.h>
int main(void)
{
printf("hello, world\n");
} |
the_stack_data/127438.c | int
main(void)
{
int i, j;
i = 1;
j = 1;
i += i + (j += i + j);
return i;
}
|
the_stack_data/7951562.c | #include <stdio.h>
int main()
{
int a[10],k,n;
printf("Enter the number of elements:");
scanf("%d",&n);
printf("Enter the elements\n");
for (k = 0; k < n; k++)
{
scanf("%d",&a[k]);
}
int i, key, j;
for (i = 1; i < n;i++)
{
key = a[i];
j = i-1;
while (j >= 0 && a[j] > key)
{
a[j+1] = a[j];
j = j-1;
}
a[j+1] = key;
}
printf("Sorted array: \n");
for (k = 0; k < n; k++)
{
printf("%d ",a[k]);
}
printf("\n");
return 0;
}
|
the_stack_data/440631.c | /**
* 完全背包问题
* N=4 M=10
* price={0,2,3,4,7};
* want={0,1,3,5,9};
*
* 4 10 //4种物品,背包承重为10
* 2 1 //第一种物品,价格为2,标准为1,数目不限
* 3 3
* 4 5
* 7 9
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void printf_arr(int *arr,int len){
for(int i=0;i<len;i++){
printf("%4d",*(arr+i));
}
printf("\n");
}
void printf_2arr(int **arr,int N,int M){
for(int i=0;i<N+1;i++){
for(int j=0;j<M+1;j++){
printf("%4d",*(arr[i]+j));
}
printf("\n");
}
}
int **createWantArr(int N,int M,int *price,int *want){
int **arr=(int **)malloc((N+1)*sizeof(int *));
for(int i=0;i<N+1;i++){
arr[i]=(int *)malloc((M+1)*sizeof(int));
memset(arr[i],0,(M+1)*sizeof(int));
}
for(int row=1;row<=N;row++){
for(int col=1;col<=M;col++){
//如果当前钱币不足以买当前物品
if(col<*(price+row)){
*(arr[row]+col)=*(arr[row-1]+col);
}else{
int n=col/(*(price+row));
int a=*(arr[row-1]+col);
int b=n*(*(want+row))+*(arr[row-1]+col%(*(price+row)));
*(arr[row]+col)=(a>b ? a :b);
}
}
}
return arr;
}
void myArrFree(int **arr,int N,int M){
for(int i=0;i<=N;i++){
free(arr[i]);
arr[i]=NULL;
}
free(arr);
arr=NULL;
}
int main(){
int N,M;
while(1){
scanf("%d%d",&N,&M);
int *price=(int *)malloc((N+1)*sizeof(int));
int *want=(int *)malloc((N+1)*sizeof(int));
memset(price,0,(N+1)*sizeof(int));
memset(want,0,(N+1)*sizeof(int));
for(int i=1;i<=N;i++){
int Price,Want;
scanf("%d%d",&Price,&Want);
*(price+i)=Price;
*(want+i)=Want;
}
printf_arr(price,N+1);
printf_arr(want,N+1);
//初始化价值矩阵
int **arr=createWantArr(N,M,price,want);
printf_2arr(arr,N,M);
printf("%d\n",*(arr[N]+M));
myArrFree(arr,N,M);
}
return 0;
}
|
the_stack_data/49855.c | #include <stdio.h>
#include <stdlib.h>
int main(void){
int a = 25;
if (a > 30){
printf("Variavel 'a' eh maior que 10. Valor = %d.\n", a);
} else{
if (a <= 25)
printf("Variavel 'a' eh menor ou igual que 25. Valor = %d.\n", a);
}
system("pause");
return(0);
} |
the_stack_data/21217.c | // ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
const char * COMPILER_VERSION = "0.90.2321";
|
the_stack_data/148577371.c | #define NUM_VALS 8
int first_array[NUM_VALS];
int second_array[NUM_VALS];
int dot_product() {
int product = 0;
for(int i=0; i<NUM_VALS; i++) {
product += first_array[i] * second_array[i];
}
return product;
}
int* getFirstOffset() {
return &first_array[0];
}
int* getSecondOffset() {
return &second_array[0];
} |
the_stack_data/487431.c | // RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep extern_weak
// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | llvm-as | llc
#if !defined(__linux__) && !defined(__FreeBSD__) && \
!defined(__OpenBSD__) && !defined(__CYGWIN__)
void foo() __attribute__((weak_import));
#else
void foo() __attribute__((weak));
#endif
void bar() { foo(); }
|
the_stack_data/190767072.c | #include <stdio.h>
int add(int a, int b);
int main()
{
float a = 50.25, b = 606;
float c = add(a,b);
return 0;
}
int add(int a, int b)
{
return a-b;
}
|
the_stack_data/234519471.c | #include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <complex.h>
#ifdef complex
#undef complex
#endif
#ifdef I
#undef I
#endif
#if defined(_WIN64)
typedef long long BLASLONG;
typedef unsigned long long BLASULONG;
#else
typedef long BLASLONG;
typedef unsigned long BLASULONG;
#endif
#ifdef LAPACK_ILP64
typedef BLASLONG blasint;
#if defined(_WIN64)
#define blasabs(x) llabs(x)
#else
#define blasabs(x) labs(x)
#endif
#else
typedef int blasint;
#define blasabs(x) abs(x)
#endif
typedef blasint integer;
typedef unsigned int uinteger;
typedef char *address;
typedef short int shortint;
typedef float real;
typedef double doublereal;
typedef struct { real r, i; } complex;
typedef struct { doublereal r, i; } doublecomplex;
#ifdef _MSC_VER
static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
#else
static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
#endif
#define pCf(z) (*_pCf(z))
#define pCd(z) (*_pCd(z))
typedef int logical;
typedef short int shortlogical;
typedef char logical1;
typedef char integer1;
#define TRUE_ (1)
#define FALSE_ (0)
/* Extern is for use with -E */
#ifndef Extern
#define Extern extern
#endif
/* I/O stuff */
typedef int flag;
typedef int ftnlen;
typedef int ftnint;
/*external read, write*/
typedef struct
{ flag cierr;
ftnint ciunit;
flag ciend;
char *cifmt;
ftnint cirec;
} cilist;
/*internal read, write*/
typedef struct
{ flag icierr;
char *iciunit;
flag iciend;
char *icifmt;
ftnint icirlen;
ftnint icirnum;
} icilist;
/*open*/
typedef struct
{ flag oerr;
ftnint ounit;
char *ofnm;
ftnlen ofnmlen;
char *osta;
char *oacc;
char *ofm;
ftnint orl;
char *oblnk;
} olist;
/*close*/
typedef struct
{ flag cerr;
ftnint cunit;
char *csta;
} cllist;
/*rewind, backspace, endfile*/
typedef struct
{ flag aerr;
ftnint aunit;
} alist;
/* inquire */
typedef struct
{ flag inerr;
ftnint inunit;
char *infile;
ftnlen infilen;
ftnint *inex; /*parameters in standard's order*/
ftnint *inopen;
ftnint *innum;
ftnint *innamed;
char *inname;
ftnlen innamlen;
char *inacc;
ftnlen inacclen;
char *inseq;
ftnlen inseqlen;
char *indir;
ftnlen indirlen;
char *infmt;
ftnlen infmtlen;
char *inform;
ftnint informlen;
char *inunf;
ftnlen inunflen;
ftnint *inrecl;
ftnint *innrec;
char *inblank;
ftnlen inblanklen;
} inlist;
#define VOID void
union Multitype { /* for multiple entry points */
integer1 g;
shortint h;
integer i;
/* longint j; */
real r;
doublereal d;
complex c;
doublecomplex z;
};
typedef union Multitype Multitype;
struct Vardesc { /* for Namelist */
char *name;
char *addr;
ftnlen *dims;
int type;
};
typedef struct Vardesc Vardesc;
struct Namelist {
char *name;
Vardesc **vars;
int nvars;
};
typedef struct Namelist Namelist;
#define abs(x) ((x) >= 0 ? (x) : -(x))
#define dabs(x) (fabs(x))
#define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
#define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
#define dmin(a,b) (f2cmin(a,b))
#define dmax(a,b) (f2cmax(a,b))
#define bit_test(a,b) ((a) >> (b) & 1)
#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
#define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
#define abort_() { sig_die("Fortran abort routine called", 1); }
#define c_abs(z) (cabsf(Cf(z)))
#define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
#ifdef _MSC_VER
#define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
#define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/Cd(b)._Val[1]);}
#else
#define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
#define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
#endif
#define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
#define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
#define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
//#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
#define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
#define d_abs(x) (fabs(*(x)))
#define d_acos(x) (acos(*(x)))
#define d_asin(x) (asin(*(x)))
#define d_atan(x) (atan(*(x)))
#define d_atn2(x, y) (atan2(*(x),*(y)))
#define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
#define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
#define d_cos(x) (cos(*(x)))
#define d_cosh(x) (cosh(*(x)))
#define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
#define d_exp(x) (exp(*(x)))
#define d_imag(z) (cimag(Cd(z)))
#define r_imag(z) (cimagf(Cf(z)))
#define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
#define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
#define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
#define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
#define d_log(x) (log(*(x)))
#define d_mod(x, y) (fmod(*(x), *(y)))
#define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
#define d_nint(x) u_nint(*(x))
#define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
#define d_sign(a,b) u_sign(*(a),*(b))
#define r_sign(a,b) u_sign(*(a),*(b))
#define d_sin(x) (sin(*(x)))
#define d_sinh(x) (sinh(*(x)))
#define d_sqrt(x) (sqrt(*(x)))
#define d_tan(x) (tan(*(x)))
#define d_tanh(x) (tanh(*(x)))
#define i_abs(x) abs(*(x))
#define i_dnnt(x) ((integer)u_nint(*(x)))
#define i_len(s, n) (n)
#define i_nint(x) ((integer)u_nint(*(x)))
#define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
#define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
#define pow_si(B,E) spow_ui(*(B),*(E))
#define pow_ri(B,E) spow_ui(*(B),*(E))
#define pow_di(B,E) dpow_ui(*(B),*(E))
#define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
#define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
#define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
#define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; }
#define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
#define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; }
#define sig_die(s, kill) { exit(1); }
#define s_stop(s, n) {exit(0);}
static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
#define z_abs(z) (cabs(Cd(z)))
#define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
#define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
#define myexit_() break;
#define mycycle_() continue;
#define myceiling_(w) {ceil(w)}
#define myhuge_(w) {HUGE_VAL}
//#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
#define mymaxloc_(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
/* procedure parameter types for -A and -C++ */
#define F2C_proc_par_types 1
#ifdef __cplusplus
typedef logical (*L_fp)(...);
#else
typedef logical (*L_fp)();
#endif
static float spow_ui(float x, integer n) {
float pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static double dpow_ui(double x, integer n) {
double pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
#ifdef _MSC_VER
static _Fcomplex cpow_ui(complex x, integer n) {
complex pow={1.0,0.0}; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
for(u = n; ; ) {
if(u & 01) pow.r *= x.r, pow.i *= x.i;
if(u >>= 1) x.r *= x.r, x.i *= x.i;
else break;
}
}
_Fcomplex p={pow.r, pow.i};
return p;
}
#else
static _Complex float cpow_ui(_Complex float x, integer n) {
_Complex float pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
#endif
#ifdef _MSC_VER
static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
_Dcomplex pow={1.0,0.0}; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
for(u = n; ; ) {
if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1];
if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1];
else break;
}
}
_Dcomplex p = {pow._Val[0], pow._Val[1]};
return p;
}
#else
static _Complex double zpow_ui(_Complex double x, integer n) {
_Complex double pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
#endif
static integer pow_ii(integer x, integer n) {
integer pow; unsigned long int u;
if (n <= 0) {
if (n == 0 || x == 1) pow = 1;
else if (x != -1) pow = x == 0 ? 1/x : 0;
else n = -n;
}
if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
u = n;
for(pow = 1; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static integer dmaxloc_(double *w, integer s, integer e, integer *n)
{
double m; integer i, mi;
for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
if (w[i-1]>m) mi=i ,m=w[i-1];
return mi-s+1;
}
static integer smaxloc_(float *w, integer s, integer e, integer *n)
{
float m; integer i, mi;
for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
if (w[i-1]>m) mi=i ,m=w[i-1];
return mi-s+1;
}
static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Fcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
}
}
pCf(z) = zdotc;
}
#else
_Complex float zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
}
}
pCf(z) = zdotc;
}
#endif
static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Dcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
}
}
pCd(z) = zdotc;
}
#else
_Complex double zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
}
}
pCd(z) = zdotc;
}
#endif
static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Fcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
}
}
pCf(z) = zdotc;
}
#else
_Complex float zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cf(&x[i]) * Cf(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
}
}
pCf(z) = zdotc;
}
#endif
static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Dcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
}
}
pCd(z) = zdotc;
}
#else
_Complex double zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cd(&x[i]) * Cd(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
}
}
pCd(z) = zdotc;
}
#endif
/* -- translated by f2c (version 20000121).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
/* Table of constant values */
static doublecomplex c_b1 = {0.,0.};
static doublecomplex c_b2 = {1.,0.};
static integer c__2 = 2;
static integer c__1 = 1;
static integer c__3 = 3;
/* > \brief \b ZLAQR5 performs a single small-bulge multi-shift QR sweep. */
/* =========== DOCUMENTATION =========== */
/* Online html documentation available at */
/* http://www.netlib.org/lapack/explore-html/ */
/* > \htmlonly */
/* > Download ZLAQR5 + dependencies */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlaqr5.
f"> */
/* > [TGZ]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlaqr5.
f"> */
/* > [ZIP]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlaqr5.
f"> */
/* > [TXT]</a> */
/* > \endhtmlonly */
/* Definition: */
/* =========== */
/* SUBROUTINE ZLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS, S, */
/* H, LDH, ILOZ, IHIZ, Z, LDZ, V, LDV, U, LDU, NV, */
/* WV, LDWV, NH, WH, LDWH ) */
/* INTEGER IHIZ, ILOZ, KACC22, KBOT, KTOP, LDH, LDU, LDV, */
/* $ LDWH, LDWV, LDZ, N, NH, NSHFTS, NV */
/* LOGICAL WANTT, WANTZ */
/* COMPLEX*16 H( LDH, * ), S( * ), U( LDU, * ), V( LDV, * ), */
/* $ WH( LDWH, * ), WV( LDWV, * ), Z( LDZ, * ) */
/* > \par Purpose: */
/* ============= */
/* > */
/* > \verbatim */
/* > */
/* > ZLAQR5, called by ZLAQR0, performs a */
/* > single small-bulge multi-shift QR sweep. */
/* > \endverbatim */
/* Arguments: */
/* ========== */
/* > \param[in] WANTT */
/* > \verbatim */
/* > WANTT is LOGICAL */
/* > WANTT = .true. if the triangular Schur factor */
/* > is being computed. WANTT is set to .false. otherwise. */
/* > \endverbatim */
/* > */
/* > \param[in] WANTZ */
/* > \verbatim */
/* > WANTZ is LOGICAL */
/* > WANTZ = .true. if the unitary Schur factor is being */
/* > computed. WANTZ is set to .false. otherwise. */
/* > \endverbatim */
/* > */
/* > \param[in] KACC22 */
/* > \verbatim */
/* > KACC22 is INTEGER with value 0, 1, or 2. */
/* > Specifies the computation mode of far-from-diagonal */
/* > orthogonal updates. */
/* > = 0: ZLAQR5 does not accumulate reflections and does not */
/* > use matrix-matrix multiply to update far-from-diagonal */
/* > matrix entries. */
/* > = 1: ZLAQR5 accumulates reflections and uses matrix-matrix */
/* > multiply to update the far-from-diagonal matrix entries. */
/* > = 2: Same as KACC22 = 1. This option used to enable exploiting */
/* > the 2-by-2 structure during matrix multiplications, but */
/* > this is no longer supported. */
/* > \endverbatim */
/* > */
/* > \param[in] N */
/* > \verbatim */
/* > N is INTEGER */
/* > N is the order of the Hessenberg matrix H upon which this */
/* > subroutine operates. */
/* > \endverbatim */
/* > */
/* > \param[in] KTOP */
/* > \verbatim */
/* > KTOP is INTEGER */
/* > \endverbatim */
/* > */
/* > \param[in] KBOT */
/* > \verbatim */
/* > KBOT is INTEGER */
/* > These are the first and last rows and columns of an */
/* > isolated diagonal block upon which the QR sweep is to be */
/* > applied. It is assumed without a check that */
/* > either KTOP = 1 or H(KTOP,KTOP-1) = 0 */
/* > and */
/* > either KBOT = N or H(KBOT+1,KBOT) = 0. */
/* > \endverbatim */
/* > */
/* > \param[in] NSHFTS */
/* > \verbatim */
/* > NSHFTS is INTEGER */
/* > NSHFTS gives the number of simultaneous shifts. NSHFTS */
/* > must be positive and even. */
/* > \endverbatim */
/* > */
/* > \param[in,out] S */
/* > \verbatim */
/* > S is COMPLEX*16 array, dimension (NSHFTS) */
/* > S contains the shifts of origin that define the multi- */
/* > shift QR sweep. On output S may be reordered. */
/* > \endverbatim */
/* > */
/* > \param[in,out] H */
/* > \verbatim */
/* > H is COMPLEX*16 array, dimension (LDH,N) */
/* > On input H contains a Hessenberg matrix. On output a */
/* > multi-shift QR sweep with shifts SR(J)+i*SI(J) is applied */
/* > to the isolated diagonal block in rows and columns KTOP */
/* > through KBOT. */
/* > \endverbatim */
/* > */
/* > \param[in] LDH */
/* > \verbatim */
/* > LDH is INTEGER */
/* > LDH is the leading dimension of H just as declared in the */
/* > calling procedure. LDH >= MAX(1,N). */
/* > \endverbatim */
/* > */
/* > \param[in] ILOZ */
/* > \verbatim */
/* > ILOZ is INTEGER */
/* > \endverbatim */
/* > */
/* > \param[in] IHIZ */
/* > \verbatim */
/* > IHIZ is INTEGER */
/* > Specify the rows of Z to which transformations must be */
/* > applied if WANTZ is .TRUE.. 1 <= ILOZ <= IHIZ <= N */
/* > \endverbatim */
/* > */
/* > \param[in,out] Z */
/* > \verbatim */
/* > Z is COMPLEX*16 array, dimension (LDZ,IHIZ) */
/* > If WANTZ = .TRUE., then the QR Sweep unitary */
/* > similarity transformation is accumulated into */
/* > Z(ILOZ:IHIZ,ILOZ:IHIZ) from the right. */
/* > If WANTZ = .FALSE., then Z is unreferenced. */
/* > \endverbatim */
/* > */
/* > \param[in] LDZ */
/* > \verbatim */
/* > LDZ is INTEGER */
/* > LDA is the leading dimension of Z just as declared in */
/* > the calling procedure. LDZ >= N. */
/* > \endverbatim */
/* > */
/* > \param[out] V */
/* > \verbatim */
/* > V is COMPLEX*16 array, dimension (LDV,NSHFTS/2) */
/* > \endverbatim */
/* > */
/* > \param[in] LDV */
/* > \verbatim */
/* > LDV is INTEGER */
/* > LDV is the leading dimension of V as declared in the */
/* > calling procedure. LDV >= 3. */
/* > \endverbatim */
/* > */
/* > \param[out] U */
/* > \verbatim */
/* > U is COMPLEX*16 array, dimension (LDU,2*NSHFTS) */
/* > \endverbatim */
/* > */
/* > \param[in] LDU */
/* > \verbatim */
/* > LDU is INTEGER */
/* > LDU is the leading dimension of U just as declared in the */
/* > in the calling subroutine. LDU >= 2*NSHFTS. */
/* > \endverbatim */
/* > */
/* > \param[in] NV */
/* > \verbatim */
/* > NV is INTEGER */
/* > NV is the number of rows in WV agailable for workspace. */
/* > NV >= 1. */
/* > \endverbatim */
/* > */
/* > \param[out] WV */
/* > \verbatim */
/* > WV is COMPLEX*16 array, dimension (LDWV,2*NSHFTS) */
/* > \endverbatim */
/* > */
/* > \param[in] LDWV */
/* > \verbatim */
/* > LDWV is INTEGER */
/* > LDWV is the leading dimension of WV as declared in the */
/* > in the calling subroutine. LDWV >= NV. */
/* > \endverbatim */
/* > \param[in] NH */
/* > \verbatim */
/* > NH is INTEGER */
/* > NH is the number of columns in array WH available for */
/* > workspace. NH >= 1. */
/* > \endverbatim */
/* > */
/* > \param[out] WH */
/* > \verbatim */
/* > WH is COMPLEX*16 array, dimension (LDWH,NH) */
/* > \endverbatim */
/* > */
/* > \param[in] LDWH */
/* > \verbatim */
/* > LDWH is INTEGER */
/* > Leading dimension of WH just as declared in the */
/* > calling procedure. LDWH >= 2*NSHFTS. */
/* > \endverbatim */
/* > */
/* Authors: */
/* ======== */
/* > \author Univ. of Tennessee */
/* > \author Univ. of California Berkeley */
/* > \author Univ. of Colorado Denver */
/* > \author NAG Ltd. */
/* > \date January 2021 */
/* > \ingroup complex16OTHERauxiliary */
/* > \par Contributors: */
/* ================== */
/* > */
/* > Karen Braman and Ralph Byers, Department of Mathematics, */
/* > University of Kansas, USA */
/* > */
/* > Lars Karlsson, Daniel Kressner, and Bruno Lang */
/* > */
/* > Thijs Steel, Department of Computer science, */
/* > KU Leuven, Belgium */
/* > \par References: */
/* ================ */
/* > */
/* > K. Braman, R. Byers and R. Mathias, The Multi-Shift QR */
/* > Algorithm Part I: Maintaining Well Focused Shifts, and Level 3 */
/* > Performance, SIAM Journal of Matrix Analysis, volume 23, pages */
/* > 929--947, 2002. */
/* > */
/* > Lars Karlsson, Daniel Kressner, and Bruno Lang, Optimally packed */
/* > chains of bulges in multishift QR algorithms. */
/* > ACM Trans. Math. Softw. 40, 2, Article 12 (February 2014). */
/* > */
/* ===================================================================== */
/* Subroutine */ int zlaqr5_(logical *wantt, logical *wantz, integer *kacc22,
integer *n, integer *ktop, integer *kbot, integer *nshfts,
doublecomplex *s, doublecomplex *h__, integer *ldh, integer *iloz,
integer *ihiz, doublecomplex *z__, integer *ldz, doublecomplex *v,
integer *ldv, doublecomplex *u, integer *ldu, integer *nv,
doublecomplex *wv, integer *ldwv, integer *nh, doublecomplex *wh,
integer *ldwh)
{
/* System generated locals */
integer h_dim1, h_offset, u_dim1, u_offset, v_dim1, v_offset, wh_dim1,
wh_offset, wv_dim1, wv_offset, z_dim1, z_offset, i__1, i__2, i__3,
i__4, i__5, i__6, i__7, i__8, i__9, i__10, i__11;
doublereal d__1, d__2, d__3, d__4, d__5, d__6, d__7, d__8, d__9, d__10;
doublecomplex z__1, z__2, z__3, z__4, z__5, z__6, z__7, z__8;
/* Local variables */
doublecomplex beta;
logical bmp22;
integer jcol, jlen, jbot, mbot, jtop, jrow, mtop, j, k, m;
doublecomplex alpha;
logical accum;
integer ndcol, incol, krcol, nbmps;
extern /* Subroutine */ int zgemm_(char *, char *, integer *, integer *,
integer *, doublecomplex *, doublecomplex *, integer *,
doublecomplex *, integer *, doublecomplex *, doublecomplex *,
integer *);
integer i2, k1, i4;
extern /* Subroutine */ int dlabad_(doublereal *, doublereal *);
doublereal h11, h12, h21, h22;
extern /* Subroutine */ int zlaqr1_(integer *, doublecomplex *, integer *,
doublecomplex *, doublecomplex *, doublecomplex *);
integer m22;
extern doublereal dlamch_(char *);
integer ns, nu;
doublecomplex vt[3];
doublereal safmin, safmax;
extern /* Subroutine */ int zlarfg_(integer *, doublecomplex *,
doublecomplex *, integer *, doublecomplex *);
doublecomplex refsum;
extern /* Subroutine */ int zlacpy_(char *, integer *, integer *,
doublecomplex *, integer *, doublecomplex *, integer *),
zlaset_(char *, integer *, integer *, doublecomplex *,
doublecomplex *, doublecomplex *, integer *);
doublereal smlnum, scl;
integer kdu, kms;
doublereal ulp;
doublereal tst1, tst2;
/* -- LAPACK auxiliary routine (version 3.7.1) -- */
/* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
/* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
/* June 2016 */
/* ================================================================ */
/* ==== If there are no shifts, then there is nothing to do. ==== */
/* Parameter adjustments */
--s;
h_dim1 = *ldh;
h_offset = 1 + h_dim1 * 1;
h__ -= h_offset;
z_dim1 = *ldz;
z_offset = 1 + z_dim1 * 1;
z__ -= z_offset;
v_dim1 = *ldv;
v_offset = 1 + v_dim1 * 1;
v -= v_offset;
u_dim1 = *ldu;
u_offset = 1 + u_dim1 * 1;
u -= u_offset;
wv_dim1 = *ldwv;
wv_offset = 1 + wv_dim1 * 1;
wv -= wv_offset;
wh_dim1 = *ldwh;
wh_offset = 1 + wh_dim1 * 1;
wh -= wh_offset;
/* Function Body */
if (*nshfts < 2) {
return 0;
}
/* ==== If the active block is empty or 1-by-1, then there */
/* . is nothing to do. ==== */
if (*ktop >= *kbot) {
return 0;
}
/* ==== NSHFTS is supposed to be even, but if it is odd, */
/* . then simply reduce it by one. ==== */
ns = *nshfts - *nshfts % 2;
/* ==== Machine constants for deflation ==== */
safmin = dlamch_("SAFE MINIMUM");
safmax = 1. / safmin;
dlabad_(&safmin, &safmax);
ulp = dlamch_("PRECISION");
smlnum = safmin * ((doublereal) (*n) / ulp);
/* ==== Use accumulated reflections to update far-from-diagonal */
/* . entries ? ==== */
accum = *kacc22 == 1 || *kacc22 == 2;
/* ==== clear trash ==== */
if (*ktop + 2 <= *kbot) {
i__1 = *ktop + 2 + *ktop * h_dim1;
h__[i__1].r = 0., h__[i__1].i = 0.;
}
/* ==== NBMPS = number of 2-shift bulges in the chain ==== */
nbmps = ns / 2;
/* ==== KDU = width of slab ==== */
kdu = nbmps << 2;
/* ==== Create and chase chains of NBMPS bulges ==== */
i__1 = *kbot - 2;
i__2 = nbmps << 1;
for (incol = *ktop - (nbmps << 1) + 1; i__2 < 0 ? incol >= i__1 : incol <=
i__1; incol += i__2) {
/* JTOP = Index from which updates from the right start. */
if (accum) {
jtop = f2cmax(*ktop,incol);
} else if (*wantt) {
jtop = 1;
} else {
jtop = *ktop;
}
ndcol = incol + kdu;
if (accum) {
zlaset_("ALL", &kdu, &kdu, &c_b1, &c_b2, &u[u_offset], ldu);
}
/* ==== Near-the-diagonal bulge chase. The following loop */
/* . performs the near-the-diagonal part of a small bulge */
/* . multi-shift QR sweep. Each 4*NBMPS column diagonal */
/* . chunk extends from column INCOL to column NDCOL */
/* . (including both column INCOL and column NDCOL). The */
/* . following loop chases a 2*NBMPS+1 column long chain of */
/* . NBMPS bulges 2*NBMPS columns to the right. (INCOL */
/* . may be less than KTOP and and NDCOL may be greater than */
/* . KBOT indicating phantom columns from which to chase */
/* . bulges before they are actually introduced or to which */
/* . to chase bulges beyond column KBOT.) ==== */
/* Computing MIN */
i__4 = incol + (nbmps << 1) - 1, i__5 = *kbot - 2;
i__3 = f2cmin(i__4,i__5);
for (krcol = incol; krcol <= i__3; ++krcol) {
/* ==== Bulges number MTOP to MBOT are active double implicit */
/* . shift bulges. There may or may not also be small */
/* . 2-by-2 bulge, if there is room. The inactive bulges */
/* . (if any) must wait until the active bulges have moved */
/* . down the diagonal to make room. The phantom matrix */
/* . paradigm described above helps keep track. ==== */
/* Computing MAX */
i__4 = 1, i__5 = (*ktop - krcol) / 2 + 1;
mtop = f2cmax(i__4,i__5);
/* Computing MIN */
i__4 = nbmps, i__5 = (*kbot - krcol - 1) / 2;
mbot = f2cmin(i__4,i__5);
m22 = mbot + 1;
bmp22 = mbot < nbmps && krcol + (m22 - 1 << 1) == *kbot - 2;
/* ==== Generate reflections to chase the chain right */
/* . one column. (The minimum value of K is KTOP-1.) ==== */
if (bmp22) {
/* ==== Special case: 2-by-2 reflection at bottom treated */
/* . separately ==== */
k = krcol + (m22 - 1 << 1);
if (k == *ktop - 1) {
zlaqr1_(&c__2, &h__[k + 1 + (k + 1) * h_dim1], ldh, &s[(
m22 << 1) - 1], &s[m22 * 2], &v[m22 * v_dim1 + 1])
;
i__4 = m22 * v_dim1 + 1;
beta.r = v[i__4].r, beta.i = v[i__4].i;
zlarfg_(&c__2, &beta, &v[m22 * v_dim1 + 2], &c__1, &v[m22
* v_dim1 + 1]);
} else {
i__4 = k + 1 + k * h_dim1;
beta.r = h__[i__4].r, beta.i = h__[i__4].i;
i__4 = m22 * v_dim1 + 2;
i__5 = k + 2 + k * h_dim1;
v[i__4].r = h__[i__5].r, v[i__4].i = h__[i__5].i;
zlarfg_(&c__2, &beta, &v[m22 * v_dim1 + 2], &c__1, &v[m22
* v_dim1 + 1]);
i__4 = k + 1 + k * h_dim1;
h__[i__4].r = beta.r, h__[i__4].i = beta.i;
i__4 = k + 2 + k * h_dim1;
h__[i__4].r = 0., h__[i__4].i = 0.;
}
/* ==== Perform update from right within */
/* . computational window. ==== */
/* Computing MIN */
i__5 = *kbot, i__6 = k + 3;
i__4 = f2cmin(i__5,i__6);
for (j = jtop; j <= i__4; ++j) {
i__5 = m22 * v_dim1 + 1;
i__6 = j + (k + 1) * h_dim1;
i__7 = m22 * v_dim1 + 2;
i__8 = j + (k + 2) * h_dim1;
z__3.r = v[i__7].r * h__[i__8].r - v[i__7].i * h__[i__8]
.i, z__3.i = v[i__7].r * h__[i__8].i + v[i__7].i *
h__[i__8].r;
z__2.r = h__[i__6].r + z__3.r, z__2.i = h__[i__6].i +
z__3.i;
z__1.r = v[i__5].r * z__2.r - v[i__5].i * z__2.i, z__1.i =
v[i__5].r * z__2.i + v[i__5].i * z__2.r;
refsum.r = z__1.r, refsum.i = z__1.i;
i__5 = j + (k + 1) * h_dim1;
i__6 = j + (k + 1) * h_dim1;
z__1.r = h__[i__6].r - refsum.r, z__1.i = h__[i__6].i -
refsum.i;
h__[i__5].r = z__1.r, h__[i__5].i = z__1.i;
i__5 = j + (k + 2) * h_dim1;
i__6 = j + (k + 2) * h_dim1;
d_cnjg(&z__3, &v[m22 * v_dim1 + 2]);
z__2.r = refsum.r * z__3.r - refsum.i * z__3.i, z__2.i =
refsum.r * z__3.i + refsum.i * z__3.r;
z__1.r = h__[i__6].r - z__2.r, z__1.i = h__[i__6].i -
z__2.i;
h__[i__5].r = z__1.r, h__[i__5].i = z__1.i;
/* L30: */
}
/* ==== Perform update from left within */
/* . computational window. ==== */
if (accum) {
jbot = f2cmin(ndcol,*kbot);
} else if (*wantt) {
jbot = *n;
} else {
jbot = *kbot;
}
i__4 = jbot;
for (j = k + 1; j <= i__4; ++j) {
d_cnjg(&z__2, &v[m22 * v_dim1 + 1]);
i__5 = k + 1 + j * h_dim1;
d_cnjg(&z__5, &v[m22 * v_dim1 + 2]);
i__6 = k + 2 + j * h_dim1;
z__4.r = z__5.r * h__[i__6].r - z__5.i * h__[i__6].i,
z__4.i = z__5.r * h__[i__6].i + z__5.i * h__[i__6]
.r;
z__3.r = h__[i__5].r + z__4.r, z__3.i = h__[i__5].i +
z__4.i;
z__1.r = z__2.r * z__3.r - z__2.i * z__3.i, z__1.i =
z__2.r * z__3.i + z__2.i * z__3.r;
refsum.r = z__1.r, refsum.i = z__1.i;
i__5 = k + 1 + j * h_dim1;
i__6 = k + 1 + j * h_dim1;
z__1.r = h__[i__6].r - refsum.r, z__1.i = h__[i__6].i -
refsum.i;
h__[i__5].r = z__1.r, h__[i__5].i = z__1.i;
i__5 = k + 2 + j * h_dim1;
i__6 = k + 2 + j * h_dim1;
i__7 = m22 * v_dim1 + 2;
z__2.r = refsum.r * v[i__7].r - refsum.i * v[i__7].i,
z__2.i = refsum.r * v[i__7].i + refsum.i * v[i__7]
.r;
z__1.r = h__[i__6].r - z__2.r, z__1.i = h__[i__6].i -
z__2.i;
h__[i__5].r = z__1.r, h__[i__5].i = z__1.i;
/* L40: */
}
/* ==== The following convergence test requires that */
/* . the tradition small-compared-to-nearby-diagonals */
/* . criterion and the Ahues & Tisseur (LAWN 122, 1997) */
/* . criteria both be satisfied. The latter improves */
/* . accuracy in some examples. Falling back on an */
/* . alternate convergence criterion when TST1 or TST2 */
/* . is zero (as done here) is traditional but probably */
/* . unnecessary. ==== */
if (k >= *ktop) {
i__4 = k + 1 + k * h_dim1;
if (h__[i__4].r != 0. || h__[i__4].i != 0.) {
i__4 = k + k * h_dim1;
i__5 = k + 1 + (k + 1) * h_dim1;
tst1 = (d__1 = h__[i__4].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + k * h_dim1]), abs(d__2)) + ((
d__3 = h__[i__5].r, abs(d__3)) + (d__4 =
d_imag(&h__[k + 1 + (k + 1) * h_dim1]), abs(
d__4)));
if (tst1 == 0.) {
if (k >= *ktop + 1) {
i__4 = k + (k - 1) * h_dim1;
tst1 += (d__1 = h__[i__4].r, abs(d__1)) + (
d__2 = d_imag(&h__[k + (k - 1) *
h_dim1]), abs(d__2));
}
if (k >= *ktop + 2) {
i__4 = k + (k - 2) * h_dim1;
tst1 += (d__1 = h__[i__4].r, abs(d__1)) + (
d__2 = d_imag(&h__[k + (k - 2) *
h_dim1]), abs(d__2));
}
if (k >= *ktop + 3) {
i__4 = k + (k - 3) * h_dim1;
tst1 += (d__1 = h__[i__4].r, abs(d__1)) + (
d__2 = d_imag(&h__[k + (k - 3) *
h_dim1]), abs(d__2));
}
if (k <= *kbot - 2) {
i__4 = k + 2 + (k + 1) * h_dim1;
tst1 += (d__1 = h__[i__4].r, abs(d__1)) + (
d__2 = d_imag(&h__[k + 2 + (k + 1) *
h_dim1]), abs(d__2));
}
if (k <= *kbot - 3) {
i__4 = k + 3 + (k + 1) * h_dim1;
tst1 += (d__1 = h__[i__4].r, abs(d__1)) + (
d__2 = d_imag(&h__[k + 3 + (k + 1) *
h_dim1]), abs(d__2));
}
if (k <= *kbot - 4) {
i__4 = k + 4 + (k + 1) * h_dim1;
tst1 += (d__1 = h__[i__4].r, abs(d__1)) + (
d__2 = d_imag(&h__[k + 4 + (k + 1) *
h_dim1]), abs(d__2));
}
}
i__4 = k + 1 + k * h_dim1;
/* Computing MAX */
d__3 = smlnum, d__4 = ulp * tst1;
if ((d__1 = h__[i__4].r, abs(d__1)) + (d__2 = d_imag(&
h__[k + 1 + k * h_dim1]), abs(d__2)) <= f2cmax(
d__3,d__4)) {
/* Computing MAX */
i__4 = k + 1 + k * h_dim1;
i__5 = k + (k + 1) * h_dim1;
d__5 = (d__1 = h__[i__4].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + 1 + k * h_dim1]), abs(
d__2)), d__6 = (d__3 = h__[i__5].r, abs(
d__3)) + (d__4 = d_imag(&h__[k + (k + 1) *
h_dim1]), abs(d__4));
h12 = f2cmax(d__5,d__6);
/* Computing MIN */
i__4 = k + 1 + k * h_dim1;
i__5 = k + (k + 1) * h_dim1;
d__5 = (d__1 = h__[i__4].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + 1 + k * h_dim1]), abs(
d__2)), d__6 = (d__3 = h__[i__5].r, abs(
d__3)) + (d__4 = d_imag(&h__[k + (k + 1) *
h_dim1]), abs(d__4));
h21 = f2cmin(d__5,d__6);
i__4 = k + k * h_dim1;
i__5 = k + 1 + (k + 1) * h_dim1;
z__2.r = h__[i__4].r - h__[i__5].r, z__2.i = h__[
i__4].i - h__[i__5].i;
z__1.r = z__2.r, z__1.i = z__2.i;
/* Computing MAX */
i__6 = k + 1 + (k + 1) * h_dim1;
d__5 = (d__1 = h__[i__6].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + 1 + (k + 1) * h_dim1]),
abs(d__2)), d__6 = (d__3 = z__1.r, abs(
d__3)) + (d__4 = d_imag(&z__1), abs(d__4))
;
h11 = f2cmax(d__5,d__6);
i__4 = k + k * h_dim1;
i__5 = k + 1 + (k + 1) * h_dim1;
z__2.r = h__[i__4].r - h__[i__5].r, z__2.i = h__[
i__4].i - h__[i__5].i;
z__1.r = z__2.r, z__1.i = z__2.i;
/* Computing MIN */
i__6 = k + 1 + (k + 1) * h_dim1;
d__5 = (d__1 = h__[i__6].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + 1 + (k + 1) * h_dim1]),
abs(d__2)), d__6 = (d__3 = z__1.r, abs(
d__3)) + (d__4 = d_imag(&z__1), abs(d__4))
;
h22 = f2cmin(d__5,d__6);
scl = h11 + h12;
tst2 = h22 * (h11 / scl);
/* Computing MAX */
d__1 = smlnum, d__2 = ulp * tst2;
if (tst2 == 0. || h21 * (h12 / scl) <= f2cmax(d__1,
d__2)) {
i__4 = k + 1 + k * h_dim1;
h__[i__4].r = 0., h__[i__4].i = 0.;
}
}
}
}
/* ==== Accumulate orthogonal transformations. ==== */
if (accum) {
kms = k - incol;
/* Computing MAX */
i__4 = 1, i__5 = *ktop - incol;
i__6 = kdu;
for (j = f2cmax(i__4,i__5); j <= i__6; ++j) {
i__4 = m22 * v_dim1 + 1;
i__5 = j + (kms + 1) * u_dim1;
i__7 = m22 * v_dim1 + 2;
i__8 = j + (kms + 2) * u_dim1;
z__3.r = v[i__7].r * u[i__8].r - v[i__7].i * u[i__8]
.i, z__3.i = v[i__7].r * u[i__8].i + v[i__7]
.i * u[i__8].r;
z__2.r = u[i__5].r + z__3.r, z__2.i = u[i__5].i +
z__3.i;
z__1.r = v[i__4].r * z__2.r - v[i__4].i * z__2.i,
z__1.i = v[i__4].r * z__2.i + v[i__4].i *
z__2.r;
refsum.r = z__1.r, refsum.i = z__1.i;
i__4 = j + (kms + 1) * u_dim1;
i__5 = j + (kms + 1) * u_dim1;
z__1.r = u[i__5].r - refsum.r, z__1.i = u[i__5].i -
refsum.i;
u[i__4].r = z__1.r, u[i__4].i = z__1.i;
i__4 = j + (kms + 2) * u_dim1;
i__5 = j + (kms + 2) * u_dim1;
d_cnjg(&z__3, &v[m22 * v_dim1 + 2]);
z__2.r = refsum.r * z__3.r - refsum.i * z__3.i,
z__2.i = refsum.r * z__3.i + refsum.i *
z__3.r;
z__1.r = u[i__5].r - z__2.r, z__1.i = u[i__5].i -
z__2.i;
u[i__4].r = z__1.r, u[i__4].i = z__1.i;
/* L50: */
}
} else if (*wantz) {
i__6 = *ihiz;
for (j = *iloz; j <= i__6; ++j) {
i__4 = m22 * v_dim1 + 1;
i__5 = j + (k + 1) * z_dim1;
i__7 = m22 * v_dim1 + 2;
i__8 = j + (k + 2) * z_dim1;
z__3.r = v[i__7].r * z__[i__8].r - v[i__7].i * z__[
i__8].i, z__3.i = v[i__7].r * z__[i__8].i + v[
i__7].i * z__[i__8].r;
z__2.r = z__[i__5].r + z__3.r, z__2.i = z__[i__5].i +
z__3.i;
z__1.r = v[i__4].r * z__2.r - v[i__4].i * z__2.i,
z__1.i = v[i__4].r * z__2.i + v[i__4].i *
z__2.r;
refsum.r = z__1.r, refsum.i = z__1.i;
i__4 = j + (k + 1) * z_dim1;
i__5 = j + (k + 1) * z_dim1;
z__1.r = z__[i__5].r - refsum.r, z__1.i = z__[i__5].i
- refsum.i;
z__[i__4].r = z__1.r, z__[i__4].i = z__1.i;
i__4 = j + (k + 2) * z_dim1;
i__5 = j + (k + 2) * z_dim1;
d_cnjg(&z__3, &v[m22 * v_dim1 + 2]);
z__2.r = refsum.r * z__3.r - refsum.i * z__3.i,
z__2.i = refsum.r * z__3.i + refsum.i *
z__3.r;
z__1.r = z__[i__5].r - z__2.r, z__1.i = z__[i__5].i -
z__2.i;
z__[i__4].r = z__1.r, z__[i__4].i = z__1.i;
/* L60: */
}
}
}
/* ==== Normal case: Chain of 3-by-3 reflections ==== */
i__6 = mtop;
for (m = mbot; m >= i__6; --m) {
k = krcol + (m - 1 << 1);
if (k == *ktop - 1) {
zlaqr1_(&c__3, &h__[*ktop + *ktop * h_dim1], ldh, &s[(m <<
1) - 1], &s[m * 2], &v[m * v_dim1 + 1]);
i__4 = m * v_dim1 + 1;
alpha.r = v[i__4].r, alpha.i = v[i__4].i;
zlarfg_(&c__3, &alpha, &v[m * v_dim1 + 2], &c__1, &v[m *
v_dim1 + 1]);
} else {
/* ==== Perform delayed transformation of row below */
/* . Mth bulge. Exploit fact that first two elements */
/* . of row are actually zero. ==== */
i__4 = m * v_dim1 + 1;
i__5 = m * v_dim1 + 3;
z__2.r = v[i__4].r * v[i__5].r - v[i__4].i * v[i__5].i,
z__2.i = v[i__4].r * v[i__5].i + v[i__4].i * v[
i__5].r;
i__7 = k + 3 + (k + 2) * h_dim1;
z__1.r = z__2.r * h__[i__7].r - z__2.i * h__[i__7].i,
z__1.i = z__2.r * h__[i__7].i + z__2.i * h__[i__7]
.r;
refsum.r = z__1.r, refsum.i = z__1.i;
i__4 = k + 3 + k * h_dim1;
z__1.r = -refsum.r, z__1.i = -refsum.i;
h__[i__4].r = z__1.r, h__[i__4].i = z__1.i;
i__4 = k + 3 + (k + 1) * h_dim1;
z__2.r = -refsum.r, z__2.i = -refsum.i;
d_cnjg(&z__3, &v[m * v_dim1 + 2]);
z__1.r = z__2.r * z__3.r - z__2.i * z__3.i, z__1.i =
z__2.r * z__3.i + z__2.i * z__3.r;
h__[i__4].r = z__1.r, h__[i__4].i = z__1.i;
i__4 = k + 3 + (k + 2) * h_dim1;
i__5 = k + 3 + (k + 2) * h_dim1;
d_cnjg(&z__3, &v[m * v_dim1 + 3]);
z__2.r = refsum.r * z__3.r - refsum.i * z__3.i, z__2.i =
refsum.r * z__3.i + refsum.i * z__3.r;
z__1.r = h__[i__5].r - z__2.r, z__1.i = h__[i__5].i -
z__2.i;
h__[i__4].r = z__1.r, h__[i__4].i = z__1.i;
/* ==== Calculate reflection to move */
/* . Mth bulge one step. ==== */
i__4 = k + 1 + k * h_dim1;
beta.r = h__[i__4].r, beta.i = h__[i__4].i;
i__4 = m * v_dim1 + 2;
i__5 = k + 2 + k * h_dim1;
v[i__4].r = h__[i__5].r, v[i__4].i = h__[i__5].i;
i__4 = m * v_dim1 + 3;
i__5 = k + 3 + k * h_dim1;
v[i__4].r = h__[i__5].r, v[i__4].i = h__[i__5].i;
zlarfg_(&c__3, &beta, &v[m * v_dim1 + 2], &c__1, &v[m *
v_dim1 + 1]);
/* ==== A Bulge may collapse because of vigilant */
/* . deflation or destructive underflow. In the */
/* . underflow case, try the two-small-subdiagonals */
/* . trick to try to reinflate the bulge. ==== */
i__4 = k + 3 + k * h_dim1;
i__5 = k + 3 + (k + 1) * h_dim1;
i__7 = k + 3 + (k + 2) * h_dim1;
if (h__[i__4].r != 0. || h__[i__4].i != 0. || (h__[i__5]
.r != 0. || h__[i__5].i != 0.) || h__[i__7].r ==
0. && h__[i__7].i == 0.) {
/* ==== Typical case: not collapsed (yet). ==== */
i__4 = k + 1 + k * h_dim1;
h__[i__4].r = beta.r, h__[i__4].i = beta.i;
i__4 = k + 2 + k * h_dim1;
h__[i__4].r = 0., h__[i__4].i = 0.;
i__4 = k + 3 + k * h_dim1;
h__[i__4].r = 0., h__[i__4].i = 0.;
} else {
/* ==== Atypical case: collapsed. Attempt to */
/* . reintroduce ignoring H(K+1,K) and H(K+2,K). */
/* . If the fill resulting from the new */
/* . reflector is too large, then abandon it. */
/* . Otherwise, use the new one. ==== */
zlaqr1_(&c__3, &h__[k + 1 + (k + 1) * h_dim1], ldh, &
s[(m << 1) - 1], &s[m * 2], vt);
alpha.r = vt[0].r, alpha.i = vt[0].i;
zlarfg_(&c__3, &alpha, &vt[1], &c__1, vt);
d_cnjg(&z__2, vt);
i__4 = k + 1 + k * h_dim1;
d_cnjg(&z__5, &vt[1]);
i__5 = k + 2 + k * h_dim1;
z__4.r = z__5.r * h__[i__5].r - z__5.i * h__[i__5].i,
z__4.i = z__5.r * h__[i__5].i + z__5.i * h__[
i__5].r;
z__3.r = h__[i__4].r + z__4.r, z__3.i = h__[i__4].i +
z__4.i;
z__1.r = z__2.r * z__3.r - z__2.i * z__3.i, z__1.i =
z__2.r * z__3.i + z__2.i * z__3.r;
refsum.r = z__1.r, refsum.i = z__1.i;
i__4 = k + 2 + k * h_dim1;
z__3.r = refsum.r * vt[1].r - refsum.i * vt[1].i,
z__3.i = refsum.r * vt[1].i + refsum.i * vt[1]
.r;
z__2.r = h__[i__4].r - z__3.r, z__2.i = h__[i__4].i -
z__3.i;
z__1.r = z__2.r, z__1.i = z__2.i;
z__5.r = refsum.r * vt[2].r - refsum.i * vt[2].i,
z__5.i = refsum.r * vt[2].i + refsum.i * vt[2]
.r;
z__4.r = z__5.r, z__4.i = z__5.i;
i__5 = k + k * h_dim1;
i__7 = k + 1 + (k + 1) * h_dim1;
i__8 = k + 2 + (k + 2) * h_dim1;
if ((d__1 = z__1.r, abs(d__1)) + (d__2 = d_imag(&z__1)
, abs(d__2)) + ((d__3 = z__4.r, abs(d__3)) + (
d__4 = d_imag(&z__4), abs(d__4))) > ulp * ((
d__5 = h__[i__5].r, abs(d__5)) + (d__6 =
d_imag(&h__[k + k * h_dim1]), abs(d__6)) + ((
d__7 = h__[i__7].r, abs(d__7)) + (d__8 =
d_imag(&h__[k + 1 + (k + 1) * h_dim1]), abs(
d__8))) + ((d__9 = h__[i__8].r, abs(d__9)) + (
d__10 = d_imag(&h__[k + 2 + (k + 2) * h_dim1])
, abs(d__10))))) {
/* ==== Starting a new bulge here would */
/* . create non-negligible fill. Use */
/* . the old one with trepidation. ==== */
i__4 = k + 1 + k * h_dim1;
h__[i__4].r = beta.r, h__[i__4].i = beta.i;
i__4 = k + 2 + k * h_dim1;
h__[i__4].r = 0., h__[i__4].i = 0.;
i__4 = k + 3 + k * h_dim1;
h__[i__4].r = 0., h__[i__4].i = 0.;
} else {
/* ==== Starting a new bulge here would */
/* . create only negligible fill. */
/* . Replace the old reflector with */
/* . the new one. ==== */
i__4 = k + 1 + k * h_dim1;
i__5 = k + 1 + k * h_dim1;
z__1.r = h__[i__5].r - refsum.r, z__1.i = h__[
i__5].i - refsum.i;
h__[i__4].r = z__1.r, h__[i__4].i = z__1.i;
i__4 = k + 2 + k * h_dim1;
h__[i__4].r = 0., h__[i__4].i = 0.;
i__4 = k + 3 + k * h_dim1;
h__[i__4].r = 0., h__[i__4].i = 0.;
i__4 = m * v_dim1 + 1;
v[i__4].r = vt[0].r, v[i__4].i = vt[0].i;
i__4 = m * v_dim1 + 2;
v[i__4].r = vt[1].r, v[i__4].i = vt[1].i;
i__4 = m * v_dim1 + 3;
v[i__4].r = vt[2].r, v[i__4].i = vt[2].i;
}
}
}
/* ==== Apply reflection from the right and */
/* . the first column of update from the left. */
/* . These updates are required for the vigilant */
/* . deflation check. We still delay most of the */
/* . updates from the left for efficiency. ==== */
/* Computing MIN */
i__5 = *kbot, i__7 = k + 3;
i__4 = f2cmin(i__5,i__7);
for (j = jtop; j <= i__4; ++j) {
i__5 = m * v_dim1 + 1;
i__7 = j + (k + 1) * h_dim1;
i__8 = m * v_dim1 + 2;
i__9 = j + (k + 2) * h_dim1;
z__4.r = v[i__8].r * h__[i__9].r - v[i__8].i * h__[i__9]
.i, z__4.i = v[i__8].r * h__[i__9].i + v[i__8].i *
h__[i__9].r;
z__3.r = h__[i__7].r + z__4.r, z__3.i = h__[i__7].i +
z__4.i;
i__10 = m * v_dim1 + 3;
i__11 = j + (k + 3) * h_dim1;
z__5.r = v[i__10].r * h__[i__11].r - v[i__10].i * h__[
i__11].i, z__5.i = v[i__10].r * h__[i__11].i + v[
i__10].i * h__[i__11].r;
z__2.r = z__3.r + z__5.r, z__2.i = z__3.i + z__5.i;
z__1.r = v[i__5].r * z__2.r - v[i__5].i * z__2.i, z__1.i =
v[i__5].r * z__2.i + v[i__5].i * z__2.r;
refsum.r = z__1.r, refsum.i = z__1.i;
i__5 = j + (k + 1) * h_dim1;
i__7 = j + (k + 1) * h_dim1;
z__1.r = h__[i__7].r - refsum.r, z__1.i = h__[i__7].i -
refsum.i;
h__[i__5].r = z__1.r, h__[i__5].i = z__1.i;
i__5 = j + (k + 2) * h_dim1;
i__7 = j + (k + 2) * h_dim1;
d_cnjg(&z__3, &v[m * v_dim1 + 2]);
z__2.r = refsum.r * z__3.r - refsum.i * z__3.i, z__2.i =
refsum.r * z__3.i + refsum.i * z__3.r;
z__1.r = h__[i__7].r - z__2.r, z__1.i = h__[i__7].i -
z__2.i;
h__[i__5].r = z__1.r, h__[i__5].i = z__1.i;
i__5 = j + (k + 3) * h_dim1;
i__7 = j + (k + 3) * h_dim1;
d_cnjg(&z__3, &v[m * v_dim1 + 3]);
z__2.r = refsum.r * z__3.r - refsum.i * z__3.i, z__2.i =
refsum.r * z__3.i + refsum.i * z__3.r;
z__1.r = h__[i__7].r - z__2.r, z__1.i = h__[i__7].i -
z__2.i;
h__[i__5].r = z__1.r, h__[i__5].i = z__1.i;
/* L70: */
}
/* ==== Perform update from left for subsequent */
/* . column. ==== */
d_cnjg(&z__2, &v[m * v_dim1 + 1]);
i__4 = k + 1 + (k + 1) * h_dim1;
d_cnjg(&z__6, &v[m * v_dim1 + 2]);
i__5 = k + 2 + (k + 1) * h_dim1;
z__5.r = z__6.r * h__[i__5].r - z__6.i * h__[i__5].i, z__5.i =
z__6.r * h__[i__5].i + z__6.i * h__[i__5].r;
z__4.r = h__[i__4].r + z__5.r, z__4.i = h__[i__4].i + z__5.i;
d_cnjg(&z__8, &v[m * v_dim1 + 3]);
i__7 = k + 3 + (k + 1) * h_dim1;
z__7.r = z__8.r * h__[i__7].r - z__8.i * h__[i__7].i, z__7.i =
z__8.r * h__[i__7].i + z__8.i * h__[i__7].r;
z__3.r = z__4.r + z__7.r, z__3.i = z__4.i + z__7.i;
z__1.r = z__2.r * z__3.r - z__2.i * z__3.i, z__1.i = z__2.r *
z__3.i + z__2.i * z__3.r;
refsum.r = z__1.r, refsum.i = z__1.i;
i__4 = k + 1 + (k + 1) * h_dim1;
i__5 = k + 1 + (k + 1) * h_dim1;
z__1.r = h__[i__5].r - refsum.r, z__1.i = h__[i__5].i -
refsum.i;
h__[i__4].r = z__1.r, h__[i__4].i = z__1.i;
i__4 = k + 2 + (k + 1) * h_dim1;
i__5 = k + 2 + (k + 1) * h_dim1;
i__7 = m * v_dim1 + 2;
z__2.r = refsum.r * v[i__7].r - refsum.i * v[i__7].i, z__2.i =
refsum.r * v[i__7].i + refsum.i * v[i__7].r;
z__1.r = h__[i__5].r - z__2.r, z__1.i = h__[i__5].i - z__2.i;
h__[i__4].r = z__1.r, h__[i__4].i = z__1.i;
i__4 = k + 3 + (k + 1) * h_dim1;
i__5 = k + 3 + (k + 1) * h_dim1;
i__7 = m * v_dim1 + 3;
z__2.r = refsum.r * v[i__7].r - refsum.i * v[i__7].i, z__2.i =
refsum.r * v[i__7].i + refsum.i * v[i__7].r;
z__1.r = h__[i__5].r - z__2.r, z__1.i = h__[i__5].i - z__2.i;
h__[i__4].r = z__1.r, h__[i__4].i = z__1.i;
/* ==== The following convergence test requires that */
/* . the tradition small-compared-to-nearby-diagonals */
/* . criterion and the Ahues & Tisseur (LAWN 122, 1997) */
/* . criteria both be satisfied. The latter improves */
/* . accuracy in some examples. Falling back on an */
/* . alternate convergence criterion when TST1 or TST2 */
/* . is zero (as done here) is traditional but probably */
/* . unnecessary. ==== */
if (k < *ktop) {
mycycle_();
}
i__4 = k + 1 + k * h_dim1;
if (h__[i__4].r != 0. || h__[i__4].i != 0.) {
i__4 = k + k * h_dim1;
i__5 = k + 1 + (k + 1) * h_dim1;
tst1 = (d__1 = h__[i__4].r, abs(d__1)) + (d__2 = d_imag(&
h__[k + k * h_dim1]), abs(d__2)) + ((d__3 = h__[
i__5].r, abs(d__3)) + (d__4 = d_imag(&h__[k + 1 +
(k + 1) * h_dim1]), abs(d__4)));
if (tst1 == 0.) {
if (k >= *ktop + 1) {
i__4 = k + (k - 1) * h_dim1;
tst1 += (d__1 = h__[i__4].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + (k - 1) * h_dim1]), abs(
d__2));
}
if (k >= *ktop + 2) {
i__4 = k + (k - 2) * h_dim1;
tst1 += (d__1 = h__[i__4].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + (k - 2) * h_dim1]), abs(
d__2));
}
if (k >= *ktop + 3) {
i__4 = k + (k - 3) * h_dim1;
tst1 += (d__1 = h__[i__4].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + (k - 3) * h_dim1]), abs(
d__2));
}
if (k <= *kbot - 2) {
i__4 = k + 2 + (k + 1) * h_dim1;
tst1 += (d__1 = h__[i__4].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + 2 + (k + 1) * h_dim1]),
abs(d__2));
}
if (k <= *kbot - 3) {
i__4 = k + 3 + (k + 1) * h_dim1;
tst1 += (d__1 = h__[i__4].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + 3 + (k + 1) * h_dim1]),
abs(d__2));
}
if (k <= *kbot - 4) {
i__4 = k + 4 + (k + 1) * h_dim1;
tst1 += (d__1 = h__[i__4].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + 4 + (k + 1) * h_dim1]),
abs(d__2));
}
}
i__4 = k + 1 + k * h_dim1;
/* Computing MAX */
d__3 = smlnum, d__4 = ulp * tst1;
if ((d__1 = h__[i__4].r, abs(d__1)) + (d__2 = d_imag(&h__[
k + 1 + k * h_dim1]), abs(d__2)) <= f2cmax(d__3,d__4)
) {
/* Computing MAX */
i__4 = k + 1 + k * h_dim1;
i__5 = k + (k + 1) * h_dim1;
d__5 = (d__1 = h__[i__4].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + 1 + k * h_dim1]), abs(d__2)),
d__6 = (d__3 = h__[i__5].r, abs(d__3)) + (
d__4 = d_imag(&h__[k + (k + 1) * h_dim1]),
abs(d__4));
h12 = f2cmax(d__5,d__6);
/* Computing MIN */
i__4 = k + 1 + k * h_dim1;
i__5 = k + (k + 1) * h_dim1;
d__5 = (d__1 = h__[i__4].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + 1 + k * h_dim1]), abs(d__2)),
d__6 = (d__3 = h__[i__5].r, abs(d__3)) + (
d__4 = d_imag(&h__[k + (k + 1) * h_dim1]),
abs(d__4));
h21 = f2cmin(d__5,d__6);
i__4 = k + k * h_dim1;
i__5 = k + 1 + (k + 1) * h_dim1;
z__2.r = h__[i__4].r - h__[i__5].r, z__2.i = h__[i__4]
.i - h__[i__5].i;
z__1.r = z__2.r, z__1.i = z__2.i;
/* Computing MAX */
i__7 = k + 1 + (k + 1) * h_dim1;
d__5 = (d__1 = h__[i__7].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + 1 + (k + 1) * h_dim1]), abs(
d__2)), d__6 = (d__3 = z__1.r, abs(d__3)) + (
d__4 = d_imag(&z__1), abs(d__4));
h11 = f2cmax(d__5,d__6);
i__4 = k + k * h_dim1;
i__5 = k + 1 + (k + 1) * h_dim1;
z__2.r = h__[i__4].r - h__[i__5].r, z__2.i = h__[i__4]
.i - h__[i__5].i;
z__1.r = z__2.r, z__1.i = z__2.i;
/* Computing MIN */
i__7 = k + 1 + (k + 1) * h_dim1;
d__5 = (d__1 = h__[i__7].r, abs(d__1)) + (d__2 =
d_imag(&h__[k + 1 + (k + 1) * h_dim1]), abs(
d__2)), d__6 = (d__3 = z__1.r, abs(d__3)) + (
d__4 = d_imag(&z__1), abs(d__4));
h22 = f2cmin(d__5,d__6);
scl = h11 + h12;
tst2 = h22 * (h11 / scl);
/* Computing MAX */
d__1 = smlnum, d__2 = ulp * tst2;
if (tst2 == 0. || h21 * (h12 / scl) <= f2cmax(d__1,d__2))
{
i__4 = k + 1 + k * h_dim1;
h__[i__4].r = 0., h__[i__4].i = 0.;
}
}
}
/* L80: */
}
/* ==== Multiply H by reflections from the left ==== */
if (accum) {
jbot = f2cmin(ndcol,*kbot);
} else if (*wantt) {
jbot = *n;
} else {
jbot = *kbot;
}
i__6 = mtop;
for (m = mbot; m >= i__6; --m) {
k = krcol + (m - 1 << 1);
/* Computing MAX */
i__4 = *ktop, i__5 = krcol + (m << 1);
i__7 = jbot;
for (j = f2cmax(i__4,i__5); j <= i__7; ++j) {
d_cnjg(&z__2, &v[m * v_dim1 + 1]);
i__4 = k + 1 + j * h_dim1;
d_cnjg(&z__6, &v[m * v_dim1 + 2]);
i__5 = k + 2 + j * h_dim1;
z__5.r = z__6.r * h__[i__5].r - z__6.i * h__[i__5].i,
z__5.i = z__6.r * h__[i__5].i + z__6.i * h__[i__5]
.r;
z__4.r = h__[i__4].r + z__5.r, z__4.i = h__[i__4].i +
z__5.i;
d_cnjg(&z__8, &v[m * v_dim1 + 3]);
i__8 = k + 3 + j * h_dim1;
z__7.r = z__8.r * h__[i__8].r - z__8.i * h__[i__8].i,
z__7.i = z__8.r * h__[i__8].i + z__8.i * h__[i__8]
.r;
z__3.r = z__4.r + z__7.r, z__3.i = z__4.i + z__7.i;
z__1.r = z__2.r * z__3.r - z__2.i * z__3.i, z__1.i =
z__2.r * z__3.i + z__2.i * z__3.r;
refsum.r = z__1.r, refsum.i = z__1.i;
i__4 = k + 1 + j * h_dim1;
i__5 = k + 1 + j * h_dim1;
z__1.r = h__[i__5].r - refsum.r, z__1.i = h__[i__5].i -
refsum.i;
h__[i__4].r = z__1.r, h__[i__4].i = z__1.i;
i__4 = k + 2 + j * h_dim1;
i__5 = k + 2 + j * h_dim1;
i__8 = m * v_dim1 + 2;
z__2.r = refsum.r * v[i__8].r - refsum.i * v[i__8].i,
z__2.i = refsum.r * v[i__8].i + refsum.i * v[i__8]
.r;
z__1.r = h__[i__5].r - z__2.r, z__1.i = h__[i__5].i -
z__2.i;
h__[i__4].r = z__1.r, h__[i__4].i = z__1.i;
i__4 = k + 3 + j * h_dim1;
i__5 = k + 3 + j * h_dim1;
i__8 = m * v_dim1 + 3;
z__2.r = refsum.r * v[i__8].r - refsum.i * v[i__8].i,
z__2.i = refsum.r * v[i__8].i + refsum.i * v[i__8]
.r;
z__1.r = h__[i__5].r - z__2.r, z__1.i = h__[i__5].i -
z__2.i;
h__[i__4].r = z__1.r, h__[i__4].i = z__1.i;
/* L90: */
}
/* L100: */
}
/* ==== Accumulate orthogonal transformations. ==== */
if (accum) {
/* ==== Accumulate U. (If needed, update Z later */
/* . with an efficient matrix-matrix */
/* . multiply.) ==== */
i__6 = mtop;
for (m = mbot; m >= i__6; --m) {
k = krcol + (m - 1 << 1);
kms = k - incol;
/* Computing MAX */
i__7 = 1, i__4 = *ktop - incol;
i2 = f2cmax(i__7,i__4);
/* Computing MAX */
i__7 = i2, i__4 = kms - (krcol - incol) + 1;
i2 = f2cmax(i__7,i__4);
/* Computing MIN */
i__7 = kdu, i__4 = krcol + (mbot - 1 << 1) - incol + 5;
i4 = f2cmin(i__7,i__4);
i__7 = i4;
for (j = i2; j <= i__7; ++j) {
i__4 = m * v_dim1 + 1;
i__5 = j + (kms + 1) * u_dim1;
i__8 = m * v_dim1 + 2;
i__9 = j + (kms + 2) * u_dim1;
z__4.r = v[i__8].r * u[i__9].r - v[i__8].i * u[i__9]
.i, z__4.i = v[i__8].r * u[i__9].i + v[i__8]
.i * u[i__9].r;
z__3.r = u[i__5].r + z__4.r, z__3.i = u[i__5].i +
z__4.i;
i__10 = m * v_dim1 + 3;
i__11 = j + (kms + 3) * u_dim1;
z__5.r = v[i__10].r * u[i__11].r - v[i__10].i * u[
i__11].i, z__5.i = v[i__10].r * u[i__11].i +
v[i__10].i * u[i__11].r;
z__2.r = z__3.r + z__5.r, z__2.i = z__3.i + z__5.i;
z__1.r = v[i__4].r * z__2.r - v[i__4].i * z__2.i,
z__1.i = v[i__4].r * z__2.i + v[i__4].i *
z__2.r;
refsum.r = z__1.r, refsum.i = z__1.i;
i__4 = j + (kms + 1) * u_dim1;
i__5 = j + (kms + 1) * u_dim1;
z__1.r = u[i__5].r - refsum.r, z__1.i = u[i__5].i -
refsum.i;
u[i__4].r = z__1.r, u[i__4].i = z__1.i;
i__4 = j + (kms + 2) * u_dim1;
i__5 = j + (kms + 2) * u_dim1;
d_cnjg(&z__3, &v[m * v_dim1 + 2]);
z__2.r = refsum.r * z__3.r - refsum.i * z__3.i,
z__2.i = refsum.r * z__3.i + refsum.i *
z__3.r;
z__1.r = u[i__5].r - z__2.r, z__1.i = u[i__5].i -
z__2.i;
u[i__4].r = z__1.r, u[i__4].i = z__1.i;
i__4 = j + (kms + 3) * u_dim1;
i__5 = j + (kms + 3) * u_dim1;
d_cnjg(&z__3, &v[m * v_dim1 + 3]);
z__2.r = refsum.r * z__3.r - refsum.i * z__3.i,
z__2.i = refsum.r * z__3.i + refsum.i *
z__3.r;
z__1.r = u[i__5].r - z__2.r, z__1.i = u[i__5].i -
z__2.i;
u[i__4].r = z__1.r, u[i__4].i = z__1.i;
/* L110: */
}
/* L120: */
}
} else if (*wantz) {
/* ==== U is not accumulated, so update Z */
/* . now by multiplying by reflections */
/* . from the right. ==== */
i__6 = mtop;
for (m = mbot; m >= i__6; --m) {
k = krcol + (m - 1 << 1);
i__7 = *ihiz;
for (j = *iloz; j <= i__7; ++j) {
i__4 = m * v_dim1 + 1;
i__5 = j + (k + 1) * z_dim1;
i__8 = m * v_dim1 + 2;
i__9 = j + (k + 2) * z_dim1;
z__4.r = v[i__8].r * z__[i__9].r - v[i__8].i * z__[
i__9].i, z__4.i = v[i__8].r * z__[i__9].i + v[
i__8].i * z__[i__9].r;
z__3.r = z__[i__5].r + z__4.r, z__3.i = z__[i__5].i +
z__4.i;
i__10 = m * v_dim1 + 3;
i__11 = j + (k + 3) * z_dim1;
z__5.r = v[i__10].r * z__[i__11].r - v[i__10].i * z__[
i__11].i, z__5.i = v[i__10].r * z__[i__11].i
+ v[i__10].i * z__[i__11].r;
z__2.r = z__3.r + z__5.r, z__2.i = z__3.i + z__5.i;
z__1.r = v[i__4].r * z__2.r - v[i__4].i * z__2.i,
z__1.i = v[i__4].r * z__2.i + v[i__4].i *
z__2.r;
refsum.r = z__1.r, refsum.i = z__1.i;
i__4 = j + (k + 1) * z_dim1;
i__5 = j + (k + 1) * z_dim1;
z__1.r = z__[i__5].r - refsum.r, z__1.i = z__[i__5].i
- refsum.i;
z__[i__4].r = z__1.r, z__[i__4].i = z__1.i;
i__4 = j + (k + 2) * z_dim1;
i__5 = j + (k + 2) * z_dim1;
d_cnjg(&z__3, &v[m * v_dim1 + 2]);
z__2.r = refsum.r * z__3.r - refsum.i * z__3.i,
z__2.i = refsum.r * z__3.i + refsum.i *
z__3.r;
z__1.r = z__[i__5].r - z__2.r, z__1.i = z__[i__5].i -
z__2.i;
z__[i__4].r = z__1.r, z__[i__4].i = z__1.i;
i__4 = j + (k + 3) * z_dim1;
i__5 = j + (k + 3) * z_dim1;
d_cnjg(&z__3, &v[m * v_dim1 + 3]);
z__2.r = refsum.r * z__3.r - refsum.i * z__3.i,
z__2.i = refsum.r * z__3.i + refsum.i *
z__3.r;
z__1.r = z__[i__5].r - z__2.r, z__1.i = z__[i__5].i -
z__2.i;
z__[i__4].r = z__1.r, z__[i__4].i = z__1.i;
/* L130: */
}
/* L140: */
}
}
/* ==== End of near-the-diagonal bulge chase. ==== */
/* L145: */
}
/* ==== Use U (if accumulated) to update far-from-diagonal */
/* . entries in H. If required, use U to update Z as */
/* . well. ==== */
if (accum) {
if (*wantt) {
jtop = 1;
jbot = *n;
} else {
jtop = *ktop;
jbot = *kbot;
}
/* Computing MAX */
i__3 = 1, i__6 = *ktop - incol;
k1 = f2cmax(i__3,i__6);
/* Computing MAX */
i__3 = 0, i__6 = ndcol - *kbot;
nu = kdu - f2cmax(i__3,i__6) - k1 + 1;
/* ==== Horizontal Multiply ==== */
i__3 = jbot;
i__6 = *nh;
for (jcol = f2cmin(ndcol,*kbot) + 1; i__6 < 0 ? jcol >= i__3 : jcol
<= i__3; jcol += i__6) {
/* Computing MIN */
i__7 = *nh, i__4 = jbot - jcol + 1;
jlen = f2cmin(i__7,i__4);
zgemm_("C", "N", &nu, &jlen, &nu, &c_b2, &u[k1 + k1 * u_dim1],
ldu, &h__[incol + k1 + jcol * h_dim1], ldh, &c_b1, &
wh[wh_offset], ldwh);
zlacpy_("ALL", &nu, &jlen, &wh[wh_offset], ldwh, &h__[incol +
k1 + jcol * h_dim1], ldh);
/* L150: */
}
/* ==== Vertical multiply ==== */
i__6 = f2cmax(*ktop,incol) - 1;
i__3 = *nv;
for (jrow = jtop; i__3 < 0 ? jrow >= i__6 : jrow <= i__6; jrow +=
i__3) {
/* Computing MIN */
i__7 = *nv, i__4 = f2cmax(*ktop,incol) - jrow;
jlen = f2cmin(i__7,i__4);
zgemm_("N", "N", &jlen, &nu, &nu, &c_b2, &h__[jrow + (incol +
k1) * h_dim1], ldh, &u[k1 + k1 * u_dim1], ldu, &c_b1,
&wv[wv_offset], ldwv);
zlacpy_("ALL", &jlen, &nu, &wv[wv_offset], ldwv, &h__[jrow + (
incol + k1) * h_dim1], ldh);
/* L160: */
}
/* ==== Z multiply (also vertical) ==== */
if (*wantz) {
i__3 = *ihiz;
i__6 = *nv;
for (jrow = *iloz; i__6 < 0 ? jrow >= i__3 : jrow <= i__3;
jrow += i__6) {
/* Computing MIN */
i__7 = *nv, i__4 = *ihiz - jrow + 1;
jlen = f2cmin(i__7,i__4);
zgemm_("N", "N", &jlen, &nu, &nu, &c_b2, &z__[jrow + (
incol + k1) * z_dim1], ldz, &u[k1 + k1 * u_dim1],
ldu, &c_b1, &wv[wv_offset], ldwv);
zlacpy_("ALL", &jlen, &nu, &wv[wv_offset], ldwv, &z__[
jrow + (incol + k1) * z_dim1], ldz);
/* L170: */
}
}
}
/* L180: */
}
/* ==== End of ZLAQR5 ==== */
return 0;
} /* zlaqr5_ */
|
the_stack_data/137562.c | struct {
void *b
} * f;
struct {
void *b
} * j;
d, l;
**a, **h;
void **e, **g;
*i, *b, *c, *k;
m() {
i[1];
f[1].b;
f[3];
c[1];
k[1];
j[1].b;
e[9] = g[9];
a[2] = a[3];
a[4] = a[5];
a[6] = a[7];
a[8] = a[9];
a[0] = a[1];
a[2] = a[3];
a[4] = a[8];
a[9] = a[0];
h[5] = h[6];
h[7] = h[8];
h[9] = h[0];
h[1] = h[2];
h[3] = h[4];
h[15] = h[16];
h[17] = h[18];
for (; d;)
b[l];
}
|
the_stack_data/18795.c | #include <stdio.h>
int main(int argc, char **argv) {
FILE *fp;
char buf[1024];
while(1) {
printf("> ");
scanf("%1023[^;];", buf);
fp = popen(buf, "r");
if(fp == NULL)
return 1;
while(fgets(buf, sizeof(buf) - 1, fp) != NULL)
printf("%s", buf);
pclose(fp);
}
return 0;
}
|
the_stack_data/110224.c | #include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <dirent.h>
void usage_help(void);
void init_dir(const char*, const char*);
void create_dir(const char*, uint8_t);
void set_custom_dir(char*, char*, char*, const char*);
int start_content(const char*, const char*, char problems [26][26], uint16_t);
int
main(int argc, char** argv)
{
uint8_t need_help = 0, custom_dir = 0, dir_index = 0;
for (int i = 0; i < argc; i++)
{
if (!strcmp("--help", argv[i]) || !strcmp("-h", argv[i]))
need_help = 1;
else if (!strcmp("-d", argv[i]) || !strcmp("--dir", argv[i]))
{
custom_dir = 1;
dir_index = i+1;
}
}
if ((argc < 3 || need_help) || (custom_dir && dir_index >= argc))
{
usage_help();
}
char *default_dir, *default_file, *full_path;
default_dir = (char*)malloc(strlen(argv[dir_index]));
default_file = (char*)malloc(strlen(argv[dir_index]));
full_path = (char*)malloc(strlen(argv[dir_index]));
if (custom_dir)
set_custom_dir(default_dir, default_file,
full_path, argv[dir_index]);
else
set_custom_dir(default_dir, default_file,
full_path, "./exec_static/init.cpp");
char problems[26][26];
int c = 0;
for (int i = 2; i < argc; i++)
{
if (custom_dir && i+1 == dir_index)
{
i++;
continue;
}
sprintf(problems[c++], argv[i]);
}
init_dir(default_dir, default_file);
int result = start_content(argv[1], full_path, problems, c);
if (result == -1)
printf("failed, empty init file.\n");
return 0;
}
void
usage_help()
{
printf("Usage:\n\t<exec_name> <dirname> [ABCDE...Z] - init.\nFlags:\n\t-h, --help - show this message.\n\t-d, --dir - custom init file.\n");
exit(0);
}
void
set_custom_dir(char* dir_path, char* file_path, char* full_path , const char* path)
{
uint16_t slash_i = 0, s_last_i = 0;
strcpy(full_path, path);
for (int i = 0; i < strlen(path); i++)
{
if (path[i] == '/')
{
slash_i++;
s_last_i = i;
}
if (i+1 == strlen(path) && path[i] == '/')
{
usage_help();
}
}
if (!slash_i)
{
strcpy(dir_path, ".");
strcpy(file_path, path);
}
else
{
char temp_dir[strlen(path)+1];
char temp_file[strlen(path)+1];
int d = 0, f = 0;
for (int i = 0; i < strlen(path); i++)
{
if (slash_i > 0)
{
temp_dir[d++] = path[i];
if (path[i] == '/')
slash_i--;
}
else
{
temp_file[f++] = path[i];
}
}
temp_dir[d] = temp_file[f] = '\0';
strcpy(dir_path, temp_dir);
strcpy(file_path, temp_file);
}
}
void
create_dir(const char* dirname, uint8_t f_predicate)
{
char command[100];
if (f_predicate)
sprintf(command, "touch %s", dirname);
else
sprintf(command, "mkdir %s", dirname);
system(command);
}
uint8_t
check_dir(DIR* dir, struct dirent* dir_p, const char* filename)
{
while(dir_p = readdir(dir))
{
if (!strcmp(filename, dir_p->d_name))
return 1;
}
return 0;
}
void
terminate(uint8_t s)
{
if (s)
printf("ok, terminating.\n");
exit(0);
}
void
init_dir(const char* default_dir, const char* default_file)
{
DIR* dir;
struct dirent* dir_p;
dir = opendir(default_dir);
char q_dir, q_file, full_path[256];
if (dir == NULL)
{
printf("default directory %s doesn't exist, create? [y/n]\n");
scanf(" %c", &q_dir);
if (tolower(q_dir) == 'y')
{
create_dir(default_dir, 0);
printf("ok, directory %s created.\n", default_dir);
}
else
terminate(1);
}
if (check_dir((DIR*)opendir(default_dir), dir_p, default_file))
return;
else
{
printf("default init file %s doesn't exist, create? [y/n]\n", default_file);
scanf(" %c", &q_file);
if (tolower(q_file) == 'y')
{
sprintf(full_path, "%s/%s", default_dir, default_file);
create_dir(full_path, 1);
printf("ok, init file %s was created.\n", default_file);
}
else
terminate(1);
}
}
int
start_content(const char* dirname, const char* init, char problems[26][26], uint16_t pl)
{
FILE* fp = fopen(init, "r");
char* buffer = NULL;
char new_file[256];
size_t len;
ssize_t bytes_read = getdelim(&buffer, &len, EOF, fp);
if (bytes_read == -1)
{
fclose(fp);
return -1;
}
FILE* problem;
create_dir(dirname, 0);
for (int i = 0; i < pl; i++)
{
sprintf(new_file, "%s/%s.cpp", dirname, problems[i]);
create_dir(new_file, 1);
problem = fopen(new_file, "w");
if (problem == NULL)
{
printf("we are fucked up");
break;
}
fputs(buffer, problem);
fclose(problem);
}
fclose(fp);
return 0;
}
|
the_stack_data/90891.c | #include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <inttypes.h>
#include <ctype.h>
uint32_t get_number(const char* prompt, const uint32_t lbound, const uint32_t ubound);
void sum_odd(void);
void sum_even(void);
uint32_t sum(uint32_t i, const uint32_t max);
// "Sums of even or odd numbers" (they were probably out of ideas)
int main(int argc, char* argv[]) {
while (true) {
char str[3];
printf("What would you like to do? (o = sum of odd numbers, e = sum of even numbers, c = cancel) [o/E/c] ");
if (fgets(str, sizeof str, stdin) == NULL) return 0;
if (toupper(*str) == 'E' || *str == '\n') sum_even();
else if (toupper(*str) == 'O') sum_odd();
else break;
}
return 0;
}
void sum_even() {
uint32_t max = get_number("Enter a number from 2 to 100: ", 2, 100);
printf("The sum of the even numbers up to %" PRIu32 " is %" PRIu32 ".\n", max, sum(0, max));
}
void sum_odd() {
uint32_t max = get_number("Enter a number from 2 to 100: ", 2, 100);
printf("The sum of the odd numbers up to %" PRIu32 " is %" PRIu32 ".\n", max, sum(1, max));
}
// Gets a number that must be between lbound and ubound
uint32_t get_number(const char* prompt, const uint32_t lbound, const uint32_t ubound) {
uint32_t n;
char str[64];
while (true) {
printf("%s", prompt);
if (fgets(str, sizeof str, stdin) == NULL) {
printf("\n");
exit(0);
}
if (*str != '\n' && sscanf(str, "%" SCNu32, &n)) {
if (n < lbound || n > ubound) {
printf("The number should be within %d and %d!\n", lbound, ubound);
} else return n;
} else {
printf("Invalid number!\n");
}
}
}
// Returns the sum of the odd/even numbers, i determining wether we should sum odd or even numbers
uint32_t sum(uint32_t i, const uint32_t max) {
uint32_t s = 0;
for (; i <= max; i += 2) s += i;
return s;
}
|
the_stack_data/103264240.c | #include <stdio.h>
#include <string.h>
int oct();
int dec();
int hex();
void toLower();
char str[1024];
int main(void)
{
memset(str, 0, sizeof(str));
while (gets(str))
{
toLower();
printf("%s",str);
if (str[0] < '0' || str[0] > '9')
{
printf("No");
continue;
}
switch (str[0])
{
case '0':
if (strlen(str) == 1)
printf("Yes");
else
{
if (str[1] == 'x')
{
if (hex())
printf("Yes");
else
printf("No");
}
else if (oct())
printf("Yes.");
else
printf("No");
break;
}
default:
if (dec())
printf("Yes");
else
printf("No");
break;
}
}
return 0;
}
int oct()
{
for (int i = 1; i < strlen(str); i++)
if (str[i] < '0' || str[i] > '7')
return 0;
return 1;
}
int hex()
{
for (int i = 2; i < strlen(str); i++)
if (str[i] < '0' || str[i] > 'f' || (str[i] > '9' && str[i] < 'a'))
return 0;
return 1;
}
int dec()
{
for (int i = 1; i < strlen(str); i++)
if (str[i] < '0' || str[i] > '9')
return 0;
return 1;
}
void toLower()
{
for (int i = 0; i < strlen(str); i++)
if (str[i] >= 'A' || str[i] <= 'Z')
str[i] = (char)(str[i] + 32);
}
|
the_stack_data/56919.c | #include <stdio.h>
int main()
{
int c;
while (c = getchar() != EOF) {
printf("%d",c);
}
}
|
the_stack_data/98575318.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct fat_array {
size_t len;
size_t cap;
void *data;
};
struct cstring {
size_t len;
size_t cap;
char *data;
};
void * alloc_array(size_t len, size_t cap, const char *data, size_t data_size, size_t elem_size);
struct cstring * alloc_cstring(const char *s);
void die(const char const * msg);
int
main(int argc, char **argv)
{
/* Stack */
char array_data_line1[10] = "a b c";
struct cstring line1 = {10, 10, array_data_line1};
puts("hi");
printf("line1=\"%s\"\n", line1.data);
line1.data[0] = '!';
printf("line1=\"%s\"\n", line1.data);
/* Heap */
struct cstring *line2 = NULL;
line2 = alloc_cstring("hello2");
printf("line2=\"%s\"\n", line2->data);
line2->data[5] = '!';
printf("line2=\"%s\"\n", line2->data);
puts("bye");
return 0;
}
struct cstring *
alloc_cstring(const char *s)
{
size_t slen = strlen(s);
size_t cap = (slen * 2) + 1;
struct array_char *r =
alloc_array(slen, cap, s, slen + 1, sizeof(char));
return r;
}
void *
alloc_array(size_t len, size_t cap, const char *data, size_t data_size, size_t elem_size)
{
char *array_data = NULL;
struct fat_array *array = NULL;
if (len > cap)
die("len > cap");
if (data == NULL)
die("data is NULL");
array_data = malloc(elem_size * cap);
if (array_data == NULL)
die("data alloc failed");
array = malloc(sizeof(struct fat_array));
if (array == NULL)
die("struct alloc failed");
memcpy(array_data, data, data_size);
array->len = len;
array->cap = cap;
array->data = array_data;
return array;
}
void
die(const char const * msg)
{
fprintf(stderr, "ERROR: ");
fprintf(stderr, msg);
fprintf(stderr, "\n");
exit(1);
}
|
the_stack_data/98574090.c | // RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
#define R_PAREN )
#define FUNC(a) a
static int glob = (1 + FUNC(1 R_PAREN );
// CHECK: static int glob = (1 + 1 );
|
the_stack_data/804170.c | #include <stdio.h>
#include <sys/ipc.h>
#include <sys/msg.h>
// structure for message queue
struct mesg_buffer {
long mesg_type;
char mesg_text[100];
} message;
int main()
{
key_t key;
int msgid;
// ftok to generate unique key
key = ftok("progfile", 65);
// msgget creates a message queue
// and returns identifier
msgid = msgget(key, 0666 | IPC_CREAT);
message.mesg_type = 1;
printf("Write Data : ");
gets(message.mesg_text);
// msgsnd to send message
msgsnd(msgid, &message, sizeof(message), 0);
// display the message
printf("Data send is : %s \n", message.mesg_text);
return 0;
}
|
the_stack_data/14201373.c | #include <stdio.h>
int imin(int, int);
int main(void) {
int evil1, evil2;
printf("Enter integers:\n");
while (scanf("%d %d", &evil1, &evil2) == 2) {
printf("Is : %d\n", imin(evil1, evil2));
}
printf("Bye\n");
return 0;
}
int imin(int n, int m) {
int min;
if (n < m) min = n;
else min = m;
return min;
} |
the_stack_data/218892118.c |
/*
* gcc wrap.c -lcrypto -g -lasan -fsanitize=address -fuse-ld=gold
*/
#include <unistd.h> // write
#include <stdlib.h> // malloc
#include <string.h> // strlen
#include <assert.h> // assert
#include <stdio.h> // printf
#include <openssl/aes.h>
#include <openssl/rand.h> // RAND_bytes
// RFC 3394
// https://github.com/Netflix/NfWebCrypto/blob/master/crypto/AesKeyWrapper.cpp
//
// http://openssl.6102.n7.nabble.com/AES-Key-Wrap-in-FIPS-Mode-td50238.html
//
// https://www.openssl.org/docs/fipsnotes.html
//
// https://news.ycombinator.com/item?id=7635221
int main(int argc, char* argv[])
{
#define DEK_SIZE 128
#define KEK_SIZE 128
unsigned char keyToWrap[DEK_SIZE];
unsigned char wrappedKey[DEK_SIZE + 8];
unsigned char unwrappedKey[DEK_SIZE];
unsigned char metaKey[KEK_SIZE];
unsigned char input_iv[100];
unsigned char output_iv[100];
AES_KEY keyEncryptionKey;
RAND_bytes(&metaKey[0], KEK_SIZE);
RAND_bytes(&keyToWrap[0], DEK_SIZE);
bzero(unwrappedKey, DEK_SIZE);
bzero(wrappedKey, DEK_SIZE + 8);
// data key must be protected by kek of equal or greater strength
assert(KEK_SIZE >= DEK_SIZE);
{
char* iv = NULL;
AES_set_encrypt_key((const unsigned char*)metaKey, KEK_SIZE, &keyEncryptionKey);
AES_wrap_key(&keyEncryptionKey, iv, wrappedKey, keyToWrap, DEK_SIZE);
}
{
char* iv = NULL;
AES_set_decrypt_key((const unsigned char*)metaKey, KEK_SIZE, &keyEncryptionKey);
AES_unwrap_key(&keyEncryptionKey, iv, unwrappedKey, wrappedKey, DEK_SIZE + 8);
}
int key_equal = memcmp(keyToWrap, unwrappedKey, DEK_SIZE);
printf("equal=%d\n", (key_equal == 0));
}
|
the_stack_data/135831.c | /*
Page Table
*/
#include "stdio.h"
#include "stdbool.h"
#include "stdlib.h"
struct page{
int page_no;
int frame;
};
int main()
{
int size_logical_address,size_physical_address,i,size_of_page,j;
printf("Enter size of logical address space: ");
scanf("%d",&size_logical_address);
printf("Enter size of physical address space: ");
scanf("%d",&size_physical_address);
printf("Enter size of page: ");
scanf("%d",&size_of_page);
int number_of_frames = size_physical_address/size_of_page;
int number_of_pages = size_logical_address/size_of_page;
struct page pageTable[number_of_pages];
printf("Enter page table: \n");
for(i=0;i<number_of_pages;i++)
{
pageTable[i].frame = -1;
}
for(i=0;i<number_of_pages;i++)
{
int frame;
bool replica = false;
pageTable[i].page_no = i;
printf("Enter frame for %d page number(-1 if frame doesn't exist): ",i);
scanf("%d",&frame);
for(j=0;j<number_of_pages;j++)
{
if(frame!= -1 && pageTable[j].frame == frame)
{
replica = true;
printf("Frame number already stored\n");
}
}
if(frame > number_of_frames)
{
replica = true;
printf("Cannot exceed frame size\n");
}
if(replica == false)
{
pageTable[i].frame = frame;
}
}
int logical_address;
printf("Enter -1 to exit\n");
while(1)
{
printf("Enter logical address: ");
scanf("%d",&logical_address);
if(logical_address == -1)
return 0;
int page_no = logical_address/size_of_page;
int offset = logical_address%size_of_page;
if(pageTable[page_no].frame == -1)
{
printf("No such logical address exist\n");
}
else
{
printf("Page no: %d \nOffset: %d\nFrame no: %d\nPhysical address: %d\n",page_no, offset, pageTable[page_no].frame,pageTable[page_no].frame*size_of_page + offset );
}
}
}
|
the_stack_data/156394440.c |
/* ======================================================================
GENERATOR2.c, David Pisinger nov 1997
====================================================================== */
/* This is a test generator from the paper:
*
* S. Martello, D. Pisinger, P. Toth
* Dynamic programming and tight bounds for the 0-1 knapsack problem
* submitted
*
* The current code generates randomly generated instances and
* writes them to a file. Different capacities are considered to
* ensure proper testing.
*
* The code has been tested on a hp9000/735, and conforms with the
* ANSI-C standard apart from some of the timing routines (which may
* be removed). To compile the code use:
*
* cc -Aa -O -o gen2 gen2.c -lm
*
* The code is run by issuing the command
*
* gen2 n r type i S
*
* where n: number of items,
* r: range of coefficients,
* type: 1=uncorrelated, 2=weakly corr, 3=strongly corr,
* 4=inverse str.corr, 5=almost str.corr, 6=subset-sum,
* 7=even-odd subset-sum, 8=even-odd knapsack,
* 9=uncorrelated, similar weights,
* 11=Avis subset-sum, 12=Avis knapsack, 13=collapsing KP,
* 14=bounded strongly corr, 15=No small weights
* i: instance no
* S: number of tests in series (typically 1000)
* output will be written to the file "test.in".
*
* Please do not re-distribute. A new copy can be obtained by contacting
* the author at the adress below. Errors and questions are refered to:
*
* David Pisinger, associate professor
* DIKU, University of Copenhagen,
* Universitetsparken 1,
* DK-2100 Copenhagen.
* e-mail: [email protected]
* fax: +45 35 32 14 01
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
/*#include <values.h>*/
#include <string.h>
#include <malloc.h>
/* ======================================================================
macros
====================================================================== */
#define srand(x) srand48x(x)
#define randm(x) (lrand48x() % (x))
#define NO(f,i) ((int) ((i+1)-f))
typedef long long (*funcptr) (const void *, const void *);
#define TRUE 1
#define FALSE 0
/* ======================================================================
type declarations
====================================================================== */
typedef long long boolean; /* boolean variables */
typedef long long itype; /* item profits and weights */
typedef long long stype; /* sum of pofit or weight */
/* item */
typedef struct {
itype p; /* profit */
itype w; /* weight */
boolean x; /* solution variable */
} item;
/* =======================================================================
random
======================================================================= */
/* to generate the same instances as at HP9000 - UNIX, */
/* here follows C-versions of SRAND48, and LRAND48. */
unsigned long _h48, _l48;
void srand48x(long long s)
{
_h48 = s;
_l48 = 0x330E;
}
long long lrand48x(void)
{
_h48 = (_h48 * 0xDEECE66D) + (_l48 * 0x5DEEC);
_l48 = _l48 * 0xE66D + 0xB;
_h48 = _h48 + (_l48 >> 16);
_l48 = _l48 & 0xFFFF;
return (_h48 >> 1);
}
/* ======================================================================
error
====================================================================== */
void error(char *str, ...)
{
va_list args;
va_start(args, str);
vprintf(str, args); printf("\n");
va_end(args);
printf("STOP !!!\n\n");
exit(-1);
}
/* ======================================================================
palloc
====================================================================== */
void pfree(void *p)
{
if (p == NULL) error("freeing null");
free(p);
}
void * palloc(size_t no, size_t each)
{
long size;
long long *p;
size = no * (long long) each;
if (size == 0) size = 1;
if (size != (size_t) size) error("alloc too big %lld", size);
p = malloc(size);
if (p == NULL) error("no memory size %ld", size);
return p;
}
/* ======================================================================
showitems
====================================================================== */
int num_case, num_type;
void showitems(item *f, item *l, stype c)
{
item *i;
stype ps, ws;
FILE *out;
char numcase[20];
char numtype[20];
int num_cop = num_case;
int num_cop2 = num_type;
itoa(num_cop, numcase, 10);
itoa(num_cop2, numtype, 10);
char prefix[] = "martello_";
char underscore[] = "_";
char suffix[] = ".kp";
strcat(prefix, numtype);
strcat(prefix, underscore);
strcat(prefix, numcase);
strcat(prefix, suffix);
out = fopen(prefix, "w");
if (out == NULL) error("no file");
fprintf(out, "%d, %lld\n", NO(f, l), c);
for (i = f; i <= l; i++) {
fprintf(out, "%lld, %lld\n", i->w, i->p);
}
fclose(out);
}
/* ======================================================================
makecol
====================================================================== */
long long icomp(item *a, item *b) { return b->w - a->w; }
stype makecol(item *fitem, item *litem, itype rp, itype rw, stype b, int m)
{
register item *i, *k, *f, *l;
register stype psum, wsum, csum;
long long h, n, nn;
nn = NO(fitem,litem);
if (m > nn/2) m = nn/2;
litem = fitem + nn/2 + m - 1; /* only m big items */
f = fitem; l = litem;
psum = 0; wsum = 0; csum = 0;
n = nn / 2;
k = f + n;
for (i = f; i != k; i++) {
i->p = randm(rp) + 1;
i->w = randm(rw) + 1;
i->x = 0;
psum += i->p;
wsum += i->w;
}
for (i = k, h = 1; i <= l; i++, h++) {
i->w = randm(b);
i->p = 0;
i->x = 0;
if (h > m) i->w = 0;
csum += i->w;
}
qsort(k, n, sizeof(item), (funcptr) icomp);
/* convert the problem */
for (i = f; i != k; i++) {
i->p += psum;
i->w += wsum;
if(i->p <= 0) i->p = 1;
if(i->w <= 0) i->w = 1;
}
for (i = k, h = n + 1; i <= l; i++, h++) {
i->p = (3*n + 1 - h) * psum;
i->w = (4*n - h) * wsum - i->w;
if(i->p <= 0) i->p = 1;
if(i->w <= 0) i->w = 1;
}
/* printf("psum %ld, wsum %ld, csum %ld\n", psum, wsum, csum); */
return 3*n*wsum;
}
/* ======================================================================
maketest
====================================================================== */
stype maketest(item *f, item *l, long long r, int type, long long v, long long int S)
{
register item *i, *j;
unsigned long long wsum, psum, c;
long long r1;
long long n, m, k, h;
wsum = 0; psum = 0;
r1 = r / 10;
n = NO(f,l);
for (i = f, h = 1; i <= l; i++, h++) {
i->w = randm(r) + 1;
switch (type) {
case 1: i->p = randm(r) + 1; /* uncorrelated */
if (i->p <= 0) i->p = 1;
break;
case 2: i->p = randm(2*r1+1) + i->w - r1; /* weakly corr */
if (i->p <= 0) i->p = 1;
break;
case 3: i->p = i->w + r1; /* strongly corr */
break;
case 4: i->p = i->w; /* inverse strongly corr */
i->w = i->p + r1;
break;
case 5: i->p = i->w + r1 + randm(2*r/1000+1) - r/1000; /* alm str.corr */
if (i->p <= 0) i->p = 1;
break;
case 6: i->p = i->w; /* subset sum */
break;
case 7: i->w = 2*((i->w + 1)/2); /* even-odd */
i->p = i->w;
break;
case 8: i->w = 2*((i->w + 1)/2); /* even-odd knapsack */
i->p = i->w + r1;
break;
case 9: i->p = i->w; /* uncorrelated, similar weights */
i->w = randm(r1) + 100* r;
break;
case 11: i->w = n*(n+1) + h; /* Avis subset sum */
i->p = i->w;
break;
case 12: i->w = n*(n+1) + h; /* Avis knapsack */
i->p = randm(1000);
break;
case 13: i->p = i->w = 0; /* collapsing KP is generated separatly */
break;
case 14: i->p = i->w + r1; /* bounded strongly corr */
m = randm(10)+1;
for (k = 1, j = i; m != 0; k=2*k) {
if (j > l) break;
if (k > m) k = m;
j->p = k * i->p; j->w = k * i->w;
wsum += j->w; psum += j->p;
m -= k; j++;
}
i = j-1;
wsum -= i->w; psum -= i->p; /* avoid double addition */
break;
case 15: i->w = randm(r/2) + r/2; /* No small weights */
i->p = randm(2*r1+1) + i->w - r1;
if (i->p <= 0) i->p = 1;
break;
default: error("undefined problem type");
}
if (i->p <= 0) i->p = 1;
if (i->w <= 0) i->w = 1;
wsum += i->w; psum += i->p;
}
c = (v * (long long) wsum) / (S + 1);
for (i = f; i <= l; i++) if (i->w > c) c = i->w;
printf("test %d, %d: wsum %lld, psum %lld, cap %lld\n", num_type, num_case, wsum, psum, c);
switch (type) {
case 1: return c;
case 2: return c;
case 3: return c;
case 4: return c;
case 5: return c;
case 6: return c;
case 7: return 2*(c/2) + 1;
case 8: return 2*(c/2) + 1;
case 9: return c;
case 11: return n*(n+1) * ((n-1)/2) + ((n*(n-1))/2);
case 12: return n*(n+1) * ((n-1)/2) + ((n*(n-1))/2);
case 13: return makecol(f, l, 300, 1000, 10000, 100);
case 14: return c;
case 15: return c;
default: error("undefined capacity type");
}
}
/* ======================================================================
main
====================================================================== */
void main(int argc, char *argv[])
{
item *f, *l;
long long n, r, type, i, S;
stype c;
/*
if (argc == 6) {
n = atoi(argv[1]);
r = atoi(argv[2]);
type = atoi(argv[3]);
i = atoi(argv[4]);
S = atoi(argv[5]);
printf("generator2 %d %d %d %d %d\n", n, r, type, i, S);
} else {
printf("generator2\n");
printf("n = ");
scanf("%d", &n);
printf("r = ");
scanf("%d", &r);
printf("t = ");
scanf("%d", &type);
printf("i = ");
scanf("%d", &i);
printf("S = ");
scanf("%d", &S);
}
*/
srand(time(NULL));
int n_arr[5] = {50, 400, 2000, 5000, 10000};
for(num_case = 0; num_case < 50; num_case++) {
for(num_type = 1; num_type <= 9; num_type++) {
n = n_arr[num_case/10];
r = n;
f = palloc(n, sizeof(item));
l = f + n-1;
c = maketest(f, l, r, num_type, 1, 1);
showitems(f, l, c);
pfree(f);
}
for(num_type = 10; num_type <= 14; num_type++) {
n = n_arr[num_case/10];
r = n;
f = palloc(n, sizeof(item));
l = f + n-1;
c = maketest(f, l, r, num_type+1, 1, 1);
showitems(f, l, c);
pfree(f);
}
}
}
|
the_stack_data/218893290.c | #include <stdio.h>
#include <stdlib.h>
int main()
{
struct bit_field
{
int bit0:1;
int bit1:1;
int bit2:1;
int bit3:1;
int topfour:4;
} b;
b.bit3 = 1;
b.bit2 = 1;
b.bit1 = 0;
b.bit0 = 1;
b.topfour = 0;
printf("byte=0x%02x (expect 0x0d)\n", *((unsigned char*)&b));
exit(0);
}
/***
** Modelines:
** Local Variables:
** tab-width: 4
** indent-tabs-mode: nil
** End:
** vi:sw=4 ts=4 expandtab
**/
|
the_stack_data/72084.c | /* This testcase is part of GDB, the GNU debugger.
Copyright 2009-2019 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
static const char *image;
static pthread_barrier_t barrier;
static char *argv1 = "go away";
static void *
thread_execler (void *arg)
{
int i;
pthread_barrier_wait (&barrier);
/* Exec ourselves again. */
if (execl (image, image, argv1, NULL) == -1) /* break-here */
{
perror ("execl");
abort ();
}
return NULL;
}
static void *
just_loop (void *arg)
{
unsigned int i;
pthread_barrier_wait (&barrier);
for (i = 1; i > 0; i++)
usleep (1);
return NULL;
}
#define THREADS 5
pthread_t loop_thread[THREADS];
int
main (int argc, char **argv)
{
pthread_t thread;
int i, t;
image = argv[0];
/* Pass "inf" as argument to keep re-execing ad infinitum, which can
be useful for manual testing. Passing any other argument exits
immediately (and that's what the execl above does by
default). */
if (argc == 2 && strcmp (argv[1], "inf") == 0)
argv1 = argv[1];
else if (argc > 1)
exit (0);
pthread_barrier_init (&barrier, NULL, 2 + THREADS);
i = pthread_create (&thread, NULL, thread_execler, NULL);
assert (i == 0);
for (t = 0; t < THREADS; t++)
{
i = pthread_create (&loop_thread[t], NULL, just_loop, NULL);
assert (i == 0);
}
pthread_barrier_wait (&barrier);
pthread_join (thread, NULL);
return 0;
}
|
the_stack_data/225142781.c | #include <term.h>
#define user2 tigetstr("u2")
/** user string 2 **/
/*
TERMINFO_NAME(u2)
TERMCAP_NAME(u2)
XOPEN(400)
*/
|
the_stack_data/15763264.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define MAXMUM 1000
#define LENGTH 1000
int bubble_sort(int array[], int size);
int quick_sort(int array[], int size);
int quick_sort_r(int array[], int start, int end);
int quick_sort_partion(int array[], int start, int end);
void produce_array(int arrary[], int size);
void print_array(int array[], int size);
typedef int (*sort_function)(int[], int);
clock_t get_clock_time(sort_function func, int array[], int size);
int main(int argc, char* argv[]) {
int array1[LENGTH] = {0};
int array2[LENGTH] = {0};
produce_array(array1, LENGTH);
produce_array(array2, LENGTH);
printf("Bubble time:");
get_clock_time(bubble_sort, array1, LENGTH);
printf("Quick time :") ;
get_clock_time(quick_sort, array2, LENGTH);
return 0;
}
clock_t get_clock_time(sort_function func, int array[], int size) {
clock_t start = clock();
func(array, size);
clock_t end = clock();
printf("cpu time [%ld]\n", end - start);
return end - start;
}
void produce_array(int array[], int size) {
static int is_seed_set = 0;
if (0 == is_seed_set ) {
srand(time(NULL));
is_seed_set = 1;
}
int i = 0;
for (i = 0; i < size; ++i) {
array[i] = rand() % MAXMUM;
}
}
void print_array(int array[], int size) {
int i = 0;
for (i = 0; i < size; ++i) {
printf("%d ", array[i]);
}
printf("\n");
}
int bubble_sort(int array[], int size) {
int i,j;
for (j = size - 1; j > 0 ; --j) {
for (i = 0; i < j; ++i) {
if (array[i] > array[i+1]) {
array[i] = array[i] ^ array[i+1];
array[i+1] = array[i] ^ array[i+1];
array[i] = array[i] ^ array[i+1];
}
}
}
return 0;
}
int quick_sort(int array[], int size) {
quick_sort_r(array, 0, size);
return 0;
}
int quick_sort_r(int array[], int start, int end) {
if (start < end) {
int j = quick_sort_partion(array, start, end);
quick_sort_r(array, start, j - 1);
quick_sort_r(array, j + 1, end);
}
return 0;
}
int quick_sort_partion(int array[], int start, int end) {
int pivot, i, j, t;
pivot = array[start];
i = start;
j = end + 1;
while( 1)
{
do ++i; while( array[i] <= pivot && i <= end );
do --j; while( array[j] > pivot );
if( i >= j ) break;
t = array[i]; array[i] = array[j]; array[j] = t;
}
t = array[start]; array[start] = array[j]; array[j] = t;
return j;
}
|
the_stack_data/182953978.c | #include "stdio.h"
int main() {
int i = 0;
while (i < 10) {
if (i < 5) {
printf("i < 5\n");
}
if (i % 2 == 0) {
printf("i mod 2 == 0\n");
}
if (i == 10) {
printf("i == 10\n");
}
++i;
}
return 0;
}
|
the_stack_data/104829187.c |
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[])
{
printf("Hello World! \n\n Teste de frase \n\n");
system("PAUSE");
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.