0.3.1
USB Cart

Macros

#define USB_CART_OUT_EP_SIZE   62
 64-byte packet containing 62-byte payload.
 

Functions

static bool usb_cart_rxf_full (void)
 Determine if the receive buffer is full.
 
static bool usb_cart_txe_full (void)
 Determine if the transfer buffer is full.
 
static void usb_cart_rxf_wait (void)
 Wait until the receive buffer is not full, but not necessarily empty.
 
static void usb_cart_txe_wait (void)
 Wait until the transfer buffer is not full, but not necessarily empty.
 
static uint8_t usb_cart_byte_read (void)
 Read a 8-bit value.
 
static void usb_cart_byte_send (uint8_t c)
 Write an 8-bit value.
 
void usb_cart_init (void)
 Initialize USB cart.
 
uint8_t usb_cart_byte_xchg (uint8_t c)
 Reads an 8-bit value and writes an 8-bit value.
 
uint32_t usb_cart_long_read (void)
 Read a 32-bit value.
 
void usb_cart_long_send (uint32_t w)
 Write a 32-bit value.
 
void usb_cart_dma_read (void *buffer, uint32_t len)
 Use DMA to read.
 
void usb_cart_dma_send (const void *buffer, uint32_t len)
 Use DMA to write.
 

Detailed Description

Description goes here.

Function Documentation

◆ usb_cart_rxf_full()

static bool usb_cart_rxf_full ( void  )
inlinestatic

Determine if the receive buffer is full.

When the RXF# flag is low, this indicates there is still unread data in the internal receive buffer remaining to be read by the downstream FPGA or micro.

Returns
Not yet documented.

◆ usb_cart_txe_full()

static bool usb_cart_txe_full ( void  )
inlinestatic

Determine if the transfer buffer is full.

When the TXE# flag is low, this indicates there is enough internal transmit buffer space available for writing data back to the host.

Returns
Not yet documented.

◆ usb_cart_rxf_wait()

static void usb_cart_rxf_wait ( void  )
inlinestatic

Wait until the receive buffer is not full, but not necessarily empty.

When the RXF# flag is low, this indicates there is still unread data in the internal receive buffer remaining to be read by the downstream FPGA or micro.

◆ usb_cart_txe_wait()

static void usb_cart_txe_wait ( void  )
inlinestatic

Wait until the transfer buffer is not full, but not necessarily empty.

When the TXE# flag is low, this indicates there is enough internal transmit buffer space available for writing data back to the host.

◆ usb_cart_byte_read()

static uint8_t usb_cart_byte_read ( void  )
inlinestatic

Read a 8-bit value.

Waits until the receive buffer has is non-empty.

Returns
A 8-bit value value read.

◆ usb_cart_byte_send()

static void usb_cart_byte_send ( uint8_t  c)
inlinestatic

Write an 8-bit value.

Waits until the transfer buffer is not full.

Parameters
cThe 8-bit value to write.

◆ usb_cart_byte_xchg()

uint8_t usb_cart_byte_xchg ( uint8_t  c)

Reads an 8-bit value and writes an 8-bit value.

The function first waits until the receive buffer is non-empty, the reads a byte then stores the value.

The function then waits until the transfer buffer is not full to send a byte.

Parameters
cThe 8-bit value to exchange.
Returns
The first 8-bit read value.

◆ usb_cart_long_read()

uint32_t usb_cart_long_read ( void  )

Read a 32-bit value.

Waits for the receive buffer to be non-empty on every byte.

Returns
The 32-bit read value.

◆ usb_cart_long_send()

void usb_cart_long_send ( uint32_t  w)

Write a 32-bit value.

Note
Waits for transfer buffer to be non-full on every byte.
Parameters
wThe 32-bit value.

◆ usb_cart_dma_read()

void usb_cart_dma_read ( void *  buffer,
uint32_t  len 
)

Use DMA to read.

This function is synchronous. CPU-DMAC is used to retrieve buffer in chunks of 62 bytes. Any remaining bytes are received byte per byte.

Warning
This function is rather unstable for unknown reasons.
Parameters
bufferThe buffer to write to.
lenThe size of buffer in bytes.

◆ usb_cart_dma_send()

void usb_cart_dma_send ( const void *  buffer,
uint32_t  len 
)

Use DMA to write.

This function is synchronous. CPU-DMAC is used to transfer in chunks of 62 bytes. Any remaining bytes are transferred byte per byte.

Warning
This function is rather unstable for unknown reasons.
Parameters
bufferThe buffer to transfer.
lenThe size of buffer in bytes.