* @defgroup Group_PipeManagement Pipe Management\r
*\r
* This module contains functions, macros and enums related to pipe management when in USB Host mode. This\r
* @defgroup Group_PipeManagement Pipe Management\r
*\r
* This module contains functions, macros and enums related to pipe management when in USB Host mode. This\r
* indicating that the pipe data will flow from host to device.\r
*/\r
#define PIPE_TOKEN_OUT (2 << PTOKEN0)\r
* indicating that the pipe data will flow from host to device.\r
*/\r
#define PIPE_TOKEN_OUT (2 << PTOKEN0)\r
/** Freezes the selected pipe, preventing it from communicating with an attached device. */\r
static inline void Pipe_Freeze(void);\r
\r
/** Freezes the selected pipe, preventing it from communicating with an attached device. */\r
static inline void Pipe_Freeze(void);\r
\r
+ /** Determines if the currently selected pipe is frozen, and not able to accept data.\r
+ *\r
+ * \return Boolean true if the currently selected pipe is frozen, false otherwise\r
+ */\r
+ static inline bool Pipe_IsFrozen(void);\r
+ \r
\r
#define Pipe_IsConfigured() ((UPSTAX & (1 << CFGOK)) ? true : false)\r
\r
#define Pipe_BoundEndpointNumber() ((UPCFG0X >> PEPNUM0) & PIPE_EPNUM_MASK)\r
\r
\r
#define Pipe_IsConfigured() ((UPSTAX & (1 << CFGOK)) ? true : false)\r
\r
#define Pipe_BoundEndpointNumber() ((UPCFG0X >> PEPNUM0) & PIPE_EPNUM_MASK)\r
\r
\r
#define Pipe_Unfreeze() MACROS{ UPCONX &= ~(1 << PFREEZE); }MACROE\r
\r
#define Pipe_Freeze() MACROS{ UPCONX |= (1 << PFREEZE); }MACROE\r
\r
#define Pipe_Unfreeze() MACROS{ UPCONX &= ~(1 << PFREEZE); }MACROE\r
\r
#define Pipe_Freeze() MACROS{ UPCONX |= (1 << PFREEZE); }MACROE\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
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
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
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
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
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
- Pipe_Write_Word_LE(DWord >> 16);\r
+ UPDATX = (DWord & 0xFF);\r
+ UPDATX = (DWord >> 8);\r
+ UPDATX = (DWord >> 16);\r
+ UPDATX = (DWord >> 24);\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
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
- Pipe_Write_Word_BE(DWord);\r
+ UPDATX = (DWord >> 24);\r
+ UPDATX = (DWord >> 16);\r
+ UPDATX = (DWord >> 8);\r
+ UPDATX = (DWord & 0xFF);\r
#endif\r
\r
/** Configures the specified pipe number with the given pipe type, token, target endpoint number in the\r
#endif\r
\r
/** Configures the specified pipe number with the given pipe type, token, target endpoint number in the\r
bool Pipe_ConfigurePipe(const uint8_t Number, const uint8_t Type, const uint8_t Token, const uint8_t EndpointNumber,\r
const uint16_t Size, const uint8_t Banks);\r
\r
bool Pipe_ConfigurePipe(const uint8_t Number, const uint8_t Type, const uint8_t Token, const uint8_t EndpointNumber,\r
const uint16_t Size, const uint8_t Banks);\r
\r
* or written to it, aborting in the case of an error condition (such as a timeout or device disconnect).\r
*\r
* \ingroup Group_PipeRW\r
* or written to it, aborting in the case of an error condition (such as a timeout or device disconnect).\r
*\r
* \ingroup Group_PipeRW\r
/** Determines if a pipe has been bound to the given device endpoint address. If a pipe which is bound to the given\r
* endpoint is found, it is automatically selected.\r
*\r
/** Determines if a pipe has been bound to the given device endpoint address. If a pipe which is bound to the given\r
* endpoint is found, it is automatically selected.\r
*\r
\r
/** Reads and discards the given number of bytes from the pipe, discarding fully read packets from the host\r
* as needed. The last packet is not automatically discarded once the remaining bytes has been read; the\r
\r
/** Reads and discards the given number of bytes from the pipe, discarding fully read packets from the host\r
* as needed. The last packet is not automatically discarded once the remaining bytes has been read; the\r
\r
/** Writes the given number of bytes to the pipe from the given buffer in little endian,\r
* sending full packets to the device as needed. The last packet filled is not automatically sent;\r
\r
/** Writes the given number of bytes to the pipe from the given buffer in little endian,\r
* sending full packets to the device as needed. The last packet filled is not automatically sent;\r
\r
/** Writes the given number of bytes to the pipe from the given buffer in big endian,\r
* sending full packets to the device as needed. The last packet filled is not automatically sent;\r
\r
/** Writes the given number of bytes to the pipe from the given buffer in big endian,\r
* sending full packets to the device as needed. The last packet filled is not automatically sent;\r
\r
/** Reads the given number of bytes from the pipe into the given buffer in little endian,\r
* sending full packets to the device as needed. The last packet filled is not automatically sent;\r
\r
/** Reads the given number of bytes from the pipe into the given buffer in little endian,\r
* sending full packets to the device as needed. The last packet filled is not automatically sent;\r
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.\r
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
*/\r
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.\r
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
*/\r
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.\r
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
*/\r
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.\r
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
*/\r
\r
/** Reads the given number of bytes from the pipe into the given buffer in big endian,\r
* sending full packets to the device as needed. The last packet filled is not automatically sent;\r
\r
/** Reads the given number of bytes from the pipe into the given buffer in big endian,\r
* sending full packets to the device as needed. The last packet filled is not automatically sent;\r
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.\r
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
*/\r
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.\r
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
*/\r
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.\r
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
*/\r
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.\r
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
*/\r