rp2 PIO get and put non-blocking
My application wants to do non-blocking i/o between array and the PIO state machines. The rp2 port only supports blocking and full length i/o, so I have to check the FIFO levels before doing a get or put to avoid blocking, resulting in duplicated code and activity.
Basic request is to support a timeout for the operation and return a short count - maybe from a new method to avoid changing return types.
Would prefer get to support MIN and TIME semantics defined by termios(3) (but with standard time units).
As an extra convenience, optionally wait for the txfifo to be emptied within the timeout.
ports/rp2: Provide direct memory access to PIO FIFOs via proxy arrays.
As per the discussion in #7641, this PR adds a new get_fifo_proxy() method to rp2.StateMachine that allows a user to get a memory proxy for either the TX or RX FIFO of an instance. This can either be used directly to gain non-blocking access to the FIFO values or it can be passed to an rp2.DMA instance for the read or write values. For example:
my_sm = rp2.StateMachine(0, ...)
d = rp2.DMA()
a = bytearray(256)
c = d.default_ctrl
c.inc_read = False # Fetch all the values from the same FIFO address
c.treq_sel = 8 # Flow control from the RX fifo for state machine 0
rx_fifo_proxy = my_sm.get_fifo_proxy(True) # True for RX FIFO
d.config(read=rx_fifo_proxy, write=a, count=len(a)//4, ctrl=c, trigger=True)