4.16 USB - Universal Serial Bus

4.16.1 Introduction

The Universal Serial Bus (USB) peripheral is a USB 2.0 full-speed (12 Mbps) device-compliant interface that supports 16 endpoint addresses and full endpoint flexibility for up to 32 endpoints. Each endpoint address is supported by the four transfer types: control, interrupt, bulk, or isochronous.

4.16.2 Supported Device Families

AVR-DU

4.16.3 Required header files:

#include "mcc_generated_files/usb/usb[X].h"
Note: Replace [X] with the instance number of the selected USB module.

4.16.4 Specific MISRA C:2012 Deviations

Global USB_EndpointInBufferSet (uint8_t endpointAddress, uint8_t *bufAddress)

Advisory: misra-c2012- 11.4  

Justification: A conversion should not be performed between a pointer to object and an integer type. The EP.IN.DATAPTR register is a 16-bit register, expecting an AVR DU specific 16-bit RAM address.

Global USB_EndpointOutBufferSet (uint8_t endpointAddress, uint8_t *bufAddress)

Advisory: misra-c2012- 11.4  

Justification: A conversion should not be performed between a pointer to object and an integer type. The EP.OUT.DATAPTR register is a 16-bit register, expecting an AVR DU specific 16-bit RAM address.

4.16.5 Module Documentation

4.16.5.1 USB0

This file contains the API prototypes for the USB0 driver.

4.16.5.1.1 Module description

This file contains the API prototypes for the USB0 driver.

Version: USB0 Driver Version 1.0.0
Typedefs
  • typedef void(* USB_cb_t) (void)

    Data type for the interrupt handlers called by USB. The default value is set to NULL which means that no callback function will be used.

4.16.5.1.2 Typedef Documentation

USB_cb_t

void * USB_cb_t

Data type for the interrupt handlers called by USB. The default value is set to NULL which means that no callback function will be used.

4.16.5.1.3 Function Documentation

USB0_BusEventCallbackRegister()

void USB0_BusEventCallbackRegister (USB_cb_t cb)

Registers a callback function handling the ISR if a Bus Event interrupt flag is set.

Parameters:
USB_cb_t

cb - Callback function for a bus event

Returns:

None.

USB0_Initialize()

void USB0_Initialize (void )

Initializes USB0.

Section: USB0 APIs

Parameters:
None.
Returns:

None.

USB0_TrnComplCallbackRegister()

void USB0_TrnComplCallbackRegister (USB_cb_t cb)

Registers a callback function handling the Interrupt Service Routine (ISR) if a Transaction Complete interrupt flag is set.

Parameters:
USB_cb_t

cb - Callback function for a transaction complete event

Returns:

None.

4.16.5.2 USB Peripheral Hardware Abstraction Layer (HAL)

Interface for a USB peripheral module that needs to be implemented by a device-specific USB module driver.

4.16.5.2.1 Module description

Interface for a USB peripheral module that needs to be implemented by a device-specific USB module driver.

Version: USB Device Stack HAL Driver Version 1.0.0
Modules
  • USB Peripheral AVR DU

    This file encompasses all the register settings of the AVR DU device in the form of inline functions. It also abstracts the Read-Modify-Write loop for STATUS registers, which is required, as the hardware and software can both write into the STATUS register.

  • USB Peripheral Endpoint

    API module for usb_peripheral_endpoint covering endpoint-related functions.

  • USB Peripheral Read/Write

    API module for usb_peripheral covering low-level USB transaction functions.

Data structures
  • struct USB_CONTROL_TRANSFER_t

    The data structure for internally handling control transfers, either IN or OUT.

Functions

4.16.5.2.2 Function Documentation

USB_BusAttach()

void USB_BusAttach (void )

Attaches the device to the USB bus.

Parameters:
None.
Returns:

None.

USB_BusDetach()

void USB_BusDetach (void )

Detaches the device from the USB bus.

Parameters:
None.
Returns:

None.

USB_ControlEndOfRequestCallbackRegister()

void USB_ControlEndOfRequestCallbackRegister (USB_SETUP_ENDOFREQUEST_CALLBACK_t callback)

Sets the callback for end of a control request.

Parameters:
callback

- The function to call for the end of a control request

Returns:

None.

USB_ControlEndpointsInit()

RETURN_CODE_t USB_ControlEndpointsInit (void )

Ensures correct control endpoint initialization.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_ControlOverUnderflowIsReceived()

uint8_t USB_ControlOverUnderflowIsReceived (void )

Detects if an Overflow and/or Underflow event was received on the control endpoints.

Parameters:
None.
Returns:

A value representing the events received

USB_ControlOverUnderRunCallbackRegister()

void USB_ControlOverUnderRunCallbackRegister (USB_SETUP_OVERUNDERRUN_CALLBACK_t callback)

Sets the callback for a control overrun or underrun.

Parameters:
callback

- The function to call on a control overrun or underrun

Returns:

None.

USB_ControlProcessOverUnderflow()

RETURN_CODE_t USB_ControlProcessOverUnderflow (uint8_t overunderflow)

Handles the control Over/Underflow events.

Parameters:
overunderflow

- A value representing overflow or underflow

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_ControlProcessSetupCallbackRegister()

void USB_ControlProcessSetupCallbackRegister (USB_SETUP_PROCESS_CALLBACK_t callback)

Sets the callback for the setup processing.

Parameters:
callback

- The function to call for the setup processing

Returns:

None.

USB_ControlSetupReceived()

RETURN_CODE_t USB_ControlSetupReceived (void )

Verifies the received control setup.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_ControlTransactionComplete()

RETURN_CODE_t USB_ControlTransactionComplete (USB_PIPE_t pipe)

Handles completed transactions on the control endpoints. Checks and verifies data OUT, data IN, ZLP OUT and ZLP IN.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_ControlTransferDataSet()

RETURN_CODE_t USB_ControlTransferDataSet (uint8_t * dataPtr, uint16_t dataSize)

Updates the transfer data pointer and size in ControlTransfer.

Parameters:
*dataPtr

- Pointer to new data

dataSize

- Number of elements in the array

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_ControlTransferDataWriteBuffer()

RETURN_CODE_t USB_ControlTransferDataWriteBuffer (uint8_t * dataPtr, uint8_t dataSize)

Copies data to the transfer buffer and sets the transfer data pointer and size in ControlTransfer.

Parameters:
*dataPtr

- Pointer to data to copy

dataSize

- Number of elements in the array

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_ControlTransferReset()

RETURN_CODE_t USB_ControlTransferReset (void )

Ensures correct control transfer reset.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_ControlTransferZLP()

RETURN_CODE_t USB_ControlTransferZLP (uint8_t direction)

Sends ZLP OUT and ZLP IN transactions on the control endpoints.

Parameters:
direction

- The endpoint direction to send the ZLP

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_DeviceAddressConfigure()

void USB_DeviceAddressConfigure (uint8_t deviceAddress)

Sets the device address.

Parameters:
deviceAddress

- Device address to set

Returns:

None.

USB_EventOverUnderflowClear()

void USB_EventOverUnderflowClear (void )

Clears the Over/Underflow event.

Parameters:
None.
Returns:

None.

USB_EventOverUnderflowIsReceived()

uint8_t USB_EventOverUnderflowIsReceived (void )

Detects if an Overflow and/or Underflow event was received.

Parameters:
None.
Returns:

A value representing the events received

USB_EventResetClear()

void USB_EventResetClear (void )

Clears the Reset event.

Parameters:
None.
Returns:

None.

USB_EventResetIsReceived()

bool USB_EventResetIsReceived (void )

Detects if the Reset event was received.

Parameters:
None.
Return values:
1

- Reset event was received

0

- Reset event was not received

USB_EventResumeClear()

void USB_EventResumeClear (void )

Clears the Resume event.

Parameters:
None.
Returns:

None.

USB_EventResumeIsReceived()

bool USB_EventResumeIsReceived (void )

Detects if a Resume event was received.

Parameters:
None.
Return values:
0

- Resume event was not received

1

- Resume event was received

USB_EventSOFClear()

void USB_EventSOFClear (void )

Clears the SOF event.

Parameters:
None.
Returns:

None.

USB_EventSOFIsReceived()

bool USB_EventSOFIsReceived (void )

Detects if the Start-of-Frame (SOF) event was received.

Parameters:
None.
Return values:
0

- SOF event was not received

1

- SOF event was received

USB_EventStalledClear()

void USB_EventStalledClear (void )

Clears the Stalled event.

Parameters:
None.
Returns:

None.

USB_EventStalledIsReceived()

bool USB_EventStalledIsReceived (void )

Detects if a Stalled event was received.

Parameters:
None.
Return values:
0

- Stalled event was not received

1

- Stalled event was received

USB_EventSuspendClear()

void USB_EventSuspendClear (void )

Clears the Suspend event.

Parameters:
None.
Returns:

None.

USB_EventSuspendIsReceived()

bool USB_EventSuspendIsReceived (void )

Detects if a Suspend event was received.

Parameters:
None.
Returns:

A boolean value representing the Suspend event received condition

Return values:
0

- Suspend event was not received

1

- Suspend event was received

USB_FrameNumberGet()

uint16_t USB_FrameNumberGet (void )

Gets the current frame number.

Parameters:
None.
Returns:

15-bit frame number

USB_FrameNumGet()

static ALWAYS_INLINE uint16_t USB_FrameNumGet (void )[static]

Gets the current frame number.

Parameters:
None.
Returns:

15-bit frame number

USB_HandleEventStalled()

RETURN_CODE_t USB_HandleEventStalled (USB_PIPE_t pipe)

Handles the Stall events.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_IsBusAttached()

bool USB_IsBusAttached (void )

Checks if the device is attached to the USB bus not.

Parameters:
None.
Return values:
0

- USB bus is not attached

1

- USB bus is attached

USB_PeripheralDisable()

void USB_PeripheralDisable (void )

Disables the USB peripheral and aborts any ongoing transaction.

Parameters:
None.
Returns:

None.

USB_PeripheralInitialize()

void USB_PeripheralInitialize (void )

Enables the peripheral and the frame number, enables and resets FIFO, sets the endpoint table address and max endpoints.

Parameters:
None.
Returns:

None.

USB_SetupIsReceived()

bool USB_SetupIsReceived (void )

Detects if the Setup event was received.

Parameters:
None.
Return values:
0

- Setup event was not received

1

- Setup event was received

4.16.5.3 USB Peripheral AVR DU

This file encompasses all the register settings of the AVR DU device in the form of inline functions. It also abstracts the Read-Modify-Write loop for STATUS registers, which is required, as the hardware and software can both write into the STATUS register.

4.16.5.3.1 Module description

This file encompasses all the register settings of the AVR DU device in the form of inline functions. It also abstracts the Read-Modify-Write loop for STATUS registers, which is required, as the hardware and software can both write into the STATUS register.

