projects
/
pub
/
lufa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More porting of the USB core to the AVR32.
[pub/lufa.git]
/
LUFA
/
Drivers
/
USB
/
LowLevel
/
Pipe.h
diff --git
a/LUFA/Drivers/USB/LowLevel/Pipe.h
b/LUFA/Drivers/USB/LowLevel/Pipe.h
index
08935e1
..
fca44d8
100644
(file)
--- a/
LUFA/Drivers/USB/LowLevel/Pipe.h
+++ b/
LUFA/Drivers/USB/LowLevel/Pipe.h
@@
-86,6
+86,7
@@
#endif
\r
\r
#include "../../../Common/Common.h"
\r
#endif
\r
\r
#include "../../../Common/Common.h"
\r
+ #include "LowLevel.h"
\r
#include "../HighLevel/USBTask.h"
\r
\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
\r
#include "../HighLevel/USBTask.h"
\r
\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
\r
@@
-99,7
+100,7
@@
\r
/* Preprocessor Checks: */
\r
#if !defined(__INCLUDE_FROM_USB_DRIVER)
\r
\r
/* Preprocessor Checks: */
\r
#if !defined(__INCLUDE_FROM_USB_DRIVER)
\r
- #error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
\r
+ #error Do not include this file directly. Include LUFA/Drivers/USB
/USB
.h instead.
\r
#endif
\r
\r
/* Public Interface - May be used in end-application: */
\r
#endif
\r
\r
/* Public Interface - May be used in end-application: */
\r
@@
-554,7
+555,7
@@
static inline uint8_t Pipe_Read_Byte(void)
\r
{
\r
#if defined(__AVR32__)
\r
static inline uint8_t Pipe_Read_Byte(void)
\r
{
\r
#if defined(__AVR32__)
\r
- return
0; // TODO
\r
+ return
__AVR32_EPREG_X(UEDAT0);
\r
#elif defined(__AVR__)
\r
return UPDATX;
\r
#endif
\r
#elif defined(__AVR__)
\r
return UPDATX;
\r
#endif
\r
@@
-570,7
+571,7
@@
static inline void Pipe_Write_Byte(const uint8_t Byte)
\r
{
\r
#if defined(__AVR32__)
\r
static inline void Pipe_Write_Byte(const uint8_t Byte)
\r
{
\r
#if defined(__AVR32__)
\r
- // TODO
\r
+ __AVR32_EPREG_X(UEDAT0) = Byte;
\r
#elif defined(__AVR__)
\r
UPDATX = Byte;
\r
#endif
\r
#elif defined(__AVR__)
\r
UPDATX = Byte;
\r
#endif
\r
@@
-586,7
+587,7
@@
uint8_t Dummy;
\r
\r
#if defined(__AVR32__)
\r
uint8_t Dummy;
\r
\r
#if defined(__AVR32__)
\r
- // TODO
\r
+ Dummy = __AVR32_EPREG_X(UEDAT0);
\r
#elif defined(__AVR__)
\r
Dummy = UPDATX;
\r
#endif
\r
#elif defined(__AVR__)
\r
Dummy = UPDATX;
\r
#endif
\r
@@
-609,7
+610,8
@@
} Data;
\r
\r
#if defined(__AVR32__)
\r
} Data;
\r
\r
#if defined(__AVR32__)
\r
- // TODO
\r
+ Data.Bytes[0] = __AVR32_EPREG_X(UEDAT0);
\r
+ Data.Bytes[1] = __AVR32_EPREG_X(UEDAT0);
\r
#elif defined(__AVR__)
\r
Data.Bytes[0] = UPDATX;
\r
Data.Bytes[1] = UPDATX;
\r
#elif defined(__AVR__)
\r
Data.Bytes[0] = UPDATX;
\r
Data.Bytes[1] = UPDATX;
\r
@@
-635,7
+637,8
@@
} Data;
\r
\r
#if defined(__AVR32__)
\r
} Data;
\r
\r
#if defined(__AVR32__)
\r
- // TODO
\r
+ Data.Bytes[1] = __AVR32_EPREG_X(UEDAT0);
\r
+ Data.Bytes[0] = __AVR32_EPREG_X(UEDAT0);
\r
#elif defined(__AVR__)
\r
Data.Bytes[1] = UPDATX;
\r
Data.Bytes[0] = UPDATX;
\r
#elif defined(__AVR__)
\r
Data.Bytes[1] = UPDATX;
\r
Data.Bytes[0] = UPDATX;
\r
@@
-655,7
+658,8
@@
static inline void Pipe_Write_Word_LE(const uint16_t Word)
\r
{
\r
#if defined(__AVR32__)
\r
static inline void Pipe_Write_Word_LE(const uint16_t Word)
\r
{
\r
#if defined(__AVR32__)
\r
- // TODO
\r
+ __AVR32_EPREG_X(UEDAT0) = (Word & 0xFF);
\r
+ __AVR32_EPREG_X(UEDAT0) = (Word >> 8);
\r
#elif defined(__AVR__)
\r
UPDATX = (Word & 0xFF);
\r
UPDATX = (Word >> 8);
\r
#elif defined(__AVR__)
\r
UPDATX = (Word & 0xFF);
\r
UPDATX = (Word >> 8);
\r
@@
-673,7
+677,8
@@
static inline void Pipe_Write_Word_BE(const uint16_t Word)
\r
{
\r
#if defined(__AVR32__)
\r
static inline void Pipe_Write_Word_BE(const uint16_t Word)
\r
{
\r
#if defined(__AVR32__)
\r
- // TODO
\r
+ __AVR32_EPREG_X(UEDAT0) = (Word >> 8);
\r
+ __AVR32_EPREG_X(UEDAT0) = (Word & 0xFF);
\r
#elif defined(__AVR__)
\r
UPDATX = (Word >> 8);
\r
UPDATX = (Word & 0xFF);
\r
#elif defined(__AVR__)
\r
UPDATX = (Word >> 8);
\r
UPDATX = (Word & 0xFF);
\r
@@
-690,7
+695,8
@@
uint8_t Dummy;
\r
\r
#if defined(__AVR32__)
\r
uint8_t Dummy;
\r
\r
#if defined(__AVR32__)
\r
- // TODO
\r
+ Dummy = __AVR32_EPREG_X(UEDAT0);
\r
+ Dummy = __AVR32_EPREG_X(UEDAT0);
\r
#elif defined(__AVR__)
\r
Dummy = UPDATX;
\r
Dummy = UPDATX;
\r
#elif defined(__AVR__)
\r
Dummy = UPDATX;
\r
Dummy = UPDATX;
\r
@@
-714,7
+720,10
@@
} Data;
\r
\r
#if defined(__AVR32__)
\r
} Data;
\r
\r
#if defined(__AVR32__)
\r
- // TODO
\r
+ Data.Bytes[0] = __AVR32_EPREG_X(UEDAT0);
\r
+ Data.Bytes[1] = __AVR32_EPREG_X(UEDAT0);
\r
+ Data.Bytes[2] = __AVR32_EPREG_X(UEDAT0);
\r
+ Data.Bytes[3] = __AVR32_EPREG_X(UEDAT0);
\r
#elif defined(__AVR__)
\r
Data.Bytes[0] = UPDATX;
\r
Data.Bytes[1] = UPDATX;
\r
#elif defined(__AVR__)
\r
Data.Bytes[0] = UPDATX;
\r
Data.Bytes[1] = UPDATX;
\r
@@
-742,12
+751,16
@@
} Data;
\r
\r
#if defined(__AVR32__)
\r
} Data;
\r
\r
#if defined(__AVR32__)
\r
- // TODO
\r
+ Data.Bytes[3] = __AVR32_EPREG_X(UEDAT0);
\r
+ Data.Bytes[2] = __AVR32_EPREG_X(UEDAT0);
\r
+ Data.Bytes[1] = __AVR32_EPREG_X(UEDAT0);
\r
+ Data.Bytes[0] = __AVR32_EPREG_X(UEDAT0);
\r
#elif defined(__AVR__)
\r
Data.Bytes[3] = UPDATX;
\r
Data.Bytes[2] = UPDATX;
\r
Data.Bytes[1] = UPDATX;
\r
Data.Bytes[0] = UPDATX;
\r
#elif defined(__AVR__)
\r
Data.Bytes[3] = UPDATX;
\r
Data.Bytes[2] = UPDATX;
\r
Data.Bytes[1] = UPDATX;
\r
Data.Bytes[0] = UPDATX;
\r
+ #endif
\r
\r
return Data.DWord;
\r
}
\r
\r
return Data.DWord;
\r
}
\r
@@
-763,7
+776,10
@@
static inline void Pipe_Write_DWord_LE(const uint32_t DWord)
\r
{
\r
#if defined(__AVR32__)
\r
static inline void Pipe_Write_DWord_LE(const uint32_t DWord)
\r
{
\r
#if defined(__AVR32__)
\r
- // TODO
\r
+ __AVR32_EPREG_X(UEDAT0) = (DWord & 0xFF);
\r
+ __AVR32_EPREG_X(UEDAT0) = (DWord >> 8);
\r
+ __AVR32_EPREG_X(UEDAT0) = (DWord >> 16);
\r
+ __AVR32_EPREG_X(UEDAT0) = (DWord >> 24);
\r
#elif defined(__AVR__)
\r
UPDATX = (DWord & 0xFF);
\r
UPDATX = (DWord >> 8);
\r
#elif defined(__AVR__)
\r
UPDATX = (DWord & 0xFF);
\r
UPDATX = (DWord >> 8);
\r
@@
-783,7
+799,10
@@
static inline void Pipe_Write_DWord_BE(const uint32_t DWord)
\r
{
\r
#if defined(__AVR32__)
\r
static inline void Pipe_Write_DWord_BE(const uint32_t DWord)
\r
{
\r
#if defined(__AVR32__)
\r
- // TODO
\r
+ __AVR32_EPREG_X(UEDAT0) = (DWord >> 24);
\r
+ __AVR32_EPREG_X(UEDAT0) = (DWord >> 16);
\r
+ __AVR32_EPREG_X(UEDAT0) = (DWord >> 8);
\r
+ __AVR32_EPREG_X(UEDAT0) = (DWord & 0xFF);
\r
#elif defined(__AVR__)
\r
UPDATX = (DWord >> 24);
\r
UPDATX = (DWord >> 16);
\r
#elif defined(__AVR__)
\r
UPDATX = (DWord >> 24);
\r
UPDATX = (DWord >> 16);
\r
@@
-802,7
+821,10
@@
uint8_t Dummy;
\r
\r
#if defined(__AVR32__)
\r
uint8_t Dummy;
\r
\r
#if defined(__AVR32__)
\r
- // TODO
\r
+ Dummy = __AVR32_EPREG_X(UEDAT0);
\r
+ Dummy = __AVR32_EPREG_X(UEDAT0);
\r
+ Dummy = __AVR32_EPREG_X(UEDAT0);
\r
+ Dummy = __AVR32_EPREG_X(UEDAT0);
\r
#elif defined(__AVR__)
\r
Dummy = UPDATX;
\r
Dummy = UPDATX;
\r
#elif defined(__AVR__)
\r
Dummy = UPDATX;
\r
Dummy = UPDATX;
\r
@@
-932,6
+954,8
@@
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
\r
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
\r
*
\r
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
\r
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
\r
*
\r
+ * \note Not available on AVR32 UC3B targets.
\r
+ *
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
uint8_t Pipe_Write_EStream_LE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
uint8_t Pipe_Write_EStream_LE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
@@
-981,6
+1005,8
@@
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
\r
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
\r
*
\r
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
\r
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
\r
*
\r
+ * \note Not available on AVR32 UC3B targets.
\r
+ *
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
uint8_t Pipe_Write_EStream_BE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
uint8_t Pipe_Write_EStream_BE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
@@
-1030,6
+1056,8
@@
* \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
* \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
+ * \note Not available on AVR32 UC3B targets.
\r
+ *
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
uint8_t Pipe_Read_EStream_LE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
uint8_t Pipe_Read_EStream_LE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
@@
-1065,6
+1093,8
@@
* \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
* \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
+ * \note Not available on AVR32 UC3B targets.
\r
+ *
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
uint8_t Pipe_Read_EStream_BE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
uint8_t Pipe_Read_EStream_BE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
@@
-1085,9
+1115,13
@@
void Pipe_ClearPipes(void);
\r
\r
/* Inline Functions: */
\r
void Pipe_ClearPipes(void);
\r
\r
/* Inline Functions: */
\r
- static inline uint
8
_t Pipe_BytesToEPSizeMask(uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS_INLINE;
\r
- static inline uint
8
_t Pipe_BytesToEPSizeMask(uint16_t Bytes)
\r
+ static inline uint
N
_t Pipe_BytesToEPSizeMask(uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS_INLINE;
\r
+ static inline uint
N
_t Pipe_BytesToEPSizeMask(uint16_t Bytes)
\r
{
\r
{
\r
+ #if defined(__AVR32__)
\r
+ // TODO
\r
+ return 0;
\r
+ #elif defined(__AVR__)
\r
if (Bytes <= 8)
\r
return (0 << EPSIZE0);
\r
else if (Bytes <= 16)
\r
if (Bytes <= 8)
\r
return (0 << EPSIZE0);
\r
else if (Bytes <= 16)
\r
@@
-1100,6
+1134,7
@@
return (4 << EPSIZE0);
\r
else
\r
return (5 << EPSIZE0);
\r
return (4 << EPSIZE0);
\r
else
\r
return (5 << EPSIZE0);
\r
+ #endif
\r
}
\r
\r
#endif
\r
}
\r
\r
#endif
\r