xQueueCreate equivalent

Discussions and support about ChibiOS/RT, the free embedded RTOS.
omorando
Posts: 2
Joined: Sat Feb 23, 2019 12:38 pm

xQueueCreate equivalent

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: xQueueCreate equivalent

Post 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
omorando
Posts: 2
Joined: Sat Feb 23, 2019 12:38 pm

Re: xQueueCreate equivalent

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: xQueueCreate equivalent

Post by Giovanni »

Hi,

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

Giovanni
faisal
Posts: 382
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 45 times
Been thanked: 62 times

Re: xQueueCreate equivalent

Post 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?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: xQueueCreate equivalent

Post 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
faisal
Posts: 382
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 45 times
Been thanked: 62 times

Re: xQueueCreate equivalent

Post 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...
faisal
Posts: 382
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 45 times
Been thanked: 62 times

Re: xQueueCreate equivalent

Post 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 ?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: xQueueCreate equivalent

Post 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
User avatar
sabdulqadir
Posts: 49
Joined: Fri Mar 23, 2018 7:29 pm
Has thanked: 13 times
Been thanked: 4 times

Re: xQueueCreate equivalent

Post 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
Post Reply