Version: USB Device Stack HAL Driver Version 1.0.0
Data structures
  • struct USB_ENDPOINT_TABLE_struct

    Represents the endpoint configuration table based on the number of endpoints in use. The table data structure is defined by USB_EP_TABLE_struct in the device header file, modified to support configuration of size from USB_EP_NUM.

  • struct USB_PIPE_TRANSFER_struct

    Represents a transfer created for a pipe, either IN or OUT.

Definitions
  • #define ALWAYS_INLINE __attribute__((always_inline)) inline

    Alias that makes always inline function definitions more readable.

Functions

4.16.5.3.2 Definition Documentation

ALWAYS_INLINE

#define ALWAYS_INLINE __attribute__((always_inline)) inline

Alias that makes always inline function definitions more readable.

4.16.5.3.3 Function Documentation

USB_AutomaticGlobalNAKDisable()

static ALWAYS_INLINE void USB_AutomaticGlobalNAKDisable (void )[static]

Disables automatic global NAK for the USB peripheral.

Parameters:
None.
Returns:

None.

USB_AutomaticGlobalNAKEnable()

static ALWAYS_INLINE void USB_AutomaticGlobalNAKEnable (void )[static]

Enables automatic global NAK for the USB peripheral.

Parameters:
None.
Returns:

None.

USB_AutomaticGlobalNAKIsEnable()

static ALWAYS_INLINE bool USB_AutomaticGlobalNAKIsEnable (void )[static]

Checks if automatic global NAK has been enabled.

Parameters:
None.
Return values:
0

- Automatic global NAK is not enabled

1

- Automatic global NAK is enabled

USB_BusStateGet()

static ALWAYS_INLINE uint8_t USB_BusStateGet (void )[static]

Gets the USB bus state.

Parameters:
None.
Returns:

The state of the USB bus

USB_BusStateIs()

static ALWAYS_INLINE bool USB_BusStateIs (uint8_t bus_state_bm)[static]

Checks if the USB bus has any specific status flags set.

Parameters:
bus_state_bm

- The bitmap of the specific status flags to check

Return values:
0

- No status flags set

1

- The bus has one or more specified status flags set

USB_ConnectionAttach()

static ALWAYS_INLINE void USB_ConnectionAttach (void )[static]

Tells the USB peripheral to attach.

Parameters:
None.
Returns:

None.

USB_ConnectionDetach()

static ALWAYS_INLINE void USB_ConnectionDetach (void )[static]

Tells the USB peripheral to detach.

Parameters:
None.
Returns:

None.

USB_ConnectionIsAttach()

static ALWAYS_INLINE bool USB_ConnectionIsAttach (void )[static]

Checks if the USB connection is attached.

Parameters:
None.
Return values:
0

- USB connection is not attached

1

- USB connection is attached

USB_DeviceAddressGet()

static ALWAYS_INLINE uint8_t USB_DeviceAddressGet (void )[static]

Gets the device address.

Parameters:
None.
Returns:

The device address

USB_DeviceAddressReset()

static ALWAYS_INLINE void USB_DeviceAddressReset (void )[static]

Resets the device address.

Parameters:
None.
Returns:

None.

USB_DeviceAddressSet()

static ALWAYS_INLINE void USB_DeviceAddressSet (uint8_t usbAddress)[static]

Sets the device address.

Parameters:
usbAddress

- The device address to set

Returns:

None.

USB_Disable()

static ALWAYS_INLINE void USB_Disable (void )[static]

Disables the USB peripheral.

Parameters:
None.
Returns:

None.

USB_Enable()

static ALWAYS_INLINE void USB_Enable (void )[static]

Enables the USB peripheral.

Parameters:
None.
Returns:

None.

USB_EndpointInAlzpEnable()

static ALWAYS_INLINE void USB_EndpointInAlzpEnable (uint8_t endpointAddress)[static]

Enables AZLP on the specified IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInAzlpDisable()

static ALWAYS_INLINE void USB_EndpointInAzlpDisable (uint8_t endpointAddress)[static]

Disables AZLP on the specified IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInBufferSet()

static ALWAYS_INLINE void USB_EndpointInBufferSet (uint8_t endpointAddress, uint8_t * bufAddress)[static]

Sets endpoint buffer IN.

Parameters:
endpointAddress

- Address of the endpoint

bufAddress

- Address pointer to buffer

Returns:

None.

MISRA C:2012 Deviation Advisory: misra-c2012- 11.4  

Justification: A conversion should not be performed between a pointer to object and an integer type. The EP.IN.DATAPTR register is a 16-bit register, expecting an AVR DU specific 16-bit RAM address.

USB_EndpointInControlSet()

static ALWAYS_INLINE void USB_EndpointInControlSet (uint8_t endpointAddress, uint8_t value)[static]

Sets endpoint control IN.

Parameters:
endpointAddress

- Address of the endpoint

value

- Register bitmask

Returns:

None.

USB_EndpointInCRCAck()

static ALWAYS_INLINE void USB_EndpointInCRCAck (uint8_t endpointAddress)[static]

Acknowledges a CRC failure on the specified IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInCRCHasFailed()

static ALWAYS_INLINE bool USB_EndpointInCRCHasFailed (uint8_t endpointAddress)[static]

Checks if the specified IN endpoint has a CRC failure.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- No CRC failure on endpoint

1

- CRC failure on endpoint

USB_EndpointInDataToggleClear()

static ALWAYS_INLINE void USB_EndpointInDataToggleClear (uint8_t endpointAddress)[static]

Clears IN endpoint data toggle.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInDataToggleIsSet()

static ALWAYS_INLINE bool USB_EndpointInDataToggleIsSet (uint8_t endpointAddress)[static]

Checks if data toggle is set on the specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- Data toggle is not set

1

- Data toggle is set

USB_EndpointInDataToggleSet()

static ALWAYS_INLINE void USB_EndpointInDataToggleSet (uint8_t endpointAddress)[static]

Sets IN endpoint data toggle.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInDefaultSizeGet()

static ALWAYS_INLINE uint8_t USB_EndpointInDefaultSizeGet (uint8_t endpointAddress)[static]

Gets the size of a default type IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

IN endpoint size

USB_EndpointInDefaultSizeSet()

static ALWAYS_INLINE void USB_EndpointInDefaultSizeSet (uint8_t endpointAddress, uint8_t endpointSizeConfig)[static]

Sets the endpoint size for a default type IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

endpointSizeConfig

- Size of endpoint to set

Returns:

None.

USB_EndPointInDisable()

static ALWAYS_INLINE void USB_EndPointInDisable (uint8_t endpointAddress)[static]

Disables the IN endpoint with the given address.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndPointInIsEnabled()

static ALWAYS_INLINE bool USB_EndPointInIsEnabled (uint8_t endpointAddress)[static]

Checks if the IN endpoint at the given address is enabled.

Parameters:
None.
Return values:
0

Endpoint not enabled

1

Endpoint enabled

USB_EndpointInIsoSizeGet()

static ALWAYS_INLINE uint8_t USB_EndpointInIsoSizeGet (uint8_t endpointAddress)[static]

Gets the size of an isochronous IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

IN endpoint size

USB_EndpointInIsoSizeSet()

static ALWAYS_INLINE void USB_EndpointInIsoSizeSet (uint8_t endpointAddress, uint8_t endpointSizeConfig)[static]

Sets the endpoint size for an isochronous IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

endpointSizeConfig

- Size of endpoint to set

Returns:

None.

USB_EndpointInIsStalled()

static ALWAYS_INLINE bool USB_EndpointInIsStalled (uint8_t endpointAddress)[static]

Checks if the specified IN endpoint is stalled.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- Endpoint is not stalled

1

- Endpoint is stalled

USB_EndpointInMultipktDisable()

static ALWAYS_INLINE void USB_EndpointInMultipktDisable (uint8_t endpointAddress)[static]

Disables multipacket for the specified IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInMultipktEnable()

static ALWAYS_INLINE void USB_EndpointInMultipktEnable (uint8_t endpointAddress)[static]

Enables multipacket for the specified IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInMultipktIsEnabled()

static ALWAYS_INLINE bool USB_EndpointInMultipktIsEnabled (uint8_t endpointAddress)[static]

Checks if multipacket is enabled on the specified IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- Multipacket disabled

1

- Multipacket enabled

USB_EndpointInNAKClear()

static ALWAYS_INLINE void USB_EndpointInNAKClear (uint8_t endpointAddress)[static]

Clears the USB NAK status from the IN endpoint STATUS register.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInNAKIsSet()

static ALWAYS_INLINE bool USB_EndpointInNAKIsSet (uint8_t endpointAddress)[static]

Checks the OUT endpoint STATUS register for the NAK status.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- Endpoint is not NAKed

1

- Endpoint is NAKed

USB_EndpointInNAKSet()

static ALWAYS_INLINE void USB_EndpointInNAKSet (uint8_t endpointAddress)[static]

Sets IN endpoint status to NAK.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInOverUnderflowAck()

static ALWAYS_INLINE void USB_EndpointInOverUnderflowAck (uint8_t endpointAddress)[static]

Acknowledges underflow on the specified IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInOverUnderflowIsSet()

static ALWAYS_INLINE bool USB_EndpointInOverUnderflowIsSet (uint8_t endpointAddress)[static]

Checks if IN endpoint has underflowed.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- No underflow on endpoint

1

- Undeflow on endpoint

USB_EndpointInSetupCompleteAck()

static ALWAYS_INLINE void USB_EndpointInSetupCompleteAck (uint8_t endpointAddress)[static]

Acknowledges the Setup Received status on a specified IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInSetupIsReceived()

static ALWAYS_INLINE bool USB_EndpointInSetupIsReceived (uint8_t endpointAddress)[static]

Checks if the USB IN endpoint has the Setup Received status.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- No setup received

1

- Setup received

USB_EndpointInStall()

static ALWAYS_INLINE void USB_EndpointInStall (uint8_t endpointAddress)[static]

Stalls the specified IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInStallAck()

static ALWAYS_INLINE void USB_EndpointInStallAck (uint8_t endpointAddress)[static]

Acknowledges that an IN endpoint is stalled and Clears the USB STATUS register.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInStallClear()

static ALWAYS_INLINE void USB_EndpointInStallClear (uint8_t endpointAddress)[static]

Stops stalling the specified IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInStatusClear()

static ALWAYS_INLINE void USB_EndpointInStatusClear (uint8_t endpointAddress)[static]

Clears IN endpoint status.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInTransactionCompleteAck()

static ALWAYS_INLINE void USB_EndpointInTransactionCompleteAck (uint8_t endpointAddress)[static]

Acknowledges the transaction complete status on a specified IN endpoint and Clears the USB STATUS register.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInTransactionCompleteDisable()

static ALWAYS_INLINE void USB_EndpointInTransactionCompleteDisable (uint8_t endpointAddress)[static]

Disables transaction complete interrupt for the specified IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInTransactionCompleteInterruptEnable()

static ALWAYS_INLINE void USB_EndpointInTransactionCompleteInterruptEnable (uint8_t endpointAddress)[static]

