![]() |
LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
|
Endpoint management definitions for the LPC18xx architecture. More...
Functions | |
bool | Endpoint_ConfigureEndpoint (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 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 |
static void | Endpoint_DisableEndpoint (void) ATTR_ALWAYS_INLINE |
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 (void) ATTR_ALWAYS_INLINE |
void | Endpoint_ClearStatusStage (void) |
Variables | |
uint8_t | USB_Device_ControlEndpointSize |
Endpoint management definitions for the LPC18xx 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.
void Endpoint_ClearStatusStage | ( | void | ) |
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.
Definition at line 122 of file Endpoint_LPC.c.
bool Endpoint_ConfigureEndpoint | ( | 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.
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. |
true
if the configuration succeeded, false
otherwise.
|
inlinestatic |
Disables the currently selected endpoint so that data cannot be sent and received through it to and from a host.
Definition at line 352 of file Endpoint_LPC18xx.h.
|
inlinestatic |
Enables the currently selected endpoint so that data can be sent and received through it to and from a host.
Definition at line 344 of file Endpoint_LPC18xx.h.
|
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})
.
Definition at line 414 of file Endpoint_LPC18xx.h.
|
inlinestatic |
Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type endpoints).
EndpointNumber | : Index of the endpoint whose interrupt flag should be tested |
true
if the specified endpoint has interrupted, false
otherwise. Definition at line 428 of file Endpoint_LPC18xx.h.
|
inlinestatic |
Determines if the currently selected endpoint is configured.
true
if the currently selected endpoint has been configured, false
otherwise. Definition at line 399 of file Endpoint_LPC18xx.h.
|
inlinestatic |
Determines if the currently selected endpoint is enabled, but not necessarily configured.
true
if the currently selected endpoint is enabled, false
otherwise. Definition at line 361 of file Endpoint_LPC18xx.h.
|
inlinestatic |
Resets the data toggle of the currently selected endpoint.
Definition at line 608 of file Endpoint_LPC18xx.h.
|
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.
EndpointNumber | : Endpoint number whose FIFO buffers are to be reset |
Definition at line 334 of file Endpoint_LPC18xx.h.
uint8_t USB_Device_ControlEndpointSize |
Global indicating the maximum packet size of the default control endpoint located at address 0 in the device. This value is set to the value indicated in the device descriptor in the user project once the USB interface is initialized into device mode.
If space is an issue, it is possible to fix this to a static value by defining the control endpoint size in the FIXED_CONTROL_ENDPOINT_SIZE
token passed to the compiler in the makefile via the -D switch. When a fixed control endpoint size is used, the size is no longer dynamically read from the descriptors at runtime and instead fixed to the given value. When used, it is important that the descriptor control endpoint size value matches the size given as the FIXED_CONTROL_ENDPOINT_SIZE
token - it is recommended that the FIXED_CONTROL_ENDPOINT_SIZE
token be used in the device descriptors to ensure this.