AnsweredAssumed Answered

generic_list usage? SERIAL_MANAGER_NON_BLOCKING_MODE broken?

Question asked by Roberto Quilez on Jul 1, 2020
Latest reply on Jul 3, 2020 by Jing Pan

I am having a look to the generic_list.c in order to reuse the code for my own lists.

The serial_manager is using it for the SERIAL_MANAGER_NON_BLOCKING_MODE.

 

Nevertheless I can not see how can it work: 

 

When adding elements to the list, we are passing the address of "link", which is type "list_element_t"

 

static void SerialManager_AddTail(list_t *queue, serial_manager_write_handle_t *node)

{

    LIST_AddTail(queue, &node->link);

}

 

But when retrieving the element from the list 

 

serial_manager_write_handle_t *writeHandle =
(serial_manager_write_handle_t *)LIST_GetHead(&handle->runningWriteHandleHead);

What we get from the list is a "list_element_t" (the "&node->link" previously added), the casting to "serial_manager_write_handle_t" does not work.

 

Am I missing something?

 

PS: I am using SDK 2.7.0 on a MK26

Outcomes