Enables transaction complete interrupt for the specified IN endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointInTransactionIsComplete()

static ALWAYS_INLINE bool USB_EndpointInTransactionIsComplete (uint8_t endpointAddress)[static]

Checks if the USB IN endpoint has the Transaction Complete status.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- Transaction incomplete

1

- Transaction complete

USB_EndPointInTypeConfigGet()

static ALWAYS_INLINE uint8_t USB_EndPointInTypeConfigGet (uint8_t endpointAddress)[static]

Gets the IN endpoint configuration at the given address.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

Endpoint configuration type

USB_EndpointOutAzlpDisable()

static ALWAYS_INLINE void USB_EndpointOutAzlpDisable (uint8_t endpointAddress)[static]

Disables AZLP on the specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutAzlpEnable()

static ALWAYS_INLINE void USB_EndpointOutAzlpEnable (uint8_t endpointAddress)[static]

Enables Auto Zero Length Packet (AZLP) on the specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutBufferSet()

static ALWAYS_INLINE void USB_EndpointOutBufferSet (uint8_t endpointAddress, uint8_t * bufAddress)[static]

Sets endpoint buffer OUT.

Parameters:
endpointAddress

- Address of the endpoint

bufAddress

- Address pointer to buffer

Returns:

None.

MISRA C:2012 Deviation Advisory: misra-c2012- 11.4  

Justification: A conversion should not be performed between a pointer to object and an integer type. The EP.OUT.DATAPTR register is a 16-bit register, expecting an AVR DU specific 16-bit RAM address.

USB_EndpointOutControlSet()

static ALWAYS_INLINE void USB_EndpointOutControlSet (uint8_t endpointAddress, uint8_t value)[static]

Sets endpoint control OUT.

Parameters:
endpointAddress

- Address of the endpoint

value

- Register bitmask

Returns:

None.

USB_EndpointOutCRCAck()

static ALWAYS_INLINE void USB_EndpointOutCRCAck (uint8_t endpointAddress)[static]

Acknowledges a CRC failure on the specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutCRCHasFailed()

static ALWAYS_INLINE bool USB_EndpointOutCRCHasFailed (uint8_t endpointAddress)[static]

Checks if the specified OUT endpoint has a Cyclic Redundancy Check (CRC) failure.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- No CRC failure on endpoint

1

- CRC failure on endpoint

USB_EndpointOutDataToggleClear()

static ALWAYS_INLINE void USB_EndpointOutDataToggleClear (uint8_t endpointAddress)[static]

Clears OUT endpoint data toggle.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutDataToggleIsSet()

static ALWAYS_INLINE bool USB_EndpointOutDataToggleIsSet (uint8_t endpointAddress)[static]

Checks if data toggle is set on the specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- Data toggle is not set

1

- Data toggle is set

USB_EndpointOutDataToggleSet()

static ALWAYS_INLINE void USB_EndpointOutDataToggleSet (uint8_t endpointAddress)[static]

Sets OUT endpoint data toggle.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutDefaultSizeGet()

static ALWAYS_INLINE uint8_t USB_EndpointOutDefaultSizeGet (uint8_t endpointAddress)[static]

Gets the size of a default type OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

OUT endpoint size

USB_EndpointOutDefaultSizeSet()

static ALWAYS_INLINE void USB_EndpointOutDefaultSizeSet (uint8_t endpointAddress, uint8_t endpointSizeConfig)[static]

Sets the endpoint size for a default type OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

endpointSizeConfig

- Size of endpoint to set

Returns:

None.

USB_EndPointOutDisable()

static ALWAYS_INLINE void USB_EndPointOutDisable (uint8_t endpointAddress)[static]

Disables the OUT endpoint with the given address.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndPointOutIsEnabled()

static ALWAYS_INLINE bool USB_EndPointOutIsEnabled (uint8_t endpointAddress)[static]

Checks if the OUT endpoint at the given address is enabled.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

Endpoint not enabled

1

Endpoint enabled

USB_EndpointOutIsoSizeGet()

static ALWAYS_INLINE uint8_t USB_EndpointOutIsoSizeGet (uint8_t endpointAddress)[static]

Gets the size of an isochronous OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

OUT endpoint size

USB_EndpointOutIsoSizeSet()

static ALWAYS_INLINE void USB_EndpointOutIsoSizeSet (uint8_t endpointAddress, uint8_t endpointSizeConfig)[static]

Sets the endpoint size for an isochronous OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

endpointSizeConfig

- Size of endpoint to set

Returns:

None.

USB_EndpointOutIsStalled()

static ALWAYS_INLINE bool USB_EndpointOutIsStalled (uint8_t endpointAddress)[static]

Checks if the specified OUT endpoint is stalled.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- Endpoint is not stalled

1

- Endpoint is stalled

USB_EndpointOutMultipktDisable()

static ALWAYS_INLINE void USB_EndpointOutMultipktDisable (uint8_t endpointAddress)[static]

Disables multipacket for the specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutMultipktEnable()

static ALWAYS_INLINE void USB_EndpointOutMultipktEnable (uint8_t endpointAddress)[static]

Enables multipacket for the specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutMultipktIsEnabled()

static ALWAYS_INLINE bool USB_EndpointOutMultipktIsEnabled (uint8_t endpointAddress)[static]

Checks if multipacket is enabled on the specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- Multipacket disabled

1

- Multipacket enabled

USB_EndpointOutNAKClear()

static ALWAYS_INLINE void USB_EndpointOutNAKClear (uint8_t endpointAddress)[static]

Clears the USB NAK status from the OUT endpoint STATUS register.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutNAKIsSet()

static ALWAYS_INLINE bool USB_EndpointOutNAKIsSet (uint8_t endpointAddress)[static]

Checks the OUT endpoint STATUS register for the NAK status.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- Endpoint is not NAKed

1

- Endpoint is NAKed

USB_EndpointOutNAKSet()

static ALWAYS_INLINE void USB_EndpointOutNAKSet (uint8_t endpointAddress)[static]

Sets OUT endpoint status to NAK.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutOverUnderflowAck()

static ALWAYS_INLINE void USB_EndpointOutOverUnderflowAck (uint8_t endpointAddress)[static]

Acknowledges overflow on the specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutOverUnderflowIsSet()

static ALWAYS_INLINE bool USB_EndpointOutOverUnderflowIsSet (uint8_t endpointAddress)[static]

Checks if OUT endpoint has overflowed.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- No overflow on endpoint

1

- Overflow on endpoint

USB_EndpointOutSetupIsReceived()

static ALWAYS_INLINE bool USB_EndpointOutSetupIsReceived (uint8_t endpointAddress)[static]

Checks if the USB OUT endpoint has the Setup Received status.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- No setup received

1

- Setup received

USB_EndpointOutSetupReceivedAck()

static ALWAYS_INLINE void USB_EndpointOutSetupReceivedAck (uint8_t endpointAddress)[static]

Acknowledges the Setup Received status on a specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutStall()

static ALWAYS_INLINE void USB_EndpointOutStall (uint8_t endpointAddress)[static]

Stalls the specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutStallAck()

static ALWAYS_INLINE void USB_EndpointOutStallAck (uint8_t endpointAddress)[static]

Acknowledges that an OUT endpoint is stalled and Clears the USB STATUS register.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutStallClear()

static ALWAYS_INLINE void USB_EndpointOutStallClear (uint8_t endpointAddress)[static]

Stops stalling the specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutStatusClear()

static ALWAYS_INLINE void USB_EndpointOutStatusClear (uint8_t endpointAddress)[static]

Clears OUT endpoint status.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutTransactionCompleteAck()

static ALWAYS_INLINE void USB_EndpointOutTransactionCompleteAck (uint8_t endpointAddress)[static]

Acknowledges the transaction complete status on a specified OUT endpoint and Clears the USB STATUS register.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutTransactionCompleteInterruptDisable()

static ALWAYS_INLINE void USB_EndpointOutTransactionCompleteInterruptDisable (uint8_t endpointAddress)[static]

Disables transaction complete interrupt for the specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutTransactionCompleteInterruptEnable()

static ALWAYS_INLINE void USB_EndpointOutTransactionCompleteInterruptEnable (uint8_t endpointAddress)[static]

Enables transaction complete interrupt for the specified OUT endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_EndpointOutTransactionIsComplete()

static ALWAYS_INLINE bool USB_EndpointOutTransactionIsComplete (uint8_t endpointAddress)[static]

Checks if the USB OUT endpoint has the Transaction Complete status.

Parameters:
endpointAddress

- Address of the endpoint

Return values:
0

- Transaction incomplete

1

- Transaction complete

USB_EndPointOutTypeConfigGet()

static ALWAYS_INLINE uint8_t USB_EndPointOutTypeConfigGet (uint8_t endpointAddress)[static]

Gets the OUT endpoint configuration at the given address.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

Endpoint configuration type

USB_EndpointTableAddressGet()

static ALWAYS_INLINE uint16_t USB_EndpointTableAddressGet (void )[static]

Gets the address of the endpoint table. This is a device-specific function.

Parameters:
None.
Returns:

The address of the endpoint table

USB_EndpointTableAddressReset()

static ALWAYS_INLINE void USB_EndpointTableAddressReset (void )[static]

Sets the address of the endpoint table to 0. This is a device-specific function.

Parameters:
None.
Returns:

None.

USB_EndpointTableAddressSet()

static ALWAYS_INLINE void USB_EndpointTableAddressSet (USB_EP_PAIR_t * endpointTableAddress)[static]

Sets the address of the endpoint table. This is a device-specific function.

Parameters:
endpointTableAddress

- Address of the endpoint table

Returns:

None.

USB_FifoDisable()

static ALWAYS_INLINE void USB_FifoDisable (void )[static]

Disables USB FIFO.

This is a device-specific function.

Parameters:
None.
Returns:

None.

USB_FifoEnable()

static ALWAYS_INLINE void USB_FifoEnable (void )[static]

Enables USB FIFO.

This is a device-specific function.

Parameters:
None.
Returns:

None.

USB_FifoIsEnable()

static ALWAYS_INLINE bool USB_FifoIsEnable (void )[static]

Checks if USB FIFO has been enabled.

This is a device-specific function.

Parameters:
None.
Return values:
0

- USB FIFO is not enabled

1

- USB FIFO is enabled

USB_FifoReadPointerGet()

static ALWAYS_INLINE int8_t USB_FifoReadPointerGet (void )[static]

Gets the read FIFO pointer. This is a device-specific function.

Parameters:
None.
Returns:

The FIFO read pointer

USB_FifoReadPointerReset()

static ALWAYS_INLINE void USB_FifoReadPointerReset (void )[static]

Resets the read FIFO pointer. This is a device-specific function.

Parameters:
None.
Returns:

None.

USB_FifoWritePointerGet()

static ALWAYS_INLINE int8_t USB_FifoWritePointerGet (void )[static]

