aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/LowLevel/Endpoint.h
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-04-16 08:50:34 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-04-16 08:50:34 +0000
commit8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c (patch)
tree65c37548f19c26de3971639067d6f290095f5843 /LUFA/Drivers/USB/LowLevel/Endpoint.h
parentef06bfd1c0ef5272c32808e23d0fd60d2d1bca9c (diff)
downloadlufa-8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c.tar.gz
lufa-8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c.tar.bz2
lufa-8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c.zip
Fixed GenericHIDHost demo report write routine incorrect for control type requests (thanks to Andrei Krainev).
Removed Endpoint_ClearCurrentBank() and Pipe_ClearCurrentBank() in favour of new Endpoint_ClearIN(), Endpoint_ClearOUT(), Endpoint_ClearControlIN(), Endpoint_ClearControlOUT(), Pipe_ClearIN(), Pipe_ClearOUT(), Pipe_ClearControlIN() and Pipe_ClearControlOUT() macros (done to allow for the detection of packets of zero length). Renamed *_ReadWriteAllowed() macros to *_IsReadWriteAllowed() to remain consistent with the rest of the LUFA API. Endpoint_IsSetupReceived() macro has been renamed to Endpoint_IsSETUPReceived(), Endpoint_ClearSetupReceived() macro has been renamed to Endpoint_ClearControlSETUP(), the Pipe_IsSetupSent() macro has been renamed to Pipe_IsSETUPSent() and the Pipe_ClearSetupSent() macro is no longer applicable and should be removed - changes made to compliment the new endpoint and pipe bank management API. Updated all demos, bootloaders and projects to use the new endpoint and pipe management APIs (thanks to Roman Thiel). Updated library doxygen documentation, added groups, changed documentation macro functions to real functions for clarity. Removed old endpoint and pipe aliased read/write/discard routines which did not have an explicit endian specifier for clarity. Removed the ButtLoadTag.h header file, as no one used for its intended purpose anyway.
Diffstat (limited to 'LUFA/Drivers/USB/LowLevel/Endpoint.h')
-rw-r--r--LUFA/Drivers/USB/LowLevel/Endpoint.h538
1 files changed, 360 insertions, 178 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h
index c0eab3584..2223f0ca4 100644
--- a/LUFA/Drivers/USB/LowLevel/Endpoint.h
+++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h
@@ -34,7 +34,25 @@
* module contains the endpoint management macros, as well as endpoint interrupt and data
* send/recieve functions for various data types.
*/
+
+/** \ingroup Group_USB
+ * @defgroup Group_EndpointManagement Endpoint Management
+ *
+ * Functions, macros, variables, enums and types related to the setup and management of endpoints while in USB Device mode.
+ *
+ * @{
+ */
+
+/** @defgroup Group_EndpointRW Endpoint Data Reading and Writing
+ *
+ * Functions, macros, variables, enums and types related to data reading and writing from and to endpoints.
+ */
+/** @defgroup Group_EndpointPacketManagement Endpoint Packet Management
+ *
+ * Functions, macros, variables, enums and types related to packet management of endpoints.
+ */
+
#ifndef __ENDPOINT_H__
#define __ENDPOINT_H__
@@ -85,10 +103,10 @@
*/
#define ENDPOINT_CONTROLEP 0
- /** Default size of the default control endpoint's bank, until altered by the Endpoint0Size value
- * in the device descriptor. Not available if the FIXED_CONTROL_ENDPOINT_SIZE token is defined.
- */
#if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__))
+ /** Default size of the default control endpoint's bank, until altered by the Endpoint0Size value
+ * in the device descriptor. Not available if the FIXED_CONTROL_ENDPOINT_SIZE token is defined.
+ */
#define ENDPOINT_CONTROLEP_DEFAULT_SIZE 8
#endif
@@ -165,125 +183,271 @@
*/
#define ENDPOINT_INT_OUT UEIENX, (1 << RXOUTE), UEINTX, (1 << RXOUTI)
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) || defined(__DOXYGEN__)
- /** Indicates the number of bytes currently stored in the current endpoint's selected bank. */
- #define Endpoint_BytesInEndpoint() UEBCX
- #else
- #define Endpoint_BytesInEndpoint() UEBCLX
- #endif
-
- /** Returns 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.
- */
- #define Endpoint_GetCurrentEndpoint() (UENUM & ENDPOINT_EPNUM_MASK)
+ /* Psuedo-Function Macros: */
+ #if defined(__DOXYGEN__)
+ /** Indicates the number of bytes currently stored in the current endpoint's selected bank.
+ *
+ * \note The return width of this function may differ, depending on the maximum endpoint bank size
+ * of the selected AVR model.
+ *
+ * \ingroup Group_EndpointRW
+ *
+ * \return Total number of bytes in the currently selected Endpoint's FIFO buffer
+ */
+ static inline uint16_t Endpoint_BytesInEndpoint(void);
- /** 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.
- */
- #define Endpoint_SelectEndpoint(epnum) MACROS{ UENUM = epnum; }MACROE
+ /** 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.
+ *
+ * \return Index of the currently selected endpoint
+ */
+ static inline uint8_t Endpoint_GetCurrentEndpoint(void);
+
+ /** 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.
+ *
+ * \param EndpointNumber Endpoint number to select
+ */
+ static inline void Endpoint_SelectEndpoint(uint8_t EndpointNumber);
+
+ /** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's
+ * In and Out pointers to the bank's contents.
+ *
+ * \param EndpointNumber Endpoint number whose FIFO buffers are to be reset
+ */
+ static inline void Endpoint_ResetFIFO(uint8_t EndpointNumber);
+
+ /** 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 rather than just being enabled via the
+ * Endpoint_ConfigureEndpoint() macro, which calls Endpoint_EnableEndpoint() automatically.
+ */
+ static inline void Endpoint_EnableEndpoint(void);
- /** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's
- * In and Out pointers to the bank's contents.
- */
- #define Endpoint_ResetFIFO(epnum) MACROS{ UERST = (1 << epnum); UERST = 0; }MACROE
+ /** Disables the currently selected endpoint so that data cannot be sent and received through it
+ * to and from a host.
+ */
+ static inline void Endpoint_DisableEndpoint(void);
+
+ /** Determines if the currently selected endpoint is enabled, but not necessarily configured.
+ *
+ * \return Boolean True if the currently selected endpoint is enabled, false otherwise
+ */
+ static inline bool Endpoint_IsEnabled(void);
+
+ /** 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.
+ *
+ * \ingroup Group_EndpointPacketManagement
+ *
+ * \return Boolean true if the currently selected endpoint may be read from or written to, depending on its direction
+ */
+ static inline bool Endpoint_IsReadWriteAllowed(void);
+
+ /** Determines if the currently selected endpoint is configured.
+ *
+ * \return Boolean true if the currently selected endpoint has been configured, false otherwise
+ */
+ static inline bool Endpoint_IsConfigured(void);
+
+ /** 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}).
+ *
+ * \return Mask whose bits indicate which endpoints have interrupted
+ */
+ static inline uint8_t Endpoint_GetEndpointInterrupts(void);
+
+ /** Clears the endpoint interrupt flag. This clears the specified endpoint number's interrupt
+ * mask in the endpoint interrupt flag register.
+ *
+ * \param EndpointNumber Index of the endpoint whose interrupt flag should be cleared
+ */
+ static inline void Endpoint_ClearEndpointInterrupt(uint8_t EndpointNumber);
+
+ /** Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type
+ * endpoints).
+ *
+ * \param EndpointNumber Index of the endpoint whose interrupt flag should be tested
+ *
+ * \return Boolean true if the specified endpoint has interrupted, false otherwise
+ */
+ static inline bool Endpoint_HasEndpointInterrupted(uint8_t EndpointNumber);
+
+ /** Determines if the selected IN endpoint is ready for a new packet.
+ *
+ * \ingroup Group_EndpointPacketManagement
+ *
+ * \return Boolean true if the current endpoint is ready for an IN packet, false otherwise.
+ */
+ static inline bool Endpoint_IsINReady(void);
+
+ /** Determines if the selected OUT endpoint has received new packet.
+ *
+ * \ingroup Group_EndpointPacketManagement
+ *
+ * \return Boolean true if current endpoint is has received an OUT packet, false otherwise.
+ */
+ static inline bool Endpoint_IsOUTReceived(void);
+
+ /** Determines if the current CONTROL type endpoint has received a SETUP packet.
+ *
+ * \ingroup Group_EndpointPacketManagement
+ *
+ * \return Boolean true if the selected endpoint has received a SETUP packet, false otherwise.
+ */
+ static inline bool Endpoint_IsSETUPReceived(void);
+
+ /** Clears a received SETUP packet on the currently selected CONTROL type endpoint, freeing up the
+ * endpoint for the next packet.
+ *
+ * \ingroup Group_EndpointPacketManagement
+ *
+ * \note This is not applicable for non CONTROL type endpoints.
+ */
+ static inline void Endpoint_ClearControlSETUP(void);
+
+ /** Sends an IN packet to the host on the currently selected CONTROL type endpoint, freeing up the
+ * endpoint for the next packet.
+ *
+ * \ingroup Group_EndpointPacketManagement
+ *
+ * \note For non CONTROL type endpoints, use Endpoint_ClearIN() instead.
+ */
+ static inline void Endpoint_ClearControlIN(void);
+
+ /** Acknowledges an OUT packet to the host on the currently selected CONTROL type endpoint, freeing
+ * up the endpoint for the next packet.
+ *
+ * \ingroup Group_EndpointPacketManagement
+ *
+ * \note For non CONTROL type endpoints, use Endpoint_ClearOUT() instead.
+ */
+ static inline void Endpoint_ClearControlOUT(void);
+
+ /** Sends an IN packet to the host on the currently selected non CONTROL type endpoint, freeing
+ * up the endpoint for the next packet and switching to the alternative endpoint bank if double banked.
+ *
+ * \ingroup Group_EndpointPacketManagement
+ *
+ * \note For CONTROL type endpoints, use Endpoint_ClearControlIN() instead.
+ */
+ static inline void Endpoint_ClearIN(void);
+
+ /** Acknowledges an OUT packet to the host on the currently selected non CONTROL type endpoint, freeing
+ * up the endpoint for the next packet and switching to the alternative endpoint bank if double banked.
+ *
+ * \ingroup Group_EndpointPacketManagement
+ *
+ * \note For CONTROL type endpoints, use Endpoint_ClearControlOUT() instead.
+ */
+ static inline void Endpoint_ClearOUT(void);
+
+ /** Stalls the current endpoint, indicating to the host that a logical problem occurred with the
+ * indicated endpoint and that the current transfer sequence should be aborted. This provides a
+ * way for devices to indicate invalid commands to the host so that the current transfer can be
+ * aborted and the host can begin its own recovery sequence.
+ *
+ * The currently selected endpoint remains stalled until either the Endpoint_ClearStall() macro
+ * is called, or the host issues a CLEAR FEATURE request to the device for the currently selected
+ * endpoint.
+ *
+ * \ingroup Group_EndpointPacketManagement
+ */
+ static inline void Endpoint_StallTransaction(void);
+
+ /** Clears the STALL condition on the currently selected endpoint.
+ *
+ * \ingroup Group_EndpointPacketManagement
+ */
+ static inline void Endpoint_ClearStall(void);
+
+ /** Determines if the currently selected endpoint is stalled, false otherwise.
+ *
+ * \ingroup Group_EndpointPacketManagement
+ *
+ * \return Boolean true if the currently selected endpoint is stalled, false otherwise
+ */
+ static inline bool Endpoint_IsStalled(void);
+
+ /** Resets the data toggle of the currently selected endpoint. */
+ static inline void Endpoint_ResetDataToggle(void);
+
+ /** Determines the currently selected endpoint's direction.
+ *
+ * \return The currently selected endpoint's direction, as a ENDPOINT_DIR_* mask.
+ */
+ static inline uint8_t Endpoint_GetEndpointDirection(void);
+ #else
+ #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) || defined(__DOXYGEN__)
+ #define Endpoint_BytesInEndpoint() UEBCX
+ #else
+ #define Endpoint_BytesInEndpoint() UEBCLX
+ #endif
+
+ #define Endpoint_GetCurrentEndpoint() (UENUM & ENDPOINT_EPNUM_MASK)
+
+ #define Endpoint_SelectEndpoint(epnum) MACROS{ UENUM = epnum; }MACROE
- /** 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 rather than just being enabled via the
- * Endpoint_ConfigureEndpoint() macro, which calls Endpoint_EnableEndpoint() automatically.
- */
- #define Endpoint_EnableEndpoint() MACROS{ UECONX |= (1 << EPEN); }MACROE
+ #define Endpoint_ResetFIFO(epnum) MACROS{ UERST = (1 << epnum); UERST = 0; }MACROE
- /** Disables the currently selected endpoint so that data cannot be sent and received through it
- * to and from a host.
- */
- #define Endpoint_DisableEndpoint() MACROS{ UECONX &= ~(1 << EPEN); }MACROE
+ #define Endpoint_EnableEndpoint() MACROS{ UECONX |= (1 << EPEN); }MACROE
- /** Returns true if the currently selected endpoint is enabled, false otherwise. */
- #define Endpoint_IsEnabled() ((UECONX & (1 << EPEN)) ? true : false)
+ #define Endpoint_DisableEndpoint() MACROS{ UECONX &= ~(1 << EPEN); }MACROE
- /** Returns true 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, or if
- * the endpoint is an OUT direction and no packet has been received, or if the endpoint is an IN
- * direction and the endpoint bank is full.
- */
- #define Endpoint_ReadWriteAllowed() ((UEINTX & (1 << RWAL)) ? true : false)
+ #define Endpoint_IsEnabled() ((UECONX & (1 << EPEN)) ? true : false)
- /** Returns true if the currently selected endpoint is configured, false otherwise. */
- #define Endpoint_IsConfigured() ((UESTA0X & (1 << CFGOK)) ? true : false)
+ #define Endpoint_IsReadWriteAllowed() ((UEINTX & (1 << RWAL)) ? true : false)
- /** 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}).
- */
- #define Endpoint_GetEndpointInterrupts() UEINT
+ #define Endpoint_IsConfigured() ((UESTA0X & (1 << CFGOK)) ? true : false)
- /** Clears the endpoint interrupt flag. This clears the specified endpoint number's interrupt
- * mask in the endpoint interrupt flag register.
- */
- #define Endpoint_ClearEndpointInterrupt(n) MACROS{ UEINT &= ~(1 << n); }MACROE
+ #define Endpoint_GetEndpointInterrupts() UEINT
- /** Returns true if the specified endpoint number has interrupted (valid only for INTERRUPT type
- * endpoints), false otherwise.
- */
- #define Endpoint_HasEndpointInterrupted(n) ((UEINT & (1 << n)) ? true : false)
+ #define Endpoint_ClearEndpointInterrupt(n) MACROS{ UEINT &= ~(1 << n); }MACROE
- /** Clears the currently selected endpoint bank, and switches to the alternate bank if the currently
- * selected endpoint is dual-banked. When cleared, this either frees the bank up for the next packet
- * from the host (if the endpoint is of the OUT direction) or sends the packet contents to the host
- * (if the endpoint is of the IN direction).
- */
- #define Endpoint_ClearCurrentBank() MACROS{ UEINTX &= ~(1 << FIFOCON); }MACROE
-
- /** Returns true if the current CONTROL type endpoint is ready for an IN packet, false otherwise. */
- #define Endpoint_IsSetupINReady() ((UEINTX & (1 << TXINI)) ? true : false)
+ #define Endpoint_HasEndpointInterrupted(n) ((UEINT & (1 << n)) ? true : false)
+
+ #define Endpoint_IsINReady() ((UEINTX & (1 << TXINI)) ? true : false)
+
+ #define Endpoint_IsOUTReceived() ((UEINTX & (1 << RXOUTI)) ? true : false)
- /** Returns true if the current CONTROL type endpoint is ready for an OUT packet, false otherwise. */
- #define Endpoint_IsSetupOUTReceived() ((UEINTX & (1 << RXOUTI)) ? true : false)
+ #define Endpoint_IsSETUPReceived() ((UEINTX & (1 << RXSTPI)) ? true : false)
- /** Returns true if the current CONTROL type endpoint is ready for a SETUP packet, false otherwise. */
- #define Endpoint_IsSetupReceived() ((UEINTX & (1 << RXSTPI)) ? true : false)
+ #define Endpoint_ClearControlSETUP() MACROS{ UEINTX &= ~(1 << RXSTPI); }MACROE
- /** Clears a received SETUP packet on the currently selected CONTROL type endpoint. */
- #define Endpoint_ClearSetupReceived() MACROS{ UEINTX &= ~(1 << RXSTPI); }MACROE
+ #define Endpoint_ClearControlIN() MACROS{ UEINTX &= ~(1 << TXINI); }MACROE
- /** Sends an IN packet to the host on the currently selected CONTROL type endpoint. */
- #define Endpoint_ClearSetupIN() MACROS{ UEINTX &= ~(1 << TXINI); }MACROE
+ #define Endpoint_ClearControlOUT() MACROS{ UEINTX &= ~(1 << RXOUTI); }MACROE
- /** Acknowledges an OUT packet to the host on the currently selected CONTROL type endpoint, freeing
- * up the endpoint for the next packet.
- */
- #define Endpoint_ClearSetupOUT() MACROS{ UEINTX &= ~(1 << RXOUTI); }MACROE
+ #define Endpoint_ClearIN() MACROS{ UEINTX &= ~(1 << TXINI); UEINTX &= ~(1 << FIFOCON); }MACROE
- /** Stalls the current endpoint, indicating to the host that a logical problem occurred with the
- * indicated endpoint and that the current transfer sequence should be aborted. This provides a
- * way for devices to indicate invalid commands to the host so that the current transfer can be
- * aborted and the host can begin its own recovery sequence.
- *
- * The currently selected endpoint remains stalled until either the Endpoint_ClearStall() macro
- * is called, or the host issues a CLEAR FEATURE request to the device for the currently selected
- * endpoint.
- */
- #define Endpoint_StallTransaction() MACROS{ UECONX |= (1 << STALLRQ); }MACROE
+ #define Endpoint_ClearOUT() MACROS{ UEINTX &= ~(1 << RXOUTI); UEINTX &= ~(1 << FIFOCON); }MACROE
- /** Clears the stall on the currently selected endpoint. */
- #define Endpoint_ClearStall() MACROS{ UECONX |= (1 << STALLRQC); }MACROE
+ #define Endpoint_StallTransaction() MACROS{ UECONX |= (1 << STALLRQ); }MACROE
- /** Returns true if the currently selected endpoint is stalled, false otherwise. */
- #define Endpoint_IsStalled() ((UECONX & (1 << STALLRQ)) ? true : false)
+ #define Endpoint_ClearStall() MACROS{ UECONX |= (1 << STALLRQC); }MACROE
- /** Resets the data toggle of the currently selected endpoint. */
- #define Endpoint_ResetDataToggle() MACROS{ UECONX |= (1 << RSTDT); }MACROE
+ #define Endpoint_IsStalled() ((UECONX & (1 << STALLRQ)) ? true : false)
+
+ #define Endpoint_ResetDataToggle() MACROS{ UECONX |= (1 << RSTDT); }MACROE
+
+ #define Endpoint_GetEndpointDirection() (UECFG0X & ENDPOINT_DIR_IN)
+ #endif
/* Enums: */
- /** Enum for the possible error return codes of the Endpoint_WaitUntilReady function */
+ /** Enum for the possible error return codes of the Endpoint_WaitUntilReady function.
+ *
+ * \ingroup Group_EndpointRW
+ */
enum Endpoint_WaitUntilReady_ErrorCodes_t
{
ENDPOINT_READYWAIT_NoError = 0, /**< Endpoint is ready for next packet, no error. */
@@ -299,7 +463,10 @@
*/
};
- /** Enum for the possible error return codes of the Endpoint_*_Stream_* functions. */
+ /** Enum for the possible error return codes of the Endpoint_*_Stream_* functions.
+ *
+ * \ingroup Group_EndpointRW
+ */
enum Endpoint_Stream_RW_ErrorCodes_t
{
ENDPOINT_RWSTREAM_ERROR_NoError = 0, /**< Command completed successfully, no error. */
@@ -318,7 +485,10 @@
*/
};
- /** Enum for the possible error return codes of the Endpoint_*_Control_Stream_* functions. */
+ /** Enum for the possible error return codes of the Endpoint_*_Control_Stream_* functions..
+ *
+ * \ingroup Group_EndpointRW
+ */
enum Endpoint_ControlStream_RW_ErrorCodes_t
{
ENDPOINT_RWCSTREAM_ERROR_NoError = 0, /**< Command completed successfully, no error. */
@@ -326,21 +496,34 @@
};
/* Inline Functions: */
- /** Reads one byte from the currently selected endpoint's bank, for OUT direction endpoints. */
+ /** Reads one byte from the currently selected endpoint's bank, for OUT direction endpoints.
+ *
+ * \ingroup Group_EndpointRW
+ *
+ * \return Next byte in the currently selected endpoint's FIFO buffer
+ */
static inline uint8_t Endpoint_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Endpoint_Read_Byte(void)
{
return UEDATX;
}
- /** Writes one byte from the currently selected endpoint's bank, for IN direction endpoints. */
+ /** Writes one byte from the currently selected endpoint's bank, for IN direction endpoints.
+ *
+ * \ingroup Group_EndpointRW
+ *
+ * \param Byte Next byte to write into the the currently selected endpoint's FIFO buffer
+ */
static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Byte(const uint8_t Byte)
{
UEDATX = Byte;
}
- /** Discards one byte from the currently selected endpoint's bank, for OUT direction endpoints. */
+ /** Discards one byte from the currently selected endpoint's bank, for OUT direction endpoints.
+ *
+ * \ingroup Group_EndpointRW
+ */
static inline void Endpoint_Discard_Byte(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Discard_Byte(void)
{
@@ -351,6 +534,10 @@
/** Reads two bytes from the currently selected endpoint's bank in little endian format, for OUT
* direction endpoints.
+ *
+ * \ingroup Group_EndpointRW
+ *
+ * \return Next word in the currently selected endpoint's FIFO buffer
*/
static inline uint16_t Endpoint_Read_Word_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Endpoint_Read_Word_LE(void)
@@ -365,6 +552,10 @@
/** Reads two bytes from the currently selected endpoint's bank in big endian format, for OUT
* direction endpoints.
+ *
+ * \ingroup Group_EndpointRW
+ *
+ * \return Next word in the currently selected endpoint's FIFO buffer
*/
static inline uint16_t Endpoint_Read_Word_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Endpoint_Read_Word_BE(void)
@@ -379,6 +570,10 @@
/** Writes two bytes to the currently selected endpoint's bank in little endian format, for IN
* direction endpoints.
+ *
+ * \ingroup Group_EndpointRW
+ *
+ * \param Word Next word to write to the currently selected endpoint's FIFO buffer
*/
static inline void Endpoint_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Word_LE(const uint16_t Word)
@@ -389,6 +584,10 @@
/** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN
* direction endpoints.
+ *
+ * \ingroup Group_EndpointRW
+ *
+ * \param Word Next word to write to the currently selected endpoint's FIFO buffer
*/
static inline void Endpoint_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_Word_BE(const uint16_t Word)
@@ -397,7 +596,10 @@
UEDATX = (Word & 0xFF);
}
- /** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints. */
+ /** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints.
+ *
+ * \ingroup Group_EndpointRW
+ */
static inline void Endpoint_Discard_Word(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Discard_Word(void)
{
@@ -409,6 +611,10 @@
/** Reads four bytes from the currently selected endpoint's bank in little endian format, for OUT
* direction endpoints.
+ *
+ * \ingroup Group_EndpointRW
+ *
+ * \return Next double word in the currently selected endpoint's FIFO buffer
*/
static inline uint32_t Endpoint_Read_DWord_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint32_t Endpoint_Read_DWord_LE(void)
@@ -429,6 +635,10 @@
/** Reads four bytes from the currently selected endpoint's bank in big endian format, for OUT
* direction endpoints.
+ *
+ * \ingroup Group_EndpointRW
+ *
+ * \return Next double word in the currently selected endpoint's FIFO buffer
*/
static inline uint32_t Endpoint_Read_DWord_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint32_t Endpoint_Read_DWord_BE(void)
@@ -449,6 +659,10 @@
/** Writes four bytes to the currently selected endpoint's bank in little endian format, for IN
* direction endpoints.
+ *
+ * \ingroup Group_EndpointRW
+ *
+ * \param DWord Next double word to write to the currently selected endpoint's FIFO buffer
*/
static inline void Endpoint_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_DWord_LE(const uint32_t DWord)
@@ -461,6 +675,10 @@
/** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN
* direction endpoints.
+ *
+ * \ingroup Group_EndpointRW
+ *
+ * \param DWord Next double word to write to the currently selected endpoint's FIFO buffer
*/
static inline void Endpoint_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Write_DWord_BE(const uint32_t DWord)
@@ -471,7 +689,10 @@
UEDATX = (DWord & 0xFF);
}
- /** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints. */
+ /** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.
+ *
+ * \ingroup Group_EndpointRW
+ */
static inline void Endpoint_Discard_DWord(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_Discard_DWord(void)
{
@@ -539,6 +760,8 @@
*
* \note This routine should not be called on CONTROL type endpoints.
*
+ * \ingroup Group_EndpointRW
+ *
* \return A value from the Endpoint_WaitUntilReady_ErrorCodes_t enum.
*/
uint8_t Endpoint_WaitUntilReady(void);
@@ -546,7 +769,7 @@
/** Reads and discards the given number of bytes from the endpoint from the given buffer,
* discarding fully read packets from the host as needed. The last packet is not automatically
* discarded once the remaining bytes has been read; the user is responsible for manually
- * discarding the last packet from the host via the Endpoint_ClearCurrentBank() macro. Between
+ * discarding the last packet from the host via the Endpoint_ClearOUT() macro. Between
* each USB packet, the given stream callback function is executed repeatedly until the next
* packet is ready, allowing for early aborts of stream transfers.
*
@@ -556,6 +779,8 @@
*
* \note This routine should not be used on CONTROL type endpoints.
*
+ * \ingroup Group_EndpointRW
+ *
* \param Length Number of bytes to send via the currently selected endpoint.
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
*
@@ -570,7 +795,7 @@
/** Writes the given number of bytes to the endpoint from the given buffer in little endian,
* sending full packets to the host as needed. The last packet filled is not automatically sent;
* the user is responsible for manually sending the last written packet to the host via the
- * Endpoint_ClearCurrentBank() macro. Between each USB packet, the given stream callback function
+ * Endpoint_ClearIN() macro. Between each USB packet, the given stream callback function
* is executed repeatedly until the endpoint is ready to accept the next packet, allowing for early
* aborts of stream transfers.
*
@@ -580,6 +805,8 @@
*
* \note This routine should not be used on CONTROL type endpoints.
*
+ * \ingroup Group_EndpointRW
+ *
* \param Buffer Pointer to the source data buffer to read from.
* \param Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
@@ -595,7 +822,7 @@
/** Writes the given number of bytes to the endpoint from the given buffer in big endian,
* sending full packets to the host as needed. The last packet filled is not automatically sent;
* the user is responsible for manually sending the last written packet to the host via the
- * Endpoint_ClearCurrentBank() macro. Between each USB packet, the given stream callback function
+ * Endpoint_ClearIN() macro. Between each USB packet, the given stream callback function
* is executed repeatedly until the endpoint is ready to accept the next packet, allowing for early
* aborts of stream transfers.
*
@@ -605,6 +832,8 @@
*
* \note This routine should not be used on CONTROL type endpoints.
*
+ * \ingroup Group_EndpointRW
+ *
* \param Buffer Pointer to the source data buffer to read from.
* \param Length Number of bytes to read for the currently selected endpoint into the buffer.
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
@@ -620,7 +849,7 @@
/** Reads the given number of bytes from the endpoint from the given buffer in little endian,
* discarding fully read packets from the host as needed. The last packet is not automatically
* discarded once the remaining bytes has been read; the user is responsible for manually
- * discarding the last packet from the host via the Endpoint_ClearCurrentBank() macro. Between
+ * discarding the last packet from the host via the Endpoint_ClearOUT() macro. Between
* each USB packet, the given stream callback function is executed repeatedly until the endpoint
* is ready to accept the next packet, allowing for early aborts of stream transfers.
*
@@ -630,6 +859,8 @@
*
* \note This routine should not be used on CONTROL type endpoints.
*
+ * \ingroup Group_EndpointRW
+ *
* \param Buffer Pointer to the destination data buffer to write to.
* \param Length Number of bytes to send via the currently selected endpoint.
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
@@ -645,7 +876,7 @@
/** Reads the given number of bytes from the endpoint from the given buffer in big endian,
* discarding fully read packets from the host as needed. The last packet is not automatically
* discarded once the remaining bytes has been read; the user is responsible for manually
- * discarding the last packet from the host via the Endpoint_ClearCurrentBank() macro. Between
+ * discarding the last packet from the host via the Endpoint_ClearOUT() macro. Between
* each USB packet, the given stream callback function is executed repeatedly until the endpoint
* is ready to accept the next packet, allowing for early aborts of stream transfers.
*
@@ -655,6 +886,8 @@
*
* \note This routine should not be used on CONTROL type endpoints.
*
+ * \ingroup Group_EndpointRW
+ *
* \param Buffer Pointer to the destination data buffer to write to.
* \param Length Number of bytes to send via the currently selected endpoint.
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
@@ -670,13 +903,15 @@
/** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian,
* sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared
* in both failure and success states; the user is responsible for manually clearing the setup OUT to
- * finalize the transfer via the Endpoint_ClearSetupOUT() macro.
+ * finalize the transfer via the Endpoint_ClearControlOUT() macro.
*
* \note This routine should only be used on CONTROL type endpoints.
*
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
* together; i.e. the entire stream data must be read or written at the one time.
*
+ * \ingroup Group_EndpointRW
+ *
* \param Buffer Pointer to the source data buffer to read from.
* \param Length Number of bytes to read for the currently selected endpoint into the buffer.
*
@@ -687,13 +922,15 @@
/** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian,
* sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared
* in both failure and success states; the user is responsible for manually clearing the setup OUT to
- * finalize the transfer via the Endpoint_ClearSetupOUT() macro.
+ * finalize the transfer via the Endpoint_ClearControlOUT() macro.
*
* \note This routine should only be used on CONTROL type endpoints.
*
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
* together; i.e. the entire stream data must be read or written at the one time.
*
+ * \ingroup Group_EndpointRW
+ *
* \param Buffer Pointer to the source data buffer to read from.
* \param Length Number of bytes to read for the currently selected endpoint into the buffer.
*
@@ -704,13 +941,15 @@
/** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian,
* discarding fully read packets from the host as needed. The device IN acknowledgement is not
* automatically sent after success or failure states; the user is responsible for manually sending the
- * setup IN to finalize the transfer via the Endpoint_ClearSetupIN() macro.
+ * setup IN to finalize the transfer via the Endpoint_ClearControlIN() macro.
*
* \note This routine should only be used on CONTROL type endpoints.
*
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
* together; i.e. the entire stream data must be read or written at the one time.
*
+ * \ingroup Group_EndpointRW
+ *
* \param Buffer Pointer to the destination data buffer to write to.
* \param Length Number of bytes to send via the currently selected endpoint.
*
@@ -721,80 +960,21 @@
/** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian,
* discarding fully read packets from the host as needed. The device IN acknowledgement is not
* automatically sent after success or failure states; the user is responsible for manually sending the
- * setup IN to finalize the transfer via the Endpoint_ClearSetupIN() macro.
+ * setup IN to finalize the transfer via the Endpoint_ClearControlIN() macro.
*
* \note This routine should only be used on CONTROL type endpoints.
*
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
* together; i.e. the entire stream data must be read or written at the one time.
*
+ * \ingroup Group_EndpointRW
+ *
* \param Buffer Pointer to the destination data buffer to write to.
* \param Length Number of bytes to send via the currently selected endpoint.
*
* \return A value from the Endpoint_ControlStream_RW_ErrorCodes_t enum.
*/
- uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
-
- /* Function Aliases: */
- /** Alias for Endpoint_Discard_Byte().
- */
- #define Endpoint_Ignore_Byte() Endpoint_Discard_Byte()
-
- /** Alias for Endpoint_Discard_Word().
- */
- #define Endpoint_Ignore_Word() Endpoint_Discard_Word()
-
- /** Alias for Endpoint_Discard_DWord().
- */
- #define Endpoint_Ignore_DWord() Endpoint_Discard_DWord()
-
- /** Alias for Endpoint_Read_Word_LE(). By default USB transfers use little endian format, thus
- * the command with no endianness specified indicates little endian mode.
- */
- #define Endpoint_Read_Word() Endpoint_Read_Word_LE()
-
- /** Alias for Endpoint_Write_Word_LE(). By default USB transfers use little endian format, thus
- * the command with no endianness specified indicates little endian mode.
- */
- #define Endpoint_Write_Word(Word) Endpoint_Write_Word_LE(Word)
-
- /** Alias for Endpoint_Read_DWord_LE(). By default USB transfers use little endian format, thus
- * the command with no endianness specified indicates little endian mode.
- */
- #define Endpoint_Read_DWord() Endpoint_Read_DWord_LE()
-
- /** Alias for Endpoint_Write_DWord_LE(). By default USB transfers use little endian format, thus
- * the command with no endianness specified indicates little endian mode.
- */
- #define Endpoint_Write_DWord(DWord) Endpoint_Write_DWord_LE(DWord)
-
- /** Alias for Endpoint_Read_Stream_LE(). By default USB transfers use little endian format, thus
- * the command with no endianness specified indicates little endian mode.
- */
- #if !defined(NO_STREAM_CALLBACKS)
- #define Endpoint_Read_Stream(Buffer, Length, Callback) Endpoint_Read_Stream_LE(Buffer, Length, Callback)
- #else
- #define Endpoint_Read_Stream(Buffer, Length) Endpoint_Read_Stream_LE(Buffer, Length)
- #endif
-
- /** Alias for Endpoint_Write_Stream_LE(). By default USB transfers use little endian format, thus
- * the command with no endianness specified indicates little endian mode.
- */
- #if !defined(NO_STREAM_CALLBACKS)
- #define Endpoint_Write_Stream(Buffer, Length, Callback) Endpoint_Write_Stream_LE(Buffer, Length, Callback)
- #else
- #define Endpoint_Write_Stream(Buffer, Length) Endpoint_Write_Stream_LE(Buffer, Length)
- #endif
-
- /** Alias for Endpoint_Read_Control_Stream_LE(). By default USB transfers use little endian format, thus
- * the command with no endianness specified indicates little endian mode.
- */
- #define Endpoint_Read_Control_Stream(Data, Length) Endpoint_Read_Control_Stream_LE(Data, Length)
-
- /** Alias for Endpoint_Write_Control_Stream_LE(). By default USB transfers use little endian format, thus
- * the command with no endianness specified indicates little endian mode.
- */
- #define Endpoint_Write_Control_Stream(Data, Length) Endpoint_Write_Control_Stream_LE(Data, Length)
+ uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
@@ -868,3 +1048,5 @@
#endif
#endif
+
+/** @} */