/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
/* External Variables: */\r
- extern uint8_t USB_SelectedPipe;\r
+ extern volatile uint8_t USB_SelectedPipe;\r
#endif\r
\r
/* Public Interface - May be used in end-application: */\r
static inline uint16_t Pipe_BytesInPipe(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline uint16_t Pipe_BytesInPipe(void)\r
{\r
- return ((avr32_usbb_upsta0_t*)AVR32_USBB_UPSTA0)[USB_SelectedPipe].pbyct;\r
+ return (&AVR32_USBB.UPSTA0)[USB_SelectedPipe].pbyct;\r
}\r
\r
/** Returns the pipe address of the currently selected pipe. This is typically used to save the\r
static inline uint8_t Pipe_GetPipeToken(void) ATTR_ALWAYS_INLINE;\r
static inline uint8_t Pipe_GetPipeToken(void)\r
{\r
- return ((avr32_usbb_upcfg0_t*)AVR32_USBB_UPCFG0)[USB_SelectedPipe].ptoken;\r
+ return (&AVR32_USBB.UPCFG0)[USB_SelectedPipe].ptoken;\r
}\r
\r
/** Sets the token for the currently selected pipe to one of the tokens specified by the \c PIPE_TOKEN_*\r
static inline void Pipe_SetPipeToken(const uint8_t Token) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_SetPipeToken(const uint8_t Token)\r
{\r
- ((avr32_usbb_upcfg0_t*)AVR32_USBB_UPCFG0)[USB_SelectedPipe].ptoken = Token;\r
+ (&AVR32_USBB.UPCFG0)[USB_SelectedPipe].ptoken = Token;\r
}\r
\r
/** Configures the currently selected pipe to allow for an unlimited number of IN requests. */\r
static inline void Pipe_SetInfiniteINRequests(void) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_SetInfiniteINRequests(void)\r
{\r
- ((avr32_usbb_upinrq0_t*)AVR32_USBB_UPINRQ0)[USB_SelectedPipe].inmode = true;\r
+ (&AVR32_USBB.UPINRQ0)[USB_SelectedPipe].inmode = true;\r
}\r
\r
/** Configures the currently selected pipe to only allow the specified number of IN requests to be\r
static inline void Pipe_SetFiniteINRequests(const uint8_t TotalINRequests) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_SetFiniteINRequests(const uint8_t TotalINRequests)\r
{\r
- ((avr32_usbb_upinrq0_t*)AVR32_USBB_UPINRQ0)[USB_SelectedPipe].inmode = false;\r
- ((avr32_usbb_upinrq0_t*)AVR32_USBB_UPINRQ0)[USB_SelectedPipe].inrq = TotalINRequests;\r
+ (&AVR32_USBB.UPINRQ0)[USB_SelectedPipe].inmode = false;\r
+ (&AVR32_USBB.UPINRQ0)[USB_SelectedPipe].inrq = TotalINRequests;\r
}\r
\r
/** Determines if the currently selected pipe is configured.\r
static inline bool Pipe_IsConfigured(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool Pipe_IsConfigured(void)\r
{\r
- return ((avr32_usbb_upsta0_t*)AVR32_USBB_UPSTA0)[USB_SelectedPipe].cfgok;\r
+ return (&AVR32_USBB.UPSTA0)[USB_SelectedPipe].cfgok;\r
}\r
\r
/** Retrieves the endpoint number of the endpoint within the attached device that the currently selected\r
static inline uint8_t Pipe_BoundEndpointNumber(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline uint8_t Pipe_BoundEndpointNumber(void)\r
{\r
- return ((avr32_usbb_upcfg0_t*)AVR32_USBB_UPCFG0)[USB_SelectedPipe].pepnum;\r
+ return (&AVR32_USBB.UPCFG0)[USB_SelectedPipe].pepnum;\r
}\r
\r
/** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds.\r
static inline void Pipe_SetInterruptPeriod(const uint8_t Milliseconds) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_SetInterruptPeriod(const uint8_t Milliseconds)\r
{\r
- ((avr32_usbb_upcfg0_t*)AVR32_USBB_UPCFG0)[USB_SelectedPipe].intfrq = Milliseconds;\r
+ (&AVR32_USBB.UPCFG0)[USB_SelectedPipe].intfrq = Milliseconds;\r
}\r
\r
/** Returns a mask indicating which pipe's interrupt periods have elapsed, indicating that the pipe should\r
static inline void Pipe_Unfreeze(void) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_Unfreeze(void)\r
{\r
- ((avr32_usbb_upcon0clr_t*)AVR32_USBB_UPCON0CLR)[USB_SelectedPipe].pfreezec = true;\r
+ (&AVR32_USBB.UPCON0CLR)[USB_SelectedPipe].pfreezec = true;\r
}\r
\r
/** Freezes the selected pipe, preventing it from communicating with an attached device. */\r
static inline void Pipe_Freeze(void) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_Freeze(void)\r
{\r
- ((avr32_usbb_upcon0set_t*)AVR32_USBB_UPCON0SET)[USB_SelectedPipe].pfreezes = true;\r
+ (&AVR32_USBB.UPCON0SET)[USB_SelectedPipe].pfreezes = true;\r
}\r
\r
/** Determines if the currently selected pipe is frozen, and not able to accept data.\r
static inline bool Pipe_IsFrozen(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool Pipe_IsFrozen(void)\r
{\r
- return ((((avr32_usbb_upcon0_t*)AVR32_USBB_UPCON0)[USB_SelectedPipe].pfreeze) ? true : false);\r
+ return (((&AVR32_USBB.UPCON0)[USB_SelectedPipe].pfreeze) ? true : false);\r
}\r
\r
/** Clears the error flags for the currently selected pipe. */\r
static inline void Pipe_ClearError(void) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_ClearError(void)\r
{\r
- ((uint32_t*)AVR32_USBB_UPERR0)[USB_SelectedPipe] = 0;\r
- ((avr32_usbb_upsta0clr_t*)AVR32_USBB_UPSTA0CLR)[USB_SelectedPipe].overfic = true;\r
+ (&AVR32_USBB.uperr0)[USB_SelectedPipe] = 0;\r
+ (&AVR32_USBB.UPSTA0CLR)[USB_SelectedPipe].overfic = true;\r
}\r
\r
/** Determines if the master pipe error flag is set for the currently selected pipe, indicating that\r
static inline bool Pipe_IsError(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool Pipe_IsError(void)\r
{\r
- return ((((uint32_t*)AVR32_USBB_UPSTA0)[USB_SelectedPipe] &\r
+ return (((&AVR32_USBB.upsta0)[USB_SelectedPipe] &\r
(AVR32_USBB_PERRI_MASK | AVR32_USBB_OVERFI_MASK)) ? true : false);\r
}\r
\r
static inline uint8_t Pipe_GetErrorFlags(void)\r
{\r
\r
- return ((((uint32_t*)AVR32_USBB_UPERR0)[USB_SelectedPipe] &\r
+ return (((&AVR32_USBB.uperr0)[USB_SelectedPipe] &\r
(PIPE_ERRORFLAG_CRC16 | PIPE_ERRORFLAG_TIMEOUT |\r
PIPE_ERRORFLAG_PID | PIPE_ERRORFLAG_DATAPID |\r
PIPE_ERRORFLAG_DATATGL)) |\r
- ((((uint32_t*)AVR32_USBB_UPSTA0)[USB_SelectedPipe] << 8) &\r
+ (((&AVR32_USBB.upsta0)[USB_SelectedPipe] << 8) &\r
PIPE_ERRORFLAG_OVERFLOW));\r
}\r
\r
*/\r
static inline uint8_t Pipe_GetBusyBanks(void)\r
{\r
- return ((avr32_usbb_upsta0_t*)AVR32_USBB_UPSTA0)[USB_SelectedPipe].nbusybk;\r
+ return (&AVR32_USBB.UPSTA0)[USB_SelectedPipe].nbusybk;\r
}\r
\r
/** Determines if the currently selected pipe may be read from (if data is waiting in the pipe\r
static inline bool Pipe_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool Pipe_IsReadWriteAllowed(void)\r
{\r
- return ((avr32_usbb_upsta0_t*)AVR32_USBB_UPSTA0)[USB_SelectedPipe].rwall;\r
+ return (&AVR32_USBB.UPSTA0)[USB_SelectedPipe].rwall;\r
}\r
\r
/** Determines if a packet has been received on the currently selected IN pipe from the attached device.\r
static inline bool Pipe_IsINReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool Pipe_IsINReceived(void)\r
{\r
- return ((avr32_usbb_upsta0_t*)AVR32_USBB_UPSTA0)[USB_SelectedPipe].rxini;\r
+ return (&AVR32_USBB.UPSTA0)[USB_SelectedPipe].rxini;\r
}\r
\r
/** Determines if the currently selected OUT pipe is ready to send an OUT packet to the attached device.\r
static inline bool Pipe_IsOUTReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool Pipe_IsOUTReady(void)\r
{\r
- return ((avr32_usbb_upsta0_t*)AVR32_USBB_UPSTA0)[USB_SelectedPipe].txouti;\r
+ return (&AVR32_USBB.UPSTA0)[USB_SelectedPipe].txouti;\r
}\r
\r
/** Determines if no SETUP request is currently being sent to the attached device on the selected\r
static inline bool Pipe_IsSETUPSent(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool Pipe_IsSETUPSent(void)\r
{\r
- return ((avr32_usbb_upsta0_t*)AVR32_USBB_UPSTA0)[USB_SelectedPipe].txstpi;\r
+ return (&AVR32_USBB.UPSTA0)[USB_SelectedPipe].txstpi;\r
}\r
\r
/** Sends the currently selected CONTROL type pipe's contents to the device as a SETUP packet.\r
static inline void Pipe_ClearSETUP(void) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_ClearSETUP(void)\r
{\r
- ((avr32_usbb_upsta0clr_t*)AVR32_USBB_UPSTA0CLR)[USB_SelectedPipe].txstpic = true;\r
+ (&AVR32_USBB.UPSTA0CLR)[USB_SelectedPipe].txstpic = true;\r
}\r
\r
/** Acknowledges the reception of a setup IN request from the attached device on the currently selected\r
static inline void Pipe_ClearIN(void) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_ClearIN(void)\r
{\r
- ((avr32_usbb_upsta0clr_t*)AVR32_USBB_UPSTA0CLR)[USB_SelectedPipe].rxinic = true;\r
- ((avr32_usbb_upcon0clr_t*)AVR32_USBB_UPCON0CLR)[USB_SelectedPipe].fifoconc = true;\r
+ (&AVR32_USBB.UPSTA0CLR)[USB_SelectedPipe].rxinic = true;\r
+ (&AVR32_USBB.UPCON0CLR)[USB_SelectedPipe].fifoconc = true;\r
}\r
\r
/** Sends the currently selected pipe's contents to the device as an OUT packet on the selected pipe, freeing\r
static inline void Pipe_ClearOUT(void) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_ClearOUT(void)\r
{\r
- ((avr32_usbb_upsta0clr_t*)AVR32_USBB_UPSTA0CLR)[USB_SelectedPipe].txoutic = true;\r
- ((avr32_usbb_upcon0clr_t*)AVR32_USBB_UPCON0CLR)[USB_SelectedPipe].fifoconc = true;\r
+ (&AVR32_USBB.UPSTA0CLR)[USB_SelectedPipe].txoutic = true;\r
+ (&AVR32_USBB.UPCON0CLR)[USB_SelectedPipe].fifoconc = true;\r
}\r
\r
/** Determines if the device sent a NAK (Negative Acknowledge) in response to the last sent packet on\r
static inline bool Pipe_IsNAKReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool Pipe_IsNAKReceived(void)\r
{\r
- return ((avr32_usbb_upsta0_t*)AVR32_USBB_UPSTA0)[USB_SelectedPipe].nakedi;\r
+ return (&AVR32_USBB.UPSTA0)[USB_SelectedPipe].nakedi;\r
}\r
\r
/** Clears the NAK condition on the currently selected pipe.\r
static inline void Pipe_ClearNAKReceived(void) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_ClearNAKReceived(void)\r
{\r
- ((avr32_usbb_upsta0clr_t*)AVR32_USBB_UPSTA0CLR)[USB_SelectedPipe].nakedic = true;\r
+ (&AVR32_USBB.UPSTA0CLR)[USB_SelectedPipe].nakedic = true;\r
}\r
\r
/** Determines if the currently selected pipe has had the STALL condition set by the attached device.\r
static inline bool Pipe_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
static inline bool Pipe_IsStalled(void)\r
{\r
- return ((avr32_usbb_upsta0_t*)AVR32_USBB_UPSTA0)[USB_SelectedPipe].rxstalldi;\r
+ return (&AVR32_USBB.UPSTA0)[USB_SelectedPipe].rxstalldi;\r
}\r
\r
/** Clears the STALL condition detection flag on the currently selected pipe, but does not clear the\r
static inline void Pipe_ClearStall(void) ATTR_ALWAYS_INLINE;\r
static inline void Pipe_ClearStall(void)\r
{\r
- ((avr32_usbb_upsta0clr_t*)AVR32_USBB_UPSTA0CLR)[USB_SelectedPipe].rxstalldic = true;\r
+ (&AVR32_USBB.UPSTA0CLR)[USB_SelectedPipe].rxstalldic = true;\r
}\r
\r
/** Reads one byte from the currently selected pipe's bank, for OUT direction pipes.\r