![]() |
LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
|
Go to the source code of this file.
Macros | |
#define | ENDPOINT_CONTROLEP_DEFAULT_SIZE 64 |
#define | ENDPOINT_MAX_SIZE(EPIndex) 512 |
#define | ENDPOINT_TOTAL_ENDPOINTS ENDPOINT_DETAILS_MAXEP |
Endpoint Bank Mode Masks | |
#define | ENDPOINT_BANK_SINGLE (0 << 1) |
#define | ENDPOINT_BANK_DOUBLE (1 << 1) |
Enumerations | |
enum | Endpoint_WaitUntilReady_ErrorCodes_t { ENDPOINT_READYWAIT_NoError = 0, ENDPOINT_READYWAIT_EndpointStalled = 1, ENDPOINT_READYWAIT_DeviceDisconnected = 2, ENDPOINT_READYWAIT_BusSuspended = 3, ENDPOINT_READYWAIT_Timeout = 4 } |
Functions | |
static PRAGMA_ALWAYS_INLINE uint8_t | Endpoint_GetCurrentEndpoint (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE |
Get the endpoint address of the currently selected endpoint. This is typically used to save the currently selected endpoint number so that it can be restored after another endpoint has been manipulated. | |
static PRAGMA_ALWAYS_INLINE void | Endpoint_SelectEndpoint (const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE |
Selects the given endpoint number. If the address from the device descriptors is used, the value should be masked with the ENDPOINT_EPNUM_MASK constant to extract only the endpoint number (and discarding the endpoint direction bit). | |
static PRAGMA_ALWAYS_INLINE uint8_t | Endpoint_Read_8 (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE |
Reads one byte from the currently selected endpoint's bank, for OUT direction endpoints. | |
static PRAGMA_ALWAYS_INLINE uint8_t | Endpoint_GetEndpointDirection (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE |
Determines the currently selected endpoint's direction. | |
static PRAGMA_ALWAYS_INLINE bool | Endpoint_IsReadWriteAllowed (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE |
Determines if the currently selected endpoint may be read from (if data is waiting in the endpoint bank and the endpoint is an OUT direction, or if the bank is not yet full if the endpoint is an IN direction). This function will return false if an error has occurred in the endpoint, if the endpoint is an OUT direction and no packet (or an empty packet) has been received, or if the endpoint is an IN direction and the endpoint bank is full. | |
static PRAGMA_ALWAYS_INLINE void | Endpoint_Write_8 (const uint8_t Data) ATTR_ALWAYS_INLINE |
Writes one byte to the currently selected endpoint's bank, for IN direction endpoints. | |
static PRAGMA_ALWAYS_INLINE void | Endpoint_Discard_8 (void) ATTR_ALWAYS_INLINE |
Discards one byte from the currently selected endpoint's bank, for OUT direction endpoints. | |
static PRAGMA_ALWAYS_INLINE uint16_t | Endpoint_Read_16_LE (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE |
Reads two bytes from the currently selected endpoint's bank in little endian format, for OUT direction endpoints. | |
static PRAGMA_ALWAYS_INLINE uint16_t | Endpoint_Read_16_BE (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE |
Reads two bytes from the currently selected endpoint's bank in big endian format, for OUT direction endpoints. | |
static PRAGMA_ALWAYS_INLINE void | Endpoint_Write_16_LE (const uint16_t Data) ATTR_ALWAYS_INLINE |
Writes two bytes to the currently selected endpoint's bank in little endian format, for IN direction endpoints. | |
static PRAGMA_ALWAYS_INLINE void | Endpoint_Write_16_BE (const uint16_t Data) ATTR_ALWAYS_INLINE |
Writes two bytes to the currently selected endpoint's bank in big endian format, for IN direction endpoints. | |
static PRAGMA_ALWAYS_INLINE void | Endpoint_Discard_16 (void) ATTR_ALWAYS_INLINE |
Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints. | |
static PRAGMA_ALWAYS_INLINE uint32_t | Endpoint_Read_32_LE (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE |
Reads four bytes from the currently selected endpoint's bank in little endian format, for OUT direction endpoints. | |
static PRAGMA_ALWAYS_INLINE uint32_t | Endpoint_Read_32_BE (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE |
Reads four bytes from the currently selected endpoint's bank in big endian format, for OUT direction endpoints. | |
static PRAGMA_ALWAYS_INLINE void | Endpoint_Write_32_LE (const uint32_t Data) ATTR_ALWAYS_INLINE |
Writes four bytes to the currently selected endpoint's bank in little endian format, for IN direction endpoints. | |
static PRAGMA_ALWAYS_INLINE void | Endpoint_Write_32_BE (const uint32_t Data) ATTR_ALWAYS_INLINE |
Writes four bytes to the currently selected endpoint's bank in big endian format, for IN direction endpoints. | |
static PRAGMA_ALWAYS_INLINE void | Endpoint_Discard_32 (void) ATTR_ALWAYS_INLINE |
Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints. | |
void | Endpoint_GetSetupPackage (uint8_t *pData) |
#define ENDPOINT_BANK_DOUBLE (1 << 1) |
Mask for the bank mode selection for the Endpoint_ConfigureEndpoint() macro. This indicates that the endpoint should have two banks, which requires more USB FIFO memory but results in faster transfers as one USB device (the LPC or the host) can access one bank while the other accesses the second bank.
Definition at line 64 of file Endpoint_LPC.h.
#define ENDPOINT_BANK_SINGLE (0 << 1) |
Mask for the bank mode selection for the Endpoint_ConfigureEndpoint() macro. This indicates that the endpoint should have one single bank, which requires less USB FIFO memory but results in slower transfers as only one USB device (the LPC or the host) can access the endpoint's bank at the one time.
Definition at line 57 of file Endpoint_LPC.h.
#define ENDPOINT_CONTROLEP_DEFAULT_SIZE 64 |
Default size of the default control endpoint's bank, until altered by the control endpoint bank size value in the device descriptor. Not available if the FIXED_CONTROL_ENDPOINT_SIZE
token is defined.
Definition at line 71 of file Endpoint_LPC.h.
#define ENDPOINT_MAX_SIZE | ( | EPIndex | ) | 512 |
Retrieves the maximum bank size in bytes of a given endpoint.
EPIndex | Endpoint number, a value between 0 and (ENDPOINT_TOTAL_ENDPOINTS - 1) |
Definition at line 81 of file Endpoint_LPC.h.
#define ENDPOINT_TOTAL_ENDPOINTS ENDPOINT_DETAILS_MAXEP |
Total number of endpoints (including the default control endpoint at address 0) which may be used in the device. Different USB LPC models support different amounts of endpoints, this value reflects the maximum number of endpoints for the currently selected LPC model.
Definition at line 88 of file Endpoint_LPC.h.
Enum for the possible error return codes of the Endpoint_WaitUntilReady() function.
ENDPOINT_READYWAIT_NoError |
Endpoint is ready for next packet, no error. |
ENDPOINT_READYWAIT_EndpointStalled |
The endpoint was stalled during the stream transfer by the host or device. |
ENDPOINT_READYWAIT_DeviceDisconnected |
Device was disconnected from the host while waiting for the endpoint to become ready. |
ENDPOINT_READYWAIT_BusSuspended |
The USB bus has been suspended by the host and no USB endpoint traffic can occur until the bus has resumed. |
ENDPOINT_READYWAIT_Timeout |
The host failed to accept or send the next packet within the software timeout period set by the USB_STREAM_TIMEOUT_MS macro. |
Definition at line 98 of file Endpoint_LPC.h.
|
inlinestatic |
Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints.
Definition at line 335 of file Endpoint_LPC.h.
|
inlinestatic |
Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.
Definition at line 440 of file Endpoint_LPC.h.
|
inlinestatic |
Discards one byte from the currently selected endpoint's bank, for OUT direction endpoints.
Definition at line 240 of file Endpoint_LPC.h.
|
inlinestatic |
Get the endpoint address of the currently selected endpoint. This is typically used to save the currently selected endpoint number so that it can be restored after another endpoint has been manipulated.
Definition at line 125 of file Endpoint_LPC.h.
|
inlinestatic |
Determines the currently selected endpoint's direction.
ENDPOINT_DIR_*
mask. Definition at line 183 of file Endpoint_LPC.h.
void Endpoint_GetSetupPackage | ( | uint8_t * | pData | ) |
|
inlinestatic |
Determines if the currently selected endpoint may be read from (if data is waiting in the endpoint bank and the endpoint is an OUT direction, or if the bank is not yet full if the endpoint is an IN direction). This function will return false if an error has occurred in the endpoint, if the endpoint is an OUT direction and no packet (or an empty packet) has been received, or if the endpoint is an IN direction and the endpoint bank is full.
true
if the currently selected endpoint may be read from or written to, depending on its direction. Definition at line 203 of file Endpoint_LPC.h.
|
inlinestatic |
Reads two bytes from the currently selected endpoint's bank in big endian format, for OUT direction endpoints.
Definition at line 279 of file Endpoint_LPC.h.
|
inlinestatic |
Reads two bytes from the currently selected endpoint's bank in little endian format, for OUT direction endpoints.
Definition at line 257 of file Endpoint_LPC.h.
|
inlinestatic |
Reads four bytes from the currently selected endpoint's bank in big endian format, for OUT direction endpoints.
Definition at line 378 of file Endpoint_LPC.h.
|
inlinestatic |
Reads four bytes from the currently selected endpoint's bank in little endian format, for OUT direction endpoints.
Definition at line 354 of file Endpoint_LPC.h.
|
inlinestatic |
Reads one byte from the currently selected endpoint's bank, for OUT direction endpoints.
Definition at line 160 of file Endpoint_LPC.h.
|
inlinestatic |
Selects the given endpoint number. If the address from the device descriptors is used, the value should be masked with the ENDPOINT_EPNUM_MASK constant to extract only the endpoint number (and discarding the endpoint direction bit).
Any endpoint operations which do not require the endpoint number to be indicated will operate on the currently selected endpoint.
EndpointNumber | : Endpoint number to select |
Definition at line 144 of file Endpoint_LPC.h.
|
inlinestatic |
Writes two bytes to the currently selected endpoint's bank in big endian format, for IN direction endpoints.
Data | : Data to write to the currently selected endpoint's FIFO buffer |
Definition at line 320 of file Endpoint_LPC.h.
|
inlinestatic |
Writes two bytes to the currently selected endpoint's bank in little endian format, for IN direction endpoints.
Data | : Data to write to the currently selected endpoint's FIFO buffer |
Definition at line 302 of file Endpoint_LPC.h.
|
inlinestatic |
Writes four bytes to the currently selected endpoint's bank in big endian format, for IN direction endpoints.
Data | : Data to write to the currently selected endpoint's FIFO buffer |
Definition at line 423 of file Endpoint_LPC.h.
|
inlinestatic |
Writes four bytes to the currently selected endpoint's bank in little endian format, for IN direction endpoints.
Data | : Data to write to the currently selected endpoint's FIFO buffer |
Definition at line 403 of file Endpoint_LPC.h.
|
inlinestatic |
Writes one byte to the currently selected endpoint's bank, for IN direction endpoints.
Data | : Data to write into the the currently selected endpoint's FIFO buffer |
Definition at line 219 of file Endpoint_LPC.h.