Gets the write FIFO pointer. This is a device-specific function.

Parameters:
None.
Returns:

The FIFO write pointer

USB_FifoWritePointerReset()

static ALWAYS_INLINE void USB_FifoWritePointerReset (void )[static]

Resets the write FIFO pointer. This is a device-specific function.

Parameters:
None.
Returns:

None.

USB_FrameNumDisable()

static ALWAYS_INLINE void USB_FrameNumDisable (void )[static]

Disables storing the last SOF token frame number in FRAMENUM. This is a device-specific function.

Parameters:
None.
Returns:

None.

USB_FrameNumEnable()

static ALWAYS_INLINE void USB_FrameNumEnable (void )[static]

Enables storing the last SOF token frame number in FRAMENUM. This is a device-specific function.

Parameters:
None.
Returns:

None.

USB_FrameNumIsEnable()

static ALWAYS_INLINE bool USB_FrameNumIsEnable (void )[static]

Checks if storing of the last SOF token frame number is enabled. This is a device-specific function.

Parameters:
None.
Return values:
0

- Storing the last SOF token frame number in FRAMENUM is disabled

1

- Storing the last SOF token frame number in FRAMENUM is enabled

USB_GlobalNAKDisable()

static ALWAYS_INLINE void USB_GlobalNAKDisable (void )[static]

Disables global NAK.

Parameters:
None.
Returns:

None.

USB_GlobalNAKDoneInterruptAck()

static ALWAYS_INLINE void USB_GlobalNAKDoneInterruptAck (void )[static]

Clears the USB Global NAK Done Interrupt flag.

Parameters:
None.
Returns:

None.

USB_GlobalNAKDoneInterruptDisable()

static ALWAYS_INLINE void USB_GlobalNAKDoneInterruptDisable (void )[static]

Disables the USB Global NAK Done interrupt.

Parameters:
None.
Returns:

None.

USB_GlobalNAKDoneInterruptEnable()

static ALWAYS_INLINE void USB_GlobalNAKDoneInterruptEnable (void )[static]

Enables the USB Global NAK Done interrupt.

Parameters:
None.
Returns:

None.

USB_GlobalNAKDoneInterruptIs()

static ALWAYS_INLINE bool USB_GlobalNAKDoneInterruptIs (void )[static]

Checks if the USB Global NAK Done interrupt has been triggered.

Parameters:
None.
Return values:
0

- Interrupt not triggered

1

- Interrupt triggered

USB_GlobalNAKEnable()

static ALWAYS_INLINE void USB_GlobalNAKEnable (void )[static]

Enables global NAK.

Parameters:
None.
Returns:

None.

USB_GlobalNAKIsEnable()

static ALWAYS_INLINE bool USB_GlobalNAKIsEnable (void )[static]

Checks the global NAK setting.

Parameters:
None.
Return values:
0

- Global NAK is disabled

1

- Global NAK is enabled

USB_InterruptFlagsClear()

static ALWAYS_INLINE void USB_InterruptFlagsClear (void )[static]

Clears all the USB Interrupt flags.

Parameters:
None.
Returns:

None.

USB_IsEnable()

static ALWAYS_INLINE bool USB_IsEnable (void )[static]

Checks if the USB peripheral is enabled.

Parameters:
None.
Return values:
0

- USB peripheral not enabled

1

- USB peripheral enabled

USB_MaxEndpointsGet()

static ALWAYS_INLINE uint8_t USB_MaxEndpointsGet (void )[static]

Checks what the maximum number of endpoint addresses is.

Parameters:
None.
Returns:

Last accessible endpoint

USB_MaxEndpointsReset()

static ALWAYS_INLINE void USB_MaxEndpointsReset (void )[static]

Clears the USB endpoint maximum, setting the maximum endpoint to EP0.

Parameters:
None.
Returns:

None.

USB_MaxEndpointsSet()

static ALWAYS_INLINE void USB_MaxEndpointsSet (uint8_t maxEndpoint)[static]

Sets maximum number of endpoint addresses used by the USB peripheral.

Parameters:
maxEndpoint

- Last accessible endpoint

Returns:

None.

USB_NumberBytesReceivedGet()

static ALWAYS_INLINE uint16_t USB_NumberBytesReceivedGet (uint8_t endpointAddress)[static]

Gets how many bytes of data have been received on a specified endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

Amount of bytes expected

USB_NumberBytesReceivedReset()

static ALWAYS_INLINE void USB_NumberBytesReceivedReset (uint8_t endpointAddress)[static]

Resets the counter that counts amount of bytes of data received on a specific endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_NumberBytesSentGet()

static ALWAYS_INLINE uint16_t USB_NumberBytesSentGet (uint8_t endpointAddress)[static]

Reads out how many bytes have been sent from the specified endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

Amount of bytes that have been sent

USB_NumberBytesSentReset()

static ALWAYS_INLINE void USB_NumberBytesSentReset (uint8_t endpointAddress)[static]

Clears the MCNT register that keeps track of how many bytes of data have been sent.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_NumberBytesToReceiveGet()

static ALWAYS_INLINE uint16_t USB_NumberBytesToReceiveGet (uint8_t endpointAddress)[static]

Gets how many bytes of data are expected to be received on a specified endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

Amount of bytes expected

USB_NumberBytesToReceiveReset()

static ALWAYS_INLINE void USB_NumberBytesToReceiveReset (uint8_t endpointAddress)[static]

Clears the MCNT register to tell the peripheral no data is intended to be received on the specified endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_NumberBytesToReceiveSet()

static ALWAYS_INLINE void USB_NumberBytesToReceiveSet (uint8_t endpointAddress, uint16_t numberBytes)[static]

Sets how many bytes of data are expected to be received on a specified endpoint.

Parameters:
endpointAddress

- Address of the endpoint

numberBytes

- The amount of bytes to receive

Returns:

None.

USB_NumberBytesToSendGet()

static ALWAYS_INLINE uint16_t USB_NumberBytesToSendGet (uint8_t endpointAddress)[static]

Reads out the CNT register to know how many bytes of data are intended to be sent from the specified endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

Amount of bytes to send

USB_NumberBytesToSendReset()

static ALWAYS_INLINE void USB_NumberBytesToSendReset (uint8_t endpointAddress)[static]

Clears the CNT register to tell the peripheral no data is intended to be sent from the specified endpoint.

Parameters:
endpointAddress

- Address of the endpoint

Returns:

None.

USB_NumberBytesToSendSet()

static ALWAYS_INLINE void USB_NumberBytesToSendSet (uint8_t endpointAddress, uint16_t numberBytes)[static]

Sets how many bytes of data are intended to be sent from the specified endpoint.

Parameters:
endpointAddress

- Address of the endpoint

numberBytes

- Amount of bytes to send

Returns:

None.

USB_OverflowInterruptClear()

static ALWAYS_INLINE void USB_OverflowInterruptClear (void )[static]

Clears the USB Overflow Interrupt flag.

Parameters:
None.
Returns:

None.

USB_OverflowInterruptDisable()

static ALWAYS_INLINE void USB_OverflowInterruptDisable (void )[static]

Disables the USB Overflow interrupt.

Parameters:
None.
Returns:

None.

USB_OverflowInterruptEnable()

static ALWAYS_INLINE void USB_OverflowInterruptEnable (void )[static]

Enables the USB Overflow interrupt.

Parameters:
None.
Returns:

None.

USB_OverflowInterruptIs()

static ALWAYS_INLINE bool USB_OverflowInterruptIs (void )[static]

Checks if an Overflow interrupt has been triggered.

Parameters:
None.
Return values:
0

- Interrupt not triggered

1

- Interrupt triggered

USB_ReadModifyWriteInterruptIs()

static ALWAYS_INLINE bool USB_ReadModifyWriteInterruptIs (void )[static]

Checks if the USB Read-Modify-Write Interrupt is enabled.

Parameters:
None.
Return values:
0

- Interrupt not enabled

1

- Interrupt enabled

USB_ResetInterruptClear()

static ALWAYS_INLINE void USB_ResetInterruptClear (void )[static]

Clears the USB Reset Interrupt flag.

Parameters:
None.
Returns:

None.

USB_ResetInterruptDisable()

static ALWAYS_INLINE void USB_ResetInterruptDisable (void )[static]

Disables the USB Reset interrupt.

Parameters:
None.
Returns:

None.

USB_ResetInterruptEnable()

static ALWAYS_INLINE void USB_ResetInterruptEnable (void )[static]

Enables the USB Reset interrupt.

Parameters:
None.
Returns:

None.

USB_ResetInterruptIs()

static ALWAYS_INLINE bool USB_ResetInterruptIs (void )[static]

Checks if the USB Reset interrupt has been triggered.

Parameters:
None.
Return values:
0

- Interrupt not triggered

1

- Interrupt triggered

USB_ResumeInterruptClear()

static ALWAYS_INLINE void USB_ResumeInterruptClear (void )[static]

Clears the USB Resume Interrupt flag.

Parameters:
None.
Returns:

None.

USB_ResumeInterruptDisable()

static ALWAYS_INLINE void USB_ResumeInterruptDisable (void )[static]

Disables the USB Resume interrupt.

Parameters:
None.
Returns:

None.

USB_ResumeInterruptEnable()

static ALWAYS_INLINE void USB_ResumeInterruptEnable (void )[static]

Enables the USB Resume interrupt.

Parameters:
None.
Returns:

None.

USB_ResumeInterruptIs()

static ALWAYS_INLINE bool USB_ResumeInterruptIs (void )[static]

Checks if the USB Resume interrupt has been triggered.

Parameters:
None.
Return values:
0

- Interrupt not triggered

1

- Interrupt triggered

USB_SetupInterruptClear()

static ALWAYS_INLINE void USB_SetupInterruptClear (void )[static]

Clears the USB Setup Interrupt flag.

Parameters:
None.
Returns:

None.

USB_SetupInterruptDisable()

static ALWAYS_INLINE void USB_SetupInterruptDisable (void )[static]

Disables the USB Setup interrupt.

Parameters:
None.
Returns:

None.

USB_SetupInterruptEnable()

static ALWAYS_INLINE void USB_SetupInterruptEnable (void )[static]

Enables the USB Setup interrupt.

Parameters:
None.
Returns:

None.

USB_SetupInterruptIs()

static ALWAYS_INLINE bool USB_SetupInterruptIs (void )[static]

Checks if a USB Setup interrupt has been triggered.

Parameters:
None.
Return values:
0

- Interrupt not triggered

1

- Interrupt triggered

USB_SOFInterruptClear()

static ALWAYS_INLINE void USB_SOFInterruptClear (void )[static]

Clears the USB Start-Of-Frame Interrupt flag.

Parameters:
None.
Returns:

None.

USB_SOFInterruptDisable()

static ALWAYS_INLINE void USB_SOFInterruptDisable (void )[static]

Disables the USB Start-Of-Frame interrupt.

Parameters:
None.
Returns:

None.

