views:

11

answers:

0

So here is an interesting question. When you have an embedded device with multiple communications ports, and potentially multiple tasks, each with their own protocols, needing to access these ports at the same time, how do you manage control and access to the port resources?

I am running an embedded OS (FreeRTOS to be precise) so I have access to queues, semaphores/mutexes, and I can have a task to block on a resource until it becomes available. The question becomes, how does a task gain access to the port? Should this be done with a separate transaction than the sending and receiving of data, i.e. through session requests? Is there a way of automatically arbitrating who has access to what resource without using sessions? What if some devices/protocols require separate actions before and after a transmit (i.e. flow control, toggling chip enable lines for SPI peripherals)?

I would like to be able to design a port access API that keeps the work done on the protocol builder/handler side to a minimum. For instance, having the protocol task responsible for telling when a command sequence has been completely shifted out is not really an option.

Thanks in advance for any insight to this architectural issue.