Page 1 of 1

IO Queue question?

Posted: Thu Jan 15, 2015 11:12 am
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?

Re: IO Queue question?

Posted: Thu Jan 15, 2015 12:09 pm
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

Re: IO Queue question?

Posted: Thu Jan 15, 2015 12:23 pm
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.