USB_SOFInterruptEnable()

static ALWAYS_INLINE void USB_SOFInterruptEnable (void )[static]

Enables the USB Start-Of-Frame interrupt.

Parameters:
None.
Returns:

None.

USB_SOFInterruptIs()

static ALWAYS_INLINE bool USB_SOFInterruptIs (void )[static]

Checks if the USB Start-Of-Frame interrupt has been triggered.

Parameters:
None.
Return values:
0

- Interrupt not triggered

1

- Interrupt triggered

USB_StalledInterruptClear()

static ALWAYS_INLINE void USB_StalledInterruptClear (void )[static]

Clears the USB Stalled Interrupt flag.

Parameters:
None.
Returns:

None.

USB_StalledInterruptDisable()

static ALWAYS_INLINE void USB_StalledInterruptDisable (void )[static]

Disables the USB Stalled interrupt.

Parameters:
None.
Returns:

None.

USB_StalledInterruptEnable()

static ALWAYS_INLINE void USB_StalledInterruptEnable (void )[static]

Enables the USB Stalled interrupt.

Parameters:
None.
Returns:

None.

USB_StalledInterruptIs()

static ALWAYS_INLINE bool USB_StalledInterruptIs (void )[static]

Checks if the USB Stalled interrupt has been triggered.

Parameters:
None.
Return values:
0

- Interrupt not triggered

1

- Interrupt triggered

USB_SuspendInterruptClear()

static ALWAYS_INLINE void USB_SuspendInterruptClear (void )[static]

Clears the USB Suspend Interrupt flag.

Parameters:
None.
Returns:

None.

USB_SuspendInterruptDisable()

static ALWAYS_INLINE void USB_SuspendInterruptDisable (void )[static]

Disables the USB Suspend interrupt.

Parameters:
None.
Returns:

None.

USB_SuspendInterruptEnable()

static ALWAYS_INLINE void USB_SuspendInterruptEnable (void )[static]

Enables the USB Suspend interrupt.

Parameters:
None.
Returns:

None.

USB_SuspendInterruptIs()

static ALWAYS_INLINE bool USB_SuspendInterruptIs (void )[static]

Checks if the USB Suspend interrupt has been triggered.

Parameters:
None.
Return values:
0

- Interrupt not triggered

1

- Interrupt triggered

USB_TransactionCompleteInterruptAck()

static ALWAYS_INLINE void USB_TransactionCompleteInterruptAck (void )[static]

Clears the USB Transaction Complete Interrupt flag.

Parameters:
None.
Returns:

None.

USB_TransactionCompleteInterruptDisable()

static ALWAYS_INLINE void USB_TransactionCompleteInterruptDisable (void )[static]

Disables the USB Transaction Complete interrupt.

Parameters:
None.
Returns:

None.

USB_TransactionCompleteInterruptEnable()

static ALWAYS_INLINE void USB_TransactionCompleteInterruptEnable (void )[static]

Enables the USB Transaction Complete interrupt.

Parameters:
None.
Returns:

None.

USB_TransactionCompleteInterruptIs()

static ALWAYS_INLINE bool USB_TransactionCompleteInterruptIs (void )[static]

Checks if a Transaction Complete interrupt has been triggered.

Parameters:
None.
Return values:
0

- Interrupt not triggered

1

- Interrupt triggered

USB_UnderflowInterruptClear()

static ALWAYS_INLINE void USB_UnderflowInterruptClear (void )[static]

Clears the USB Underflow Interrupt flag.

Parameters:
None.
Returns:

None.

USB_UnderflowInterruptDisable()

static ALWAYS_INLINE void USB_UnderflowInterruptDisable (void )[static]

Disables the USB Underflow interrupt.

Parameters:
None.
Returns:

None.

USB_UnderflowInterruptEnable()

static ALWAYS_INLINE void USB_UnderflowInterruptEnable (void )[static]

Enables the USB Underflow interrupt.

Parameters:
None.
Returns:

None.

USB_UnderflowInterruptIs()

static ALWAYS_INLINE bool USB_UnderflowInterruptIs (void )[static]

Checks if an Underflow interrupt has been triggered.

Parameters:
None.
Return values:
0

- Interrupt not triggered

1

- Interrupt triggered

USB_UpstreamResumeEnable()

static ALWAYS_INLINE void USB_UpstreamResumeEnable (void )[static]

Enables an upstream resume to be initated.

Parameters:
None.
Returns:

None.

USB_UpstreamResumeIsEnable()

static ALWAYS_INLINE bool USB_UpstreamResumeIsEnable (void )[static]

Checks if upstream resume is enabled, but not yet initiated.

Parameters:
None.
Return values:
0

- Upstream resume initiated or not enabled

1

- Upstream resume enabled

WaitUntilRMWDone()

static ALWAYS_INLINE void WaitUntilRMWDone (void )[static]

Waits until a Read-Modify-Write operation is done. This blocking wait operation is expected to complete within 14 clock cycles.

Parameters:
None.
Returns:

None.

4.16.5.4 USB Peripheral Endpoint

API module for usb_peripheral_endpoint covering endpoint-related functions.

4.16.5.4.1 Module description

API module for usb_peripheral_endpoint covering endpoint-related functions.

Version: USB Device Stack HAL Driver Version 1.0.0
Definitions
  • #define IsPowerOfTwo(number) ((0u != (number)) && (((number) & ((number)-1u)) == 0u))

    Algorithm to detect if a given number is a power of two. A number is a power of two if it has exactly one '1' in its binary representation. This is true if subtracting '1' from the number and doing an AND operation on the result with the number itself returns 0.

Functions
  • RETURN_CODE_t USB_EndpointConfigure (USB_PIPE_t pipe, uint16_t endpointSize, USB_ENDPOINT_t endpointType)

    Configures the endpoint with the desired settings using the Control and Status Register. Used to set up an endpoint before using it in an application. Sets up all the control register settings by looking up the usb_config.h file and clears the count registers.

  • RETURN_CODE_t USB_EndpointDisable (USB_PIPE_t pipe)

    Disables the endpoint by setting the endpoint type to 0x00.

  • uint16_t USB_EndpointSizeGet (USB_PIPE_t pipe)

    Helper function to return the endpoint size.

  • USB_ENDPOINT_t USB_EndpointTypeGet (USB_PIPE_t pipe)

    Helper function to return the endpoint type.

  • RETURN_CODE_t USB_EndpointStall (USB_PIPE_t pipe)

    Helps stall an endpoint when a command received from the host is invalid or unrecognizable. Used if the host sends data that is not supported by the device.

  • RETURN_CODE_t USB_EndpointStallClear (USB_PIPE_t pipe)

    Helps clear the Stall condition after the device has recovered from an unsupported command from the host. Used to reset stall before the next USB transfer. Used when the host issues a clear HALT/Feature request to reset stall.

  • bool USB_EndpointIsStalled (USB_PIPE_t pipe)

    Helper function to return the endpoint Stall condition.

  • RETURN_CODE_t USB_EndpointStalledConditionAck (USB_PIPE_t pipe)

    Acknowledges the stall status condition by clearing the Stall Status bit. Used to clear the Stall Status bit after a stall has been detected.

  • RETURN_CODE_t USB_DataToggleSet (USB_PIPE_t pipe)

    Sets the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

  • RETURN_CODE_t USB_DataToggleClear (USB_PIPE_t pipe)

    Clears the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

  • RETURN_CODE_t USB_DataToggle (USB_PIPE_t pipe)

    Toggles the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

  • RETURN_CODE_t ConvertEndpointSizeToMask (uint16_t endpointSize, USB_ENDPOINT_t endpointType, uint8_t *endpointMaskPtr)

    Converts an endpoint size in number of bytes into a register setting. Converts the endpoint size bit mask based on the EP_BUFSIZE setting of the endpoint control register.

  • RETURN_CODE_t EndpointBufferSet (USB_PIPE_t pipe, uint8_t *bufAddress)

    Configures the endpoint data buffer to a location in RAM for the next transaction.

Variables
  • USB_ENDPOINT_TABLE_t endpointTable

    SRAM tables for the FIFO and endpoint registers, as well as the FRAMENUM register. Represents the endpoint configuration table based on the number of endpoints in use. This line instantiates an object using the data structure type.

4.16.5.4.2 Definition Documentation

IsPowerOfTwo

#define IsPowerOfTwo( number) ((0u != (number)) && (((number) & ((number)-1u)) == 0u))

Algorithm to detect if a given number is a power of two. A number is a power of two if it has exactly one '1' in its binary representation. This is true if subtracting '1' from the number and doing an AND operation on the result with the number itself returns 0.

Parameters:
number

8-bit unsigned integer

Return values:
True

- The given number is a power of two

False

- The given number is not a power of two

4.16.5.4.3 Function Documentation

ConvertEndpointSizeToMask()

RETURN_CODE_t ConvertEndpointSizeToMask (uint16_t endpointSize, USB_ENDPOINT_t endpointType, uint8_t * endpointMaskPtr)

Converts an endpoint size in number of bytes into a register setting. Converts the endpoint size bit mask based on the EP_BUFSIZE setting of the endpoint control register.

Parameters:
endpointSize

- The size to convert

endpointType

- The endpoint type

endpointMaskPtr

- Pointer to the mask variable to write to

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

EndpointBufferSet()

RETURN_CODE_t EndpointBufferSet (USB_PIPE_t pipe, uint8_t * bufAddress)

Configures the endpoint data buffer to a location in RAM for the next transaction.

Parameters:
pipe

- A combination of endpoint address and direction

bufAddress

- The pointer to the data buffer the endpoint will use

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_DataToggle()

RETURN_CODE_t USB_DataToggle (USB_PIPE_t pipe)

Toggles the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_DataToggleClear()

RETURN_CODE_t USB_DataToggleClear (USB_PIPE_t pipe)

Clears the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_DataToggleSet()

RETURN_CODE_t USB_DataToggleSet (USB_PIPE_t pipe)

Sets the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_EndpointConfigure()

RETURN_CODE_t USB_EndpointConfigure (USB_PIPE_t pipe, uint16_t endpointSize, USB_ENDPOINT_t endpointType)

Configures the endpoint with the desired settings using the Control and Status Register. Used to set up an endpoint before using it in an application. Sets up all the control register settings by looking up the usb_config.h file and clears the count registers.

Parameters:
pipe

- A combination of endpoint address and direction

endpointSize

- Number of bytes of data supported by the endpoint in one USB transaction

endpointType

- Type of USB endpoint as defined by usb_endpoint_type

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_EndpointDisable()

RETURN_CODE_t USB_EndpointDisable (USB_PIPE_t pipe)

Disables the endpoint by setting the endpoint type to 0x00.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_EndpointIsStalled()

bool USB_EndpointIsStalled (USB_PIPE_t pipe)

Helper function to return the endpoint Stall condition.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

A boolean value representing the Stall condition. If the pipe address is out of bounds, the function will always return false

USB_EndpointSizeGet()

