IO Queue question?

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
Ceco
Posts: 40
Joined: Tue Nov 27, 2012 12:16 pm
Been thanked: 3 times

IO Queue question?

Post by Ceco »

Hello.

I'm using ChibiOS 2.6.6. on STM32F4.

Is there a reason to restrict the block access to IO queues from both directions? As I see, Input queues are block accessible from the output only. And the opposite - output queues are block accessible from the input only. I understand that such a implementation fits perfectly on low level drivers like UART, where the low side is byte sized. But there is a cases when the low side also has a block of bytes structure. In this case it will be good if we have block access from both side of queue. Typically such a need exist when two thread are connected on both sides of queue. Of course the block R/W operations needs to be atomic (protected) but it's not an usual case.

Did I miss something, or these is a special reason to restrict block access from both sides of queues?
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: IO Queue question?

Post by Giovanni »

Hi,

Those queues are meant to link an ISR to a Thread, the ISR side cannot be blocking by definition this is why I/O queues are asymmetrical.

If you need a queue between two threads then mailboxes are a better choice.

Giovanni
Ceco
Posts: 40
Joined: Tue Nov 27, 2012 12:16 pm
Been thanked: 3 times

Re: IO Queue question?

Post by Ceco »

I understand.

Yes, mailbox is an option, but generally it is heavier and with more complicate usage. Generally I need a simple FIFO with thread safe functionality.

I think for an option to use an existing queue structures and to create a custom wrapper around them.
Post Reply