Changeset cb89430 in mainline for uspace/drv/bus/usb/xhci/trb_ring.h
- Timestamp:
- 2017-06-22T13:59:15Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e4d7363
- Parents:
- 62ba2cbe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/trb_ring.h
r62ba2cbe rcb89430 45 45 #include <adt/list.h> 46 46 #include <libarch/config.h> 47 #include "hw_struct/trb.h"48 47 49 48 typedef struct trb_segment trb_segment_t; 49 typedef struct xhci_hc xhci_hc_t; 50 typedef struct xhci_trb xhci_trb_t; 51 typedef struct xhci_erst_entry xhci_erst_entry_t; 50 52 51 53 /** … … 54 56 typedef struct xhci_trb_ring { 55 57 list_t segments; /* List of assigned segments */ 58 int segment_count; /* Number of segments assigned */ 56 59 57 60 /* … … 67 70 } xhci_trb_ring_t; 68 71 69 /** 70 * Initializes the ring. 71 * Allocates one page as the first segment. 72 */ 73 int trb_ring_init(xhci_trb_ring_t *ring); 74 int trb_ring_fini(xhci_trb_ring_t *ring); 72 int xhci_trb_ring_init(xhci_trb_ring_t *, xhci_hc_t *); 73 int xhci_trb_ring_fini(xhci_trb_ring_t *); 74 int xhci_trb_ring_enqueue(xhci_trb_ring_t *, xhci_trb_t *); 75 75 76 76 /** 77 * Enqueue a TD composed of TRBs. 78 * 79 * This will copy all TRBs chained together into the ring. The cycle flag in 80 * TRBs may be changed. 81 * 82 * The chained TRBs must be contiguous in memory, and must not contain Link TRBs. 83 * 84 * We cannot avoid the copying, because the TRB in ring should be updated atomically. 85 * 86 * @param td the first TRB of TD 87 * @return EOK on success, 88 * EAGAIN when the ring is too full to fit all TRBs (temporary) 77 * Get the initial value to fill into CRCR. 89 78 */ 90 int trb_ring_enqueue(xhci_trb_ring_t *ring, xhci_trb_t *td); 79 static inline uintptr_t xhci_trb_ring_get_dequeue_ptr(xhci_trb_ring_t *ring) 80 { 81 return ring->dequeue; 82 } 91 83 92 84 /** … … 94 86 * pointer inside the ring. Otherwise, the ring will soon show up as full. 95 87 */ 96 void trb_ring_update_dequeue(xhci_trb_ring_t *ring, uintptr_t dequeue); 88 void xhci_trb_ring_update_dequeue(xhci_trb_ring_t *, uintptr_t); 89 uintptr_t xhci_trb_ring_get_dequeue_ptr(xhci_trb_ring_t *); 97 90 91 /** 92 * A TRB ring of which the software is a consumer (event rings). 93 */ 94 typedef struct xhci_event_ring { 95 list_t segments; /* List of assigned segments */ 96 int segment_count; /* Number of segments assigned */ 97 98 trb_segment_t *dequeue_segment; /* Current segment of the dequeue ptr */ 99 xhci_trb_t *dequeue_trb; /* Next TRB to be processed */ 100 uintptr_t dequeue_ptr; /* Physical address of the ERDP to be reported to the HC */ 101 102 xhci_erst_entry_t *erst; /* ERST given to the HC */ 103 104 bool ccs; /* Consumer Cycle State: section 4.9.2 */ 105 } xhci_event_ring_t; 106 107 int xhci_event_ring_init(xhci_event_ring_t *, xhci_hc_t *); 108 int xhci_event_ring_fini(xhci_event_ring_t *); 109 int xhci_event_ring_dequeue(xhci_event_ring_t *, xhci_trb_t *); 98 110 99 111 #endif
Note:
See TracChangeset
for help on using the changeset viewer.