uint16_t USB_EndpointSizeGet (USB_PIPE_t pipe)

Helper function to return the endpoint size.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

The size of the endpoint

USB_EndpointStall()

RETURN_CODE_t USB_EndpointStall (USB_PIPE_t pipe)

Helps stall an endpoint when a command received from the host is invalid or unrecognizable. Used if the host sends data that is not supported by the device.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_EndpointStallClear()

RETURN_CODE_t USB_EndpointStallClear (USB_PIPE_t pipe)

Helps clear the Stall condition after the device has recovered from an unsupported command from the host. Used to reset stall before the next USB transfer. Used when the host issues a clear HALT/Feature request to reset stall.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_EndpointStalledConditionAck()

RETURN_CODE_t USB_EndpointStalledConditionAck (USB_PIPE_t pipe)

Acknowledges the stall status condition by clearing the Stall Status bit. Used to clear the Stall Status bit after a stall has been detected.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_EndpointTypeGet()

USB_ENDPOINT_t USB_EndpointTypeGet (USB_PIPE_t pipe)

Helper function to return the endpoint type.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

The endpoint type

4.16.5.4.4 Variable Documentation

endpointTable

USB_ENDPOINT_TABLE_t endpointTable

SRAM tables for the FIFO and endpoint registers, as well as the FRAMENUM register. Represents the endpoint configuration table based on the number of endpoints in use. This line instantiates an object using the data structure type.

4.16.5.5 USB Peripheral Read/Write

API module for usb_peripheral covering low-level USB transaction functions.

4.16.5.5.1 Module description

API module for usb_peripheral covering low-level USB transaction functions.

Version: USB Device Stack HAL Driver Version 1.0.0
Functions
  • RETURN_CODE_t USB_TransactionStart (USB_PIPE_t pipe)

    Starts sending or receiving data on an endpoint by clearing BUSNACK. Used as a final step while setting up a transaction on the bus.

  • RETURN_CODE_t USB_TransactionAbort (USB_PIPE_t pipe)

    Aborts the next transaction on an endpoint by setting BUSNACK. Used to stop exchanging data on an endpoint. The device will start NAKing requests from the host after calling this API.

  • RETURN_CODE_t USB_TransactionCompleteAck (USB_PIPE_t pipe)

    Acknowledges the Transaction Complete status condition by clearing the Transaction Complete status bit. Used to clear the Transaction Complete status bit after a transaction has successfully completed.

  • bool USB_TransactionIsCompleted (void)

    Helper function to return the endpoint transaction complete condition.

  • RETURN_CODE_t USB_TransactionCompletedPipeGet (USB_PIPE_t *pipe)

    Returns the pipe address and direction for the latest completed transaction.

  • RETURN_CODE_t USB_PipeReset (USB_PIPE_t pipe)

    Resets the pipe.

  • USB_TRANSFER_STATUS_t USB_PipeStatusGet (USB_PIPE_t pipe)

    Gets the current status of pipe.

  • bool USB_PipeStatusIsBusy (USB_PIPE_t pipe)

    Checks if the pipe status is busy.

  • void USB_PipeDataPtrSet (USB_PIPE_t pipe, uint8_t *dataPtr)

    Configures the pointer for the data transfer in a given pipe.

  • uint8_t * USB_PipeDataPtrGet (USB_PIPE_t pipe)

    Gets the current data pointer for a given pipe.

  • void USB_PipeDataToTransferSizeSet (USB_PIPE_t pipe, uint16_t dataSize)

    Sets the size of pipe data to transfer.

  • uint16_t USB_PipeDataToTransferSizeGet (USB_PIPE_t pipe)

    Gets the size of pipe data to transfer.

  • uint16_t USB_PipeDataTransferredSizeGet (USB_PIPE_t pipe)

    Gets the size of the transferred pipe data.

  • void USB_PipeDataTransferredSizeSet (USB_PIPE_t pipe, uint16_t dataSize)

    Sets the size of the transferred pipe data.

  • void USB_PipeDataTransferredSizeReset (USB_PIPE_t pipe)

    Resets the size of transferred pipe data.

  • void USB_PipeTransferZLP_Enable (USB_PIPE_t pipe)

    Enables a ZLP on a transfer. It is enabled by default if the AZLP static config is enabled for the pipe.

  • void USB_PipeTransferEndCallbackRegister (USB_PIPE_t pipe, USB_TRANSFER_END_CALLBACK_t callback)

    Sets the callback for transfer end.

  • void USB_PipeTransferEndCallback (USB_PIPE_t pipe)

    Calls the callback for transfer end.

  • RETURN_CODE_t USB_InTransactionRun (USB_PIPE_t pipe)

    Checks the correctness of IN transactions and runs them.

  • RETURN_CODE_t USB_OutTransactionRun (USB_PIPE_t pipe)

    Checks the correctness OUT transactions and runs them.

  • RETURN_CODE_t USB_PipeTransactionComplete (USB_PIPE_t pipe)

    Handles completed IN and OUT transactions. Processes the completed transaction and either completes the transfer or runs the next transaction. Will call the pipe transferEndCallback at the end of transfer, if configured.

4.16.5.5.2 Function Documentation

USB_InTransactionRun()

RETURN_CODE_t USB_InTransactionRun (USB_PIPE_t pipe)

Checks the correctness of IN transactions and runs them.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_OutTransactionRun()

RETURN_CODE_t USB_OutTransactionRun (USB_PIPE_t pipe)

Checks the correctness OUT transactions and runs them.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_PipeDataPtrGet()

uint8_t* USB_PipeDataPtrGet (USB_PIPE_t pipe)

Gets the current data pointer for a given pipe.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

The pointer to the data location

USB_PipeDataPtrSet()

void USB_PipeDataPtrSet (USB_PIPE_t pipe, uint8_t * dataPtr)

Configures the pointer for the data transfer in a given pipe.

Parameters:
pipe

- A combination of endpoint address and direction

*dataPtr

- The pointer to the data location

Returns:

None.

USB_PipeDataToTransferSizeGet()

uint16_t USB_PipeDataToTransferSizeGet (USB_PIPE_t pipe)

Gets the size of pipe data to transfer.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

The size of pipe data to transfer

USB_PipeDataToTransferSizeSet()

void USB_PipeDataToTransferSizeSet (USB_PIPE_t pipe, uint16_t dataSize)

Sets the size of pipe data to transfer.

Parameters:
pipe

- A combination of endpoint address and direction

dataSize

- The size of pipe data to transfer

Returns:

None.

USB_PipeDataTransferredSizeGet()

uint16_t USB_PipeDataTransferredSizeGet (USB_PIPE_t pipe)

Gets the size of the transferred pipe data.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

The size of transferred pipe data

USB_PipeDataTransferredSizeReset()

void USB_PipeDataTransferredSizeReset (USB_PIPE_t pipe)

Resets the size of transferred pipe data.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

None.

USB_PipeDataTransferredSizeSet()

void USB_PipeDataTransferredSizeSet (USB_PIPE_t pipe, uint16_t dataSize)

Sets the size of the transferred pipe data.

Parameters:
pipe

- A combination of endpoint address and direction

dataSize

- The size of pipe data transferred

Returns:

None.

USB_PipeReset()

RETURN_CODE_t USB_PipeReset (USB_PIPE_t pipe)

Resets the pipe.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_PipeStatusGet()

USB_TRANSFER_STATUS_t USB_PipeStatusGet (USB_PIPE_t pipe)

Gets the current status of pipe.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

USB_PIPE_TRANSFER_OK or an Error code according to USB_TRANSFER_STATUS_t

USB_PipeStatusIsBusy()

bool USB_PipeStatusIsBusy (USB_PIPE_t pipe)

Checks if the pipe status is busy.

Parameters:
pipe

- A combination of endpoint address and direction

Return values:
0

- Pipe status not busy

1

- Pipe status is busy

USB_PipeTransactionComplete()

RETURN_CODE_t USB_PipeTransactionComplete (USB_PIPE_t pipe)

Handles completed IN and OUT transactions. Processes the completed transaction and either completes the transfer or runs the next transaction. Will call the pipe transferEndCallback at the end of transfer, if configured.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_PipeTransferEndCallback()

void USB_PipeTransferEndCallback (USB_PIPE_t pipe)

Calls the callback for transfer end.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

None.

USB_PipeTransferEndCallbackRegister()

void USB_PipeTransferEndCallbackRegister (USB_PIPE_t pipe, USB_TRANSFER_END_CALLBACK_t callback)

Sets the callback for transfer end.

Parameters:
pipe

- A combination of endpoint address and direction

callback

- A combination of pipe, status and transferred bytes

Returns:

None.

USB_PipeTransferZLP_Enable()

void USB_PipeTransferZLP_Enable (USB_PIPE_t pipe)

Enables a ZLP on a transfer. It is enabled by default if the AZLP static config is enabled for the pipe.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

None.

USB_TransactionAbort()

RETURN_CODE_t USB_TransactionAbort (USB_PIPE_t pipe)

Aborts the next transaction on an endpoint by setting BUSNACK. Used to stop exchanging data on an endpoint. The device will start NAKing requests from the host after calling this API.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_TransactionCompleteAck()

RETURN_CODE_t USB_TransactionCompleteAck (USB_PIPE_t pipe)

Acknowledges the Transaction Complete status condition by clearing the Transaction Complete status bit. Used to clear the Transaction Complete status bit after a transaction has successfully completed.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_TransactionCompletedPipeGet()

RETURN_CODE_t USB_TransactionCompletedPipeGet (USB_PIPE_t * pipe)

Returns the pipe address and direction for the latest completed transaction.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_TransactionIsCompleted()

bool USB_TransactionIsCompleted (void )

Helper function to return the endpoint transaction complete condition.

Parameters:
None.
Return values:
0

- Transaction not complete or pipe address is out of bounds

1

- Transaction is complete

USB_TransactionStart()

RETURN_CODE_t USB_TransactionStart (USB_PIPE_t pipe)

Starts sending or receiving data on an endpoint by clearing BUSNACK. Used as a final step while setting up a transaction on the bus.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

4.16.6 Data Structure Documentation

4.16.6.1 USB_CONTROL_TRANSFER_struct Struct Reference

#include <usb_peripheral.h>

4.16.6.1.2 Field Documentation

The documentation for this struct was generated from the following file:

source/

usb_peripheral.h

buffer

uint8_t buffer[64]

Default buffer for control data transfers

endOfRequestCallback

USB_SETUP_ENDOFREQUEST_CALLBACK_t endOfRequestCallback

Callback to call when a setup request is complete

overUnderRunCallback

USB_SETUP_OVERUNDERRUN_CALLBACK_t overUnderRunCallback

Callback to call on a control overrun or underrun

processSetupCallback

USB_SETUP_PROCESS_CALLBACK_t processSetupCallback

Callback to call during setup process

setupRequest

USB_SETUP_REQUEST_t setupRequest

Setup request packet

status

volatile USB_CONTROL_STATUS_t status

