Page 1 of 2

xQueueCreate equivalent

Posted: Sat Feb 23, 2019 2:45 pm
by omorando
Hello,
I'm new of Chibios/RT, sorry for my dummy question. What's the equivalent of xQueueCreate of FreeRTOS?

I know that in ChRt we have mailboxes, I/O queues, sync messages but it's not clear for me what the best choise to replace the xQueueCreate class. My need is to have queues of structs to share data between tasks/tasks and ISR/tasks.

Thanks, regards

Re: xQueueCreate equivalent

Posted: Sat Feb 23, 2019 4:05 pm
by Giovanni
Hi,

Look at "Object Queues", it is a pool of structures of the same size exchanged via a mailbox: Get a structure from the pool, send it, receive it, return it to the pool.

It can be used by ISR and tasks, fully static.

Giovanni

Re: xQueueCreate equivalent

Posted: Sat Feb 23, 2019 4:19 pm
by omorando
Giovanni wrote:Hi,

Look at "Object Queues", it is a pool of structures of the same size exchanged via a mailbox: Get a structure from the pool, send it, receive it, return it to the pool.

It can be used by ISR and tasks, fully static.

Giovanni


Thanks for your reply. I'm not able to find info about object queues, sorry, could you give me more details/links?
Thanks

Re: xQueueCreate equivalent

Posted: Sat Feb 23, 2019 4:52 pm
by Giovanni
Hi,

My bad, it is "Objects FIFOs": http://chibios.sourceforge.net/docs/19. ... fifos.html

Giovanni

Re: xQueueCreate equivalent

Posted: Sat Feb 23, 2019 5:23 pm
by faisal
You can also use (abuse?) I/O Buffers Queues.

http://chibios.sourceforge.net/docs/19. ... e_r_s.html

It may even be faster than Object FIFOs. Any comments on the fastest block based queue implementation in ChibiOS Giovanni?

Re: xQueueCreate equivalent

Posted: Sat Feb 23, 2019 6:58 pm
by Giovanni
Those are different, ObjFIFOs are meant to exchange fixed-size structures in a copy-less way.

HAL I/O buffers are used in those situations where you have to read/write byte streams from one side and fetch/post buffers from the other side, it is more of a buffering system.

Which is better depends on the use case.

Giovanni

Re: xQueueCreate equivalent

Posted: Sat Feb 23, 2019 7:28 pm
by faisal
Giovanni wrote:Those are different, ObjFIFOs are meant to exchange fixed-size structures in a copy-less way.

HAL I/O buffers are used in those situations where you have to read/write byte streams from one side and fetch/post buffers from the other side, it is more of a buffering system.

Which is better depends on the use case.

Giovanni


From the API documentation:
Buffers Queues are used when there is the need to exchange fixed-length data buffers between ISRs and threads.


It has a byte queue emulation API as well, but can certain be used for fixed length object.

Need to benchmark...

Re: xQueueCreate equivalent

Posted: Sat Feb 23, 2019 7:32 pm
by faisal
Giovanni wrote:Those are different, ObjFIFOs are meant to exchange fixed-size structures in a copy-less way.

HAL I/O buffers are used in those situations where you have to read/write byte streams from one side and fetch/post buffers from the other side, it is more of a buffering system.

Which is better depends on the use case.

Giovanni


For a byte queue, what's the difference between an I/O queue, and the new pipe_t ?

Re: xQueueCreate equivalent

Posted: Sat Feb 23, 2019 8:34 pm
by Giovanni
I/O queues are asymmetric, there always is an ISR (low) side and a thread (high) side, in addition, there is a callback notification mechanism high->low. It is specialized for a specific use, serial-like drivers. This is why I/O queues are in HAL, same for buffer queues.

Pipes are generic thread to thread byte streams with no specific use.

Giovanni

Re: xQueueCreate equivalent

Posted: Mon May 13, 2019 10:59 pm
by sabdulqadir
Giovanni wrote:Those are different, ObjFIFOs are meant to exchange fixed-size structures in a copy-less way.
Giovanni


Are HAL I/O BUFFERS not copy-less too?
AQ