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

Postby omorando » Sat Feb 23, 2019 2:45 pm

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: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: xQueueCreate equivalent

Postby Giovanni » Sat Feb 23, 2019 4:05 pm

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

Postby omorando » Sat Feb 23, 2019 4:19 pm

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: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: xQueueCreate equivalent

Postby Giovanni » Sat Feb 23, 2019 4:52 pm

Hi,

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

Giovanni

faisal
Posts: 374
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 44 times
Been thanked: 60 times

Re: xQueueCreate equivalent

Postby faisal » Sat Feb 23, 2019 5:23 pm

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: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: xQueueCreate equivalent

Postby Giovanni » Sat Feb 23, 2019 6:58 pm

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: 374
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 44 times
Been thanked: 60 times

Re: xQueueCreate equivalent

Postby faisal » Sat Feb 23, 2019 7:28 pm

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: 374
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 44 times
Been thanked: 60 times

Re: xQueueCreate equivalent

Postby faisal » Sat Feb 23, 2019 7:32 pm

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: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: xQueueCreate equivalent

Postby Giovanni » Sat Feb 23, 2019 8:34 pm

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

Postby sabdulqadir » Mon May 13, 2019 10:59 pm

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


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 5 guests