Lines Matching +full:in +full:- +full:and +full:- +full:around

1 /*-
9 Public License V2 as published by the Free Software Foundation and can be
10 found at http://www.gnu.org/licenses/gpl-2.0.html
12 Alternatively, redistribution and use in source and binary forms, with or
17 this list of conditions and the following disclaimer.
19 * Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in
21 the documentation and/or other materials provided with the
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
60 /* *INDENT-OFF* */
64 /* *INDENT-ON* */
78 /* Statistics - TBD */
103 /* TX desc length and control fields */
132 /* TX/RX descriptor Target-ID field (in the buffer address 64 bit field) */
161 uint32_t len; /**< Buffer lenght in bytes */
170 * Target-ID to be assigned to the block descriptors
171 * Requires Target-ID in descriptor to be enabled for the specific UDMA
196 uint32_t size; /**< ring size (in descriptors), submission and
218 uint32_t cdesc_size; /**< size (in bytes) of a single dma completion
246 uint16_t size_mask; /**< mask used for pointers wrap around
247 * equals to size - 1
263 uint32_t cdesc_size; /**< size (in bytes) of the udma completion ring
266 uint16_t next_cdesc_idx; /**< index in descriptors for next completing
269 uint8_t *end_cdesc_ptr; /**< used for wrap around detection */
273 volatile union al_udma_cdesc *comp_head_ptr; /**< when working in get_packet mode
288 uint32_t size; /**< ring size in descriptors */
324 * @return 0 on success. -EINVAL otherwise.
336 * -EINVAL if the qid is out of range
337 * -EIO if queue was already initialized
370 * @return 0 on success. -EINVAL otherwise.
407 uint16_t tmp = udma_q->next_cdesc_idx - (udma_q->next_desc_idx + 1); in al_udma_available_get()
408 tmp &= udma_q->size_mask; in al_udma_available_get()
418 * @return AL_TRUE if descriptors are submitted to completion ring and still
423 if (((udma_q->next_cdesc_idx - udma_q->next_desc_idx) & in al_udma_is_empty()
424 udma_q->size_mask) == 0) in al_udma_is_empty()
443 next_desc_idx = udma_q->next_desc_idx; in al_udma_desc_get()
444 desc = udma_q->desc_base_ptr + next_desc_idx; in al_udma_desc_get()
448 /* if reached end of queue, wrap around */ in al_udma_desc_get()
449 udma_q->next_desc_idx = next_desc_idx & udma_q->size_mask; in al_udma_desc_get()
468 ring_id = udma_q->desc_ring_id; in al_udma_ring_id_get()
471 /* if next_desc points to first desc, then queue wrapped around */ in al_udma_ring_id_get()
472 if (unlikely(udma_q->next_desc_idx) == 0) in al_udma_ring_id_get()
473 udma_q->desc_ring_id = (udma_q->desc_ring_id + 1) & in al_udma_ring_id_get()
478 /* add DMA action - trigger the engine */
493 al_assert((num > 0) && (num <= udma_q->size)); in al_udma_desc_action_add()
495 addr = &udma_q->q_regs->rings.drtp_inc; in al_udma_desc_action_add()
513 * return pointer to the cdesc + offset desciptors. wrap around when needed.
525 volatile uint8_t *tmp = (volatile uint8_t *) cdesc + offset * udma_q->cdesc_size; in al_cdesc_next()
529 /* if wrap around */ in al_cdesc_next()
530 if (unlikely((tmp > udma_q->end_cdesc_ptr))) in al_cdesc_next()
532 (udma_q->cdesc_base_ptr + in al_cdesc_next()
533 (tmp - udma_q->end_cdesc_ptr - udma_q->cdesc_size)); in al_cdesc_next()
553 == udma_q->comp_ring_id) in al_udma_new_cdesc()
561 * around
573 /* if last desc, wrap around */ in al_cdesc_next_update()
574 if (unlikely(((volatile uint8_t *) cdesc == udma_q->end_cdesc_ptr))) { in al_cdesc_next_update()
575 udma_q->comp_ring_id = in al_cdesc_next_update()
576 (udma_q->comp_ring_id + 1) & DMA_RING_ID_MASK; in al_cdesc_next_update()
577 return (union al_udma_cdesc *) udma_q->cdesc_base_ptr; in al_cdesc_next_update()
579 return (volatile union al_udma_cdesc *) ((volatile uint8_t *) cdesc + udma_q->cdesc_size); in al_cdesc_next_update()
590 * If the descriptors found in the completion queue don't form full packet (no
607 ((volatile union al_udma_cdesc *) ((udma_q)->cdesc_base_ptr + \
608 (idx) * (udma_q)->cdesc_size))
612 * return number of all completed descriptors in the completion ring
632 udma_q->comp_head_idx = (uint16_t) in al_udma_cdesc_get_all()
633 (al_reg_read32(&udma_q->q_regs->rings.crhp) & in al_udma_cdesc_get_all()
636 count = (udma_q->comp_head_idx - udma_q->next_cdesc_idx) & in al_udma_cdesc_get_all()
637 udma_q->size_mask; in al_udma_cdesc_get_all()
640 *cdesc = al_udma_cdesc_idx_to_ptr(udma_q, udma_q->next_cdesc_idx); in al_udma_cdesc_get_all()
658 udma_q->next_cdesc_idx += num; in al_udma_cdesc_ack()
659 udma_q->next_cdesc_idx &= udma_q->size_mask; in al_udma_cdesc_ack()
664 /* *INDENT-OFF* */
668 /* *INDENT-ON* */