The status of a transfer on this pipe

totalBytesTransferred

uint16_t totalBytesTransferred

Number of data transfered last transaction

transferDataPtr

uint8_t* transferDataPtr

Location in RAM to send or fill during transfer

transferDataSize

uint16_t transferDataSize

Number of bytes to transfer to or from RAM location

4.16.6.2 USB_CONTROL_TRANSFER_t Struct Reference

The data structure for internally handling control transfers, either IN or OUT.

4.16.6.2.1 Detailed Description

The data structure for internally handling control transfers, either IN or OUT.

#include <usb_peripheral.h>

The documentation for this struct was generated from the following file:

source/

usb_peripheral.h

4.16.6.3 USB_ENDPOINT_TABLE_struct Struct Reference

Represents the endpoint configuration table based on the number of endpoints in use. The table data structure is defined by USB_EP_TABLE_struct in the device header file, modified to support configuration of size from USB_EP_NUM.

4.16.6.3.1 Detailed Description

Represents the endpoint configuration table based on the number of endpoints in use. The table data structure is defined by USB_EP_TABLE_struct in the device header file, modified to support configuration of size from USB_EP_NUM.

#include <usb_peripheral_avr_du.h>

Data Fields
  • register8_t FIFO [USB_EP_NUM *2u]

  • USB_EP_PAIR_t EP [USB_EP_NUM]

  • register16_t FRAMENUM

4.16.6.3.2 Field Documentation

The documentation for this struct was generated from the following file:

source/

usb_peripheral_avr_du.h

EP

USB_EP_PAIR_t EP[USB_EP_NUM]

USB Endpoint Register Pairs

FIFO

register8_t FIFO[USB_EP_NUM *2u]

FIFO Entry

FRAMENUM

register16_t FRAMENUM

Frame Number

4.16.6.4 USB_PIPE_TRANSFER_struct Struct Reference

Represents a transfer created for a pipe, either IN or OUT.

4.16.6.4.2 Field Documentation

The documentation for this struct was generated from the following file:

source/

usb_peripheral_avr_du.h

bytesTransferred

uint16_t bytesTransferred

Total number of data transfered

reserved

uint8_t reserved

These bits are unused

status

USB_TRANSFER_STATUS_t status

The status of a transfer on this pipe

transferDataPtr

uint8_t* transferDataPtr

Location in RAM to send or fill during transfer

transferDataSize

uint16_t transferDataSize

Number of bytes to transfer to or from the RAM location

transferEndCallback

USB_TRANSFER_END_CALLBACK_t transferEndCallback

Callback to call at the end of transfer when transfer_data_size == bytes_transfered, NULL if not used

ZLPEnable

uint8_t ZLPEnable

A Zero Length Packet (ZLP) is enabled for the end of this transfer if the transfer size is a multiple of endpoint size

4.16.7 File Documentation

4.16.7.1 source/usb0.c File Reference

This file contains the API implementations for the USB0 driver.

#include <stddef.h>
#include "../usb0.h"
#include "../../system/syscfg.h"
#include "../../system/utils/compiler.h"

4.16.7.1.1 Functions

4.16.7.1.3 Detailed Description

This file contains the API implementations for the USB0 driver.

USB0 Generated Driver File

Version: USB0 Driver Version 1.0.0

4.16.7.1.4 Function Documentation

ISR()[1/2]

ISR (USB0_BUSEVENT_vect )

ISR()[2/2]

ISR (USB0_TRNCOMPL_vect )

USB0_DefaultBusEventCallback()

static void USB0_DefaultBusEventCallback (void )[static]

USB0_DefaultTrnComplCallback()

static void USB0_DefaultTrnComplCallback (void )[static]

4.16.7.1.5 Variable Documentation

USB0_BusEvent_isr_cb

void(* USB0_BusEvent_isr_cb) (void) = &USB0_DefaultBusEventCallback[static]

USB0_TrnCompl_isr_cb

void(* USB0_TrnCompl_isr_cb) (void) = &USB0_DefaultTrnComplCallback[static]

4.16.7.2 source/usb0.h File Reference

4.16.7.2.2 Typedefs

  • typedef void(* USB_cb_t) (void)

    Data type for the interrupt handlers called by USB. The default value is set to NULL which means that no callback function will be used.

4.16.7.2.3 Detailed Description

USB0 Generated Driver API Header File

4.16.7.3 source/usb_peripheral.c File Reference

Interface for a usb_peripheral module that needs to be implemented by a device specific USB module driver.

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <usb_common_elements.h>
#include <usb_config.h>
#include <usb_peripheral.h>
#include <usb_peripheral_avr_du.h>
#include <usb_protocol_headers.h>

4.16.7.3.1 Functions

4.16.7.3.3 Detailed Description

Interface for a usb_peripheral module that needs to be implemented by a device specific USB module driver.

USBPERIPHERAL Peripheral Source File

Version: USB Device Stack HAL Driver Version 1.0.0

4.16.7.3.4 Variable Documentation

controlTransfer

STATIC USB_CONTROL_TRANSFER_t controlTransfer = { .transferDataPtr = controlTransfer.buffer }

4.16.7.4 source/usb_peripheral.h File Reference

#include <stdbool.h>
#include <stdint.h>
#include <usb_common_elements.h>
#include <usb_peripheral_endpoint.h>
#include <usb_peripheral_read_write.h>
#include <usb_protocol_headers.h>

4.16.7.4.2 Functions

4.16.7.4.4 Detailed Description

USBPERIPHERAL Peripheral Header File

4.16.7.4.5 Typedef Documentation

USB_CONTROL_TRANSFER_t

typedef struct USB_CONTROL_TRANSFER_struct USB_CONTROL_TRANSFER_t

4.16.7.5 source/usb_peripheral_avr_du.h File Reference

#include <avr/io.h>
#include <usb_config.h>
#include <usb_protocol_headers.h>

4.16.7.5.1 Data structures

  • struct USB_ENDPOINT_TABLE_struct

    Represents the endpoint configuration table based on the number of endpoints in use. The table data structure is defined by USB_EP_TABLE_struct in the device header file, modified to support configuration of size from USB_EP_NUM.

  • struct USB_PIPE_TRANSFER_struct

    Represents a transfer created for a pipe, either IN or OUT.

4.16.7.5.2 Functions

4.16.7.5.3 Macros

  • #define ALWAYS_INLINE __attribute__((always_inline)) inline

    Alias that makes always inline function definitions more readable.

4.16.7.5.5 Variables

  • USB_ENDPOINT_TABLE_t endpointTable

    SRAM tables for the FIFO and endpoint registers, as well as the FRAMENUM register. Represents the endpoint configuration table based on the number of endpoints in use. This line instantiates an object using the data structure type.

4.16.7.5.6 Detailed Description

USBPERIPHERALAVRDU Peripheral AVR DU Specific Header File

4.16.7.5.7 Typedef Documentation

USB_ENDPOINT_TABLE_t

typedef struct USB_ENDPOINT_TABLE_struct USB_ENDPOINT_TABLE_t

USB_PIPE_TRANSFER_t

typedef struct USB_PIPE_TRANSFER_struct USB_PIPE_TRANSFER_t

4.16.7.6 source/usb_peripheral_endpoint.c File Reference

API module for usb_peripheral covering endpoint related functions.

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <usb_common_elements.h>
#include <usb_config.h>
#include <usb_peripheral_avr_du.h>
#include <usb_peripheral_endpoint.h>
#include <usb_protocol_headers.h>

4.16.7.6.1 Functions

  • RETURN_CODE_t USB_EndpointConfigure (USB_PIPE_t pipe, uint16_t endpointSize, USB_ENDPOINT_t endpointType)

    Configures the endpoint with the desired settings using the Control and Status Register. Used to set up an endpoint before using it in an application. Sets up all the control register settings by looking up the usb_config.h file and clears the count registers.

  • RETURN_CODE_t USB_EndpointDisable (USB_PIPE_t pipe)

    Disables the endpoint by setting the endpoint type to 0x00.

  • uint16_t USB_EndpointSizeGet (USB_PIPE_t pipe)

    Helper function to return the endpoint size.

  • USB_ENDPOINT_t USB_EndpointTypeGet (USB_PIPE_t pipe)

    Helper function to return the endpoint type.

  • RETURN_CODE_t USB_EndpointStall (USB_PIPE_t pipe)

    Helps stall an endpoint when a command received from the host is invalid or unrecognizable. Used if the host sends data that is not supported by the device.

  • RETURN_CODE_t USB_EndpointStallClear (USB_PIPE_t pipe)

    Helps clear the Stall condition after the device has recovered from an unsupported command from the host. Used to reset stall before the next USB transfer. Used when the host issues a clear HALT/Feature request to reset stall.

  • bool USB_EndpointIsStalled (USB_PIPE_t pipe)

    Helper function to return the endpoint Stall condition.

  • RETURN_CODE_t USB_EndpointStalledConditionAck (USB_PIPE_t pipe)

    Acknowledges the stall status condition by clearing the Stall Status bit. Used to clear the Stall Status bit after a stall has been detected.

  • RETURN_CODE_t USB_DataToggleSet (USB_PIPE_t pipe)

    Sets the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

  • RETURN_CODE_t USB_DataToggleClear (USB_PIPE_t pipe)

    Clears the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

  • RETURN_CODE_t USB_DataToggle (USB_PIPE_t pipe)

    Toggles the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

  • RETURN_CODE_t ConvertEndpointSizeToMask (uint16_t endpointSize, USB_ENDPOINT_t endpointType, uint8_t *endpointMaskPtr)

    Converts an endpoint size in number of bytes into a register setting. Converts the endpoint size bit mask based on the EP_BUFSIZE setting of the endpoint control register.

  • RETURN_CODE_t EndpointBufferSet (USB_PIPE_t pipe, uint8_t *bufAddress)

    Configures the endpoint data buffer to a location in RAM for the next transaction.

4.16.7.6.2 Macros

  • #define IsPowerOfTwo(number) ((0u != (number)) && (((number) & ((number)-1u)) == 0u))

    Algorithm to detect if a given number is a power of two. A number is a power of two if it has exactly one '1' in its binary representation. This is true if subtracting '1' from the number and doing an AND operation on the result with the number itself returns 0.

4.16.7.6.3 Variables

  • USB_ENDPOINT_TABLE_t endpointTable

    SRAM tables for the FIFO and endpoint registers, as well as the FRAMENUM register. Represents the endpoint configuration table based on the number of endpoints in use. This line instantiates an object using the data structure type.

4.16.7.6.4 Detailed Description

API module for usb_peripheral covering endpoint related functions.

USBPERIPHERALENDPOINT Peripheral Endpoint Source File

Version: USB Device Stack HAL Driver Version 1.0.0

4.16.7.7 source/usb_peripheral_endpoint.h File Reference

#include <stdbool.h>
#include <stdint.h>
#include "usb_common_elements.h"
#include "usb_protocol_headers.h"

