@ -89,7 +89,7 @@
* should have one single bank , which requires less USB FIFO memory but results in slower transfers as
* should have one single bank , which requires less USB FIFO memory but results in slower transfers as
* only one USB device ( the AVR or the attached device ) can access the pipe ' s bank at the one time .
* only one USB device ( the AVR or the attached device ) can access the pipe ' s bank at the one time .
*/
*/
# define PIPE_BANK_SINGLE 0
# define PIPE_BANK_SINGLE (0 << EPBK0)
/** Mask for the bank mode selection for the Pipe_ConfigurePipe() macro. This indicates that the pipe
/** Mask for the bank mode selection for the Pipe_ConfigurePipe() macro. This indicates that the pipe
* should have two banks , which requires more USB FIFO memory but results in faster transfers as one
* should have two banks , which requires more USB FIFO memory but results in faster transfers as one
@ -143,8 +143,8 @@
* elapsed and the pipe is ready for the next packet from the attached device to be read out from its
* elapsed and the pipe is ready for the next packet from the attached device to be read out from its
* FIFO buffer ( if received ) .
* FIFO buffer ( if received ) .
*
*
* This interrupt must be enabl ed on * each * pipe which requires it ( after the pipe is selected ) , and
* \ note This interrupt must be enabl ed and clear ed on * each * pipe which requires it ( after the pipe
* will fire the common pipe interrupt vector .
* is selected ) , and will fire the common pipe interrupt vector .
*
*
* \ see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector .
* \ see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector .
*/
*/
@ -157,10 +157,11 @@
* has elapsed and the pipe is ready for a packet to be written to the pipe ' s FIFO buffer and sent
* has elapsed and the pipe is ready for a packet to be written to the pipe ' s FIFO buffer and sent
* to the attached device ( if required ) .
* to the attached device ( if required ) .
*
*
* This interrupt must be enabl ed on * each * pipe which requires it ( after the pipe is selected ) , and
* \ note This interrupt must be enabl ed and clear ed on * each * pipe which requires it ( after the pipe
* will fire the common pipe interrupt vector .
* is selected ) , and will fire the common pipe interrupt vector .
*
*
* \ see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector . */
* \ see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector .
*/
# define PIPE_INT_OUT UPIENX, (1 << TXOUTE), UPINTX, (1 << TXOUTI)
# define PIPE_INT_OUT UPIENX, (1 << TXOUTE), UPINTX, (1 << TXOUTI)
/** Interrupt definition for the pipe SETUP bank ready interrupt (for CONTROL type pipes). Should be
/** Interrupt definition for the pipe SETUP bank ready interrupt (for CONTROL type pipes). Should be
@ -169,8 +170,8 @@
* This interrupt will fire if enabled on an CONTROL type pipe when the pipe is ready for a new
* This interrupt will fire if enabled on an CONTROL type pipe when the pipe is ready for a new
* control request .
* control request .
*
*
* This interrupt must be enabl ed on * each * pipe which requires it ( after the pipe is selected ) , and
* \ note This interrupt must be enabl ed and clear ed on * each * pipe which requires it ( after the pipe
* will fire the common pipe interrupt vector .
* is selected ) , and will fire the common pipe interrupt vector .
*
*
* \ see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector .
* \ see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector .
*/
*/
@ -182,8 +183,8 @@
* This interrupt will fire if enabled on a particular pipe if an error occurs on that pipe , such
* This interrupt will fire if enabled on a particular pipe if an error occurs on that pipe , such
* as a CRC mismatch error .
* as a CRC mismatch error .
*
*
* This interrupt must be enabl ed on * each * pipe which requires it ( after the pipe is selected ) , and
* \ note This interrupt must be enabl ed and clear ed on * each * pipe which requires it ( after the pipe
* will fire the common pipe interrupt vector .
* is selected ) , and will fire the common pipe interrupt vector .
*
*
* \ see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector .
* \ see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector .
*
*
@ -197,8 +198,8 @@
* This interrupt will fire if enabled on a particular pipe if an attached device returns a NAK in
* This interrupt will fire if enabled on a particular pipe if an attached device returns a NAK in
* response to a sent packet .
* response to a sent packet .
*
*
* This interrupt must be enabl ed on * each * pipe which requires it ( after the pipe is selected ) , and
* \ note This interrupt must be enabl ed and clear ed on * each * pipe which requires it ( after the pipe
* will fire the common pipe interrupt vector .
* is selected ) , and will fire the common pipe interrupt vector .
*
*
* \ see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector .
* \ see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector .
*
*
@ -212,8 +213,8 @@
* This interrupt will fire if enabled on a particular pipe if an attached device returns a STALL on the
* This interrupt will fire if enabled on a particular pipe if an attached device returns a STALL on the
* currently selected pipe . This will also fire if the pipe is an isochronous pipe and a CRC error occurs .
* currently selected pipe . This will also fire if the pipe is an isochronous pipe and a CRC error occurs .
*
*
* This interrupt must be enabl ed on * each * pipe which requires it ( after the pipe is selected ) , and
* \ note This interrupt must be enabl ed and clear ed on * each * pipe which requires it ( after the pipe
* will fire the common pipe interrupt vector .
* is selected ) , and will fire the common pipe interrupt vector .
*
*
* \ see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector .
* \ see ENDPOINT_PIPE_vect for more information on the common pipe and endpoint interrupt vector .
*/
*/
@ -401,19 +402,21 @@
/* Inline Functions: */
/* Inline Functions: */
/** Reads one byte from the currently selected pipe's bank, for OUT direction pipes. */
/** Reads one byte from the currently selected pipe's bank, for OUT direction pipes. */
static inline uint8_t Pipe_Read_Byte ( void ) ATTR_WARN_UNUSED_RESULT ;
static inline uint8_t Pipe_Read_Byte ( void ) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE ;
static inline uint8_t Pipe_Read_Byte ( void )
static inline uint8_t Pipe_Read_Byte ( void )
{
{
return UPDATX ;
return UPDATX ;
}
}
/** Writes one byte from the currently selected pipe's bank, for IN direction pipes. */
/** Writes one byte from the currently selected pipe's bank, for IN direction pipes. */
static inline void Pipe_Write_Byte ( const uint8_t Byte ) ATTR_ALWAYS_INLINE ;
static inline void Pipe_Write_Byte ( const uint8_t Byte )
static inline void Pipe_Write_Byte ( const uint8_t Byte )
{
{
UPDATX = Byte ;
UPDATX = Byte ;
}
}
/** Discards one byte from the currently selected pipe's bank, for OUT direction pipes. */
/** Discards one byte from the currently selected pipe's bank, for OUT direction pipes. */
static inline void Pipe_Discard_Byte ( void ) ATTR_ALWAYS_INLINE ;
static inline void Pipe_Discard_Byte ( void )
static inline void Pipe_Discard_Byte ( void )
{
{
uint8_t Dummy ;
uint8_t Dummy ;
@ -424,7 +427,7 @@
/** Reads two bytes from the currently selected pipe's bank in little endian format, for OUT
/** Reads two bytes from the currently selected pipe's bank in little endian format, for OUT
* direction pipes .
* direction pipes .
*/
*/
static inline uint16_t Pipe_Read_Word_LE ( void ) ATTR_WARN_UNUSED_RESULT ;
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 )
static inline uint16_t Pipe_Read_Word_LE ( void )
{
{
uint16_t Data ;
uint16_t Data ;
@ -438,7 +441,7 @@
/** Reads two bytes from the currently selected pipe's bank in big endian format, for OUT
/** Reads two bytes from the currently selected pipe's bank in big endian format, for OUT
* direction pipes .
* direction pipes .
*/
*/
static inline uint16_t Pipe_Read_Word_BE ( void ) ATTR_WARN_UNUSED_RESULT ;
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 )
static inline uint16_t Pipe_Read_Word_BE ( void )
{
{
uint16_t Data ;
uint16_t Data ;
@ -452,6 +455,7 @@
/** Writes two bytes to the currently selected pipe's bank in little endian format, for IN
/** Writes two bytes to the currently selected pipe's bank in little endian format, for IN
* direction pipes .
* direction pipes .
*/
*/
static inline void Pipe_Write_Word_LE ( const uint16_t Word ) ATTR_ALWAYS_INLINE ;
static inline void Pipe_Write_Word_LE ( const uint16_t Word )
static inline void Pipe_Write_Word_LE ( const uint16_t Word )
{
{
UPDATX = ( Word & 0xFF ) ;
UPDATX = ( Word & 0xFF ) ;
@ -461,6 +465,7 @@
/** Writes two bytes to the currently selected pipe's bank in big endian format, for IN
/** Writes two bytes to the currently selected pipe's bank in big endian format, for IN
* direction pipes .
* direction pipes .
*/
*/
static inline void Pipe_Write_Word_BE ( const uint16_t Word ) ATTR_ALWAYS_INLINE ;
static inline void Pipe_Write_Word_BE ( const uint16_t Word )
static inline void Pipe_Write_Word_BE ( const uint16_t Word )
{
{
UPDATX = ( Word > > 8 ) ;
UPDATX = ( Word > > 8 ) ;
@ -468,6 +473,7 @@
}
}
/** Discards two bytes from the currently selected pipe's bank, for OUT direction pipes. */
/** Discards two bytes from the currently selected pipe's bank, for OUT direction pipes. */
static inline void Pipe_Ignore_Word ( void ) ATTR_ALWAYS_INLINE ;
static inline void Pipe_Ignore_Word ( void )
static inline void Pipe_Ignore_Word ( void )
{
{
uint8_t Dummy ;
uint8_t Dummy ;
@ -479,7 +485,7 @@
/** Reads four bytes from the currently selected pipe's bank in little endian format, for OUT
/** Reads four bytes from the currently selected pipe's bank in little endian format, for OUT
* direction pipes .
* direction pipes .
*/
*/
static inline uint32_t Pipe_Read_DWord_LE ( void ) ATTR_WARN_UNUSED_RESULT ;
static inline uint32_t Pipe_Read_DWord_LE ( void ) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE ;
static inline uint32_t Pipe_Read_DWord_LE ( void )
static inline uint32_t Pipe_Read_DWord_LE ( void )
{
{
union
union
@ -499,7 +505,7 @@
/** Reads four bytes from the currently selected pipe's bank in big endian format, for OUT
/** Reads four bytes from the currently selected pipe's bank in big endian format, for OUT
* direction pipes .
* direction pipes .
*/
*/
static inline uint32_t Pipe_Read_DWord_BE ( void ) ATTR_WARN_UNUSED_RESULT ;
static inline uint32_t Pipe_Read_DWord_BE ( void ) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE ;
static inline uint32_t Pipe_Read_DWord_BE ( void )
static inline uint32_t Pipe_Read_DWord_BE ( void )
{
{
union
union
@ -519,6 +525,7 @@
/** Writes four bytes to the currently selected pipe's bank in little endian format, for IN
/** Writes four bytes to the currently selected pipe's bank in little endian format, for IN
* direction pipes .
* direction pipes .
*/
*/
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 )
static inline void Pipe_Write_DWord_LE ( const uint32_t DWord )
{
{
Pipe_Write_Word_LE ( DWord ) ;
Pipe_Write_Word_LE ( DWord ) ;
@ -528,6 +535,7 @@
/** Writes four bytes to the currently selected pipe's bank in big endian format, for IN
/** Writes four bytes to the currently selected pipe's bank in big endian format, for IN
* direction pipes .
* direction pipes .
*/
*/
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 )
static inline void Pipe_Write_DWord_BE ( const uint32_t DWord )
{
{
Pipe_Write_Word_BE ( DWord > > 16 ) ;
Pipe_Write_Word_BE ( DWord > > 16 ) ;
@ -535,6 +543,7 @@
}
}
/** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes. */
/** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes. */
static inline void Pipe_Ignore_DWord ( void ) ATTR_ALWAYS_INLINE ;
static inline void Pipe_Ignore_DWord ( void )
static inline void Pipe_Ignore_DWord ( void )
{
{
uint8_t Dummy ;
uint8_t Dummy ;
@ -761,7 +770,7 @@
void Pipe_ClearPipes ( void ) ;
void Pipe_ClearPipes ( void ) ;
/* Inline Functions: */
/* Inline Functions: */
static inline uint8_t Pipe_BytesToEPSizeMask ( uint16_t Bytes ) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS INLINE;
static inline uint8_t Pipe_BytesToEPSizeMask ( uint16_t Bytes ) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS _ INLINE;
static inline uint8_t Pipe_BytesToEPSizeMask ( uint16_t Bytes )
static inline uint8_t Pipe_BytesToEPSizeMask ( uint16_t Bytes )
{
{
if ( Bytes < = 8 )
if ( Bytes < = 8 )