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
+ union\r
+ {\r
+ uint16_t Word;\r
+ uint8_t Bytes[2];\r
+ } Data;\r
\r
- Data = UPDATX;\r
- Data |= (((uint16_t)UPDATX) << 8);\r
+ Data.Bytes[0] = UPDATX;\r
+ Data.Bytes[1] = UPDATX;\r
\r
- return Data;\r
+ return Data.Word;\r
}\r
\r
/** Reads two bytes from the currently selected pipe's bank in big endian format, for OUT\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
+ union\r
+ {\r
+ uint16_t Word;\r
+ uint8_t Bytes[2];\r
+ } Data;\r
\r
- Data = (((uint16_t)UPDATX) << 8);\r
- Data |= UPDATX;\r
+ Data.Bytes[1] = UPDATX;\r
+ Data.Bytes[0] = UPDATX;\r
\r
- return Data;\r
+ return Data.Word;\r
}\r
\r
/** Writes two bytes to the currently selected pipe's bank in little endian format, for IN\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
}\r
\r
/** Writes four bytes to the currently selected pipe's bank in big endian format, for IN\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
} \r
\r
/** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes. \r
*/\r
uint8_t Pipe_Write_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); \r
\r
- /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE.\r
+ /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE().\r
*\r
* \ingroup Group_PipeStreamRW\r
*\r
*/\r
uint8_t Pipe_Write_EStream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
\r
- /** FLASH buffer source version of \ref Pipe_Write_Stream_LE.\r
+ /** FLASH buffer source version of \ref Pipe_Write_Stream_LE().\r
*\r
* \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.\r
*\r
*/\r
uint8_t Pipe_Write_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
\r
- /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE.\r
+ /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE().\r
*\r
* \ingroup Group_PipeStreamRW\r
*\r
*/\r
uint8_t Pipe_Write_EStream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
\r
- /** FLASH buffer source version of \ref Pipe_Write_Stream_BE.\r
+ /** FLASH buffer source version of \ref Pipe_Write_Stream_BE().\r
*\r
* \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.\r
*\r
*\r
* \ingroup Group_PipeStreamRW\r
*\r
- * \param[out] Buffer Pointer to the source data buffer to write to.\r
+ * \param[out] Buffer Pointer to the source data buffer to write to.\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
*/\r
uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
\r
- /** EEPROM buffer source version of \ref Pipe_Read_Stream_LE.\r
+ /** EEPROM buffer source version of \ref Pipe_Read_Stream_LE().\r
*\r
* \ingroup Group_PipeStreamRW\r
*\r
- * \param[out] Buffer Pointer to the source data buffer to write to.\r
+ * \param[out] Buffer Pointer to the source data buffer to write to.\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
*\r
* \ingroup Group_PipeStreamRW\r
*\r
- * \param[out] Buffer Pointer to the source data buffer to write to.\r
+ * \param[out] Buffer Pointer to the source data buffer to write to.\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
*/\r
uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
\r
- /** EEPROM buffer source version of \ref Pipe_Read_Stream_BE.\r
+ /** EEPROM buffer source version of \ref Pipe_Read_Stream_BE().\r
*\r
* \ingroup Group_PipeStreamRW\r
*\r
- * \param[out] Buffer Pointer to the source data buffer to write to.\r
+ * \param[out] Buffer Pointer to the source data buffer to write to.\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