4.16.7.7.1 Functions

  • RETURN_CODE_t USB_EndpointConfigure (USB_PIPE_t pipe, uint16_t endpointSize, USB_ENDPOINT_t endpointType)

    Configures the endpoint with the desired settings using the Control and Status Register. Used to set up an endpoint before using it in an application. Sets up all the control register settings by looking up the usb_config.h file and clears the count registers.

  • RETURN_CODE_t USB_EndpointDisable (USB_PIPE_t pipe)

    Disables the endpoint by setting the endpoint type to 0x00.

  • uint16_t USB_EndpointSizeGet (USB_PIPE_t pipe)

    Helper function to return the endpoint size.

  • USB_ENDPOINT_t USB_EndpointTypeGet (USB_PIPE_t pipe)

    Helper function to return the endpoint type.

  • RETURN_CODE_t USB_EndpointStall (USB_PIPE_t pipe)

    Helps stall an endpoint when a command received from the host is invalid or unrecognizable. Used if the host sends data that is not supported by the device.

  • RETURN_CODE_t USB_EndpointStallClear (USB_PIPE_t pipe)

    Helps clear the Stall condition after the device has recovered from an unsupported command from the host. Used to reset stall before the next USB transfer. Used when the host issues a clear HALT/Feature request to reset stall.

  • bool USB_EndpointIsStalled (USB_PIPE_t pipe)

    Helper function to return the endpoint Stall condition.

  • RETURN_CODE_t USB_EndpointStalledConditionAck (USB_PIPE_t pipe)

    Acknowledges the stall status condition by clearing the Stall Status bit. Used to clear the Stall Status bit after a stall has been detected.

  • RETURN_CODE_t USB_DataToggleSet (USB_PIPE_t pipe)

    Sets the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

  • RETURN_CODE_t USB_DataToggleClear (USB_PIPE_t pipe)

    Clears the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

  • RETURN_CODE_t USB_DataToggle (USB_PIPE_t pipe)

    Toggles the Data Toggle bit on an endpoint which is used to ensure correct data sequence. Only used if hardware data toggling is not available. After a successful transaction, toggle the Data Toggle bit. For SETUP transactions, ensure that the SETUP stage clears the Data Toggle bit, while the data stage and status stage set the Data Toggle bit.

  • RETURN_CODE_t ConvertEndpointSizeToMask (uint16_t endpointSize, USB_ENDPOINT_t endpointType, uint8_t *endpointMaskPtr)

    Converts an endpoint size in number of bytes into a register setting. Converts the endpoint size bit mask based on the EP_BUFSIZE setting of the endpoint control register.

  • RETURN_CODE_t EndpointBufferSet (USB_PIPE_t pipe, uint8_t *bufAddress)

    Configures the endpoint data buffer to a location in RAM for the next transaction.

4.16.7.7.2 Detailed Description

USBPERIPHERALENDPOINT Peripheral Endpoint Header File

4.16.7.8 source/usb_peripheral_read_write.c File Reference

API module for usb_peripheral covering low level USB transaction functions.

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <usb_common_elements.h>
#include <usb_config.h>
#include <usb_peripheral_avr_du.h>
#include <usb_peripheral_endpoint.h>
#include <usb_peripheral_read_write.h>
#include <usb_protocol_headers.h>

4.16.7.8.1 Functions

  • RETURN_CODE_t USB_TransactionStart (USB_PIPE_t pipe)

    Starts sending or receiving data on an endpoint by clearing BUSNACK. Used as a final step while setting up a transaction on the bus.

  • RETURN_CODE_t USB_TransactionAbort (USB_PIPE_t pipe)

    Aborts the next transaction on an endpoint by setting BUSNACK. Used to stop exchanging data on an endpoint. The device will start NAKing requests from the host after calling this API.

  • RETURN_CODE_t USB_TransactionCompleteAck (USB_PIPE_t pipe)

    Acknowledges the Transaction Complete status condition by clearing the Transaction Complete status bit. Used to clear the Transaction Complete status bit after a transaction has successfully completed.

  • bool USB_TransactionIsCompleted (void)

    Helper function to return the endpoint transaction complete condition.

  • RETURN_CODE_t USB_TransactionCompletedPipeGet (USB_PIPE_t *pipe)

    Returns the pipe address and direction for the latest completed transaction.

  • RETURN_CODE_t USB_PipeReset (USB_PIPE_t pipe)

    Resets the pipe.

  • USB_TRANSFER_STATUS_t USB_PipeStatusGet (USB_PIPE_t pipe)

    Gets the current status of pipe.

  • bool USB_PipeStatusIsBusy (USB_PIPE_t pipe)

    Checks if the pipe status is busy.

  • void USB_PipeDataPtrSet (USB_PIPE_t pipe, uint8_t *dataPtr)

    Configures the pointer for the data transfer in a given pipe.

  • uint8_t * USB_PipeDataPtrGet (USB_PIPE_t pipe)

    Gets the current data pointer for a given pipe.

  • void USB_PipeDataToTransferSizeSet (USB_PIPE_t pipe, uint16_t dataSize)

    Sets the size of pipe data to transfer.

  • uint16_t USB_PipeDataToTransferSizeGet (USB_PIPE_t pipe)

    Gets the size of pipe data to transfer.

  • uint16_t USB_PipeDataTransferredSizeGet (USB_PIPE_t pipe)

    Gets the size of the transferred pipe data.

  • void USB_PipeDataTransferredSizeSet (USB_PIPE_t pipe, uint16_t dataSize)

    Sets the size of the transferred pipe data.

  • void USB_PipeDataTransferredSizeReset (USB_PIPE_t pipe)

    Resets the size of transferred pipe data.

  • void USB_PipeTransferZLP_Enable (USB_PIPE_t pipe)

    Enables a ZLP on a transfer. It is enabled by default if the AZLP static config is enabled for the pipe.

  • void USB_PipeTransferEndCallbackRegister (USB_PIPE_t pipe, USB_TRANSFER_END_CALLBACK_t callback)

    Sets the callback for transfer end.

  • void USB_PipeTransferEndCallback (USB_PIPE_t pipe)

    Calls the callback for transfer end.

  • RETURN_CODE_t USB_InTransactionRun (USB_PIPE_t pipe)

    Checks the correctness of IN transactions and runs them.

  • RETURN_CODE_t USB_OutTransactionRun (USB_PIPE_t pipe)

    Checks the correctness OUT transactions and runs them.

  • RETURN_CODE_t USB_PipeTransactionComplete (USB_PIPE_t pipe)

    Handles completed IN and OUT transactions. Processes the completed transaction and either completes the transfer or runs the next transaction. Will call the pipe transferEndCallback at the end of transfer, if configured.

4.16.7.8.4 Detailed Description

API module for usb_peripheral covering low level USB transaction functions.

USBPERIPHERALREADWRITE Peripheral Read/Write Source File

Version: USB Device Stack HAL Driver Version 1.0.0

4.16.7.8.5 Macro Definition Documentation

PipeTransferIndexGet

#define PipeTransferIndexGet( pipe) (((pipe).address * 2) + (pipe).direction)

4.16.7.8.6 Variable Documentation

pipeTransfer

STATIC USB_PIPE_TRANSFER_t pipeTransfer[USB_EP_NUM *2]

4.16.7.9 source/usb_peripheral_read_write.h File Reference

#include <stdbool.h>
#include <stdint.h>
#include "usb_common_elements.h"
#include "usb_protocol_headers.h"

4.16.7.9.1 Functions

  • RETURN_CODE_t USB_TransactionStart (USB_PIPE_t pipe)

    Starts sending or receiving data on an endpoint by clearing BUSNACK. Used as a final step while setting up a transaction on the bus.

  • RETURN_CODE_t USB_TransactionAbort (USB_PIPE_t pipe)

    Aborts the next transaction on an endpoint by setting BUSNACK. Used to stop exchanging data on an endpoint. The device will start NAKing requests from the host after calling this API.

  • RETURN_CODE_t USB_TransactionCompleteAck (USB_PIPE_t pipe)

    Acknowledges the Transaction Complete status condition by clearing the Transaction Complete status bit. Used to clear the Transaction Complete status bit after a transaction has successfully completed.

  • bool USB_TransactionIsCompleted (void)

    Helper function to return the endpoint transaction complete condition.

  • RETURN_CODE_t USB_TransactionCompletedPipeGet (USB_PIPE_t *pipe)

    Returns the pipe address and direction for the latest completed transaction.

  • RETURN_CODE_t USB_PipeReset (USB_PIPE_t pipe)

    Resets the pipe.

  • USB_TRANSFER_STATUS_t USB_PipeStatusGet (USB_PIPE_t pipe)

    Gets the current status of pipe.

  • bool USB_PipeStatusIsBusy (USB_PIPE_t pipe)

    Checks if the pipe status is busy.

  • void USB_PipeDataPtrSet (USB_PIPE_t pipe, uint8_t *dataPtr)

    Configures the pointer for the data transfer in a given pipe.

  • uint8_t * USB_PipeDataPtrGet (USB_PIPE_t pipe)

    Gets the current data pointer for a given pipe.

  • void USB_PipeDataToTransferSizeSet (USB_PIPE_t pipe, uint16_t dataSize)

    Sets the size of pipe data to transfer.

  • uint16_t USB_PipeDataToTransferSizeGet (USB_PIPE_t pipe)

    Gets the size of pipe data to transfer.

  • uint16_t USB_PipeDataTransferredSizeGet (USB_PIPE_t pipe)

    Gets the size of the transferred pipe data.

  • void USB_PipeDataTransferredSizeSet (USB_PIPE_t pipe, uint16_t dataSize)

    Sets the size of the transferred pipe data.

  • void USB_PipeDataTransferredSizeReset (USB_PIPE_t pipe)

    Resets the size of transferred pipe data.

  • void USB_PipeTransferZLP_Enable (USB_PIPE_t pipe)

    Enables a ZLP on a transfer. It is enabled by default if the AZLP static config is enabled for the pipe.

  • void USB_PipeTransferEndCallbackRegister (USB_PIPE_t pipe, USB_TRANSFER_END_CALLBACK_t callback)

    Sets the callback for transfer end.

  • void USB_PipeTransferEndCallback (USB_PIPE_t pipe)

    Calls the callback for transfer end.

  • RETURN_CODE_t USB_InTransactionRun (USB_PIPE_t pipe)

    Checks the correctness of IN transactions and runs them.

  • RETURN_CODE_t USB_OutTransactionRun (USB_PIPE_t pipe)

    Checks the correctness OUT transactions and runs them.

  • RETURN_CODE_t USB_PipeTransactionComplete (USB_PIPE_t pipe)

    Handles completed IN and OUT transactions. Processes the completed transaction and either completes the transfer or runs the next transaction. Will call the pipe transferEndCallback at the end of transfer, if configured.

4.16.7.9.2 Detailed Description

USBPERIPHERALREADWRITE Peripheral Read/Write Header File