Classes | |
struct | Endpoint |
struct | MblTransfer |
struct | Transfer |
struct | TransferHeader |
struct | UdphsDmaDescriptor |
Macros | |
#define | bmEP(bEP) (1 << (bEP)) |
#define | DMA |
#define | DMAEndpointInt |
#define | EndpointInt |
#define | MBL_FULL 1 |
#define | MBL_NbBuffer(i, o, size) (((i)>(o))?((i)-(o)):((i)+(size)-(o))) |
#define | MBL_NULL 2 |
#define | SHIFT_INTERUPT 12 |
#define | UDPHS_ENDPOINT_DISABLED 0 |
#define | UDPHS_ENDPOINT_HALTED 1 |
#define | UDPHS_ENDPOINT_IDLE 2 |
#define | UDPHS_ENDPOINT_RECEIVING 4 |
#define | UDPHS_ENDPOINT_RECEIVINGM 6 |
#define | UDPHS_ENDPOINT_SENDING 3 |
#define | UDPHS_ENDPOINT_SENDINGM 5 |
Functions | |
COMPILER_ALIGNED (16) | |
static uint8_t | UDPHS_AddWr (uint8_t bEndpoint, const void *pData, uint32_t dLength) |
static void | UDPHS_DmaHandler (uint8_t bEndpoint) |
static void | UDPHS_DmaSingle (uint8_t bEndpoint, Transfer *pXfr, uint32_t dwCfg) |
static void | UDPHS_EndpointHandler (uint8_t bEndpoint) |
static uint8_t | UDPHS_MblUpdate (MblTransfer *pTransfer, USBDTransferBuffer *pBi, uint16_t size, uint8_t forceEnd) |
static uint8_t | UDPHS_MblWriteFifo (uint8_t bEndpoint) |
static uint8_t | UDPHS_Read (uint8_t bEndpoint, void *pData, uint32_t dLength) |
static void | UDPHS_ReadPayload (uint8_t bEndpoint, int32_t wPacketSize) |
static void | UDPHS_ReadRequest (USBGenericRequest *pRequest) |
static uint8_t | UDPHS_Write (uint8_t bEndpoint, const void *pData, uint32_t dLength) |
static void | UDPHS_WritePayload (uint8_t bEndpoint, int32_t size) |
void | USBD_HAL_Activate (void) |
void | USBD_HAL_AttachUsb (void) |
void | USBD_HAL_CancelIo (uint32_t bmEPs) |
uint8_t | USBD_HAL_ConfigureEP (const USBEndpointDescriptor *pDescriptor) |
void | USBD_HAL_Connect (void) |
Enable Pull-up, connect. More... | |
void | USBD_HAL_DetachUsb (void) |
void | USBD_HAL_Disable (void) |
void | USBD_HAL_Disconnect (void) |
Disable Pull-up, disconnect. More... | |
void | USBD_HAL_Enable (void) |
uint8_t | USBD_HAL_Halt (uint8_t bEndpoint, uint8_t ctl) |
void | USBD_HAL_Init (void) |
uint8_t | USBD_HAL_IsHighSpeed (void) |
uint8_t | USBD_HAL_Read (uint8_t bEndpoint, void *pData, uint32_t dLength) |
void | USBD_HAL_RemoteWakeUp (void) |
void | USBD_HAL_ResetEPs (uint32_t bmEPs, uint8_t bStatus, uint8_t bKeepCfg) |
Reset endpoints and disable them.
| |
void | USBD_HAL_SetAddress (uint8_t address) |
void | USBD_HAL_SetConfiguration (uint8_t cfgnum) |
uint8_t | USBD_HAL_SetTransferCallback (uint8_t bEP, TransferCallback fCallback, void *pCbData) |
uint8_t | USBD_HAL_SetupMblTransfer (uint8_t bEndpoint, USBDTransferBuffer *pMbList, uint16_t mblSize, uint16_t startOffset) |
uint8_t | USBD_HAL_Stall (uint8_t bEP) |
void | USBD_HAL_Suspend (void) |
void | USBD_HAL_Test (uint8_t bIndex) |
void | USBD_HAL_WaitReadData (uint8_t bEndpoint) |
uint8_t | USBD_HAL_Write (uint8_t bEndpoint, const void *pData, uint32_t dLength) |
uint8_t | USBD_HAL_WrWithHdr (uint8_t bEndpoint, const void *pHdr, uint8_t bHdrLen, const void *pData, uint32_t dLength) |
void | USBHS_Handler (void) |
Variables | |
static Endpoint | endpoints [CHIP_USB_NUMENDPOINTS] |
static const char | test_packet_buffer [] |
#define bmEP | ( | bEP | ) | (1 << (bEP)) |
Get bitmap for an endpoint
Definition at line 60 of file USBD_HAL.h.
#define DMA |
Definition at line 60 of file USBD_HAL.c.
#define DMAEndpointInt |
Definition at line 66 of file USBD_HAL.h.
#define EndpointInt |
Definition at line 62 of file USBD_HAL.h.
#define MBL_FULL 1 |
Buffer list is full
Definition at line 105 of file USBD_HAL.c.
#define MBL_NbBuffer | ( | i, | |
o, | |||
size | |||
) | (((i)>(o))?((i)-(o)):((i)+(size)-(o))) |
Get Number of buffer in Multi-Buffer-List
i | input index |
o | output index |
size | list size |
Definition at line 102 of file USBD_HAL.c.
#define MBL_NULL 2 |
Buffer list is null
Definition at line 107 of file USBD_HAL.c.
#define SHIFT_INTERUPT 12 |
Bits that should be shifted to access interrupt bits.
Definition at line 64 of file USBD_HAL.c.
#define UDPHS_ENDPOINT_DISABLED 0 |
This page lists the endpoint states.
Definition at line 82 of file USBD_HAL.c.
#define UDPHS_ENDPOINT_HALTED 1 |
Endpoint states: Endpoint is halted (i.e. STALLs every request)
Definition at line 84 of file USBD_HAL.c.
#define UDPHS_ENDPOINT_IDLE 2 |
Endpoint states: Endpoint is idle (i.e. ready for transmission)
Definition at line 86 of file USBD_HAL.c.
#define UDPHS_ENDPOINT_RECEIVING 4 |
Endpoint states: Endpoint is receiving data
Definition at line 90 of file USBD_HAL.c.
#define UDPHS_ENDPOINT_RECEIVINGM 6 |
Endpoint states: Endpoint is receiving MBL
Definition at line 94 of file USBD_HAL.c.
#define UDPHS_ENDPOINT_SENDING 3 |
Endpoint states: Endpoint is sending data
Definition at line 88 of file USBD_HAL.c.
#define UDPHS_ENDPOINT_SENDINGM 5 |
Endpoint states: Endpoint is sending MBL
Definition at line 92 of file USBD_HAL.c.
COMPILER_ALIGNED | ( | 16 | ) |
DMA link list
Definition at line 221 of file USBD_HAL.c.
|
inlinestatic |
Sends data through a USB endpoint. Sets up the transfer descriptor list, writes one or two data payloads (depending on the number of FIFO bank for the endpoint) and then starts the actual transfer. The operation is complete when all the transfer buffer in the list has been sent.
If the size of the buffer is greater than the size of the endpoint (or twice the size if the endpoint has two FIFO banks), then the buffer must be kept allocated until the transfer is finished. This means that it is not possible to declare it on the stack (i.e. as a local variable of a function which returns after starting a transfer).
pEndpoint | Pointer to Endpoint struct. |
pData | Pointer to a buffer with the data to send. |
dLength | Size of the data buffer. |
Definition at line 869 of file USBD_HAL.c.
|
static |
Endpoint DMA interrupt handler. This function handles DMA interrupts.
bEndpoint | Index of endpoint |
Definition at line 687 of file USBD_HAL.c.
|
inlinestatic |
DMA Single transfer
bEndpoint | EP number. Pointer to transfer instance. DMA Control configuration (excluding length). |
Definition at line 663 of file USBD_HAL.c.
|
static |
Endpoint interrupt handler. Handle IN/OUT transfers, received SETUP packets and STALLing
bEndpoint | Index of endpoint |
Definition at line 470 of file USBD_HAL.c.
|
static |
Update multi-buffer-transfer descriptors.
pTransfer | Pointer to instance MblTransfer. |
size | Size of bytes that processed. |
forceEnd | Force the buffer END. |
Definition at line 290 of file USBD_HAL.c.
|
static |
Transfers a data payload from the current transfer buffer to the endpoint FIFO
bEndpoint | Number of the endpoint which is sending data. |
Definition at line 331 of file USBD_HAL.c.
|
inlinestatic |
Reads incoming data on an USB endpoint This methods sets the transfer descriptor and activate the endpoint interrupt. The actual transfer is then carried out by the endpoint interrupt handler. The Read operation finishes either when the buffer is full, or a short packet (inferior to endpoint maximum size) is received.
The buffer must be kept allocated until the transfer is finished.
bEndpoint | Endpoint number. |
pData | Pointer to a data buffer. |
dLength | Size of the data buffer in bytes. |
Definition at line 949 of file USBD_HAL.c.
|
static |
Transfers a data payload from an endpoint FIFO to the current transfer buffer
bEndpoint | Endpoint number. |
wPacketSize | Size of received data packet |
Definition at line 420 of file USBD_HAL.c.
|
static |
Received SETUP packet from endpoint 0 FIFO
pRequest | Generic USB SETUP request sent over Control endpoints |
Definition at line 451 of file USBD_HAL.c.
|
inlinestatic |
Sends data through a USB endpoint. Sets up the transfer descriptor, writes one or two data payloads (depending on the number of FIFO bank for the endpoint) and then starts the actual transfer. The operation is complete when all the data has been sent.
If the size of the buffer is greater than the size of the endpoint (or twice the size if the endpoint has two FIFO banks), then the buffer must be kept allocated until the transfer is finished. This means that it is not possible to declare it on the stack (i.e. as a local variable of a function which returns after starting a transfer).
pEndpoint | Pointer to Endpoint struct. |
pData | Pointer to a buffer with the data to send. |
dLength | Size of the data buffer. |
Definition at line 790 of file USBD_HAL.c.
|
static |
Transfers a data payload from the current transfer buffer to the endpoint FIFO
bEndpoint | Number of the endpoint which is sending data. |
Definition at line 389 of file USBD_HAL.c.
void USBD_HAL_Activate | ( | void | ) |
Activate USB Device HW Interface
Definition at line 1922 of file USBD_HAL.c.
void USBD_HAL_AttachUsb | ( | void | ) |
void USBD_HAL_CancelIo | ( | uint32_t | bmEPs | ) |
Cancel pending READ/WRITE
bmEPs | Bitmap for endpoints to reset. |
Definition at line 1163 of file USBD_HAL.c.
uint8_t USBD_HAL_ConfigureEP | ( | const USBEndpointDescriptor * | pDescriptor | ) |
Configures an endpoint according to its endpoint Descriptor.
pDescriptor | Pointer to an endpoint descriptor. |
Definition at line 1188 of file USBD_HAL.c.
void USBD_HAL_Connect | ( | void | ) |
Enable Pull-up, connect.
Definition at line 1635 of file USBD_HAL.c.
void USBD_HAL_DetachUsb | ( | void | ) |
void USBD_HAL_Disable | ( | void | ) |
Definition at line 1927 of file USBD_HAL.c.
void USBD_HAL_Disconnect | ( | void | ) |
Disable Pull-up, disconnect.
Definition at line 1684 of file USBD_HAL.c.
void USBD_HAL_Enable | ( | void | ) |
uint8_t USBD_HAL_Halt | ( | uint8_t | bEndpoint, |
uint8_t | ctl | ||
) |
Sets/Clear/Get the HALT state on the endpoint. In HALT state, the endpoint should keep stalling any packet.
bEndpoint | Endpoint number. |
ctl | Control code CLR/HALT/READ. 0: Clear HALT state; 1: Set HALT state; .: Return HALT status. |
Definition at line 1809 of file USBD_HAL.c.
void USBD_HAL_Init | ( | void | ) |
Initializes the USB HW Access driver.
Disable USB hardware
Enable USB hardware
Definition at line 1734 of file USBD_HAL.c.
uint8_t USBD_HAL_IsHighSpeed | ( | void | ) |
Indicates if the device is running in high or full-speed. Always returns 0 since UDP does not support high-speed mode.
Definition at line 1898 of file USBD_HAL.c.
uint8_t USBD_HAL_Read | ( | uint8_t | bEndpoint, |
void * | pData, | ||
uint32_t | dLength | ||
) |
Reads incoming data on an USB endpoint This methods sets the transfer descriptor and activate the endpoint interrupt. The actual transfer is then carried out by the endpoint interrupt handler. The Read operation finishes either when the buffer is full, or a short packet (inferior to endpoint maximum size) is received.
The buffer must be kept allocated until the transfer is finished.
bEndpoint | Endpoint number. |
pData | Pointer to a data buffer. |
dLength | Size of the data buffer in bytes. |
Definition at line 1618 of file USBD_HAL.c.
void USBD_HAL_RemoteWakeUp | ( | void | ) |
Starts a remote wake-up procedure.
Definition at line 1694 of file USBD_HAL.c.
void USBD_HAL_ResetEPs | ( | uint32_t | bmEPs, |
uint8_t | bStatus, | ||
uint8_t | bKeepCfg | ||
) |
Reset endpoints and disable them.
bmEPs | Bitmap for endpoints to reset. |
bStatus | Status passed to terminate transfer on endpoint. |
bKeepCfg | 1 to keep old endpoint configuration. |
Definition at line 1119 of file USBD_HAL.c.
void USBD_HAL_SetAddress | ( | uint8_t | address | ) |
Sets the device address to the given value.
address | New device address. |
Definition at line 1711 of file USBD_HAL.c.
void USBD_HAL_SetConfiguration | ( | uint8_t | cfgnum | ) |
Sets the current device configuration.
cfgnum | - Configuration number to set. |
Definition at line 1725 of file USBD_HAL.c.
uint8_t USBD_HAL_SetTransferCallback | ( | uint8_t | bEP, |
TransferCallback | fCallback, | ||
void * | pCbData | ||
) |
Set callback for a USB endpoint for transfer (read/write).
bEP | Endpoint number. |
fCallback | Optional callback function to invoke when the transfer is complete. |
pCbData | Optional pointer to data to the callback function. |
Definition at line 1340 of file USBD_HAL.c.
uint8_t USBD_HAL_SetupMblTransfer | ( | uint8_t | bEndpoint, |
USBDTransferBuffer * | pMbList, | ||
uint16_t | mblSize, | ||
uint16_t | startOffset | ||
) |
Configure an endpoint to use multi-buffer-list transfer mode. The buffers can be added by _Read/_Write function.
pMbList | Pointer to a multi-buffer list used, NULL to disable MBL. |
mblSize | Multi-buffer list size (number of buffers can be queued) |
startOffset | When number of buffer achieve this offset transfer start |
Definition at line 1365 of file USBD_HAL.c.
uint8_t USBD_HAL_Stall | ( | uint8_t | bEP | ) |
Causes the given endpoint to acknowledge the next packet it receives with a STALL handshake except setup request.
bEP | Endpoint number. |
Definition at line 1779 of file USBD_HAL.c.
void USBD_HAL_Suspend | ( | void | ) |
Suspend USB Device HW Interface
Definition at line 1910 of file USBD_HAL.c.
void USBD_HAL_Test | ( | uint8_t | bIndex | ) |
Certification test for High Speed device.
bIndex | Test to be done |
Definition at line 1943 of file USBD_HAL.c.
void USBD_HAL_WaitReadData | ( | uint8_t | bEndpoint | ) |
Wait for data to read and then return
bEndpoint | Endpoint number |
Definition at line 1887 of file USBD_HAL.c.
uint8_t USBD_HAL_Write | ( | uint8_t | bEndpoint, |
const void * | pData, | ||
uint32_t | dLength | ||
) |
Sends data through a USB endpoint. Sets up the transfer descriptor, writes one or two data payloads (depending on the number of FIFO bank for the endpoint) and then starts the actual transfer. The operation is complete when all the data has been sent.
If the size of the buffer is greater than the size of the endpoint (or twice the size if the endpoint has two FIFO banks), then the buffer must be kept allocated until the transfer is finished. This means that it is not possible to declare it on the stack (i.e. as a local variable of a function which returns after starting a transfer).
bEndpoint | Endpoint number. |
pData | Pointer to a buffer with the data to send. |
dLength | Size of the data buffer. |
Definition at line 1429 of file USBD_HAL.c.
uint8_t USBD_HAL_WrWithHdr | ( | uint8_t | bEndpoint, |
const void * | pHdr, | ||
uint8_t | bHdrLen, | ||
const void * | pData, | ||
uint32_t | dLength | ||
) |
Special write function. Sends data through a USB endpoint. Sets up the transfer descriptor, writes header and one or two data payloads (depending on the number of FIFO bank for the endpoint) and then starts the actual transfer. The operation is complete when all the data has been sent.
If the size of the buffer is greater than the size of the endpoint (or twice the size if the endpoint has two FIFO banks), then the buffer must be kept allocated until the transfer is finished. This means that it is not possible to declare it on the stack (i.e. as a local variable of a function which returns after starting a transfer).
bEndpoint | Endpoint number. |
pData | Pointer to a buffer with the data to send. |
dLength | Size of the data buffer. |
Definition at line 1458 of file USBD_HAL.c.
void USBHS_Handler | ( | void | ) |
USBD (UDP) interrupt handler Manages device resume, suspend, end of bus reset. Forwards endpoint events to the appropriate handler.
Definition at line 1008 of file USBD_HAL.c.
|
static |
Holds the internal state for each endpoint of the UDP.
Definition at line 207 of file USBD_HAL.c.
|
static |
7.1.20 Test Mode Support Test codes for the USB HS test mode.
Definition at line 211 of file USBD_HAL.c.