X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/cbbd3d746acef02a4afd562652a2ba71b24dfd6f..3dce79d68ccc50ee1007e485396826762b6965b5:/LUFA/Drivers/USB/LowLevel/Pipe.h?ds=inline diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h index b6fad5146..1057ec8bc 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.h +++ b/LUFA/Drivers/USB/LowLevel/Pipe.h @@ -566,12 +566,16 @@ static inline uint16_t Pipe_Read_Word_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint16_t Pipe_Read_Word_LE(void) { - uint16_t Data; + union + { + uint16_t Word; + uint8_t Bytes[2]; + } Data; - Data = UPDATX; - Data |= (((uint16_t)UPDATX) << 8); + Data.Bytes[0] = UPDATX; + Data.Bytes[1] = UPDATX; - return Data; + return Data.Word; } /** Reads two bytes from the currently selected pipe's bank in big endian format, for OUT @@ -584,12 +588,16 @@ static inline uint16_t Pipe_Read_Word_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint16_t Pipe_Read_Word_BE(void) { - uint16_t Data; + union + { + uint16_t Word; + uint8_t Bytes[2]; + } Data; - Data = (((uint16_t)UPDATX) << 8); - Data |= UPDATX; + Data.Bytes[1] = UPDATX; + Data.Bytes[0] = UPDATX; - return Data; + return Data.Word; } /** Writes two bytes to the currently selected pipe's bank in little endian format, for IN @@ -691,8 +699,10 @@ static inline void Pipe_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE; static inline void Pipe_Write_DWord_LE(const uint32_t DWord) { - Pipe_Write_Word_LE(DWord); - Pipe_Write_Word_LE(DWord >> 16); + UPDATX = (DWord & 0xFF); + UPDATX = (DWord >> 8); + UPDATX = (DWord >> 16); + UPDATX = (DWord >> 24); } /** Writes four bytes to the currently selected pipe's bank in big endian format, for IN @@ -705,8 +715,10 @@ static inline void Pipe_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE; static inline void Pipe_Write_DWord_BE(const uint32_t DWord) { - Pipe_Write_Word_BE(DWord >> 16); - Pipe_Write_Word_BE(DWord); + UPDATX = (DWord >> 24); + UPDATX = (DWord >> 16); + UPDATX = (DWord >> 8); + UPDATX = (DWord & 0xFF); } /** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes. @@ -836,7 +848,7 @@ */ uint8_t Pipe_Write_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); - /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE. + /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE(). * * \ingroup Group_PipeStreamRW * @@ -848,7 +860,7 @@ */ uint8_t Pipe_Write_EStream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); - /** FLASH buffer source version of \ref Pipe_Write_Stream_LE. + /** FLASH buffer source version of \ref Pipe_Write_Stream_LE(). * * \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. * @@ -885,7 +897,7 @@ */ uint8_t Pipe_Write_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); - /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE. + /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE(). * * \ingroup Group_PipeStreamRW * @@ -897,7 +909,7 @@ */ uint8_t Pipe_Write_EStream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); - /** FLASH buffer source version of \ref Pipe_Write_Stream_BE. + /** FLASH buffer source version of \ref Pipe_Write_Stream_BE(). * * \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. * @@ -926,7 +938,7 @@ * * \ingroup Group_PipeStreamRW * - * \param[out] Buffer Pointer to the source data buffer to write to. + * \param[out] Buffer Pointer to the source data buffer to write to. * \param[in] Length Number of bytes to read for the currently selected pipe to read from. * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * @@ -934,11 +946,11 @@ */ uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); - /** EEPROM buffer source version of \ref Pipe_Read_Stream_LE. + /** EEPROM buffer source version of \ref Pipe_Read_Stream_LE(). * * \ingroup Group_PipeStreamRW * - * \param[out] Buffer Pointer to the source data buffer to write to. + * \param[out] Buffer Pointer to the source data buffer to write to. * \param[in] Length Number of bytes to read for the currently selected pipe to read from. * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * @@ -961,7 +973,7 @@ * * \ingroup Group_PipeStreamRW * - * \param[out] Buffer Pointer to the source data buffer to write to. + * \param[out] Buffer Pointer to the source data buffer to write to. * \param[in] Length Number of bytes to read for the currently selected pipe to read from. * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback * @@ -969,11 +981,11 @@ */ uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); - /** EEPROM buffer source version of \ref Pipe_Read_Stream_BE. + /** EEPROM buffer source version of \ref Pipe_Read_Stream_BE(). * * \ingroup Group_PipeStreamRW * - * \param[out] Buffer Pointer to the source data buffer to write to. + * \param[out] Buffer Pointer to the source data buffer to write to. * \param[in] Length Number of bytes to read for the currently selected pipe to read from. * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback *