projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove dependancies from the LowLevel demos to the ClassDriver demos, since the use...
[pub/USBasp.git]
/
LUFA
/
Drivers
/
USB
/
LowLevel
/
Pipe.h
diff --git
a/LUFA/Drivers/USB/LowLevel/Pipe.h
b/LUFA/Drivers/USB/LowLevel/Pipe.h
index
beee2eb
..
6e64377
100644
(file)
--- a/
LUFA/Drivers/USB/LowLevel/Pipe.h
+++ b/
LUFA/Drivers/USB/LowLevel/Pipe.h
@@
-32,7
+32,7
@@
* @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
- * module contains the pipe management macros, as well as pipe interrupt and data send/rec
ie
ve functions
\r
+ * module contains the pipe management macros, as well as pipe interrupt and data send/rec
ei
ve functions
\r
* for various data types.
\r
*
\r
* @{
\r
* for various data types.
\r
*
\r
* @{
\r
@@
-124,7
+124,7
@@
*/
\r
#define PIPE_TOKEN_IN (1 << PTOKEN0)
\r
\r
*/
\r
#define PIPE_TOKEN_IN (1 << PTOKEN0)
\r
\r
- /** Token mask for \ref Pipe_ConfigurePipe(). This sets the pipe as a
IN
token (for non-CONTROL type pipes),
\r
+ /** Token mask for \ref Pipe_ConfigurePipe(). This sets the pipe as a
OUT
token (for non-CONTROL type pipes),
\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
@@
-292,6
+292,12
@@
/** 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
/** Clears the master pipe error flag. */
\r
static inline void Pipe_ClearError(void);
\r
\r
/** Clears the master pipe error flag. */
\r
static inline void Pipe_ClearError(void);
\r
\r
@@
-414,9
+420,9
@@
\r
#define Pipe_GetCurrentPipe() (UPNUM & PIPE_PIPENUM_MASK)
\r
\r
\r
#define Pipe_GetCurrentPipe() (UPNUM & PIPE_PIPENUM_MASK)
\r
\r
- #define Pipe_SelectPipe(pipenum) MACROS{ UPNUM =
pipenum
; }MACROE
\r
+ #define Pipe_SelectPipe(pipenum) MACROS{ UPNUM =
(pipenum)
; }MACROE
\r
\r
\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
#define Pipe_EnablePipe() MACROS{ UPCONX |= (1 << PEN); }MACROE
\r
\r
\r
#define Pipe_EnablePipe() MACROS{ UPCONX |= (1 << PEN); }MACROE
\r
\r
@@
-426,25
+432,27
@@
\r
#define Pipe_GetPipeToken() (UPCFG0X & PIPE_TOKEN_MASK)
\r
\r
\r
#define Pipe_GetPipeToken() (UPCFG0X & PIPE_TOKEN_MASK)
\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
#define Pipe_SetInfiniteINRequests() MACROS{ UPCONX |= (1 << INMODE); }MACROE
\r
\r
\r
#define Pipe_SetInfiniteINRequests() MACROS{ UPCONX |= (1 << INMODE); }MACROE
\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
#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
- #define Pipe_SetInterruptPeriod(ms) MACROS{ UPCFG2X =
ms
; }MACROE
\r
+ #define Pipe_SetInterruptPeriod(ms) MACROS{ UPCFG2X =
(ms)
; }MACROE
\r
\r
#define Pipe_GetPipeInterrupts() UPINT
\r
\r
\r
#define Pipe_GetPipeInterrupts() UPINT
\r
\r
- #define Pipe_HasPipeInterrupted(n) ((UPINT & (1 <<
n
)) ? true : false)
\r
+ #define Pipe_HasPipeInterrupted(n) ((UPINT & (1 <<
(n)
)) ? true : false)
\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
+
\r
+ #define Pipe_IsFrozen() ((UPCONX & (1 << PFREEZE)) ? true : false)
\r
\r
#define Pipe_ClearError() MACROS{ UPINTX &= ~(1 << PERRI); }MACROE
\r
\r
\r
#define Pipe_ClearError() MACROS{ UPINTX &= ~(1 << PERRI); }MACROE
\r
\r
@@
-699,8
+707,10
@@
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
}
\r
\r
/** Writes four bytes to the currently selected pipe's bank in big endian format, for IN
\r
}
\r
\r
/** Writes four bytes to the currently selected pipe's bank in big endian format, for IN
\r
@@
-713,8
+723,10
@@
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
}
\r
\r
/** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes.
\r
}
\r
\r
/** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes.
\r
@@
-745,9
+757,9
@@
\r
/* Function Prototypes: */
\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
\r
\r
/* Function Prototypes: */
\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
\r
- #define _CALLBACK_PARAM , StreamCallbackPtr_t Callback
\r
+ #define _
_
CALLBACK_PARAM , StreamCallbackPtr_t Callback
\r
#else
\r
#else
\r
- #define _
CALLBACK_PARAM
\r
+ #define _
_CALLBACK_PARAM
\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
@@
-793,11
+805,11
@@
/** 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
- * \param EndpointAddress Address of the endpoint within the attached device to check
\r
+ * \param
[in]
EndpointAddress Address of the endpoint within the attached device to check
\r
*
\r
* \return Boolean true if a pipe bound to the given endpoint address is found, false otherwise
\r
*/
\r
*
\r
* \return Boolean true if a pipe bound to the given endpoint address is found, false otherwise
\r
*/
\r
- bool Pipe_IsEndpointBound(uint8_t EndpointAddress);
\r
+ bool Pipe_IsEndpointBound(
const
uint8_t EndpointAddress);
\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
@@
-819,7
+831,7
@@
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
- uint8_t Pipe_Discard_Stream(uint16_t Length _CALLBACK_PARAM);
\r
+ uint8_t Pipe_Discard_Stream(uint16_t Length _
_
CALLBACK_PARAM);
\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
@@
-842,7
+854,7
@@
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
- uint8_t Pipe_Write_Stream_LE(
void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
+ uint8_t Pipe_Write_Stream_LE(
const 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
*
\r
\r
/** EEPROM buffer source version of \ref Pipe_Write_Stream_LE().
\r
*
\r
@@
-854,7
+866,7
@@
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
- uint8_t Pipe_Write_EStream_LE(
void* Buffer, uint16_t Length
_CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
+ uint8_t Pipe_Write_EStream_LE(
const 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
*
\r
\r
/** FLASH buffer source version of \ref Pipe_Write_Stream_LE().
\r
*
\r
@@
-868,7
+880,7
@@
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
- uint8_t Pipe_Write_PStream_LE(
void* Buffer, uint16_t Length
_CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
+ uint8_t Pipe_Write_PStream_LE(
const void* Buffer, uint16_t Length _
_CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\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
@@
-891,7
+903,7
@@
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
- uint8_t Pipe_Write_Stream_BE(
void* Buffer, uint16_t Length
_CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
+ uint8_t Pipe_Write_Stream_BE(
const 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
*
\r
\r
/** EEPROM buffer source version of \ref Pipe_Write_Stream_BE().
\r
*
\r
@@
-903,7
+915,7
@@
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
- uint8_t Pipe_Write_EStream_BE(
void* Buffer, uint16_t Length
_CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
+ uint8_t Pipe_Write_EStream_BE(
const 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
*
\r
\r
/** FLASH buffer source version of \ref Pipe_Write_Stream_BE().
\r
*
\r
@@
-917,7
+929,7
@@
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
- uint8_t Pipe_Write_PStream_BE(
void* Buffer, uint16_t Length
_CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
+ uint8_t Pipe_Write_PStream_BE(
const void* Buffer, uint16_t Length _
_CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\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
@@
-940,7
+952,7
@@
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
- uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\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
*
\r
\r
/** EEPROM buffer source version of \ref Pipe_Read_Stream_LE().
\r
*
\r
@@
-952,7
+964,7
@@
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\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
+ uint8_t Pipe_Read_EStream_LE(void* Buffer, uint16_t Length _
_
CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\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
@@
-975,7
+987,7
@@
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\r
- uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\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
*
\r
\r
/** EEPROM buffer source version of \ref Pipe_Read_Stream_BE().
\r
*
\r
@@
-987,7
+999,7
@@
*
\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
\r
*/
\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
+ uint8_t Pipe_Read_EStream_BE(void* Buffer, uint16_t Length _
_
CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
\r
\r
/* Private Interface - For use in library only: */
\r
#if !defined(__DOXYGEN__)
\r
\r
/* Private Interface - For use in library only: */
\r
#if !defined(__DOXYGEN__)
\r