Lines Matching refs:chan
162 #define EDMA_CHAN_PRODUCE_CONSUME_A(chan, size)\ argument
163 ((chan)->type == CHAN_TYPE_CONSUMER ?\
164 edma_chan_cyclic_consume(chan, size) :\
165 edma_chan_cyclic_produce(chan, size))
167 #define EDMA_CHAN_PRODUCE_CONSUME_B(chan, size)\ argument
168 ((chan)->type == CHAN_TYPE_CONSUMER ?\
169 edma_chan_cyclic_produce(chan, size) :\
170 edma_chan_cyclic_consume(chan, size))
172 #define EDMA_CHAN_IS_ACTIVE(data, chan)\ argument
173 (EDMA_ChannelRegRead((data)->hal_cfg, (chan)->id, EDMA_TCD_CH_CSR) &\
240 static inline bool channel_allows_transition(struct edma_channel *chan, in channel_allows_transition() argument
243 enum channel_state prev = chan->state; in channel_allows_transition()
328 static inline int edma_set_channel_type(struct edma_channel *chan, in edma_set_channel_type() argument
333 chan->type = CHAN_TYPE_CONSUMER; in edma_set_channel_type()
336 chan->type = CHAN_TYPE_PRODUCER; in edma_set_channel_type()
361 static inline int edma_chan_cyclic_consume(struct edma_channel *chan, in edma_chan_cyclic_consume() argument
364 if (bytes > chan->stat.pending_length) { in edma_chan_cyclic_consume()
368 chan->stat.read_position = in edma_chan_cyclic_consume()
369 (chan->stat.read_position + bytes) % chan->bsize; in edma_chan_cyclic_consume()
371 if (chan->stat.read_position > chan->stat.write_position) { in edma_chan_cyclic_consume()
372 chan->stat.free = chan->stat.read_position - in edma_chan_cyclic_consume()
373 chan->stat.write_position; in edma_chan_cyclic_consume()
374 } else if (chan->stat.read_position == chan->stat.write_position) { in edma_chan_cyclic_consume()
375 chan->stat.free = chan->bsize; in edma_chan_cyclic_consume()
377 chan->stat.free = chan->bsize - in edma_chan_cyclic_consume()
378 (chan->stat.write_position - chan->stat.read_position); in edma_chan_cyclic_consume()
381 chan->stat.pending_length = chan->bsize - chan->stat.free; in edma_chan_cyclic_consume()
400 static inline int edma_chan_cyclic_produce(struct edma_channel *chan, in edma_chan_cyclic_produce() argument
403 if (bytes > chan->stat.free) { in edma_chan_cyclic_produce()
407 chan->stat.write_position = in edma_chan_cyclic_produce()
408 (chan->stat.write_position + bytes) % chan->bsize; in edma_chan_cyclic_produce()
410 if (chan->stat.write_position > chan->stat.read_position) { in edma_chan_cyclic_produce()
411 chan->stat.pending_length = chan->stat.write_position - in edma_chan_cyclic_produce()
412 chan->stat.read_position; in edma_chan_cyclic_produce()
413 } else if (chan->stat.write_position == chan->stat.read_position) { in edma_chan_cyclic_produce()
414 chan->stat.pending_length = chan->bsize; in edma_chan_cyclic_produce()
416 chan->stat.pending_length = chan->bsize - in edma_chan_cyclic_produce()
417 (chan->stat.read_position - chan->stat.write_position); in edma_chan_cyclic_produce()
420 chan->stat.free = chan->bsize - chan->stat.pending_length; in edma_chan_cyclic_produce()