kindly explain this code segment

Added by kiran nayak about 7 years ago

i m going through the source code of zboss and not able to get what the following code is doing

for (i = 0 ; i < ZB_SCHEDULER_Q_SIZE ; ++i)
ZB_STK_PUSH(ZG->sched.tm_freelist, next, &ZG->sched.tm_buffer[i]);
for (i = 0; i < ZB_BUF_Q_SIZE ; ++i)
ZB_STK_PUSH(ZG->sched.buf_freelist, next, &ZG->sched.delayed_buf[i]);

is it initializing the timer callback buffers ? pls explain

Replies (1)

RE: kindly explain this code segment - Added by Denis Akopov about 7 years ago

First loop initializes scheduler's callbacks list.
Second loop initializes list of callbacks waiting for free buffer. This list is used when you need to schedule callback but do not have a buffer for it. Common usage looks like zb_schedule_callback(your_callback);