4.4.14.1.3 Functions
static ALWAYS_INLINE void WaitUntilRMWDone (void)
Waits until a Read-Modify-Write operation is done. This blocking wait operation is expected to complete within 14 clock cycles.
static ALWAYS_INLINE void USB_EndPointOutDisable (uint8_t endpointAddress)
Disables the OUT endpoint with the given address.
static ALWAYS_INLINE void USB_EndPointInDisable (uint8_t endpointAddress)
Disables the IN endpoint with the given address.
static ALWAYS_INLINE bool USB_EndPointOutIsEnabled (uint8_t endpointAddress)
Checks if the OUT endpoint at the given address is enabled.
static ALWAYS_INLINE bool USB_EndPointInIsEnabled (uint8_t endpointAddress)
Checks if the IN endpoint at the given address is enabled.
static ALWAYS_INLINE uint8_t USB_EndPointOutTypeConfigGet (uint8_t endpointAddress)
Gets the OUT endpoint configuration at the given address.
static ALWAYS_INLINE uint8_t USB_EndPointInTypeConfigGet (uint8_t endpointAddress)
Gets the IN endpoint configuration at the given address.
static ALWAYS_INLINE void USB_EndpointOutControlSet (uint8_t endpointAddress, uint8_t value)
Sets endpoint control OUT.
static ALWAYS_INLINE void USB_EndpointInControlSet (uint8_t endpointAddress, uint8_t value)
Sets endpoint control IN.
static ALWAYS_INLINE void USB_EndpointOutStatusClear (uint8_t endpointAddress)
Clears OUT endpoint status.
static ALWAYS_INLINE void USB_EndpointInStatusClear (uint8_t endpointAddress)
Clears IN endpoint status.
static ALWAYS_INLINE void USB_EndpointOutDefaultSizeSet (uint8_t endpointAddress, uint8_t endpointSizeConfig)
Sets the endpoint size for a default type OUT endpoint.
static ALWAYS_INLINE void USB_EndpointInDefaultSizeSet (uint8_t endpointAddress, uint8_t endpointSizeConfig)
Sets the endpoint size for a default type IN endpoint.
static ALWAYS_INLINE void USB_EndpointOutIsoSizeSet (uint8_t endpointAddress, uint8_t endpointSizeConfig)
Sets the endpoint size for an isochronous OUT endpoint.
static ALWAYS_INLINE void USB_EndpointInIsoSizeSet (uint8_t endpointAddress, uint8_t endpointSizeConfig)
Sets the endpoint size for an isochronous IN endpoint.
static ALWAYS_INLINE uint8_t USB_EndpointOutDefaultSizeGet (uint8_t endpointAddress)
Gets the size of a default type OUT endpoint.
static ALWAYS_INLINE uint8_t USB_EndpointInDefaultSizeGet (uint8_t endpointAddress)
Gets the size of a default type IN endpoint.
static ALWAYS_INLINE uint8_t USB_EndpointOutIsoSizeGet (uint8_t endpointAddress)
Gets the size of an isochronous OUT endpoint.
static ALWAYS_INLINE uint8_t USB_EndpointInIsoSizeGet (uint8_t endpointAddress)
Gets the size of an isochronous IN endpoint.
static ALWAYS_INLINE void USB_EndpointOutTransactionCompleteInterruptEnable (uint8_t endpointAddress)
Enables transaction complete interrupt for the specified OUT endpoint.
static ALWAYS_INLINE void USB_EndpointInTransactionCompleteInterruptEnable (uint8_t endpointAddress)
Enables transaction complete interrupt for the specified IN endpoint.
static ALWAYS_INLINE void USB_EndpointOutTransactionCompleteInterruptDisable (uint8_t endpointAddress)
Disables transaction complete interrupt for the specified OUT endpoint.
static ALWAYS_INLINE void USB_EndpointInTransactionCompleteDisable (uint8_t endpointAddress)
Disables transaction complete interrupt for the specified IN endpoint.
static ALWAYS_INLINE void USB_EndpointOutMultipktEnable (uint8_t endpointAddress)
Enables multipacket for the specified OUT endpoint.
static ALWAYS_INLINE void USB_EndpointInMultipktEnable (uint8_t endpointAddress)
Enables multipacket for the specified IN endpoint.
static ALWAYS_INLINE void USB_EndpointOutMultipktDisable (uint8_t endpointAddress)
Disables multipacket for the specified OUT endpoint.
static ALWAYS_INLINE void USB_EndpointInMultipktDisable (uint8_t endpointAddress)
Disables multipacket for the specified IN endpoint.
static ALWAYS_INLINE bool USB_EndpointOutMultipktIsEnabled (uint8_t endpointAddress)
Checks if multipacket is enabled on the specified OUT endpoint.
static ALWAYS_INLINE bool USB_EndpointInMultipktIsEnabled (uint8_t endpointAddress)
Checks if multipacket is enabled on the specified IN endpoint.
static ALWAYS_INLINE void USB_EndpointOutAzlpEnable (uint8_t endpointAddress)
Enables Auto Zero Length Packet (AZLP) on the specified OUT endpoint.
static ALWAYS_INLINE void USB_EndpointInAlzpEnable (uint8_t endpointAddress)
Enables AZLP on the specified IN endpoint.
static ALWAYS_INLINE void USB_EndpointOutAzlpDisable (uint8_t endpointAddress)
Disables AZLP on the specified OUT endpoint.
static ALWAYS_INLINE void USB_EndpointInAzlpDisable (uint8_t endpointAddress)
Disables AZLP on the specified IN endpoint.
static ALWAYS_INLINE void USB_EndpointOutStall (uint8_t endpointAddress)
Stalls the specified OUT endpoint.
static ALWAYS_INLINE void USB_EndpointInStall (uint8_t endpointAddress)
Stalls the specified IN endpoint.
static ALWAYS_INLINE void USB_EndpointOutStallClear (uint8_t endpointAddress)
Stops stalling the specified OUT endpoint.
static ALWAYS_INLINE void USB_EndpointInStallClear (uint8_t endpointAddress)
Stops stalling the specified IN endpoint.
static ALWAYS_INLINE bool USB_EndpointOutIsStalled (uint8_t endpointAddress)
Checks if the specified OUT endpoint is stalled.
static ALWAYS_INLINE bool USB_EndpointInIsStalled (uint8_t endpointAddress)
Checks if the specified IN endpoint is stalled.
static ALWAYS_INLINE void USB_EndpointOutStallAck (uint8_t endpointAddress)
Acknowledges that an OUT endpoint is stalled and Clears the USB STATUS register.
static ALWAYS_INLINE void USB_EndpointInStallAck (uint8_t endpointAddress)
Acknowledges that an IN endpoint is stalled and Clears the USB STATUS register.
static ALWAYS_INLINE void USB_EndpointOutNAKSet (uint8_t endpointAddress)
Sets OUT endpoint status to NAK.
static ALWAYS_INLINE void USB_EndpointInNAKSet (uint8_t endpointAddress)
Sets IN endpoint status to NAK.
static ALWAYS_INLINE void USB_EndpointOutNAKClear (uint8_t endpointAddress)
Clears the USB NAK status from the OUT endpoint STATUS register.
static ALWAYS_INLINE void USB_EndpointInNAKClear (uint8_t endpointAddress)
Clears the USB NAK status from the IN endpoint STATUS register.
static ALWAYS_INLINE bool USB_EndpointOutNAKIsSet (uint8_t endpointAddress)
Checks the OUT endpoint STATUS register for the NAK status.
static ALWAYS_INLINE bool USB_EndpointInNAKIsSet (uint8_t endpointAddress)
Checks the OUT endpoint STATUS register for the NAK status.
static ALWAYS_INLINE void USB_EndpointOutTransactionCompleteAck (uint8_t endpointAddress)
Acknowledges the transaction complete status on a specified OUT endpoint and Clears the USB STATUS register.
static ALWAYS_INLINE void USB_EndpointInTransactionCompleteAck (uint8_t endpointAddress)
Acknowledges the transaction complete status on a specified IN endpoint and Clears the USB STATUS register.
static ALWAYS_INLINE bool USB_EndpointOutTransactionIsComplete (uint8_t endpointAddress)
Checks if the USB OUT endpoint has the Transaction Complete status.
static ALWAYS_INLINE bool USB_EndpointInTransactionIsComplete (uint8_t endpointAddress)
Checks if the USB IN endpoint has the Transaction Complete status.
static ALWAYS_INLINE void USB_EndpointOutSetupReceivedAck (uint8_t endpointAddress)
Acknowledges the Setup Received status on a specified OUT endpoint.
static ALWAYS_INLINE void USB_EndpointInSetupCompleteAck (uint8_t endpointAddress)
Acknowledges the Setup Received status on a specified IN endpoint.
static ALWAYS_INLINE bool USB_EndpointOutSetupIsReceived (uint8_t endpointAddress)
Checks if the USB OUT endpoint has the Setup Received status.
static ALWAYS_INLINE bool USB_EndpointInSetupIsReceived (uint8_t endpointAddress)
Checks if the USB IN endpoint has the Setup Received status.
static ALWAYS_INLINE void USB_EndpointOutDataToggleSet (uint8_t endpointAddress)
Sets OUT endpoint data toggle.
static ALWAYS_INLINE void USB_EndpointInDataToggleSet (uint8_t endpointAddress)
Sets IN endpoint data toggle.
static ALWAYS_INLINE void USB_EndpointOutDataToggleClear (uint8_t endpointAddress)
Clears OUT endpoint data toggle.
static ALWAYS_INLINE void USB_EndpointInDataToggleClear (uint8_t endpointAddress)
Clears IN endpoint data toggle.
static ALWAYS_INLINE bool USB_EndpointOutDataToggleIsSet (uint8_t endpointAddress)
Checks if data toggle is set on the specified OUT endpoint.
static ALWAYS_INLINE bool USB_EndpointInDataToggleIsSet (uint8_t endpointAddress)
Checks if data toggle is set on the specified OUT endpoint.
static ALWAYS_INLINE void USB_EndpointOutBufferSet (uint8_t endpointAddress, uint8_t *bufAddress)
Sets endpoint buffer OUT.
static ALWAYS_INLINE void USB_EndpointInBufferSet (uint8_t endpointAddress, uint8_t *bufAddress)
Sets endpoint buffer IN.
static ALWAYS_INLINE void USB_NumberBytesToSendSet (uint8_t endpointAddress, uint16_t numberBytes)
Sets how many bytes of data are intended to be sent from the specified endpoint.
static ALWAYS_INLINE uint16_t USB_NumberBytesToSendGet (uint8_t endpointAddress)
Reads out the CNT register to know how many bytes of data are intended to be sent from the specified endpoint.
static ALWAYS_INLINE void USB_NumberBytesToSendReset (uint8_t endpointAddress)
Clears the CNT register to tell the peripheral no data is intended to be sent from the specified endpoint.
static ALWAYS_INLINE uint16_t USB_NumberBytesSentGet (uint8_t endpointAddress)
Reads out how many bytes have been sent from the specified endpoint.
static ALWAYS_INLINE void USB_NumberBytesSentReset (uint8_t endpointAddress)
Clears the MCNT register that keeps track of how many bytes of data have been sent.
static ALWAYS_INLINE void USB_NumberBytesToReceiveSet (uint8_t endpointAddress, uint16_t numberBytes)
Sets how many bytes of data are expected to be received on a specified endpoint.
static ALWAYS_INLINE uint16_t USB_NumberBytesToReceiveGet (uint8_t endpointAddress)
Gets how many bytes of data are expected to be received on a specified endpoint.
static ALWAYS_INLINE void USB_NumberBytesToReceiveReset (uint8_t endpointAddress)
Clears the MCNT register to tell the peripheral no data is intended to be received on the specified endpoint.
static ALWAYS_INLINE uint16_t USB_NumberBytesReceivedGet (uint8_t endpointAddress)
Gets how many bytes of data have been received on a specified endpoint.
static ALWAYS_INLINE void USB_NumberBytesReceivedReset (uint8_t endpointAddress)
Resets the counter that counts amount of bytes of data received on a specific endpoint.
static ALWAYS_INLINE bool USB_EndpointOutOverUnderflowIsSet (uint8_t endpointAddress)
Checks if OUT endpoint has overflowed.
static ALWAYS_INLINE bool USB_EndpointInOverUnderflowIsSet (uint8_t endpointAddress)
Checks if IN endpoint has underflowed.
static ALWAYS_INLINE void USB_EndpointOutOverUnderflowAck (uint8_t endpointAddress)
Acknowledges overflow on the specified OUT endpoint.
static ALWAYS_INLINE void USB_EndpointInOverUnderflowAck (uint8_t endpointAddress)
Acknowledges underflow on the specified IN endpoint.
static ALWAYS_INLINE bool USB_EndpointOutCRCHasFailed (uint8_t endpointAddress)
Checks if the specified OUT endpoint has a Cyclic Redundancy Check (CRC) failure.
static ALWAYS_INLINE bool USB_EndpointInCRCHasFailed (uint8_t endpointAddress)
Checks if the specified IN endpoint has a CRC failure.
static ALWAYS_INLINE void USB_EndpointOutCRCAck (uint8_t endpointAddress)
Acknowledges a CRC failure on the specified OUT endpoint.
static ALWAYS_INLINE void USB_EndpointInCRCAck (uint8_t endpointAddress)
Acknowledges a CRC failure on the specified IN endpoint.
static ALWAYS_INLINE void USB_GlobalNAKEnable (void)
Enables global NAK.
static ALWAYS_INLINE void USB_GlobalNAKDisable (void)
Disables global NAK.
static ALWAYS_INLINE bool USB_GlobalNAKIsEnable (void)
Checks the global NAK setting.
static ALWAYS_INLINE void USB_ConnectionAttach (void)
Tells the USB peripheral to attach.
static ALWAYS_INLINE void USB_ConnectionDetach (void)
Tells the USB peripheral to detach.
static ALWAYS_INLINE bool USB_ConnectionIsAttach (void)
Checks if the USB connection is attached.
static ALWAYS_INLINE void USB_Enable (void)
Enables the USB peripheral.
static ALWAYS_INLINE void USB_Disable (void)
Disables the USB peripheral.
static ALWAYS_INLINE bool USB_IsEnable (void)
Checks if the USB peripheral is enabled.
static ALWAYS_INLINE void USB_FifoEnable (void)
Enables USB FIFO.
static ALWAYS_INLINE void USB_FifoDisable (void)
Disables USB FIFO.
static ALWAYS_INLINE bool USB_FifoIsEnable (void)
Checks if USB FIFO has been enabled.
static ALWAYS_INLINE void USB_AutomaticGlobalNAKEnable (void)
Enables automatic global NAK for the USB peripheral.
static ALWAYS_INLINE void USB_AutomaticGlobalNAKDisable (void)
Disables automatic global NAK for the USB peripheral.
static ALWAYS_INLINE bool USB_AutomaticGlobalNAKIsEnable (void)
Checks if automatic global NAK has been enabled.
static ALWAYS_INLINE void USB_FrameNumEnable (void)
Enables storing the last SOF token frame number in FRAMENUM. This is a device-specific function.
static ALWAYS_INLINE void USB_FrameNumDisable (void)
Disables storing the last SOF token frame number in FRAMENUM. This is a device-specific function.
static ALWAYS_INLINE bool USB_FrameNumIsEnable (void)
Checks if storing of the last SOF token frame number is enabled. This is a device-specific function.
static ALWAYS_INLINE void USB_MaxEndpointsSet (uint8_t maxEndpoint)
Sets maximum number of endpoint addresses used by the USB peripheral.
static ALWAYS_INLINE void USB_MaxEndpointsReset (void)
Clears the USB endpoint maximum, setting the maximum endpoint to EP0.
static ALWAYS_INLINE uint8_t USB_MaxEndpointsGet (void)
Checks what the maximum number of endpoint addresses is.
static ALWAYS_INLINE void USB_EndpointTableAddressSet (USB_EP_PAIR_t *endpointTableAddress)
Sets the address of the endpoint table. This is a device-specific function.
static ALWAYS_INLINE void USB_EndpointTableAddressReset (void)
Sets the address of the endpoint table to 0. This is a device-specific function.
static ALWAYS_INLINE uint16_t USB_EndpointTableAddressGet (void)
Gets the address of the endpoint table. This is a device-specific function.
static ALWAYS_INLINE void USB_FifoReadPointerReset (void)
Resets the read FIFO pointer. This is a device-specific function.
static ALWAYS_INLINE int8_t USB_FifoReadPointerGet (void)
Gets the read FIFO pointer. This is a device-specific function.
static ALWAYS_INLINE void USB_FifoWritePointerReset (void)
Resets the write FIFO pointer. This is a device-specific function.
static ALWAYS_INLINE int8_t USB_FifoWritePointerGet (void)
Gets the write FIFO pointer. This is a device-specific function.
static ALWAYS_INLINE void USB_DeviceAddressSet (uint8_t usbAddress)
Sets the device address.
static ALWAYS_INLINE void USB_DeviceAddressReset (void)
Resets the device address.
static ALWAYS_INLINE uint8_t USB_DeviceAddressGet (void)
Gets the device address.
static ALWAYS_INLINE void USB_UpstreamResumeEnable (void)
Enables an upstream resume to be initated.
static ALWAYS_INLINE bool USB_UpstreamResumeIsEnable (void)
Checks if upstream resume is enabled, but not yet initiated.
static ALWAYS_INLINE uint8_t USB_BusStateGet (void)
Gets the USB bus state.
static ALWAYS_INLINE bool USB_BusStateIs (uint8_t bus_state_bm)
Checks if the USB bus has any specific status flags set.
static ALWAYS_INLINE void USB_SOFInterruptEnable (void)
Enables the USB Start-Of-Frame interrupt.
static ALWAYS_INLINE void USB_SOFInterruptDisable (void)
Disables the USB Start-Of-Frame interrupt.
static ALWAYS_INLINE void USB_SOFInterruptClear (void)
Clears the USB Start-Of-Frame Interrupt flag.
static ALWAYS_INLINE bool USB_SOFInterruptIs (void)
Checks if the USB Start-Of-Frame interrupt has been triggered.
static ALWAYS_INLINE void USB_SuspendInterruptEnable (void)
Enables the USB Suspend interrupt.
static ALWAYS_INLINE void USB_SuspendInterruptDisable (void)
Disables the USB Suspend interrupt.
static ALWAYS_INLINE void USB_SuspendInterruptClear (void)
Clears the USB Suspend Interrupt flag.
static ALWAYS_INLINE bool USB_SuspendInterruptIs (void)
Checks if the USB Suspend interrupt has been triggered.
static ALWAYS_INLINE void USB_ResumeInterruptEnable (void)
Enables the USB Resume interrupt.
static ALWAYS_INLINE void USB_ResumeInterruptDisable (void)
Disables the USB Resume interrupt.
static ALWAYS_INLINE void USB_ResumeInterruptClear (void)
Clears the USB Resume Interrupt flag.
static ALWAYS_INLINE bool USB_ResumeInterruptIs (void)
Checks if the USB Resume interrupt has been triggered.
static ALWAYS_INLINE void USB_ResetInterruptEnable (void)
Enables the USB Reset interrupt.
static ALWAYS_INLINE void USB_ResetInterruptDisable (void)
Disables the USB Reset interrupt.
static ALWAYS_INLINE void USB_ResetInterruptClear (void)
Clears the USB Reset Interrupt flag.
static ALWAYS_INLINE bool USB_ResetInterruptIs (void)
Checks if the USB Reset interrupt has been triggered.
static ALWAYS_INLINE void USB_StalledInterruptEnable (void)
Enables the USB Stalled interrupt.
static ALWAYS_INLINE void USB_StalledInterruptDisable (void)
Disables the USB Stalled interrupt.
static ALWAYS_INLINE void USB_StalledInterruptClear (void)
Clears the USB Stalled Interrupt flag.
static ALWAYS_INLINE bool USB_StalledInterruptIs (void)
Checks if the USB Stalled interrupt has been triggered.
static ALWAYS_INLINE void USB_UnderflowInterruptEnable (void)
Enables the USB Underflow interrupt.
static ALWAYS_INLINE void USB_UnderflowInterruptDisable (void)
Disables the USB Underflow interrupt.
static ALWAYS_INLINE void USB_UnderflowInterruptClear (void)
Clears the USB Underflow Interrupt flag.
static ALWAYS_INLINE bool USB_UnderflowInterruptIs (void)
Checks if an Underflow interrupt has been triggered.
static ALWAYS_INLINE void USB_OverflowInterruptEnable (void)
Enables the USB Overflow interrupt.
static ALWAYS_INLINE void USB_OverflowInterruptDisable (void)
Disables the USB Overflow interrupt.
static ALWAYS_INLINE void USB_OverflowInterruptClear (void)
Clears the USB Overflow Interrupt flag.
static ALWAYS_INLINE bool USB_OverflowInterruptIs (void)
Checks if an Overflow interrupt has been triggered.
static ALWAYS_INLINE void USB_TransactionCompleteInterruptEnable (void)
Enables the USB Transaction Complete interrupt.
static ALWAYS_INLINE void USB_TransactionCompleteInterruptDisable (void)
Disables the USB Transaction Complete interrupt.
static ALWAYS_INLINE void USB_TransactionCompleteInterruptAck (void)
Clears the USB Transaction Complete Interrupt flag.
static ALWAYS_INLINE bool USB_TransactionCompleteInterruptIs (void)
Checks if a Transaction Complete interrupt has been triggered.
static ALWAYS_INLINE bool USB_ReadModifyWriteInterruptIs (void)
Checks if the USB Read-Modify-Write Interrupt is enabled.
static ALWAYS_INLINE void USB_GlobalNAKDoneInterruptEnable (void)
Enables the USB Global NAK Done interrupt.
static ALWAYS_INLINE void USB_GlobalNAKDoneInterruptDisable (void)
Disables the USB Global NAK Done interrupt.
static ALWAYS_INLINE void USB_GlobalNAKDoneInterruptAck (void)
Clears the USB Global NAK Done Interrupt flag.
static ALWAYS_INLINE bool USB_GlobalNAKDoneInterruptIs (void)
Checks if the USB Global NAK Done interrupt has been triggered.
static ALWAYS_INLINE void USB_SetupInterruptEnable (void)
Enables the USB Setup interrupt.
static ALWAYS_INLINE void USB_SetupInterruptDisable (void)
Disables the USB Setup interrupt.
static ALWAYS_INLINE void USB_SetupInterruptClear (void)
Clears the USB Setup Interrupt flag.
static ALWAYS_INLINE bool USB_SetupInterruptIs (void)
Checks if a USB Setup interrupt has been triggered.
static ALWAYS_INLINE void USB_InterruptFlagsClear (void)
Clears all the USB Interrupt flags.