Open steverpalmer opened 5 months ago
Searching through the rest of the codebase, everywhere the bhp_event_t
structure is used (i.e. gnrc/netif/init_devs.auto_init_*
and in pkg/lwip/include/lwip/netif/compat.h
) it is part of a static structure and so will be initialized to 0 at the start. Therefore, this "problem" does not get exposed elsewhere in the codebase.
The comparable function event_callback_init
starts by using memset(event_callback, 0, sizeof(*event_callback))
to clear out the structure.
Description
In my ISR routine I call
bhp_event_isr_cb
to defer the interrupt event handling to a high priority thread, which I understand to be the intent of this feature. However, the callback never occurs. I think I have debugged this back to an uninitializedclist
pointer in a containedevent_t
structure.In
sys/bhp/event.c
the functionbhp_event_init
correctly initializes thebhp_t
structure (with a call tobhp_set_cb
) and theevent_queue_t
pointer (simple assignment), but only partially initializes theevent_t
structure with an assignment to the.handler
field. Specifically, the.list_node.next
field remains unchanged by this function.A subsequent call to
bhp_event_isr_cb
then callsevent_post(bhp_event->evq, &bhp_event->ev)
to push the event onto the appropriate queue, butevent_post
will only add the event to the queue (clist_rpush
) if the.list_node.next
field isNULL
. I understand this is to allowevent_post
to be called multiple times (hopefully onto the same queue).I suggest that the function
bhp_event_init
should initialize the wholeevent_t
structure including the wholelist_node
field.Steps to reproduce the issue
Consider:
I've built the code with DEVELHELP=1 for the microbit-v2, and the program runs and asserts.
Expected results
No output (other than "main(): This is RIOT! ...").
Actual results
Versions
RIOT version 2024-04