LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Endpoint Management (LPC17xx)

Detailed Description

Endpoint management definitions for the LPC17xx architecture.

Functions, macros and enums related to endpoint management when in USB Device mode. This module contains the endpoint management macros, as well as endpoint interrupt and data send/receive functions for various data types.

Functions

bool Endpoint_ConfigureEndpoint (uint8_t corenum, const uint8_t Number, const uint8_t Type, const uint8_t Direction, const uint16_t Size, const uint8_t Banks)
 Configures the specified endpoint number with the given endpoint type, direction, bank size and banking mode. Once configured, the endpoint may be read from or written to, depending on its direction.
 
static uint16_t USB_Device_GetFrameNumber (void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT
 
static void USB_Device_SetDeviceAddress (uint8_t corenum, const uint8_t Address) ATTR_ALWAYS_INLINE
 
static void Endpoint_ResetEndpoint (const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE
 Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's data In and Out pointers to the bank's contents.
 
static void Endpoint_EnableEndpoint (void) ATTR_ALWAYS_INLINE
 Enables the currently selected endpoint so that data can be sent and received through it to and from a host.
 
static void Endpoint_DisableEndpoint (void) ATTR_ALWAYS_INLINE
 Disables the currently selected endpoint so that data cannot be sent and received through it to and from a host.
 
static bool Endpoint_IsEnabled (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE
 Determines if the currently selected endpoint is enabled, but not necessarily configured.
 
static bool Endpoint_IsConfigured (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE
 Determines if the currently selected endpoint is configured.
 
static uint8_t Endpoint_GetEndpointInterrupts (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE
 Returns a mask indicating which INTERRUPT type endpoints have interrupted - i.e. their interrupt duration has elapsed. Which endpoints have interrupted can be determined by masking the return value against (1 << {Endpoint Number}).
 
static bool Endpoint_HasEndpointInterrupted (const uint8_t EndpointNumber) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE
 Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type endpoints).
 
static void Endpoint_ResetDataToggle (uint8_t corenum) ATTR_ALWAYS_INLINE
 
void Endpoint_ClearStatusStage (uint8_t corenum)
 Completes the status stage of a control transfer on a CONTROL type endpoint automatically, with respect to the data direction. This is a convenience function which can be used to simplify user control request handling.
 
uint8_t Endpoint_WaitUntilReady (void)
 

Variables

uint8_t USB_Device_ControlEndpointSize
 

Function Documentation

void Endpoint_ClearStatusStage ( uint8_t  corenum)

Completes the status stage of a control transfer on a CONTROL type endpoint automatically, with respect to the data direction. This is a convenience function which can be used to simplify user control request handling.

Parameters
corenum: ID Number of USB Core to be processed.
Returns
Nothing.

Definition at line 124 of file Endpoint.c.

bool Endpoint_ConfigureEndpoint ( uint8_t  corenum,
const uint8_t  Number,
const uint8_t  Type,
const uint8_t  Direction,
const uint16_t  Size,
const uint8_t  Banks 
)

Configures the specified endpoint number with the given endpoint type, direction, bank size and banking mode. Once configured, the endpoint may be read from or written to, depending on its direction.

Parameters
corenum: ID Number of USB Core to be processed.
Number: Endpoint number to configure. This must be more than 0 and less than ENDPOINT_TOTAL_ENDPOINTS.
Type: Type of endpoint to configure, a EP_TYPE_* mask. Not all endpoint types are available on Low Speed USB devices - refer to the USB 2.0 specification.
Direction: Endpoint data direction, either ENDPOINT_DIR_OUT or ENDPOINT_DIR_IN. All endpoints (except Control type) are unidirectional - data may only be read from or written to the endpoint bank based on its direction, not both.
Size: Size of the endpoint's bank, where packets are stored before they are transmitted to the USB host, or after they have been received from the USB host (depending on the endpoint's data direction). The bank size must indicate the maximum packet size that the endpoint can handle.
Banks: Number of banks to use for the endpoint being configured, an ENDPOINT_BANK_* mask. More banks uses more USB DPRAM, but offers better performance. Isochronous type endpoints must have at least two banks.
Returns
Boolean true if the configuration succeeded, false otherwise.
static void Endpoint_DisableEndpoint ( void  )
inlinestatic

Disables the currently selected endpoint so that data cannot be sent and received through it to and from a host.

Returns
Nothing.

Definition at line 197 of file Endpoint_LPC17xx.h.

static void Endpoint_EnableEndpoint ( void  )
inlinestatic

Enables the currently selected endpoint so that data can be sent and received through it to and from a host.

Note
Endpoints must first be configured properly via Endpoint_ConfigureEndpoint().
Returns
Nothing.

Definition at line 187 of file Endpoint_LPC17xx.h.

static uint8_t Endpoint_GetEndpointInterrupts ( void  )
inlinestatic

Returns a mask indicating which INTERRUPT type endpoints have interrupted - i.e. their interrupt duration has elapsed. Which endpoints have interrupted can be determined by masking the return value against (1 << {Endpoint Number}).

Returns
Mask whose bits indicate which endpoints have interrupted.

Definition at line 259 of file Endpoint_LPC17xx.h.

static bool Endpoint_HasEndpointInterrupted ( const uint8_t  EndpointNumber)
inlinestatic

Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type endpoints).

Parameters
EndpointNumber: Index of the endpoint whose interrupt flag should be tested
Returns
Boolean true if the specified endpoint has interrupted, false otherwise.

Definition at line 273 of file Endpoint_LPC17xx.h.

static bool Endpoint_IsConfigured ( void  )
inlinestatic

Determines if the currently selected endpoint is configured.

Returns
Boolean true if the currently selected endpoint has been configured, false otherwise.

Definition at line 245 of file Endpoint_LPC17xx.h.

static bool Endpoint_IsEnabled ( void  )
inlinestatic

Determines if the currently selected endpoint is enabled, but not necessarily configured.

Returns
Boolean true if the currently selected endpoint is enabled, false otherwise.

Definition at line 206 of file Endpoint_LPC17xx.h.

static void Endpoint_ResetDataToggle ( uint8_t  corenum)
inlinestatic

Resets the data toggle of the currently selected endpoint.

Definition at line 502 of file Endpoint_LPC17xx.h.

static void Endpoint_ResetEndpoint ( const uint8_t  EndpointNumber)
inlinestatic

Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's data In and Out pointers to the bank's contents.

Parameters
EndpointNumber: Endpoint number whose FIFO buffers are to be reset.
Returns
Nothing.

Definition at line 175 of file Endpoint_LPC17xx.h.

uint8_t Endpoint_WaitUntilReady ( void  )

Definition at line 135 of file Endpoint.c.

static uint16_t USB_Device_GetFrameNumber ( void  )
inlinestatic

Definition at line 147 of file Endpoint_LPC17xx.h.

static void USB_Device_SetDeviceAddress ( uint8_t  corenum,
const uint8_t  Address 
)
inlinestatic

Definition at line 160 of file Endpoint_LPC17xx.h.

Variable Documentation

uint8_t USB_Device_ControlEndpointSize