#include "../HighLevel/USBTask.h"\r
\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
- #include "StreamCallbacks.h"\r
+ #include "StreamCallbacks.h"\r
#endif\r
+ \r
/* Enable C linkage for C++ Compilers: */\r
#if defined(__cplusplus)\r
extern "C" {\r
/* Public Interface - May be used in end-application: */\r
/* Macros: */\r
/** Mask for Pipe_GetErrorFlags(), indicating that a CRC error occurred in the pipe on the received data. */\r
- #define PIPE_ERRORFLAG_CRC16 (1 << 4)\r
+ #define PIPE_ERRORFLAG_CRC16 (1 << 4)\r
\r
/** Mask for Pipe_GetErrorFlags(), indicating that a hardware timeout error occurred in the pipe. */\r
- #define PIPE_ERRORFLAG_TIMEOUT (1 << 3)\r
+ #define PIPE_ERRORFLAG_TIMEOUT (1 << 3)\r
\r
/** Mask for Pipe_GetErrorFlags(), indicating that a hardware PID error occurred in the pipe. */\r
- #define PIPE_ERRORFLAG_PID (1 << 2)\r
+ #define PIPE_ERRORFLAG_PID (1 << 2)\r
\r
/** Mask for Pipe_GetErrorFlags(), indicating that a hardware data PID error occurred in the pipe. */\r
- #define PIPE_ERRORFLAG_DATAPID (1 << 1)\r
+ #define PIPE_ERRORFLAG_DATAPID (1 << 1)\r
\r
/** Mask for Pipe_GetErrorFlags(), indicating that a hardware data toggle error occurred in the pipe. */\r
- #define PIPE_ERRORFLAG_DATATGL (1 << 0)\r
+ #define PIPE_ERRORFLAG_DATATGL (1 << 0)\r
\r
/** Token mask for Pipe_ConfigurePipe(). This sets the pipe as a SETUP token (for CONTROL type pipes),\r
* which will trigger a control request on the attached device when data is written to the pipe.\r
*/\r
- #define PIPE_TOKEN_SETUP (0b00 << PTOKEN0)\r
+ #define PIPE_TOKEN_SETUP (0b00 << PTOKEN0)\r
\r
/** Token mask for Pipe_ConfigurePipe(). This sets the pipe as a IN token (for non-CONTROL type pipes),\r
* indicating that the pipe data will flow from device to host.\r
*/\r
- #define PIPE_TOKEN_IN (0b01 << PTOKEN0)\r
+ #define PIPE_TOKEN_IN (0b01 << PTOKEN0)\r
\r
/** Token mask for Pipe_ConfigurePipe(). This sets the pipe as a IN token (for non-CONTROL type pipes),\r
* indicating that the pipe data will flow from host to device.\r
*/\r
- #define PIPE_TOKEN_OUT (0b10 << PTOKEN0)\r
+ #define PIPE_TOKEN_OUT (0b10 << PTOKEN0)\r
\r
/** Mask for the bank mode selection for the Pipe_ConfigurePipe() macro. This indicates that the pipe\r
* should have one single bank, which requires less USB FIFO memory but results in slower transfers as\r
* only one USB device (the AVR or the attached device) can access the pipe's bank at the one time.\r
*/\r
- #define PIPE_BANK_SINGLE 0\r
+ #define PIPE_BANK_SINGLE (0 << EPBK0)\r
\r
/** Mask for the bank mode selection for the Pipe_ConfigurePipe() macro. This indicates that the pipe\r
* should have two banks, which requires more USB FIFO memory but results in faster transfers as one\r
* USB device (the AVR or the attached device) can access one bank while the other accesses the second\r
* bank.\r
*/\r
- #define PIPE_BANK_DOUBLE (1 << EPBK0)\r
+ #define PIPE_BANK_DOUBLE (1 << EPBK0)\r
\r
/** Pipe address for the default control pipe, which always resides in address 0. This is\r
* defined for convenience to give more readable code when used with the pipe macros.\r
*/\r
- #define PIPE_CONTROLPIPE 0\r
+ #define PIPE_CONTROLPIPE 0\r
\r
/** Default size of the default control pipe's bank, until altered by the Endpoint0Size value \r
* in the device descriptor of the attached device.\r
*/\r
- #define PIPE_CONTROLPIPE_DEFAULT_SIZE 8\r
+ #define PIPE_CONTROLPIPE_DEFAULT_SIZE 8\r
\r
/** Pipe number mask, for masking against pipe addresses to retrieve the pipe's numerical address\r
* in the device.\r
*/\r
- #define PIPE_PIPENUM_MASK 0x07\r
+ #define PIPE_PIPENUM_MASK 0x07\r
\r
/** Total number of pipes (including the default control pipe at address 0) which may be used in\r
* the device. Different USB AVR models support different amounts of pipes, this value reflects\r
* the maximum number of pipes for the currently selected AVR model.\r
*/\r
- #define PIPE_TOTAL_PIPES 7\r
+ #define PIPE_TOTAL_PIPES 7\r
\r
/** Size in bytes of the largest pipe bank size possible in the device. Not all banks on each AVR\r
* model supports the largest bank size possible on the device; different pipe numbers support\r
* different maximum bank sizes. This value reflects the largest possible bank of any pipe on the\r
* currently selected USB AVR model.\r
*/\r
- #define PIPE_MAX_SIZE 256\r
+ #define PIPE_MAX_SIZE 256\r
\r
/** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's\r
* numerical address in the attached device.\r
*/\r
- #define PIPE_EPNUM_MASK 0x07\r
+ #define PIPE_EPNUM_MASK 0x07\r
\r
/** Endpoint bank size mask, for masking against endpoint addresses to retrieve the endpoint's\r
* bank size in the attached device.\r
*/\r
- #define PIPE_EPSIZE_MASK 0x7FF\r
+ #define PIPE_EPSIZE_MASK 0x7FF\r
\r
/** Interrupt definition for the pipe IN interrupt (for INTERRUPT type pipes). Should be used with\r
* the USB_INT_* macros located in USBInterrupt.h.\r
* elapsed and the pipe is ready for the next packet from the attached device to be read out from its\r
* FIFO buffer (if received).\r
*\r
- * This interrupt must be enabled on *each* pipe which requires it (after the pipe is selected), and\r
- * will fire the common pipe interrupt vector.\r
+ * \note This interrupt must be enabled and cleared on *each* pipe which requires it (after the pipe\r
+ * is selected), and will fire the common pipe interrupt vector.\r
*\r
* \see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector.\r
*/\r
- #define PIPE_INT_IN UPIENX, (1 << RXINE) , UPINTX, (1 << RXINI)\r
+ #define PIPE_INT_IN UPIENX, (1 << RXINE) , UPINTX, (1 << RXINI)\r
\r
/** Interrupt definition for the pipe OUT interrupt (for INTERRUPT type pipes). Should be used with\r
* the USB_INT_* macros located in USBInterrupt.h.\r
* has elapsed and the pipe is ready for a packet to be written to the pipe's FIFO buffer and sent\r
* to the attached device (if required).\r
* \r
- * This interrupt must be enabled on *each* pipe which requires it (after the pipe is selected), and\r
- * will fire the common pipe interrupt vector.\r
+ * \note This interrupt must be enabled and cleared on *each* pipe which requires it (after the pipe\r
+ * is selected), and will fire the common pipe interrupt vector.\r
*\r
- * \see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector. */\r
- #define PIPE_INT_OUT UPIENX, (1 << TXOUTE), UPINTX, (1 << TXOUTI)\r
+ * \see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector.\r
+ */\r
+ #define PIPE_INT_OUT UPIENX, (1 << TXOUTE), UPINTX, (1 << TXOUTI)\r
\r
/** Interrupt definition for the pipe SETUP bank ready interrupt (for CONTROL type pipes). Should be\r
* used with the USB_INT_* macros located in USBInterrupt.h.\r
* This interrupt will fire if enabled on an CONTROL type pipe when the pipe is ready for a new\r
* control request.\r
*\r
- * This interrupt must be enabled on *each* pipe which requires it (after the pipe is selected), and\r
- * will fire the common pipe interrupt vector.\r
+ * \note This interrupt must be enabled and cleared on *each* pipe which requires it (after the pipe\r
+ * is selected), and will fire the common pipe interrupt vector.\r
*\r
* \see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector.\r
*/\r
- #define PIPE_INT_SETUP UPIENX, (1 << TXSTPE) , UPINTX, (1 << TXSTPI)\r
+ #define PIPE_INT_SETUP UPIENX, (1 << TXSTPE) , UPINTX, (1 << TXSTPI)\r
\r
/** Interrupt definition for the pipe error interrupt. Should be used with the USB_INT_* macros\r
* located in USBInterrupt.h.\r
* This interrupt will fire if enabled on a particular pipe if an error occurs on that pipe, such\r
* as a CRC mismatch error.\r
*\r
- * This interrupt must be enabled on *each* pipe which requires it (after the pipe is selected), and\r
- * will fire the common pipe interrupt vector.\r
+ * \note This interrupt must be enabled and cleared on *each* pipe which requires it (after the pipe\r
+ * is selected), and will fire the common pipe interrupt vector.\r
*\r
* \see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector.\r
*\r
* \see Pipe_GetErrorFlags() for more information on the pipe errors.\r
*/\r
- #define PIPE_INT_ERROR UPIENX, (1 << PERRE), UPINTX, (1 << PERRI)\r
+ #define PIPE_INT_ERROR UPIENX, (1 << PERRE), UPINTX, (1 << PERRI)\r
\r
/** Interrupt definition for the pipe NAK received interrupt. Should be used with the USB_INT_* macros\r
* located in USBInterrupt.h.\r
* This interrupt will fire if enabled on a particular pipe if an attached device returns a NAK in\r
* response to a sent packet.\r
*\r
- * This interrupt must be enabled on *each* pipe which requires it (after the pipe is selected), and\r
- * will fire the common pipe interrupt vector.\r
+ * \note This interrupt must be enabled and cleared on *each* pipe which requires it (after the pipe\r
+ * is selected), and will fire the common pipe interrupt vector.\r
*\r
* \see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector.\r
*\r
* \see Pipe_IsNAKReceived() for more information on pipe NAKs.\r
*/\r
- #define PIPE_INT_NAK UPIENX, (1 << NAKEDE), UPINTX, (1 << NAKEDI)\r
+ #define PIPE_INT_NAK UPIENX, (1 << NAKEDE), UPINTX, (1 << NAKEDI)\r
\r
/** Interrupt definition for the pipe STALL received interrupt. Should be used with the USB_INT_* macros\r
* located in USBInterrupt.h.\r
* This interrupt will fire if enabled on a particular pipe if an attached device returns a STALL on the\r
* currently selected pipe. This will also fire if the pipe is an isochronous pipe and a CRC error occurs.\r
*\r
- * This interrupt must be enabled on *each* pipe which requires it (after the pipe is selected), and\r
- * will fire the common pipe interrupt vector.\r
+ * \note This interrupt must be enabled and cleared on *each* pipe which requires it (after the pipe\r
+ * is selected), and will fire the common pipe interrupt vector.\r
*\r
* \see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector.\r
*/\r
- #define PIPE_INT_STALL UPIENX, (1 << RXSTALLE), UPINTX, (1 << RXSTALLI)\r
+ #define PIPE_INT_STALL UPIENX, (1 << RXSTALLE), UPINTX, (1 << RXSTALLI)\r
\r
/** Indicates the number of bytes currently stored in the current pipe's selected bank. */\r
- #define Pipe_BytesInPipe() UPBCX\r
+ #define Pipe_BytesInPipe() UPBCX\r
\r
/** Resets the desired pipe, including the pipe banks and flags. */\r
- #define Pipe_ResetPipe(pipenum) MACROS{ UPRST = (1 << pipenum); UPRST = 0; }MACROE\r
+ #define Pipe_ResetPipe(pipenum) MACROS{ UPRST = (1 << pipenum); UPRST = 0; }MACROE\r
\r
/** Selects the given pipe number. Any pipe operations which do not require the pipe number to be\r
* indicated will operate on the currently selected pipe.\r
*/\r
- #define Pipe_SelectPipe(pipenum) MACROS{ UPNUM = pipenum; }MACROE\r
+ #define Pipe_SelectPipe(pipenum) MACROS{ UPNUM = pipenum; }MACROE\r
\r
/** Returns the pipe address of the currently selected pipe. This is typically used to save the\r
* currently selected pipe number so that it can be restored after another pipe has been manipulated.\r
*/\r
- #define Pipe_GetCurrentPipe() (UPNUM & PIPE_PIPENUM_MASK)\r
+ #define Pipe_GetCurrentPipe() (UPNUM & PIPE_PIPENUM_MASK)\r
\r
/** Enables the currently selected pipe so that data can be sent and received through it to and from\r
* an attached device.\r
* \note Pipes must first be configured properly rather than just being enabled via the\r
* Pipe_ConfigurePipe() macro, which calls Pipe_EnablePipe() automatically.\r
*/\r
- #define Pipe_EnablePipe() MACROS{ UPCONX |= (1 << PEN); }MACROE\r
+ #define Pipe_EnablePipe() MACROS{ UPCONX |= (1 << PEN); }MACROE\r
\r
/** Disables the currently selected pipe so that data cannot be sent and received through it to and\r
* from an attached device.\r
*/\r
- #define Pipe_DisablePipe() MACROS{ UPCONX &= ~(1 << PEN); }MACROE\r
+ #define Pipe_DisablePipe() MACROS{ UPCONX &= ~(1 << PEN); }MACROE\r
\r
/** Returns true if the currently selected pipe is enabled, false otherwise. */\r
- #define Pipe_IsEnabled() ((UPCONX & (1 << PEN)) ? true : false)\r
+ #define Pipe_IsEnabled() ((UPCONX & (1 << PEN)) ? true : false)\r
\r
/** Sets the token for the currently selected endpoint to one of the tokens specified by the PIPE_TOKEN_*\r
* masks. This should only be used on CONTROL type endpoints, to allow for bidirectional transfer of\r
* data during control requests.\r
*/\r
- #define Pipe_SetToken(token) MACROS{ UPCFG0X = ((UPCFG0X & ~PIPE_TOKEN_MASK) | token); }MACROE\r
+ #define Pipe_SetToken(token) MACROS{ UPCFG0X = ((UPCFG0X & ~PIPE_TOKEN_MASK) | token); }MACROE\r
\r
/** Configures the currently selected pipe to allow for an unlimited number of IN requests. */\r
- #define Pipe_SetInfiniteINRequests() MACROS{ UPCONX |= (1 << INMODE); }MACROE\r
+ #define Pipe_SetInfiniteINRequests() MACROS{ UPCONX |= (1 << INMODE); }MACROE\r
\r
/** Configures the currently selected pipe to only allow the specified number of IN requests to be\r
* accepted by the pipe before it is automatically frozen.\r
*/\r
- #define Pipe_SetFiniteINRequests(n) MACROS{ UPCONX &= ~(1 << INMODE); UPINRQX = n; }MACROE\r
+ #define Pipe_SetFiniteINRequests(n) MACROS{ UPCONX &= ~(1 << INMODE); UPINRQX = n; }MACROE\r
\r
/** Returns true if the currently selected pipe is configured, false otherwise. */\r
- #define Pipe_IsConfigured() ((UPSTAX & (1 << CFGOK)) ? true : false)\r
+ #define Pipe_IsConfigured() ((UPSTAX & (1 << CFGOK)) ? true : false)\r
\r
/** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds. */\r
- #define Pipe_SetInterruptPeriod(ms) MACROS{ UPCFG2X = ms; }MACROE\r
+ #define Pipe_SetInterruptPeriod(ms) MACROS{ UPCFG2X = ms; }MACROE\r
\r
/** Returns a mask indicating which pipe's interrupt periods have elapsed, indicating that the pipe should\r
* be serviced.\r
*/\r
- #define Pipe_GetPipeInterrupts() UPINT\r
+ #define Pipe_GetPipeInterrupts() UPINT\r
\r
/** Clears the interrupt flag for the specified pipe number. */\r
- #define Pipe_ClearPipeInterrupt(n) MACROS{ UPINT &= ~(1 << n); }MACROE\r
+ #define Pipe_ClearPipeInterrupt(n) MACROS{ UPINT &= ~(1 << n); }MACROE\r
\r
/** Returns true if the specified pipe's interrupt period has elapsed, false otherwise. */\r
- #define Pipe_HasPipeInterrupted(n) ((UPINT & (1 << n)) ? true : false)\r
+ #define Pipe_HasPipeInterrupted(n) ((UPINT & (1 << n)) ? true : false)\r
\r
/** Clears the pipe bank, and switches to the alternate bank if the currently selected pipe is\r
* dual-banked. When cleared, this either frees the bank up for the next packet from the host\r
* (if the endpoint is of the OUT direction) or sends the packet contents to the host (if the\r
* pipe is of the IN direction).\r
*/\r
- #define Pipe_ClearCurrentBank() MACROS{ UPINTX &= ~(1 << FIFOCON); }MACROE\r
+ #define Pipe_ClearCurrentBank() MACROS{ UPINTX &= ~(1 << FIFOCON); }MACROE\r
\r
/** Unfreezes the pipe, allowing it to communicate with an attached device. */\r
- #define Pipe_Unfreeze() MACROS{ UPCONX &= ~(1 << PFREEZE); }MACROE\r
+ #define Pipe_Unfreeze() MACROS{ UPCONX &= ~(1 << PFREEZE); }MACROE\r
\r
/** Freezes the pipe, preventing it from communicating with an attached device. */\r
- #define Pipe_Freeze() MACROS{ UPCONX |= (1 << PFREEZE); }MACROE\r
+ #define Pipe_Freeze() MACROS{ UPCONX |= (1 << PFREEZE); }MACROE\r
\r
/** Clears the master pipe error flag. */\r
- #define Pipe_ClearError() MACROS{ UPINTX &= ~(1 << PERRI); }MACROE\r
+ #define Pipe_ClearError() MACROS{ UPINTX &= ~(1 << PERRI); }MACROE\r
\r
/** Returns true if the master pipe error flag is set for the currently selected pipe, indicating that\r
* some sort of hardware error has occurred on the pipe.\r
*\r
* \see Pipe_GetErrorFlags() macro for information on retreiving the exact error flag.\r
*/\r
- #define Pipe_IsError() ((UPINTX & (1 << PERRI)) ? true : false)\r
+ #define Pipe_IsError() ((UPINTX & (1 << PERRI)) ? true : false)\r
\r
/** Clears all the currently selected pipe's hardware error flags, but does not clear the master error\r
* flag for the pipe. */\r
- #define Pipe_ClearErrorFlags() MACROS{ UPERRX = 0; }MACROE\r
+ #define Pipe_ClearErrorFlags() MACROS{ UPERRX = 0; }MACROE\r
\r
/** Returns a mask of the hardware error flags which have occured on the currently selected pipe. This\r
* value can then be masked against the PIPE_ERRORFLAG_* masks to determine what error has occurred.\r
*/\r
- #define Pipe_GetErrorFlags() UPERRX\r
+ #define Pipe_GetErrorFlags() UPERRX\r
\r
/** Returns true if the currently selected pipe may be read from (if data is waiting in the pipe\r
* bank and the pipe is an IN direction, or if the bank is not yet full if the pipe is an OUT\r
* is an IN direction and no packet has been received, or if the pipe is an OUT direction and the\r
* pipe bank is full.\r
*/\r
- #define Pipe_ReadWriteAllowed() ((UPINTX & (1 << RWAL)) ? true : false)\r
+ #define Pipe_ReadWriteAllowed() ((UPINTX & (1 << RWAL)) ? true : false)\r
\r
/** Clears the flag indicating that a SETUP request has been sent to the attached device from the\r
* currently selected CONTROL type pipe.\r
*/\r
- #define Pipe_ClearSetupSent() MACROS{ UPINTX &= ~(1 << TXSTPI); }MACROE\r
+ #define Pipe_ClearSetupSent() MACROS{ UPINTX &= ~(1 << TXSTPI); }MACROE\r
\r
/** Returns true if no SETUP request is currently being sent to the attached device, false otherwise. */\r
- #define Pipe_IsSetupSent() ((UPINTX & (1 << TXSTPI)) ? true : false)\r
+ #define Pipe_IsSetupSent() ((UPINTX & (1 << TXSTPI)) ? true : false)\r
\r
/** Returns true if the currently selected pipe has been stalled by the attached device, false otherwise. */\r
- #define Pipe_IsStalled() ((UPINTX & (1 << RXSTALLI)) ? true : false)\r
+ #define Pipe_IsStalled() ((UPINTX & (1 << RXSTALLI)) ? true : false)\r
\r
/** Clears the stall condition on the currently selected pipe. */\r
- #define Pipe_ClearStall() MACROS{ UPINTX &= ~(1 << RXSTALLI); }MACROE \r
+ #define Pipe_ClearStall() MACROS{ UPINTX &= ~(1 << RXSTALLI); }MACROE \r
\r
/** Returns true if an IN request has been received on the currently selected CONTROL type pipe, false\r
* otherwise.\r
*/\r
- #define Pipe_IsSetupINReceived() ((UPINTX & (1 << RXINI)) ? true : false)\r
+ #define Pipe_IsSetupINReceived() ((UPINTX & (1 << RXINI)) ? true : false)\r
\r
/** Returns true if the currently selected CONTROL type pipe is ready to send an OUT request, false\r
* otherwise.\r
*/\r
- #define Pipe_IsSetupOUTReady() ((UPINTX & (1 << TXOUTI)) ? true : false)\r
+ #define Pipe_IsSetupOUTReady() ((UPINTX & (1 << TXOUTI)) ? true : false)\r
\r
- /** Acknowedges the reception of a setup IN request from the attached device on the currently selected\r
+ /** Acknowledges the reception of a setup IN request from the attached device on the currently selected\r
* CONTROL type endpoint, allowing for the transmission of a setup OUT packet, or the reception of\r
* another setup IN packet.\r
*/\r
- #define Pipe_ClearSetupIN() MACROS{ UPINTX &= ~(1 << RXINI); UPINTX &= ~(1 << FIFOCON); }MACROE\r
+ #define Pipe_ClearSetupIN() MACROS{ UPINTX &= ~(1 << RXINI); UPINTX &= ~(1 << FIFOCON); }MACROE\r
\r
/** Sends the currently selected CONTROL type pipe's contents to the device as a setup OUT packet. */\r
- #define Pipe_ClearSetupOUT() MACROS{ UPINTX &= ~(1 << TXOUTI); UPINTX &= ~(1 << FIFOCON); }MACROE\r
+ #define Pipe_ClearSetupOUT() MACROS{ UPINTX &= ~(1 << TXOUTI); UPINTX &= ~(1 << FIFOCON); }MACROE\r
\r
- /** Returns true if the device sent a NAK (Negative Acknowedge) in response to the last sent packet on\r
+ /** Returns true if the device sent a NAK (Negative Acknowledge) in response to the last sent packet on\r
* the currently selected pipe. This ocurrs when the host sends a packet to the device, but the device\r
* is not currently ready to handle the packet (i.e. its endpoint banks are full). Once a NAK has been\r
* received, it must be cleard using Pipe_ClearNAKReceived() before the previous (or any other) packet\r
* can be re-sent.\r
*/\r
- #define Pipe_IsNAKReceived() ((UPINTX & (1 << NAKEDI)) ? true : false)\r
+ #define Pipe_IsNAKReceived() ((UPINTX & (1 << NAKEDI)) ? true : false)\r
\r
/** Clears the NAK condition on the currently selected pipe.\r
*\r
* \see Pipe_IsNAKReceived() for more details.\r
*/\r
- #define Pipe_ClearNAKReceived() MACROS{ UPINTX &= ~(1 << NAKEDI); }MACROE\r
+ #define Pipe_ClearNAKReceived() MACROS{ UPINTX &= ~(1 << NAKEDI); }MACROE\r
\r
/* Enums: */\r
/** Enum for the possible error return codes of the Pipe_WaitUntilReady function */\r
\r
/* Inline Functions: */\r
/** Reads one byte from the currently selected pipe's bank, for OUT direction pipes. */\r
- static inline uint8_t Pipe_Read_Byte(void) ATTR_WARN_UNUSED_RESULT;\r
+ static inline uint8_t Pipe_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline uint8_t Pipe_Read_Byte(void)\r
{\r
return UPDATX;\r
}\r
\r
/** Writes one byte from the currently selected pipe's bank, for IN direction pipes. */\r
+ static inline void Pipe_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_Write_Byte(const uint8_t Byte)\r
{\r
UPDATX = Byte;\r
}\r
\r
/** Discards one byte from the currently selected pipe's bank, for OUT direction pipes. */\r
+ static inline void Pipe_Discard_Byte(void) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_Discard_Byte(void)\r
{\r
uint8_t Dummy;\r
/** Reads two bytes from the currently selected pipe's bank in little endian format, for OUT\r
* direction pipes.\r
*/\r
- static inline uint16_t Pipe_Read_Word_LE(void) ATTR_WARN_UNUSED_RESULT;\r
+ static inline uint16_t Pipe_Read_Word_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline uint16_t Pipe_Read_Word_LE(void)\r
{\r
uint16_t Data;\r
/** Reads two bytes from the currently selected pipe's bank in big endian format, for OUT\r
* direction pipes.\r
*/\r
- static inline uint16_t Pipe_Read_Word_BE(void) ATTR_WARN_UNUSED_RESULT;\r
+ static inline uint16_t Pipe_Read_Word_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline uint16_t Pipe_Read_Word_BE(void)\r
{\r
uint16_t Data;\r
/** Writes two bytes to the currently selected pipe's bank in little endian format, for IN\r
* direction pipes.\r
*/\r
+ static inline void Pipe_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_Write_Word_LE(const uint16_t Word)\r
{\r
UPDATX = (Word & 0xFF);\r
/** Writes two bytes to the currently selected pipe's bank in big endian format, for IN\r
* direction pipes.\r
*/\r
+ static inline void Pipe_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_Write_Word_BE(const uint16_t Word)\r
{\r
UPDATX = (Word >> 8);\r
}\r
\r
/** Discards two bytes from the currently selected pipe's bank, for OUT direction pipes. */\r
+ static inline void Pipe_Ignore_Word(void) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_Ignore_Word(void)\r
{\r
uint8_t Dummy;\r
/** Reads four bytes from the currently selected pipe's bank in little endian format, for OUT\r
* direction pipes.\r
*/\r
- static inline uint32_t Pipe_Read_DWord_LE(void) ATTR_WARN_UNUSED_RESULT;\r
+ static inline uint32_t Pipe_Read_DWord_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline uint32_t Pipe_Read_DWord_LE(void)\r
{\r
union\r
/** Reads four bytes from the currently selected pipe's bank in big endian format, for OUT\r
* direction pipes.\r
*/\r
- static inline uint32_t Pipe_Read_DWord_BE(void) ATTR_WARN_UNUSED_RESULT;\r
+ static inline uint32_t Pipe_Read_DWord_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline uint32_t Pipe_Read_DWord_BE(void)\r
{\r
union\r
/** Writes four bytes to the currently selected pipe's bank in little endian format, for IN\r
* direction pipes.\r
*/\r
+ static inline void Pipe_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_Write_DWord_LE(const uint32_t DWord)\r
{\r
Pipe_Write_Word_LE(DWord);\r
\r
/** Writes four bytes to the currently selected pipe's bank in big endian format, for IN\r
* direction pipes.\r
- */ \r
+ */\r
+ static inline void Pipe_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_Write_DWord_BE(const uint32_t DWord)\r
{\r
Pipe_Write_Word_BE(DWord >> 16);\r
} \r
\r
/** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes. */\r
+ static inline void Pipe_Ignore_DWord(void) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_Ignore_DWord(void)\r
{\r
uint8_t Dummy;\r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
/* Macros: */\r
- #define PIPE_TOKEN_MASK (0x03 << PTOKEN0)\r
+ #define PIPE_TOKEN_MASK (0x03 << PTOKEN0)\r
\r
- #define Pipe_AllocateMemory() MACROS{ UPCFG1X |= (1 << ALLOC); }MACROE\r
- #define Pipe_DeallocateMemory() MACROS{ UPCFG1X &= ~(1 << ALLOC); }MACROE\r
+ #define Pipe_AllocateMemory() MACROS{ UPCFG1X |= (1 << ALLOC); }MACROE\r
+ #define Pipe_DeallocateMemory() MACROS{ UPCFG1X &= ~(1 << ALLOC); }MACROE\r
\r
/* Function Prototypes: */\r
void Pipe_ClearPipes(void);\r
\r
/* Inline Functions: */\r
- static inline uint8_t Pipe_BytesToEPSizeMask(uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYSINLINE;\r
+ static inline uint8_t Pipe_BytesToEPSizeMask(uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS_INLINE;\r
static inline uint8_t Pipe_BytesToEPSizeMask(uint16_t Bytes)\r
{\r
if (Bytes <= 8)\r
return (2 << EPSIZE0);\r
else if (Bytes <= 64)\r
return (3 << EPSIZE0);\r
- else if (Bytes <= (8 << 4))\r
+ else if (Bytes <= 128)\r
return (4 << EPSIZE0);\r
else\r
return (5 << EPSIZE0);\r