diff --git a/include/at91_pitc.h b/include/at91_pitc.h index 2763d3f..286a722 100644 --- a/include/at91_pitc.h +++ b/include/at91_pitc.h @@ -17,7 +17,6 @@ struct pitc_timer { }; void pitc_schedule_timer(struct pitc_timer *timer); -struct pitc_timer * alloc_pitc_timer(uint32_t interval, uint32_t (*func)(struct pitc_timer *), void *privdata); uint32_t pitc_get_ticks(void); void at91_pitc_init(void); diff --git a/main.c b/main.c index 476eaa9..e6fd27f 100644 --- a/main.c +++ b/main.c @@ -51,6 +51,11 @@ static uint32_t pitc_test(struct pitc_timer *timer) return PITC_RESTART_TIMER; } +static struct pitc_timer pitc_test_timer = { + .interval = 1, + .func = &pitc_test, +}; + int main(void) { /* LED outputs */ @@ -78,14 +83,13 @@ int main(void) at91_twi_init(); /* usb */ - at91_udp_init(); - - struct pitc_timer *pitc_test_timer = alloc_pitc_timer(1, &pitc_test, NULL); - pitc_schedule_timer(pitc_test_timer); +// at91_udp_init(); printf("static alloc: %5ld bytes\n\r", static_alloc_used()); at91_twi_test(); + pitc_schedule_timer(&pitc_test_timer); + while (1); } diff --git a/src/at91_adc.c b/src/at91_adc.c index 0b93721..84b558c 100644 --- a/src/at91_adc.c +++ b/src/at91_adc.c @@ -44,6 +44,11 @@ static uint32_t adc_trigger(struct pitc_timer *timer) return PITC_RESTART_TIMER; } +static struct pitc_timer adc_timer = { + .interval = 100, + .func = &adc_trigger, +}; + void at91_adc_test_init(void) { /* enable ADC clock */ @@ -83,16 +88,5 @@ void at91_adc_test_init(void) aic->AIC_SVR[AT91C_ID_ADC] = (uint32_t)at91_adc_isr; aic->AIC_IECR = (1< min. 3Hz @48MHz MCK */ #define HZ_TO_PIV(HZ) (MCK / (16 * HZ)) @@ -28,16 +27,6 @@ static LIST_HEAD(timer_list); volatile static uint32_t pitc_ticks; -struct pitc_timer * alloc_pitc_timer(uint32_t interval, uint32_t (*func)(struct pitc_timer *), void *privdata) -{ - struct pitc_timer *timer = static_alloc(sizeof(struct pitc_timer)); - timer->interval = interval; - timer->func = func; - timer->privdata = privdata; - - return timer; -} - void pitc_schedule_timer(struct pitc_timer *timer) { timer->nextrun = timer->interval + pitc_ticks; diff --git a/src/memalloc.c b/src/memalloc.c index 3976762..4d6afde 100644 --- a/src/memalloc.c +++ b/src/memalloc.c @@ -88,6 +88,8 @@ static struct memchunk * alloc_add(uint32_t size) { size = ALIGN(size); + printf("alloc_add(%ld)\n\r", size); + /* struct at begin of memory block */ struct memchunk *newblock = static_alloc(size); diff --git a/src/telemetrie.c b/src/telemetrie.c index cf784e7..4df776c 100644 --- a/src/telemetrie.c +++ b/src/telemetrie.c @@ -32,6 +32,7 @@ extern struct tdc_value _tdc_value_table_end; /* max. 8x 32 = 256 variables */ static uint32_t tdc_varmap[8]; +/* array of devices, that are used to reach address X */ static struct comm_device *routing_table[8]; /*