template <typename T>

class Fifo

Defined at line 22 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

Protected Members

unique_ptr buffer_
T * first_
T * write_
T * read_
T * last_

Public Methods

zx::result<> Init (zx::bti & bti, bool cached)

Defined at line 27 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

void Clear ()

WARNING: DO NOT CALL THIS FUNCTION DURING NORMAL DRIVER OPERATION!

Unilaterally resetting the FIFO pointers (`read_ = write_`) without

coordinating with the hardware controller causes hardware/software

desynchronization. Hardware DMA may still own pending TRBs (with the HWO

bit set) or have cached descriptor addresses. Overwriting or clearing TRBs

without gracefully canceling transfers leads to DMA corruption, missing

completion callbacks for USB function drivers, and hardware lockups.

In normal operation, transfers must be gracefully canceled so that hardware

and software remain in lockstep and completion callbacks are properly

retired.

This function MUST ONLY be called during extreme hardware recovery cases,

such as after a full controller soft reset (DCTL.CSFTRST), core quiesce /

power-off, or a complete USB bus reset where hardware endpoint state has

been completely reset by the controller.

Defined at line 47 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

void Release ()

Defined at line 48 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

size_t TotalSlots ()

Defined at line 53 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

size_t WriteOffset ()

Defined at line 54 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

size_t ReadOffset ()

Defined at line 55 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

bool IsEmpty ()

Defined at line 56 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

size_t AvailableSlots ()

Defined at line 58 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

size_t GetActiveCount ()

Defined at line 69 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

std::vector<T> Read (size_t count)

Defined at line 76 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

std::vector<T> Read (T *& ptr, size_t count)

Defined at line 81 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

zx_paddr_t Write (T *& ptr, size_t count)

Defined at line 101 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

T * Advance (T *& ptr, size_t count)

Defined at line 118 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

const T * Advance (const T *& ptr, size_t count)

Defined at line 127 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

Protected Methods

zx::result<bool> InitBuffer (zx::bti & bti, bool cached)

Defined at line 137 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

zx_paddr_t GetPhys (T * ptr)

Defined at line 161 of file ../../src/devices/usb/drivers/dwc3/dwc3-fifo.h

Friends

template <bool manage_lifetimetypename gtest_base>
class TestFixture