Changeset eb928c4 in mainline for uspace/drv/bus/usb/xhci/trb_ring.c


Ignore:
Timestamp:
2018-01-08T00:07:00Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1102eca
Parents:
ecbad17
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-08 00:05:39)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-08 00:07:00)
Message:

xhci: documentation & cleanup

Also, a simple refactoring to remove functions that only wraps another
functions unused anywhere else.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/trb_ring.c

    recbad17 reb928c4  
    5252
    5353
     54/**
     55 * Get the first TRB of a segment.
     56 */
    5457static inline xhci_trb_t *segment_begin(trb_segment_t *segment)
    5558{
     
    5760}
    5861
     62/**
     63 * Get the one-past-end TRB of a segment.
     64 */
    5965static inline xhci_trb_t *segment_end(trb_segment_t *segment)
    6066{
     
    9197/**
    9298 * Initializes the ring with one segment.
    93  * Event when it fails, the structure needs to be finalized.
    9499 */
    95100int xhci_trb_ring_init(xhci_trb_ring_t *ring)
     
    117122        fibril_mutex_initialize(&ring->guard);
    118123
    119         usb_log_debug2("Initialized new TRB ring.");
    120 
    121         return EOK;
    122 }
    123 
     124        return EOK;
     125}
     126
     127/**
     128 * Free all segments inside the ring.
     129 */
    124130void xhci_trb_ring_fini(xhci_trb_ring_t *ring)
    125131{
     
    150156}
    151157
     158/**
     159 * Get the physical address of the enqueue pointer.
     160 */
    152161static uintptr_t trb_ring_enqueue_phys(xhci_trb_ring_t *ring)
    153162{
     
    156165}
    157166
     167/**
     168 * Decides whether the TRB will trigger an interrupt after being processed.
     169 */
    158170static bool trb_generates_interrupt(xhci_trb_t *trb)
    159171{
     
    163175
    164176/**
    165  * Enqueue TDs composed of TRBs.
     177 * Enqueue TD composed of TRBs.
    166178 *
    167179 * This will copy specified number of TRBs chained together into the ring. The
     
    256268/**
    257269 * Initializes an event ring.
    258  * Even when it fails, the structure needs to be finalized.
    259270 */
    260271int xhci_event_ring_init(xhci_event_ring_t *ring)
     
    275286        ring->dequeue_ptr = segment->phys;
    276287
    277         if (dma_buffer_alloc(&ring->erst, PAGE_SIZE))
     288        if (dma_buffer_alloc(&ring->erst, PAGE_SIZE)) {
     289                xhci_event_ring_fini(ring);
    278290                return ENOMEM;
     291        }
    279292        xhci_erst_entry_t *erst = ring->erst.virt;
    280293
     
    301314}
    302315
     316/**
     317 * Get the physical address of the dequeue pointer.
     318 */
    303319static uintptr_t event_ring_dequeue_phys(xhci_event_ring_t *ring)
    304320{
Note: See TracChangeset for help on using the changeset viewer.