/************************************************************************ * NAME: fnet_isr_register * * DESCRIPTION: Register 'handler' at the isr table. *************************************************************************/ static fnet_return_t fnet_isr_register(fnet_uint32_t vector_number, void (*handler_top)(fnet_uint32_t handler_top_cookie), void (*handler_bottom)(fnet_uint32_t handler_bottom_cookie), fnet_uint32_t cookie) { fnet_return_t result; fnet_isr_entry_t *isr_temp; isr_temp = (fnet_isr_entry_t *)fnet_malloc_zero(sizeof(fnet_isr_entry_t)); if (isr_temp) { isr_temp->vector_number = vector_number; isr_temp->handler_top = (void (*)(fnet_uint32_t handler_top_cookie))handler_top; isr_temp->handler_bottom = (void (*)(fnet_uint32_t handler_bottom_cookie))handler_bottom; isr_temp->next = fnet_isr_table; isr_temp->cookie = cookie; fnet_isr_table = isr_temp; result = FNET_OK; } else { result = FNET_ERR; } return result; }
/************************************************************************ * NAME: fnet_timer_new * * DESCRIPTION: Creates new software timer with the period * *************************************************************************/ fnet_timer_desc_t fnet_timer_new( fnet_time_t period_ticks, void (*handler)(fnet_uint32_t cookie), fnet_uint32_t cookie ) { struct fnet_net_timer *timer = FNET_NULL; if( period_ticks && handler ) { timer = (struct fnet_net_timer *)fnet_malloc_zero(sizeof(struct fnet_net_timer)); if(timer) { timer->next = fnet_tl_head; fnet_tl_head = timer; timer->timer_rv = period_ticks; timer->handler = handler; timer->cookie = cookie; } } return (fnet_timer_desc_t)timer; }