shared fifo

Technical questions regarding the XTC tools and programming with XMOS.
omega7
Active Member
Posts: 32
Joined: Thu Jun 03, 2010 12:16 pm

shared fifo

Post by omega7 »

Hi all,
I have a concept of a transmit thread which transmits frames by means of a uart and a frame fifo. This transmit thread must have a frame fifo which can be accessed (frame push) by one or more other threads on different cores.
My struggle is that channels are point-to-point. So a resource, in this case a frame fifo, cannot be accessed by two or more threads.
Any suggestion or example for such a fifo is welcome!
Thanks in advance.
Martin


User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm

Post by Bianco »

Hello,

Channels are not neccesary point-to-point.
A multipoint-to-point setup is also possible as multiple channel ends can have the same destination.
This is not achievable in pure XC though, it requires some assembly snippets here and there.
richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

Are you able to use multiple channels and a select? You would have a channel between every thread that produces data and the thread managing the FIFO. The thread managing the FIFO would select on receiving data from any of the channel ends attached to the producers and then read the data from that channel end into buffer.
omega7
Active Member
Posts: 32
Joined: Thu Jun 03, 2010 12:16 pm

Post by omega7 »

Hi Richard, Bianco,

Thanks for your quick answers. This is what I needed. In the meantime I found some asm code for locking resources. I am thinking of a solution which uses both of your hints. Any example of a frame fifo is welcome by the way... ;)

Martin