LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Endpoint.h File Reference
#include "../../../Common/Common.h"
#include "USBMode.h"
#include "USBTask.h"
#include "USBInterrupt.h"

Go to the source code of this file.

Macros

#define ENDPOINT_EPNUM_MASK   0x0F
 
#define ENDPOINT_CONTROLEP   0
 
#define ENDPOINT_BANK_SINGLE   (0 << 1)
 
#define ENDPOINT_BANK_DOUBLE   (1 << 1)
 
#define ENDPOINT_CONTROLEP_DEFAULT_SIZE   64
 
#define ENDPOINT_MAX_SIZE(EPIndex)   512
 
#define ENDPOINT_TOTAL_ENDPOINTS0   ENDPOINT_DETAILS_MAXEP0
 
#define ENDPOINT_TOTAL_ENDPOINTS1   ENDPOINT_DETAILS_MAXEP1
 
#define ENDPOINT_TOTAL_ENDPOINTS(corenum)   ((corenum) ? ENDPOINT_DETAILS_MAXEP1 : ENDPOINT_DETAILS_MAXEP0)
 

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 (uint8_t corenum) 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 (uint8_t corenum, 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 (uint8_t corenum) 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 (uint8_t corenum) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE
 Determines the currently selected endpoint's direction.
 
static PRAGMA_ALWAYS_INLINE bool Endpoint_IsReadWriteAllowed (uint8_t corenum) 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 (uint8_t corenum, 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 (uint8_t corenum) 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 (uint8_t corenum) 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 (uint8_t corenum) 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 (uint8_t corenum, 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 (uint8_t corenum, 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 (uint8_t corenum) 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 (uint8_t corenum) 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 (uint8_t corenum) 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 (uint8_t corenum, 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 (uint8_t corenum, 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 (uint8_t corenum) ATTR_ALWAYS_INLINE
 Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.
 
void Endpoint_GetSetupPackage (uint8_t corenum, uint8_t *pData)