2.11 USB Device Stack Library

2.11.1 Introduction

The MPLAB® Code Configurator USB Device Stack Library allows quick and easy configuration and code generation of USB Device Classes by enabling users to define descriptors for the selected USB class.

List of supported classes:

  • Vendor
  • Human Interface Device (HID)
  • Communication Device Class (CDC)

2.11.2 Supported Device Families

AVR-DU

2.11.3 Required header files:

#include "mcc_generated_files/usb/usb_device.h"

2.11.4 Configurations APIs

This topic contains dynamic firmware APIs for the USB device configurations.

2.11.4.1 Module Documentation

2.11.4.1.1 USB_DEVICE_STACK

This is a device-specific USB static configuration file that will be editable through a code composer tool, build script or manual entry by a user.  

Module description

This is a device-specific USB static configuration file that will be editable through a code composer tool, build script or manual entry by a user.  

The file encompasses static settings like number of endpoints, features to be enabled, etc.

Version: USB_DEVICE_STACK Driver Version 1.0.0
Data structures
Definitions
Functions
Definition Documentation
LANG_EN_US

#define LANG_EN_US 0x0409U

Language ID String Descriptor, for English (US).

LANG_ID_NUM

#define LANG_ID_NUM 1U

Controls the number of language IDs supported by the application.

STRING_MANUFACTURER

#define STRING_MANUFACTURER L"Microchip Technology Inc."

Manufacturer String descriptor.

STRING_PRODUCT

#define STRING_PRODUCT L"HID Class Demo"

Product String descriptor.

STRING_SERIAL

#define STRING_SERIAL L"1"

Serial Number String descriptor.

USB_CDC_BULK_EP_IN

#define USB_CDC_BULK_EP_IN INTERFACE1ALTERNATE0_BULK_EP2_IN

The address for the CDC bulk IN endpoint.

USB_CDC_BULK_EP_OUT

#define USB_CDC_BULK_EP_OUT INTERFACE1ALTERNATE0_BULK_EP2_OUT

The address for the CDC bulk OUT endpoint.

USB_CDC_DATA_ENDPOINT_SIZE

#define USB_CDC_DATA_ENDPOINT_SIZE INTERFACE1ALTERNATE0_BULK_EP2_OUT_SIZE

Controls the size of the CDC data endpoints.

USB_CDC_INTERRUPT_EP

#define USB_CDC_INTERRUPT_EP INTERFACE0ALTERNATE0_INTERRUPT_EP1_IN

The address for the Communication Device Class (CDC) interrupt notification endpoint.

USB_CDC_RX_BUFFER_SIZE

#define USB_CDC_RX_BUFFER_SIZE (2*MAX_ENDPOINT_SIZE_DEFAULT)

Macro for the receive buffer size.

USB_CDC_RX_PACKET_SIZE

#define USB_CDC_RX_PACKET_SIZE USB_CDC_DATA_ENDPOINT_SIZE

Macro for the receive packet size.

USB_CDC_TX_BUFFER_SIZE

#define USB_CDC_TX_BUFFER_SIZE (2*MAX_ENDPOINT_SIZE_DEFAULT)

Macro for the transmit buffer size.

USB_CDC_UNION_SUBORDINATE_NUM

#define USB_CDC_UNION_SUBORDINATE_NUM 0u

Macro for the maximum number of configured subordinate interfaces of union functional descriptors.

USB_EP0_SIZE

#define USB_EP0_SIZE 64U

Controls the packet size of endpoint 0 and must correspond to bMaxPacketSize0 in the device descriptor.

USB_EP_NUM

#define USB_EP_NUM 3U

Limits the size of the endpoint table and transfer array in the RAM to 1 + the highest endpoint address used by the application.

USB_HID_INTERRUPT_EP

#define USB_HID_INTERRUPT_EP INTERFACE0ALTERNATE0_INTERRUPT_EP1_IN

Macro for the interrupt endpoint.

USB_HID_REPORT_DESCRIPTOR_SIZE

#define USB_HID_REPORT_DESCRIPTOR_SIZE 50U

Macro for the Human Interface Devices (HID) report descriptor size.

USB_INTERFACE_NUM

#define USB_INTERFACE_NUM 2U

The number of interfaces used by a configuration, excluding alternate interfaces.

Function Documentation
HID_SetReportCallbackRegister()

void HID_SetReportCallbackRegister (USB_HID_REPORT_CALLBACK_t cb)

Registers the callback for the HID report handler.

Parameters:
USB_HID_REPORT_CALLBACK_t

cb - Callback function for the HID report

Returns:

None.

USBDevice_Handle()

RETURN_CODE_t USBDevice_Handle (void )

Handles the USB stack events and in progress transfers for the USB stack to function.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USBDevice_Initialize()

void USBDevice_Initialize (void )

Initializes the USB device.

Parameters:
None.
Returns:

None.

USBDevice_ResetCallbackRegister()

void USBDevice_ResetCallbackRegister (USB_EVENT_CALLBACK_t cb)

Registers a callback function handling the Reset events.

Parameters:
USB_EVENT_CALLBACK_t

cb - Callback function for a Reset event

Returns:

None.

USBDevice_StartOfFrameCallbackRegister()

void USBDevice_StartOfFrameCallbackRegister (USB_EVENT_CALLBACK_t cb)

Registers a callback function handling the Start Of Frame (SOF) events.

Parameters:
USB_EVENT_CALLBACK_t

cb - Callback function for an SOF event

Returns:

None.

USBDevice_StatusGet()

RETURN_CODE_t USBDevice_StatusGet (void )

Returns the status of the USB device.

Parameters:
None.
Returns:

USB status code

USBDevice_SuspendCallbackRegister()

void USBDevice_SuspendCallbackRegister (USB_EVENT_CALLBACK_t cb)

Registers a callback function handling the Suspend events.

Parameters:
USB_EVENT_CALLBACK_t

cb - Callback function for a Suspend event

Returns:

None.

USBDevice_WakeFromSuspendCallbackRegister()

void USBDevice_WakeFromSuspendCallbackRegister (USB_EVENT_CALLBACK_t cb)

Registers a callback function handling the Wake From Suspend events.

Parameters:
USB_EVENT_CALLBACK_t

cb - Callback function for a Wake From Suspend event

Returns:

None.

Vendor_ControlReqCallbackRegister()

void Vendor_ControlReqCallbackRegister (USB_SETUP_PROCESS_CALLBACK_t cb)

Registers the callback for the control request handler.

Parameters:
USB_SETUP_PROCESS_CALLBACK_t

cb - Callback function for the control request

Returns:

None.

Vendor_InterfaceEnCallbackRegister()

void Vendor_InterfaceEnCallbackRegister (USB_SETUP_EVENT_CALLBACK_t cb)

Registers the callback for the interface enable setup request handler.

Parameters:
USB_SETUP_EVENT_CALLBACK_t

cb - Callback function for the interface enable setup request

Returns:

None.

2.11.4.2 Data Structure Documentation

2.11.4.2.1 descriptorPointers Struct Reference

Pointers to the standard USB descriptors.

Detailed Description

Pointers to the standard USB descriptors.

#include <usb_descriptors.h>

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

source/

usb_descriptors.h

2.11.4.2.2 endpointStaticConfig Struct Reference

Configuration of static endpoint settings.

Detailed Description

Configuration of static endpoint settings.

#include <usb_config.h>

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

source/

usb_config.h

2.11.4.2.3 USB_APPLICATION_CONFIGURATION1_struct Struct Reference

USB Configuration, Interface and Endpoint descriptors for Config1.

Field Documentation

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

source/

usb_descriptors.h

Configuration

USB_CONFIGURATION_DESCRIPTOR_t Configuration

HID_Descriptor0

USB_HID_DESCRIPTOR_t HID_Descriptor0

Interface0Alternate0

USB_INTERFACE_DESCRIPTOR_t Interface0Alternate0

Interface0Alternate0_Endpoint1IN

USB_ENDPOINT_DESCRIPTOR_t Interface0Alternate0_Endpoint1IN

2.11.4.2.4 USB_APPLICATION_CONFIGURATION_struct Struct Reference

USB Configuration, Interface and Endpoint descriptors.

Field Documentation

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

source/

usb_descriptors.h

Config1

USB_APPLICATION_CONFIGURATION1_t Config1

2.11.4.2.5 USB_APPLICATION_STRING_DESCRIPTORS_struct Struct Reference

USB String descriptors.

Field Documentation

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

source/

usb_descriptors.h

manufacturer

wchar_t manufacturer[DESCRIPTOR_STRING_LENGTH(STRING_MANUFACTURER)]

manufacturer_header

USB_DESCRIPTOR_HEADER_t manufacturer_header

product

wchar_t product[DESCRIPTOR_STRING_LENGTH(STRING_PRODUCT)]

product_header

USB_DESCRIPTOR_HEADER_t product_header

serial

wchar_t serial[DESCRIPTOR_STRING_LENGTH(STRING_SERIAL)]

serial_header

USB_DESCRIPTOR_HEADER_t serial_header

2.11.4.2.6 USB_EP_STATIC_CONFIG_BITS_struct Struct Reference

Static endpoint settings.

Field Documentation

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

source/

usb_config.h

InAzlpEnable

uint8_t InAzlpEnable

InMultipktEnable

uint8_t InMultipktEnable

InTrncInterruptEnable

uint8_t InTrncInterruptEnable

OutAzlpEnable

uint8_t OutAzlpEnable

OutMultipktEnable

uint8_t OutMultipktEnable

OutTrncInterruptEnable

uint8_t OutTrncInterruptEnable

reserved

uint8_t reserved

2.11.4.3 File Documentation

2.11.4.3.1 source/usb_config.h File Reference

#include <stdint.h>
#include <usb_common_elements.h>
Macros
Detailed Description

USB_CONFIG Generated Config Header File

Macro Definition Documentation
INTERFACE0ALTERNATE0_INTERRUPT_EP1_IN

#define INTERFACE0ALTERNATE0_INTERRUPT_EP1_IN 1U

INTERFACE0ALTERNATE0_INTERRUPT_EP1_IN_SIZE

#define INTERFACE0ALTERNATE0_INTERRUPT_EP1_IN_SIZE 64U

INTERFACE1ALTERNATE0_BULK_EP2_IN

#define INTERFACE1ALTERNATE0_BULK_EP2_IN 2U

INTERFACE1ALTERNATE0_BULK_EP2_IN_SIZE

#define INTERFACE1ALTERNATE0_BULK_EP2_IN_SIZE 16U

INTERFACE1ALTERNATE0_BULK_EP2_OUT

#define INTERFACE1ALTERNATE0_BULK_EP2_OUT 2U

INTERFACE1ALTERNATE0_BULK_EP2_OUT_SIZE

#define INTERFACE1ALTERNATE0_BULK_EP2_OUT_SIZE 16U

Typedef Documentation
USB_EP_STATIC_CONFIG_BITS_t

typedef struct USB_EP_STATIC_CONFIG_BITS_struct USB_EP_STATIC_CONFIG_BITS_t

Variable Documentation
endpointStaticConfig

const USB_EP_STATIC_CONFIG_BITS_t endpointStaticConfig[USB_EP_NUM][static]

Initial value:

= {
    [0] = {.InTrncInterruptEnable = 1, .OutTrncInterruptEnable = 1, .InMultipktEnable = 1, .InAzlpEnable = 0, .OutMultipktEnable = 1, .OutAzlpEnable = 0},
    [1] = {.InTrncInterruptEnable = 1, .OutTrncInterruptEnable = 1, .InMultipktEnable = 0, .InAzlpEnable = 0},
    [2] = {.InTrncInterruptEnable = 1, .OutTrncInterruptEnable = 1, .InMultipktEnable = 0, .InAzlpEnable = 0, .OutMultipktEnable = 0, .OutAzlpEnable = 0},
}

2.11.4.3.2 source/usb_descriptors.c File Reference

Driver implementation file for example application descriptors.

#include <string.h>
#include "usb_descriptors.h"
#include <usb_protocol_headers.h>
Detailed Description

Driver implementation file for example application descriptors.

USB_DEVICE_STACK Generated Driver File

Version: USB_DEVICE_STACK Driver Version 1.0.0
Variable Documentation
configurationDescriptor

USB_APPLICATION_CONFIGURATION_t configurationDescriptor[static]

deviceDescriptor

USB_DEVICE_DESCRIPTOR_t deviceDescriptor[static]

Initial value:

= {
    .header = {
        .bLength = sizeof(USB_DEVICE_DESCRIPTOR_t),
        .bDescriptorType = USB_DESCRIPTOR_TYPE_DEVICE,
    },
    .bcdUSB = 0x200,            
    .bDeviceClass = USB_NO_DEVICE_CLASS,        
    .bDeviceSubClass = 0x00,            
    .bDeviceProtocol = 0x00,            
    .bMaxPacketSize0 = USB_EP0_SIZE,    
    .idVendor = 0x04D8,            
    .idProduct = 0x0B13,          
    .bcdDevice = 0x0110,   
    .iManufacturer = 0x01,              
    .iProduct = 0x02,                   
    .iSerialNumber = 0x03,              
    .bNumConfigurations = 0x01          
}
langIDDescriptor

USB_STRING_LANG_ID_DESCRIPTOR_t langIDDescriptor[static]

Initial value:

= {
    .header =
    {
        .bLength = sizeof (USB_STRING_LANG_ID_DESCRIPTOR_t),
        .bDescriptorType = USB_DESCRIPTOR_TYPE_STRING,
    },
    .id_array =
    {LANG_EN_US},
}
stringDescriptors

USB_APPLICATION_STRING_DESCRIPTORS_t stringDescriptors[static]

Initial value:

= {
    .manufacturer_header =
    {
        .bLength = sizeof (stringDescriptors.manufacturer) + sizeof (USB_DESCRIPTOR_HEADER_t),
        .bDescriptorType = USB_DESCRIPTOR_TYPE_STRING,
    },
    .manufacturer = STRING_MANUFACTURER,
    .product_header =
    {
        .bLength = sizeof (stringDescriptors.product) + sizeof (USB_DESCRIPTOR_HEADER_t),
        .bDescriptorType = USB_DESCRIPTOR_TYPE_STRING,
    },
    .product = STRING_PRODUCT,
    .serial_header =
    {
        .bLength = sizeof (stringDescriptors.serial) + sizeof (USB_DESCRIPTOR_HEADER_t),
        .bDescriptorType = USB_DESCRIPTOR_TYPE_STRING,
    },
    .serial = STRING_SERIAL,
}
USB_HIDMouseReportDescriptor

USB_HID_REPORT_DESCRIPTOR_t USB_HIDMouseReportDescriptor

Initial value:

= {
    {
        0x05, 0x01, 
        0x09, 0x02, 
        0xA1, 0x01, 
        0x09, 0x01, 
        0xA1, 0x00, 
        0x05, 0x09, 
        0x19, 0x01, 
        0x29, 0x03, 
        0x15, 0x00, 
        0x25, 0x01, 
        0x75, 0x01, 
        0x95, 0x03, 
        0x81, 0x02, 
        0x75, 0x05, 
        0x95, 0x01, 
        0x81, 0x01, 
        0x05, 0x01, 
        0x09, 0x30, 
        0x09, 0x31, 
        0x15, 0x81, 
        0x25, 0x7F, 
        0x75, 0x08, 
        0x95, 0x02, 
        0x81, 0x06, 
        0xC0, 
        0xC0, 
    }
}

2.11.4.3.3 source/usb_descriptors.h File Reference

Header file for example application descriptors.

#include <stddef.h>
#include <usb_protocol_headers.h>
#include "usb_config.h"
#include <usb_protocol_hid.h>
Macros
  • #define LANG_EN_US 0x0409U

    Language ID String Descriptor, for English (US).

  • #define STRING_MANUFACTURER L"Microchip Technology Inc."

    Manufacturer String descriptor.

  • #define STRING_PRODUCT L"HID Class Demo"

    Product String descriptor.

  • #define STRING_SERIAL L"1"

    Serial Number String descriptor.

Detailed Description

Header file for example application descriptors.

USB_DEVICE_STACK Generated API Header File

Version: USB_DEVICE_STACK Driver Version 1.0.0
Typedef Documentation
USB_APPLICATION_CONFIGURATION1_t

typedef struct USB_APPLICATION_CONFIGURATION1_struct USB_APPLICATION_CONFIGURATION1_t

USB_APPLICATION_CONFIGURATION_t

typedef struct USB_APPLICATION_CONFIGURATION_struct USB_APPLICATION_CONFIGURATION_t

USB_APPLICATION_STRING_DESCRIPTORS_t

typedef struct USB_APPLICATION_STRING_DESCRIPTORS_struct USB_APPLICATION_STRING_DESCRIPTORS_t

Variable Documentation
descriptorPointers

USB_DESCRIPTOR_POINTERS_t descriptorPointers

USB_HIDMouseReportDescriptor

USB_HID_REPORT_DESCRIPTOR_t USB_HIDMouseReportDescriptor

2.11.4.3.4 source/usb_device.c File Reference

Driver implementation file for the USB device setup.

#include <usb_core.h>
#include <usb_vendor.h>
#include "usb_device.h"
#include "usb0.h"
Functions
Detailed Description

Driver implementation file for the USB device setup.

USB_DEVICE_STACK Generated Driver File

Version: USB_DEVICE_STACK Driver Version 1.0.0
Function Documentation
USBDevice_EventHandler()

static void USBDevice_EventHandler (void )[static]

USBDevice_TransferHandler()

static void USBDevice_TransferHandler (void )[static]

Vendor_DefaultControlReqCallback()

static RETURN_CODE_t Vendor_DefaultControlReqCallback (USB_SETUP_REQUEST_t * setupRequestPtr)[static]

Vendor_DefaultInterfaceEnCallback()

static void Vendor_DefaultInterfaceEnCallback (USB_SETUP_REQUEST_t * setupRequestPtr)[static]

Variable Documentation
usbStatus

RETURN_CODE_t usbStatus[static]

Vendor_ControlReq_cb

USB_SETUP_PROCESS_CALLBACK_t Vendor_ControlReq_cb = &Vendor_DefaultControlReqCallback[static]

Vendor_InterfaceEn_cb

USB_SETUP_EVENT_CALLBACK_t Vendor_InterfaceEn_cb = &Vendor_DefaultInterfaceEnCallback[static]

2.11.4.3.5 source/usb_device.h File Reference

Header file for the USB device setup.

#include <usb_common_elements.h>
#include "usb_descriptors.h"
Functions
Detailed Description

Header file for the USB device setup.

USB_DEVICE_STACK Generated API Header File

Version: USB_DEVICE_STACK Driver Version 1.0.0

2.11.5 Core and Class APIs

This topic contains static firmware APIs for the USB device core and class specifications.

2.11.5.1 Project MISRA C:2012 deviations

This page contains all project deviations, defined as deviations from MISRA C guidelines in a particular class of circumstances, for all files in the USB Device Stack for 8-bit AVR® MCUs.

Advisory: misra-c2012-2.5  

Justification: False positive - This deviation explicitly only concerns the false positive on include guard macros. While rule 2.5 does not explicitly specify an exception for include guards, it is deemed that the wording of the rule effectively confirms that this is a false positive. The standard does not specify what "unused" means. An include guard macro is deemed as used as it does, in fact, have a function when used as an include guard. Moreover, the rationale for rule 2.5 states: "If a macro is declared but not used, then it is unclear to the reviewer if the macro is redundant or has been left unused by mistake". It is assumed that no code reviewer would think it is unclear whether or not an include guard is redundant. Finally, MISRA C:2012 Directive 4.10 states that: "Precautions shall be taken in order to prevent the contents of a header file being included more than once" and shows the usage of include guards as an example of compliance. Thus, the false positive can be suppressed for all include guards that trigger this false positive, even if the header-file is only included in one place. The latter reasoning is added because one cannot always know in advance whether or not a header file will be included more than once and include guards should thus be added regardless. Also, see thread-1317 on the official MISRA forum webpage for further confirmation that this is a false positive.  

Include guard example:
#ifndef FOO_H
// cppcheck-suppress misra-c2012-2.5
#define FOO_H 
//contents of file 
#endif //FOO_H

2.11.5.2 Specific MISRA C:2012 deviations

This page contains all Specific MISRA C:2012 deviations.  

Note:

Any project deviations are documented in Project MISRA C:2012 deviations

.

Global USB_DESCRIPTOR_PTR_t

Advisory: misra-c2012-19.2  

Justification: Needed for the stack to parse through the configuration descriptors without pointer casting between the different descriptor types and uint8_t.

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.

2.11.5.3 Supported MISRA C:2012 Rules

2.11.5.3.1 Supported MISRA C:2012 Rules

The USB Device Stack library is checked for any deviations from the MISRA C:2012 guidelines using the MISRA CLI MPLAB®X (MisraCheck plugin) static analyzer bundled with the MPLAB®X IDE version used during release verification (see the library release notes for this library version). The below table lists which of the MISRA rules are supported by the tool. The fields used in the table are defined as:

  • Rule ID - The ID of the rule or directive being checked. These IDs correspond to the rule or directive numbers used in the MISRA C:2012 guidelines.

  • Classification - Each MISRA C:2012 rule or directive is assigned one of three possible categories:
    • Mandatory

    • Required

    • Advisory

  • Status - Describes which rules are enabled/disabled during verification or if a rule or directive is not supported by the tool  

Rule ID

Classification

Status

1.1

Required

Not supported

1.2

Advisory

Not supported

1.3

Required

Enabled

1.4

Required

Enabled

2.1

Required

Enabled

2.2

Required

Enabled

2.3

Advisory

Disabled

2.4

Advisory

Disabled

2.5

Advisory

Disabled

2.6

Advisory

Enabled

2.7

Advisory

Enabled

3.1

Required

Enabled

3.2

Required

Enabled

4.1

Required

Enabled

4.2

Advisory

Enabled

4.3

Required

Enabled

4.4

Advisory

Enabled

4.5

Advisory

Enabled

4.6

Advisory

Enabled

4.7

Required

Enabled

4.8

Advisory

Enabled

4.9

Advisory

Enabled

4.10

Required

Enabled

4.11

Required

Enabled

4.12

Required

Enabled

4.13

Advisory

Enabled

4.14

Required

Enabled

5.1

Required

Enabled

5.2

Required

Enabled

5.3

Required

Enabled

5.4

Required

Enabled

5.5

Required

Enabled

5.6

Required

Enabled

5.7

Required

Enabled

5.8

Required

Enabled

5.9

Advisory

Enabled

6.1

Required

Enabled

6.2

Required

Enabled

7.1

Required

Enabled

7.2

Required

Enabled

7.3

Required

Enabled

7.4

Required

Enabled

8.1

Required

Enabled

8.2

Required

Enabled

8.3

Required

Enabled

8.4

Required

Disabled

8.5

Required

Enabled

8.6

Required

Enabled

8.7

Advisory

Disabled

8.8

Required

Enabled

8.9

Advisory

Enabled

8.10

Required

Enabled

8.11

Advisory

Enabled

8.12

Required

Enabled

8.13

Advisory

Enabled

8.14

Required

Enabled

9.1

Mandatory

Enabled

9.2

Required

Enabled

9.3

Required

Enabled

9.4

Required

Enabled

9.5

Required

Enabled

10.1

Required

Enabled

10.2

Required

Enabled

10.3

Required

Enabled

10.4

Required

Enabled

10.5

Advisory

Enabled

10.6

Required

Enabled

10.7

Required

Enabled

10.8

Required

Enabled

11.1

Required

Enabled

11.2

Required

Enabled

11.3

Required

Enabled

11.4

Advisory

Enabled

11.5

Advisory

Enabled

11.6

Required

Enabled

11.7

Required

Enabled

11.8

Required

Enabled

11.9

Required

Enabled

12.1

Advisory

Enabled

12.2

Required

Enabled

12.3

Advisory

Enabled

12.5

Mandatory

Enabled

12.4

Advisory

Enabled

13.1

Required

Enabled

13.2

Required

Enabled

13.3

Advisory

Enabled

13.4

Advisory

Enabled

13.5

Required

Enabled

13.6

Mandatory

Enabled

14.1

Required

Enabled

14.2

Required

Enabled

14.3

Required

Enabled

14.4

Required

Enabled

15.1

Advisory

Enabled

15.2

Required

Enabled

15.3

Required

Enabled

15.4

Advisory

Enabled

15.5

Advisory

Enabled

15.6

Required

Enabled

15.7

Required

Enabled

16.1

Required

Enabled

16.2

Required

Enabled

16.3

Required

Enabled

16.4

Required

Enabled

16.5

Required

Enabled

16.6

Required

Enabled

16.7

Required

Enabled

17.1

Required

Enabled

17.2

Required

Enabled

17.3

Mandatory

Not supported

17.4

Mandatory

Enabled

17.5

Advisory

Enabled

17.6

Mandatory

Enabled

17.7

Required

Enabled

17.8

Advisory

Enabled

18.1

Required

Enabled

18.2

Required

Enabled

18.3

Required

Enabled

18.4

Advisory

Enabled

18.5

Advisory

Enabled

18.6

Required

Enabled

18.7

Required

Enabled

18.8

Required

Enabled

19.1

Mandatory

Enabled

19.2

Advisory

Enabled

20.1

Advisory

Enabled

20.2

Required

Enabled

20.3

Required

Enabled

20.4

Required

Enabled

20.5

Advisory

Enabled

20.6

Required

Enabled

20.7

Required

Enabled

20.8

Required

Enabled

20.9

Required

Enabled

20.10

Advisory

Enabled

20.11

Required

Enabled

20.12

Required

Enabled

20.13

Required

Enabled

20.14

Required

Enabled

21.1

Required

Enabled

21.2

Required

Enabled

21.3

Required

Enabled

21.4

Required

Enabled

21.5

Required

Enabled

21.6

Required

Enabled

21.7

Required

Enabled

21.8

Required

Enabled

21.9

Required

Enabled

21.10

Required

Enabled

21.11

Required

Enabled

21.12

Required

Enabled

21.13

Mandatory

Enabled

21.14

Required

Enabled

21.15

Required

Enabled

21.16

Required

Enabled

21.17

Mandatory

Enabled

21.18

Mandatory

Enabled

21.19

Mandatory

Enabled

21.20

Mandatory

Enabled

21.21

Required

Enabled

22.1

Required

Enabled

22.2

Mandatory

Enabled

22.3

Required

Enabled

22.4

Mandatory

Enabled

22.5

Mandatory

Enabled

22.6

Mandatory

Enabled

22.7

Required

Enabled

22.8

Required

Enabled

22.9

Required

Enabled

22.10

Required

Enabled

2.11.5.4 Module Documentation

2.11.5.4.1 USB Communications Device Class (CDC)

This file contains prototypes and data types for a CDC application.

Module description

This file contains prototypes and data types for a CDC application.

Version: USB Device Stack Driver Version 1.0.0
Data structures
Functions
Function Documentation
CIRCBUF_Dequeue()

BUFFER_RETURN_CODE_t CIRCBUF_Dequeue (CIRCULAR_BUFFER_t * buffer, uint8_t * data)

Pulls data from the circular buffer if it's available.

Parameters:
buffer

- Circular buffer address

data

- Output data variable address

Returns:

status - Result of the retrieval process

CIRCBUF_Empty()

bool CIRCBUF_Empty (CIRCULAR_BUFFER_t * buffer)

Checks if the circular buffer is empty.

Parameters:
buffer

- Circular buffer address

Return values:
0

- Buffer not full

1

- Buffer full

CIRCBUF_Enqueue()

BUFFER_RETURN_CODE_t CIRCBUF_Enqueue (CIRCULAR_BUFFER_t * buffer, uint8_t data)

Adds input data to circular buffer if there is space available.

Parameters:
buffer

- Circular buffer address

data

- Intput data

Returns:

status - Result of the addition process

CIRCBUF_FreeSpace()

uint16_t CIRCBUF_FreeSpace (CIRCULAR_BUFFER_t * buffer)

Returns the number of available bytes in the circular buffer.

Parameters:
buffer

- Circular buffer address

Returns:

freeSpace - Available bytes

CIRCBUF_Full()

bool CIRCBUF_Full (CIRCULAR_BUFFER_t * buffer)

Checks if the circular buffer is full.

Parameters:
buffer

- Circular buffer address

Return values:
0

- Buffer not full

1

- Buffer full

USB_CDCDataReceived()

void USB_CDCDataReceived (USB_PIPE_t pipe, USB_TRANSFER_STATUS_t status, uint16_t bytesTransferred)

Callback function called after the USB OUT transaction started.

Parameters:
pipe

- USB pipe used for the started transaction

status

- Transfer status

bytesTransferred

- Number of bytes received in the transaction

Returns:

None.

USB_CDCDataTerminalReady()

bool USB_CDCDataTerminalReady (void )

Checks if the Data Terminal Equipment bit has been set from the host.

Parameters:
None.
Return values:
0

- False if bit not set

1

- True if bit set

USB_CDCDataTransmitted()

void USB_CDCDataTransmitted (USB_PIPE_t pipe, USB_TRANSFER_STATUS_t status, uint16_t bytesTransferred)

Callback function called after the USB IN transaction started.

Parameters:
pipe

- USB pipe used for the started transaction

status

- Transfer status

bytesTransferred

- Number of bytes transmitted in the transaction

Returns:

None.

USB_CDCGetBaud()

uint32_t USB_CDCGetBaud (void )

Gets the data transfer baud rate for the CDC communication.

Parameters:
None.
Returns:

baud - Data transfer baud rate

USB_CDCGetDataBits()

USD_CDC_LINE_CODING_DATA_BITS_t USB_CDCGetDataBits (void )

Gets the number of data transfer data bits for the CDC communication.

Parameters:
None.
Returns:

numDataBits - Number of data bits

USB_CDCGetParity()

USD_CDC_LINE_CODING_PARITY_t USB_CDCGetParity (void )

Gets the data transfer parity for the CDC communication.

Parameters:
None.
Returns:

parity - Data transfer parity

USB_CDCGetStopBits()

USB_CDC_LINE_CODING_STOP_BITS_t USB_CDCGetStopBits (void )

Gets the number of data transfer stop bits for the CDC communication.

Parameters:
None.
Returns:

numStopBits - Number of stop bits

USB_CDCInitialize()

void USB_CDCInitialize (void )

Initializes the CDC class.

Parameters:
None.
Returns:

None.

USB_CDCRead()

CDC_RETURN_CODE_t USB_CDCRead (uint8_t * data)

Pulls data from the CDC receive buffer.

Parameters:
buffer

- Pointer to application receive buffer

Returns:

status - Result of the called circular buffer function

USB_CDCRequestHandler()

RETURN_CODE_t USB_CDCRequestHandler (USB_SETUP_REQUEST_t * setupRequestPtr)

Performs handling of control transfers.

Parameters:
setupRequestPtr

- Pointer to the Setup Request struct

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_CDCSetBaud()

void USB_CDCSetBaud (uint16_t baud)

Sets the data transfer baud rate for the CDC communication.

Parameters:
baud

- Data transfer baud rate

Returns:

None.

USB_CDCSetDataBits()

void USB_CDCSetDataBits (USD_CDC_LINE_CODING_DATA_BITS_t numDataBits)

Sets the number of data transfer data bits for the CDC communication.

Parameters:
numDataBits

- Number of data bits

Returns:

None.

USB_CDCSetParity()

void USB_CDCSetParity (USD_CDC_LINE_CODING_PARITY_t parity)

Sets the data transfer parity for the CDC communication.

Parameters:
parity

- Data transfer parity

Returns:

None.

USB_CDCSetStopBits()

void USB_CDCSetStopBits (USB_CDC_LINE_CODING_STOP_BITS_t numStopBits)

Sets the number of data transfer stop bits for the CDC communication.

Parameters:
numStopBits

- Number of stop bits

Returns:

None.

USB_CDCTxBusy()

bool USB_CDCTxBusy (void )

Checks if the transmit buffer is full.

Parameters:
None.
Return values:
0

- Buffer not full

1

- Buffer full

USB_CDCVirtualSerialPortHandler()

RETURN_CODE_t USB_CDCVirtualSerialPortHandler (void )

Performs Virtual Serial Port writes using the CDC class.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_CDCVirtualSerialPortInitialize()

void USB_CDCVirtualSerialPortInitialize (void )

Initializes the CDC Virtual Serial Port functionality.

Parameters:
None.
Returns:

None.

USB_CDCWrite()

CDC_RETURN_CODE_t USB_CDCWrite (uint8_t data)

Adds data to the CDC transmit buffer.

Parameters:
data

- Pointer to data to be transmitted

length

- Length in number of bytes for data to be transmitted

Returns:

status - Result of the called circular buffer function

2.11.5.4.2 USB Common Elements

Common elements for the USB stack.

Module description

Common elements for the USB stack.

Version: USB Common Elements Version 1.0.0
Definitions
  • #define MAX_ENDPOINT_SIZE_DEFAULT (64)

    The maximum endpoint packet size for the default endpoint types (control, bulk, interrupt).

  • #define MAX_ENDPOINT_SIZE_ISO (1023)

    The maximum endpoint packet size for the isochronous endpoint type.

Enumerations
Definition Documentation
MAX_ENDPOINT_SIZE_DEFAULT

#define MAX_ENDPOINT_SIZE_DEFAULT (64)

The maximum endpoint packet size for the default endpoint types (control, bulk, interrupt).

MAX_ENDPOINT_SIZE_ISO

#define MAX_ENDPOINT_SIZE_ISO (1023)

The maximum endpoint packet size for the isochronous endpoint type.

Enumeration Type Documentation
RETURN_CODE_enum

enum RETURN_CODE_enum

Describes the different function return reserved codes used by the USB stack.

UNSUPPORTED

Action not supported by the USB Device Stack

UNINITIALIZED

Status unchanged since initialization

SUCCESS

Action successfully executed

ENDPOINT_SIZE_ERROR

Error related to the wMaxPacketSize in the endpoint configuration

ENDPOINT_ADDRESS_ERROR

Error related to the address byte of bEndpointAddress in the endpoint configuration

ENDPOINT_DIRECTION_ERROR

Error related to the direction byte of bEndpointAddress in the endpoint configuration

ENDPOINT_TYPE_ERROR

Error related to the type bitmask of bmAttributes in the endpoint configuration

ENDPOINT_AZLP_ERROR

Error related to the Auto Zero Length Packet (AZLP) setting in the endpoint configuration

ENDPOINT_ALIGN_ERROR

Error related to unaligned OUT transactions when using multipacket

PIPE_BUSY_ERROR

Error triggered by the pipe being busy while attempting a read or write transaction

PIPE_TRANSFER_ERROR

Error triggered by a failed pipe transaction

CONTROL_SIZE_ERROR

Error related to the size of the control endpoint transaction packet

CONTROL_TRANSACTION_STATUS_ERROR

Error triggered by a failed transaction on the control endpoint

CONTROL_SETUP_CALLBACK_ERROR

Error triggered by a failed control setup

CONTROL_SETUP_DIRECTION_ERROR

Error triggerd by a control setup IN request not requesting any data

DESCRIPTOR_POINTER_ERROR

Error triggered by an invalid descriptor pointer

DESCRIPTOR_CONFIGURATIONS_ERROR

Error triggered by an invalid configuration descriptor pointer

DESCRIPTOR_INTERFACE_ERROR

Error triggered by an invalid interface descriptor pointer

DESCRIPTOR_ENDPOINT_ERROR

Error triggered by an invalid endpoint descriptor pointer

DESCRIPTOR_REQUEST_ERROR

Error triggered by a failed attempt at retrieving a descriptor pointer

DESCRIPTOR_SEARCH_ERROR

Error triggered by an incorrect descriptor structure

INTERFACE_SET_ERROR

Error triggered by a failure to set an interface

INTERFACE_GET_ERROR

Error triggered by a failure to retrieve an interface

USB_CONNECTION_ERROR

Error triggered by a failure during setup device request

USB_CLASS_ERROR

Error triggered by an invalid class code

2.11.5.4.3 USB Core Layer

Core functionality for the USB stack.

Module description

Core functionality for the USB stack.

Version: USB Device Core Version 1.0.0
Modules
Data structures
Functions
Function Documentation
ActiveAlternateSettingGet()

RETURN_CODE_t ActiveAlternateSettingGet (uint8_t interfaceNumber, uint8_t * alternateSetting)

Get the active alternate interface number for an interface.

Parameters:
interfaceNumber

- The interface number to get the alternate setting for

*alternateSetting

- The requested alternate setting

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

ActiveAlternateSettingSet()

RETURN_CODE_t ActiveAlternateSettingSet (uint8_t interfaceNumber, uint8_t alternateSetting)

Set the active alternate interface number for an interface.

Parameters:
interfaceNumber

- The interface number to set the alternate setting for

alternateSetting

- The alternate setting to set

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

ConfigurationPointerGet()

RETURN_CODE_t ConfigurationPointerGet (uint8_t configurationValue, USB_CONFIGURATION_DESCRIPTOR_t ** configurationPtr)

Collects the configuration pointer.

Parameters:
configurationValue

- Value of the referenced configuration

**configurationPtr

- Pointer to the configuration

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

DescriptorEndpointsConfigure()

RETURN_CODE_t DescriptorEndpointsConfigure (USB_INTERFACE_DESCRIPTOR_t * interfacePtr, bool enable)

Configures the endpoints as given in the descriptor.

Parameters:
*interfacePtr

- Pointer to an interface

enable

- Boolean to enable or disable the endpoint

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

NextDescriptorPointerGet()

RETURN_CODE_t NextDescriptorPointerGet (USB_DESCRIPTOR_TYPE_t descriptorType, USB_DESCRIPTOR_HEADER_t ** descriptorHeaderPtr)

Gets the next descriptor.

Parameters:
descriptorType

- Selected descriptor type

**descriptorHeaderPtr

- Pointer to the descriptor header

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_ClassRequestCallbackRegister()

void USB_ClassRequestCallbackRegister (USB_SETUP_PROCESS_CALLBACK_t callback)

Registers a callback for class requests.

Parameters:
callback

- Reference for the callback function

Returns:

None.

USB_DescriptorActiveConfigurationRemoteWakeupGet()

bool USB_DescriptorActiveConfigurationRemoteWakeupGet (void )

Gets the Remote Wake-up setting from the active configuration.

Parameters:
None.
Return values:
0

- Remote Wake-up is not enabled

1

- Remote Wake-up is enabled

USB_DescriptorActiveConfigurationSelfPoweredGet()

bool USB_DescriptorActiveConfigurationSelfPoweredGet (void )

Gets the Self-Powered setting from the active configuration.

Parameters:
None.
Return values:
0

- Self-Powered is not enabled

1

- Self-Powered is enabled

USB_DescriptorActiveConfigurationValueGet()

uint8_t USB_DescriptorActiveConfigurationValueGet (void )

Gets the active configuration value.

Parameters:
None.
Returns:

The active configuration value

USB_DescriptorConfigurationEnable()

RETURN_CODE_t USB_DescriptorConfigurationEnable (uint8_t configurationValue)

Enables endpoint configuration descriptor.

The USB Device Enable Endpoint function, from USB 2.0 Specification Ch. 9.6.6.

Offset

Field

Size

Value

Description

0

bLength

1

Number

Size of this descriptor in bytes

1

bDescriptorType

1

Constant

CONFIGURATION Descriptor Type

2

bEndpointAddress

1

Endpoint

Address of the endpoint on the USB device described by this descriptor. Address is encoded by the following: Bit 3-0: The endpoint number, Bit 6-4: Reserved, reset to zero, Bit 7: Direction, ignored for control endpoint. 0 = OUT endpoint, 1 = IN endpoint

3

bmAttributes

1

Bitmap

Describes the endpoint attributes when it is configured using the bConfigurationValue. Bit 1-0: Transfer type, 00=Control, 01=Isochronous, 10=Bulk, 11=Interrupt. If not isochronous endpoint, bit 5-2 are reserved and must be set to zero. If isochronous: Bit 3-2: Synchronization type, 00 = No Sync, 01 = Async, 10 = Adaptive, 11 = Sync. Bit 5-4: Usage type, 00 = Data endpoint, 01 = Feedback endpoint, 10 = Implicit feedback Data endpoint, 11 = Reserved. All other bits are reserved and must be reset to zero. Reserved bits must be ignored by the host.

4

wMaxPacketSize

2

Number

Maximum packet size this endpoint is capable of RX/TX when this configuration is selected. For isochronous endpoints, this value is used to reserve bus time in the schedule. For all endpoints, bit 10-0 specify maximum packet size. For high-speed isochronous and interrupt endpoints: Bit 12-11 number of additional transaction opportunities per microframe, 00 = None (1 transaction per microframe), 01 = 1 additional, 10 = 2 additional, 11 = Reserved. Bits 15-13 are reserved and must be set to zero.

Parameters:
configurationValue

- The value of the configuration to be enabled

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_DescriptorInterfaceConfigure()

RETURN_CODE_t USB_DescriptorInterfaceConfigure (uint8_t interfaceNumber, uint8_t alternateSetting, bool enable)

Enables or Disables an Interface Descriptor.

The USB Device Enable Interface Descriptor, from USB 2.0 Specification Ch. 9.6.5.

Offset

Field

Size

Value

Description

2

bInterfaceNumber

1

Number

Number of this interface. Zero-based value identifying the index in the array of concurrent interfaces supported by this configuration

3

bAlternateSetting

1

Number

Value used to select this alternate setting for the interface identified in the prior field

Parameters:
interfaceNumber

- Interface number value

alternateSetting

- Alternative settings value, ignored if enable is false .

enable

- Enable or disable the interface.

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_DescriptorPointerGet()

RETURN_CODE_t USB_DescriptorPointerGet (USB_DESCRIPTOR_TYPE_t descriptor, uint8_t attribute, uint8_t ** descriptorPtr, uint16_t * descriptorLength)

Gets the pointer to the descriptor.

Parameters:
descriptor

- Descriptor type

attribute

- Attribute type

**descriptorPtr

- Pointer to the descriptor

*descriptorLength

- Length of the descriptor

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_DescriptorPointersSet()

RETURN_CODE_t USB_DescriptorPointersSet (USB_DESCRIPTOR_POINTERS_t * descriptorPtr)

Handles Descriptor pointer setup. Sets the address to the application descriptor pointers. Checks if the device pointer and a pointer to the start of the application configuration(s) are set before saving the address to the USB Core Stack.

Parameters:
*descriptorPtr

- The address of the application descriptor pointers

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_DescriptorStringPointerGet()

RETURN_CODE_t USB_DescriptorStringPointerGet (uint8_t stringIndex, uint16_t langID, uint8_t ** descriptorAddressPtr, uint16_t * descriptorLength)

Gets the pointer to the string descriptor.

Parameters:
stringIndex

- Index of the string

langID

- Language ID

**descriptorAddressPtr

- Pointer to the descriptor

*descriptorLength

- Length of the descriptor

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_EventHandler()

RETURN_CODE_t USB_EventHandler (void )

Handles the different types of events.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_InterfaceDisabledCallbackRegister()

void USB_InterfaceDisabledCallbackRegister (USB_EVENT_CALLBACK_t callback)

Registers a callback for disabling interfaces.

Parameters:
callback

- Reference for the callback function

Returns:

None.

USB_OtherRequestCallbackRegister()

void USB_OtherRequestCallbackRegister (USB_SETUP_PROCESS_CALLBACK_t callback)

Registers a callback for other requests.

Parameters:
callback

- Reference for the callback function

Returns:

None.

USB_Reset()

RETURN_CODE_t USB_Reset (void )

Resets the USB peripheral.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_ResetCallbackRegister()

void USB_ResetCallbackRegister (USB_EVENT_CALLBACK_t callback)

Registers a callback for Reset events.

Parameters:
callback

- Reference for the callback function

Returns:

None.

USB_ResumeCallbackRegister()

void USB_ResumeCallbackRegister (USB_EVENT_CALLBACK_t callback)

Registers a callback for Resume events.

Parameters:
callback

- Reference for the callback function

Returns:

None.

USB_SetConfigurationCallbackRegister()

void USB_SetConfigurationCallbackRegister (USB_SETUP_EVENT_CALLBACK_t callback)

Registers a callback for Set Configuration requests.

Parameters:
callback

- Reference for the callback function

Returns:

None.

USB_SetInterfaceCallbackRegister()

void USB_SetInterfaceCallbackRegister (USB_SETUP_EVENT_CALLBACK_t callback)

Registers a callback for Set Interface requests.

Parameters:
callback

- Reference for the callback function

Returns:

None.

USB_SetupProcess()

RETURN_CODE_t USB_SetupProcess (USB_SETUP_REQUEST_t * setupRequestPtr)

Setup function for the Standard Device Request USB 2.0 Specification Ch 9.4.

bRequest

wValue

wIndex

wLength

Data

CLEAR_FEATURE

Feature Selector

Zero

None

CLEAR_FEATURE

Feature Selector

Interface

None

CLEAR_FEATURE

Feature Selector

Endpoint

None

GET_CONFIGURATION

Zero

Zero

One

Configuration Value

GET_DESCRIPTOR

Descriptor type and Descriptor index

Zero or Language ID

Descriptor Length

Descriptor

GET_INTERFACE

Zero

Interface

One

Alternate Interface

GET_STATUS

Zero

Zero Interface Endpoint

Two

Device status

GET_STATUS

Zero

Interface

Two

Interface Status

GET_STATUS

Zero

Endpoint

Two

Endpoint Status

SET_ADDRESS

Device Address

Zero

Zero

None

SET_CONFIGURATION

Configuration Value

Zero

Zero

None

SET_DESCRIPTOR

Descriptor type and Descriptor index

Zero or Language ID

Descriptor Length

Descriptor

SET_FEATURE

Feature Selector

Zero Interface Endpoint

Zero

None

SET_FEATURE

Feature Selector

Interface

Zero

SET_FEATURE

Feature Selector

Endpoint

Zero

SET_INTERFACE

Alternate Setting

Interface

Zero

None

SYNCH_FRAME

Zero

Endpoint

Two

Frame Number

Parameters:
*setupRequestPtr

- Pointer to the setup request and its data

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_SOFCallbackRegister()

void USB_SOFCallbackRegister (USB_EVENT_CALLBACK_t callback)

Registers a callback for Start-Of-Frame (SOF) events.

Parameters:
callback

- Reference for the callback function

Returns:

None.

USB_Start()

RETURN_CODE_t USB_Start (void )

Starts the USB peripheral, configures the callbacks and attaches it to the bus.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_Stop()

RETURN_CODE_t USB_Stop (void )

Stops the USB peripheral and detaches it from the bus.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_SuspendCallbackRegister()

void USB_SuspendCallbackRegister (USB_EVENT_CALLBACK_t callback)

Registers a callback for Suspend events.

Parameters:
callback

- Reference for the callback function

Returns:

None.

USB_VendorRequestCallbackRegister()

void USB_VendorRequestCallbackRegister (USB_SETUP_PROCESS_CALLBACK_t callback)

Registers a callback for vendor requests.

Parameters:
callback

- Reference for the callback function

Returns:

None.

2.11.5.4.4 USB Descriptor Definitions

In this file the active configuration and interfaces can be changed. The active configuration and active interface is referenced by a pointer as two global variables.

Module description

In this file the active configuration and interfaces can be changed. The active configuration and active interface is referenced by a pointer as two global variables.

Version: USB Device Core Version 1.0.0
Definition Documentation
USB_DEFAULT_ALTERNATE_SETTING

#define USB_DEFAULT_ALTERNATE_SETTING 0u

Default alternate setting.

USB_DEFAULT_INTERFACE

#define USB_DEFAULT_INTERFACE 0u

Default interface number.

USB_DESCRIPTOR_SEARCH_LIMIT

#define USB_DESCRIPTOR_SEARCH_LIMIT 30u

The number of descriptors NextDescriptorPointerGet will search through before returning an error.

2.11.5.4.5 USB Core Events

Event handling for the USB Core Stack.

Module description

Event handling for the USB Core Stack.

Version: USB Device Core Version 1.0.0

2.11.5.4.6 USB Core Requests

USB Device Core Requests handling.

Module description

USB Device Core Requests handling.

Version: USB Device Core Version 1.0.0
Definitions
Functions
Definition Documentation
ENDPOINT_ADDRESS_MASK

#define ENDPOINT_ADDRESS_MASK (0x7fu)

Mask for the endpoint address in the wIndex field of the setup request.

ENDPOINT_DIRECTION_BITPOSITION

#define ENDPOINT_DIRECTION_BITPOSITION (7u)

Bit position for the endpoint direction in the wIndex field of the setup request.

GET_INTERFACE_REQUEST_NUMBER_MASK

#define GET_INTERFACE_REQUEST_NUMBER_MASK (0xffu)

Mask for the interface number in the wIndex field of the setup request.

GET_INTERFACE_REQUEST_WVALUE

#define GET_INTERFACE_REQUEST_WVALUE 0u

Value for the wValue field of the setup request.

GET_INTERFACE_RESPONSE_SIZE

#define GET_INTERFACE_RESPONSE_SIZE 1u

Size of the response to the Get Interface request.

GET_STATUS_ENDPOINT_STALLED

#define GET_STATUS_ENDPOINT_STALLED (1u << 0u)

Mask for the endpoint stall status in the first byte of the data stage of the setup request.

Function Documentation
EndpointFromRequestGet()

USB_PIPE_t EndpointFromRequestGet (uint16_t wIndex)

Gets the endpoint status.

Parameters:
wIndex

- Endpoint address and direction

Returns:

A structure with the endpoint status

SetupDeviceAddressCallback()

void SetupDeviceAddressCallback (void )

Callback function for the address.

Parameters:
None.
Returns:

None.

SetupDeviceRequestClearFeature()

RETURN_CODE_t SetupDeviceRequestClearFeature (USB_SETUP_REQUEST_t * setupRequestPtr)

Clears the device feature.

Parameters:
*setupRequestPtr

- Pointer to the setup request

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

SetupDeviceRequestGetConfiguration()

RETURN_CODE_t SetupDeviceRequestGetConfiguration (void )

Gets the device configuration.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

SetupDeviceRequestGetDescriptor()

RETURN_CODE_t SetupDeviceRequestGetDescriptor (USB_SETUP_REQUEST_t * setupRequestPtr)

Gets the device descriptor.

Parameters:
*setupRequestPtr

- Pointer to the setup request

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

SetupDeviceRequestGetStatus()

RETURN_CODE_t SetupDeviceRequestGetStatus (void )

Returns the status of the device features.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

SetupDeviceRequestSetAddress()

RETURN_CODE_t SetupDeviceRequestSetAddress (uint8_t address)

Sets the device address.

Parameters:
address

- Address to be set

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

SetupDeviceRequestSetConfiguration()

RETURN_CODE_t SetupDeviceRequestSetConfiguration (uint8_t configurationValue)

Sets the device configuration.

Parameters:
configurationValue

- Configuration value to be set

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

SetupDeviceRequestSetFeature()

RETURN_CODE_t SetupDeviceRequestSetFeature (USB_SETUP_REQUEST_t * setupRequestPtr)

Sets the device feature.

Parameters:
*setupRequestPtr

- Pointer to the setup request

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

SetupEndpointRequestClearFeature()

RETURN_CODE_t SetupEndpointRequestClearFeature (USB_SETUP_REQUEST_t * setupRequestPtr)

Clears the endpoint feature.

Parameters:
*setupRequestPtr

- Pointer to the setup request

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

SetupEndpointRequestGetStatus()

RETURN_CODE_t SetupEndpointRequestGetStatus (USB_SETUP_REQUEST_t * setupRequestPtr)

Gets the endpoint status.

Parameters:
*setupRequestPtr

- Pointer to the setup request

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

SetupEndpointRequestSetFeature()

RETURN_CODE_t SetupEndpointRequestSetFeature (USB_SETUP_REQUEST_t * setupRequestPtr)

Sets the endpoint feature.

Parameters:
*setupRequestPtr

- Pointer to the setup request

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

SetupEndpointRequestSynchFrame()

RETURN_CODE_t SetupEndpointRequestSynchFrame (void )

Gets the current frame number.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_SetupInterfaceRequestGetDescriptor()

RETURN_CODE_t USB_SetupInterfaceRequestGetDescriptor (USB_SETUP_REQUEST_t * setupRequestPtr)

Setup function for the interface request for class-specific descriptors.

bRequest

wValue

wIndex

wLength

Data

GET_DESCRIPTOR

Type and index

Zero

Length

Descriptor

Parameters:
*setupRequestPtr

- Pointer to the request and its data

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_SetupInterfaceRequestGetInterface()

RETURN_CODE_t USB_SetupInterfaceRequestGetInterface (USB_SETUP_REQUEST_t * setupRequestPtr)

Returns the alternate setting for the specified interface.

Format for GET_INTERFACE request according to USB 2.0 specification Ch 9.4.4. Document: Universal Serial Bus Specification for USB 2.0.

bRequest

wValue

wIndex

wLength

Data

GET_INTERFACE

Zero

Interface

One

Alternate setting

Parameters:
*setupRequestPtr

- Pointer to the request and its data

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_SetupInterfaceRequestGetStatus()

RETURN_CODE_t USB_SetupInterfaceRequestGetStatus (void )

Returns status for the specified interface.

Get status from interface request according to USB 2.0 specification Ch. 9.4.5.

bRequest

wValue

wIndex

wLength

Data

GET_STATUS

Zero

Interface

Two

Interface

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_SetupInterfaceRequestSetInterface()

RETURN_CODE_t USB_SetupInterfaceRequestSetInterface (USB_SETUP_REQUEST_t * setupRequestPtr)

Setup function for the interface request to select the alternate setting.

A request to set interface according to USB 2.0 specification Ch. 9.4.10. Document: Universal Serial Bus Specification for USB 2.0

bRequest

wValue

wIndex

wLength

Data

SET_INTERFACE

Alternate setting

Interface

Zero

None

Parameters:
*setupRequestPtr

- Pointer to the request and its data

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_SetupProcessDeviceRequest()

RETURN_CODE_t USB_SetupProcessDeviceRequest (USB_SETUP_REQUEST_t * setupRequestPtr)

Setup function for the device requests.

USB 2.0 Specification Ch 9.4.

bRequest

wValue

wIndex

wLength

Data

CLEAR_FEATURE

Feature selector

Zero

Zero

None

GET_CONFIGURATION

Zero

Zero

One

Config value

GET_DESCRIPTOR

Type and index

Zero or ID

Length

Descriptor

GET_STATUS

Zero

Endpoint

Two

Device status

SET_ADDRESS

Device address

Zero

Zero

None

SET_CONFIGURATION

Config value

Zero

Zero

None

SET_DESCRIPTOR

Type and index

Zero or ID

Length

Descriptor

SET_FEATURE

Feature selector

Zero

Zero

None

Parameters:
setupRequestPtr

- Pointer to the setup request and its data

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_SetupProcessEndpointRequest()

RETURN_CODE_t USB_SetupProcessEndpointRequest (USB_SETUP_REQUEST_t * setupRequestPtr)

Setup function for the endpoint requests.

USB 2.0 Specification Ch. 9.4.

bRequest

wValue

wIndex

wLength

Data

CLEAR_FEATURE

Feature selector

Endpoint

Zero

None

GET_STATUS

Zero

Endpoint

Two

Endpoint status

SET_FEATURE

Feature selector

Endpoint

Zero

None

SYNCH_FRAME

Zero

Endpoint

Two

Frame number

Parameters:
*setupRequestPtr

- Pointer to the request and its data

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_SetupProcessInterfaceRequest()

RETURN_CODE_t USB_SetupProcessInterfaceRequest (USB_SETUP_REQUEST_t * setupRequestPtr)

Setup function for the interface requests.

USB 2.0 Specification Ch 9.4.

bRequest

wValue

wIndex

wLength

Data

CLEAR_FEATURE

Feature selector

Interface

Zero

None

GET_INTERFACE

Zero

Interface

One

Alternate interface

GET_STATUS

Zero

Interface

Two

Interface

SET_FEATURE

Feature selector

Interface

Zero

None

SET_INTERFACE

Alternate setting

Interface

Zero

None

GET_DESCRIPTOR

Type and index

Zero

Length

Descriptor

Parameters:
setupRequestPtr

- Pointer to the setup request and its data

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

2.11.5.4.7 USB Core Transfer

USB core layer implementation file.

Module description

USB core layer implementation file.

Version: USB Core Version 1.0.0
Functions
Function Documentation
USB_TransferAbort()

RETURN_CODE_t USB_TransferAbort (USB_PIPE_t pipe)

Aborts an ongoing transfer.

Will call the pipe transferEndCallback with the abort status, if configured.

Parameters:
pipe

- A combination of endpoint address and direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_TransferControlDataSet()

RETURN_CODE_t USB_TransferControlDataSet (uint8_t * dataPtr, uint16_t dataSize, USB_SETUP_ENDOFREQUEST_CALLBACK_t callback)

Sets up vendor or class control request data transfers.

Sets up the pointer and size of the read or write trnasfer in the control data stage.

Parameters:
*dataPtr

- The pointer to the data to read or write

dataSize

- The size of the data to read or write

callback

- Pointer to a function to be called at the end of the control request

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_TransferHandler()

RETURN_CODE_t USB_TransferHandler (void )

Handles the different types of packages received or transferred.

Checks if a setup package is received or if a transaction is completed and which pipe has a completed transaction, then it handles them accordingly. Sends an ACK upon completed transaction confirmation.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_TransferReadStart()

RETURN_CODE_t USB_TransferReadStart (USB_PIPE_t pipe, uint8_t * dataPtr, uint16_t dataSize, bool useZLP, USB_TRANSFER_END_CALLBACK_t callback)

Sets up the pipe for the read transfers.

Sets up the pipe for the write transfers and checks to see if it is busy. If it is not busy, then the routine resets the pipe, setting it up for read transfer, then starts the transfer.

Parameters:
pipe

- A combination of endpoint address and direction

*dataPtr

- The pointer to the data to read

dataSize

- The size of the data to read

useZLP

- Enable zero-length package at the end of transfer

callback

- A combination of pipe, status and transferred bytes

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_TransferWriteStart()

RETURN_CODE_t USB_TransferWriteStart (USB_PIPE_t pipe, uint8_t * dataPtr, uint16_t dataSize, bool useZLP, USB_TRANSFER_END_CALLBACK_t callback)

Sets up the pipe for the write transfers.

Sets up the pipe for the write transfers and checks to see if it is busy. If it is not busy, then the routine resets the pipe, setting it up for write transfer, then starts the transfer.

Parameters:
pipe

- A combination of endpoint address and direction

*dataPtr

- The pointer to the data to write

dataSize

- The size of the data to write

useZLP

- Enable zero-length package at the end of transfer

callback

- A combination of pipe, status and transferred bytes

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

2.11.5.4.8 USB Protocol

Common data structures, enumerations and macro definitons based on the USB 2.0 base protocol.

Module description

Common data structures, enumerations and macro definitons based on the USB 2.0 base protocol.

Version: USB Protocol Version 1.0.0
Typedefs
Definitions
Enumerations
Definition Documentation
CLASS_IAD

#define CLASS_IAD 0xEF

IAD class code.

DESCRIPTOR_STRING_LENGTH

#define DESCRIPTOR_STRING_LENGTH( wstring) (sizeof(wstring) / sizeof(wchar_t) - 1)

Calculates descriptor length of a UTF-16 string descriptor without the null character.

NO_PROTOCOL

#define NO_PROTOCOL 0x00

No protocol code.

NO_SUBCLASS

#define NO_SUBCLASS 0x00

No subclass code.

OVERFLOW_EVENT

#define OVERFLOW_EVENT 1u

Overflow event for the endpoint.

PROTOCOL_IAD

#define PROTOCOL_IAD 0x01

IAD protocol code.

SUB_CLASS_IAD

#define SUB_CLASS_IAD 0x02

IAD subclass code.

UNDERFLOW_EVENT

#define UNDERFLOW_EVENT 2u

Underflow event for the endpoint.

USB_CONFIG_ATTR_BUS_POWERED

#define USB_CONFIG_ATTR_BUS_POWERED (0u << 6u)

USB Attribute Bus Powered bitfield for the configuration descriptor.

Bus-Powered

USB_CONFIG_ATTR_MUST_SET

#define USB_CONFIG_ATTR_MUST_SET (1u << 7u)

USB Attribute bitfield for the configuration descriptor.

Must always be set

USB_CONFIG_ATTR_REMOTE_WAKEUP

#define USB_CONFIG_ATTR_REMOTE_WAKEUP (1u << 5u)

USB Attribute Remote Wakeup bitfield for the configuration descriptor.

Remote wakeup supported

USB_CONFIG_ATTR_SELF_POWERED

#define USB_CONFIG_ATTR_SELF_POWERED (1u << 6u)

USB Attribute Self Powered bitfield for the configuration descriptor.

Self-Powered

USB_CONFIG_MAX_POWER

#define USB_CONFIG_MAX_POWER( ma) (((ma) + 1u) / 2u)

USB Max Power bitfield for the configuration descriptor.

Maximum power in mA

USB_ENDPOINT_FEATURE_HALT

#define USB_ENDPOINT_FEATURE_HALT 0x00u

USB endpoint feature halt.

USB_EP_DIR_IN

#define USB_EP_DIR_IN 0x01u

Endpoint direction IN.

USB_EP_DIR_OUT

#define USB_EP_DIR_OUT 0x00u

Endpoint direction OUT.

USB_V2_0

#define USB_V2_0 0x0200

USB Specification version 2.00.

USB_V2_1

#define USB_V2_1 0x0201

USB Specification version 2.01.

Typedef Documentation
USB_EVENT_CALLBACK_t

typedef void(* USB_EVENT_CALLBACK_t) (void)

Function callback type USB_EVENT_CALLBACK_t. Callback type used for USB event notifications.

Parameters:
None.
Returns:

None.

USB_SETUP_ENDOFREQUEST_CALLBACK_t

typedef void(* USB_SETUP_ENDOFREQUEST_CALLBACK_t) (void)

Function callback type USB_SETUP_ENDOFREQUEST_CALLBACK_t. Callback type used for setup request complete notifications.

Parameters:
None.
Returns:

None.

USB_SETUP_EVENT_CALLBACK_t

typedef void(* USB_SETUP_EVENT_CALLBACK_t) (USB_SETUP_REQUEST_t *setupRequestPtr)

Function callback type USB_SETUP_EVENT_CALLBACK_t. Callback type used for setup request notifications.

Parameters:
*setupRequestPtr

- Pointer to the current setup request data structure

Returns:

None.

USB_SETUP_OVERUNDERRUN_CALLBACK_t

typedef RETURN_CODE_t(* USB_SETUP_OVERUNDERRUN_CALLBACK_t) (void)

Function callback type USB_SETUP_OVERUNDERRUN_CALLBACK_t. Callback type used for USB Overrun and Underrun event processing on the control endpoints, with a return code to let the stack know to proceed.

Parameters:
None.
Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_SETUP_PROCESS_CALLBACK_t

typedef RETURN_CODE_t(* USB_SETUP_PROCESS_CALLBACK_t) (USB_SETUP_REQUEST_t *setupRequestPtr)

Function callback type USB_SETUP_PROCESS_CALLBACK_t. Callback type used for setup request processing, with a return code to let the stack know to proceed.

Parameters:
*setupRequestPtr

- Pointer to the current setup request data structure

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_SETUP_STRING_CALLBACK_t

typedef RETURN_CODE_t(* USB_SETUP_STRING_CALLBACK_t) (uint8_t stringIndex, uint16_t langID, uint8_t **descriptorAddressPtr, uint16_t *descriptorLength)

Function callback type USB_SETUP_STRING_CALLBACK_t. Callback type used for setup request processing a string descriptor, with a return code to let the stack know to proceed.

Parameters:
stringIndex

- Specifies which string of device information is requested

langID

- Which language the string requested must be in

**descriptorAddressPtr

- Pointer to write string descriptor address to

*descriptorLength

- pointer to the size of the descriptor

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_TRANSFER_END_CALLBACK_t

typedef void(* USB_TRANSFER_END_CALLBACK_t) (USB_PIPE_t pipe, USB_TRANSFER_STATUS_t status, uint16_t bytesTransferred)

Function callback type USB_TRANSFER_END_CALLBACK_t. Callback type used for transfer complete notifications.

Parameters:
pipe

- Address and direction of the pipe used for the transfer

status

- Status of the completed transfer, USB_PIPE_TRANSFER_OK when successful

bytesTransferred

- Number of bytes transferred

Returns:

None.

Enumeration Type Documentation
USB_CONTROL_STATUS_enum

enum USB_CONTROL_STATUS_enum

Defines the possible states of a configured control transfer.

USB_CONTROL_SETUP

Wait a SETUP packet

USB_CONTROL_DATA_OUT

Wait an OUT data packet

USB_CONTROL_DATA_IN

Wait an IN data packet

USB_CONTROL_ZLP

Wait an IN or OUT ZLP packet

USB_CONTROL_STALL_REQ

STALL enabled on IN and OUT packets

USB_DESCRIPTOR_TYPE_enum

enum USB_DESCRIPTOR_TYPE_enum

Standard USB descriptor types.

USB_DESCRIPTOR_TYPE_DEVICE

Provides essential information about the USB device

USB_DESCRIPTOR_TYPE_CONFIGURATION

Describes a specific configuration of the device

USB_DESCRIPTOR_TYPE_STRING

Contains human-readable string information

USB_DESCRIPTOR_TYPE_INTERFACE

Specifies the characteristics of a single interface within a configuration

USB_DESCRIPTOR_TYPE_ENDPOINT

Defines the characteristics of a specific endpoint within an interface

USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER

For high-speed USB devices, informs the host if the device has different device information for when operating in full-speed

USB_DESCRIPTOR_TYPE_OTHER_SPEED_CONFIGURATION

Provides details about the configuration of a device for a specific speed when operating at high-speed

USB_DESCRIPTOR_TYPE_INTERFACE_POWER

Specifies the amount of power that an interface of a USB device consumes when it's active

USB_DESCRIPTOR_TYPE_IAD

Interface Association Descriptor which associates a group of interfaces that form a single function, helping to manage composite devices

USB_DESCRIPTOR_TYPE_BOS

Binary Object Store Descriptor which provides information about the capabilities of the device

USB_DESCRIPTOR_TYPE_DEVICE_CAPABILITY

Describes specific capabilities and features supported by the device, such as USB Power Delivery or USB 2.0 features

USB_DESCRIPTOR_TYPE_CLASS

Class descriptor types are from 0x20 to 0x3f

USB_DESCRIPTOR_TYPE_VENDOR

Vendor descriptor types are from 0x40 to 0x5f

USB_ENDPOINT_enum

enum USB_ENDPOINT_enum

Defines labels for the different endpoint types as per the USB 2.0 base specification.

CONTROL

Control transfer type

ISOCHRONOUS

Isochronous transfer type

BULK

Bulk transfer type

INTERRUPT

Interrupt transfer type

DISABLED

Endpoint disabled

USB_REQUEST_DIR_enum

enum USB_REQUEST_DIR_enum

Standard USB enumeration used by setup requests.

USB_REQUEST_DIR_OUT

Setup request has direction OUT

USB_REQUEST_DIR_IN

Setup request has direction IN

USB_REQUEST_ID_enum

enum USB_REQUEST_ID_enum

Standard USB requests (bRequest).

USB_REQUEST_GET_STATUS

Retrieve status information, such as device power status or endpoint stall conditions

USB_REQUEST_CLEAR_FEATURE

Clear or reset specific device or component features, like clearing an endpoint halt condition

USB_REQUEST_SET_FEATURE

Set or enable specific device or component features, often used to configure device behavior

USB_REQUEST_SET_ADDRESS

Assign a unique device address during enumeration

USB_REQUEST_GET_DESCRIPTOR

Request descriptor information, specifying the type of descriptor being requested

USB_REQUEST_SET_DESCRIPTOR

Update certain descriptors

USB_REQUEST_GET_CONFIGURATION

Retrieve the currently selected device configuration

USB_REQUEST_SET_CONFIGURATION

Select a specific device configuration

USB_REQUEST_GET_INTERFACE

Retrieve the currently selected alternate setting of an interface

USB_REQUEST_SET_INTERFACE

Select a specific alternate setting for an interface

USB_REQUEST_SYNCH_FRAME

Retrieve synchronization information for isochronous transfers

USB_REQUEST_RECIPIENT_enum

enum USB_REQUEST_RECIPIENT_enum

USB recipient codes (bmRequestType).

USB_REQUEST_RECIPIENT_DEVICE

Request is directed at the entire USB device

USB_REQUEST_RECIPIENT_INTERFACE

Request is directed at an interface within the USB device

USB_REQUEST_RECIPIENT_ENDPOINT

Request is directed at an endpoint within an interface

USB_REQUEST_RECIPIENT_OTHER

Request is directed at another specific recipient

USB_REQUEST_TYPE_enum

enum USB_REQUEST_TYPE_enum

USB request types (bmRequestType).

USB_REQUEST_TYPE_STANDARD

Standard USB request defined in the USB specification

USB_REQUEST_TYPE_CLASS

Class-specific request defined in the USB Class Specification

USB_REQUEST_TYPE_VENDOR

Vendor-specific request not defined in the USB Specification

USB_TRANSFER_STATUS_enum

enum USB_TRANSFER_STATUS_enum

Defines the possible states of a configured transfer.

READ WRITE LAYER

USB_PIPE_TRANSFER_OK

Successful transfer on the pipe

USB_PIPE_TRANSFER_BUSY

The pipe is busy

USB_PIPE_TRANSFER_ABORTED

Transfer aborted on the pipe

USB_PIPE_TRANSFER_ERROR

Failure during transfer on the pipe

2.11.5.4.9 USB Human Interface Device (HID)

Contains the prototypes and data types for the generic HID application drivers.

Module description

Contains the prototypes and data types for the generic HID application drivers.

Version: USB Device Stack HID Driver Version 1.0.0
Typedefs
Functions
Typedef Documentation
USB_HID_REPORT_CALLBACK_t

typedef void(* USB_HID_REPORT_CALLBACK_t) (uint16_t report)

Defines a type for registering a callback for the HID report.

Function Documentation
USB_HIDInitialize()

void USB_HIDInitialize (uint8_t * ratePtr, uint8_t * protocolPtr, USB_HID_REPORT_DESCRIPTOR_t * reportPtr)

Registers the rate, protocol and report descriptor for HID.

Parameters:
ratePtr

- Pointer to rate

protocolPtr

- Pointer to protocol

reportPtr

- Pointer to report descriptor

Returns:

None.

USB_HIDReportUpdatedCallback()

void USB_HIDReportUpdatedCallback (void )

Checks if a callback is registered and calls the End Of Request function.

Parameters:
None.
Returns:

None.

USB_HIDReportUpdatedCallbackRegister()

void USB_HIDReportUpdatedCallbackRegister (USB_HID_REPORT_CALLBACK_t callback)

Registers a callback to the HID report.

Parameters:
callback

- Callback to the report updated function

Returns:

None.

USB_HIDRequestHandler()

RETURN_CODE_t USB_HIDRequestHandler (USB_SETUP_REQUEST_t * setupRequestPtr)

Initializes the HID class and performs control transfers.

Parameters:
setupRequestPtr

- Pointer to the Setup Request struct

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

2.11.5.4.10 USB Human Interface Device (HID) Keyboard

Contains the prototypes and data types for the USB Keyboard application drivers.

Module description

Contains the prototypes and data types for the USB Keyboard application drivers.

Version: USB Device Stack HID Driver Version 1.0.0
Keyboard input report sizes

Macros for the input report for a standard HID keyboard.

Definition Documentation
USB_HID_KEYBOARD_REPORT_KEYNUM

#define USB_HID_KEYBOARD_REPORT_KEYNUM 6u

USB_HID_KEYBOARD_REPORT_SIZE

#define USB_HID_KEYBOARD_REPORT_SIZE (USB_HID_KEYBOARD_REPORT_KEYNUM + 2u)

Function Documentation
USB_HIDKeyboardInitialize()

void USB_HIDKeyboardInitialize (USB_HID_REPORT_DESCRIPTOR_t * reportPtr, USB_HID_REPORT_CALLBACK_t callback)

Sets up the keyboard application for use with the HID class.

Parameters:
reportPtr

- Pointer to report descriptor

callback

- Callback for registering the Set Report function

Returns:

None.

USB_HIDKeyCodeIndexGet()

int8_t USB_HIDKeyCodeIndexGet (uint8_t keyID)

Checks the report array to see that the key is already present.

Parameters:
keyID

- ID of the key being pressed

Returns:

HID_KEYID_NOT_FOUND or location in array where the key is already present

USB_HIDKeyModifierDown()

RETURN_CODE_t USB_HIDKeyModifierDown (uint8_t modifierID)

Updates the keyboard report by adding the pressed modifier key in the modifier byte in the report array.

Parameters:
modifierID

- ID of modifier key being pressed

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_HIDKeyModifierUp()

RETURN_CODE_t USB_HIDKeyModifierUp (uint8_t modifierID)

Updates the keyboard report by removing the released modifier key in the modifier byte in the report array.

Parameters:
modifierID

- ID of modifier key being released

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_HIDKeyPressDown()

RETURN_CODE_t USB_HIDKeyPressDown (uint8_t keyID)

Updates the keyboard report by adding the pressed key at the first available byte in the report array.

Parameters:
keyID

- ID of key being pressed

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_HIDKeyPressUp()

RETURN_CODE_t USB_HIDKeyPressUp (uint8_t keyID)

Updates the keyboard report by removing the released key and shifts the registered keys towards the beginning of the report array.

Parameters:
keyID

- ID of key being released

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

2.11.5.4.11 USB Human Interface Device (HID) Mouse

Contains the prototypes and data types for the USB Mouse application drivers.

Module description

Contains the prototypes and data types for the USB Mouse application drivers.

Version: USB Device Stack Driver Version 1.0.0
Functions
Definition Documentation
HID_MOUSE_BUTTON_DOWN

#define HID_MOUSE_BUTTON_DOWN true

HID_MOUSE_BUTTON_UP

#define HID_MOUSE_BUTTON_UP false

HID_MOUSE_LEFT_BUTTON

#define HID_MOUSE_LEFT_BUTTON 0x01u

HID_MOUSE_MIDDLE_BUTTON

#define HID_MOUSE_MIDDLE_BUTTON 0x04u

HID_MOUSE_RIGHT_BUTTON

#define HID_MOUSE_RIGHT_BUTTON 0x02u

USB_HID_MOUSE_REPORT_SIZE

#define USB_HID_MOUSE_REPORT_SIZE 8

Size of the report for a standard HID mouse.

Function Documentation
USB_HIDMouseButton()

RETURN_CODE_t USB_HIDMouseButton (bool buttonState, uint8_t button)

Registers the button and its state and sends it to the host.

Parameters:
buttonState

- Boolean value indicating if the button is pressed or not

button

- Parameter for which button is pressed

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_HIDMouseButtonLeft()

RETURN_CODE_t USB_HIDMouseButtonLeft (bool buttonState)

Registers the button state of the left button.

Parameters:
buttonState

- Boolean value indicating if the button is pressed or not

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_HIDMouseButtonMiddle()

RETURN_CODE_t USB_HIDMouseButtonMiddle (bool buttonState)

Registers the button state of the middle button.

Parameters:
buttonState

- Boolean value indicating if the button is pressed or not

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_HIDMouseButtonRight()

RETURN_CODE_t USB_HIDMouseButtonRight (bool buttonState)

Registers the button state of the right button.

Parameters:
buttonState

- Boolean value indicating if the button is pressed or not

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_HIDMouseInitialize()

void USB_HIDMouseInitialize (USB_HID_REPORT_DESCRIPTOR_t * reportPtr)

Sets up the mouse application for use with the HID class.

Parameters:
reportPtr

- Pointer to report descriptor

Returns:

None.

USB_HIDMouseMove()

RETURN_CODE_t USB_HIDMouseMove (int8_t x_position, int8_t y_position)

Registers mouse movement and sends its coordinates to the host.

Parameters:
x_position

- Relative position in X direction

y_position

- Relative position in Y direction

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

2.11.5.4.12 USB Human Interface Device (HID) Transfer

Contains the prototypes and data types for the USB HID transfer application drivers.

Module description

Contains the prototypes and data types for the USB HID transfer application drivers.

Version: USB Device Stack HID Driver Version 1.0.0
Function Documentation
USB_HIDKeyboardInputReportSentCallback()

void USB_HIDKeyboardInputReportSentCallback (USB_PIPE_t pipe, USB_TRANSFER_STATUS_t status, uint16_t bytesTransferred)

Verifies if a transfer was completed.

Parameters:
pipe

- The pipe that data is being sent on

status

- Status of the transfer

bytesTransferred

- Number of bytes transferred

Returns:

None.

USB_HIDKeyboardReportInSend()

RETURN_CODE_t USB_HIDKeyboardReportInSend (USB_KEYBOARD_REPORT_DATA_t * data)

Sends a HID keyboard input report to the interrupt IN endpoint.

Parameters:
data

- Keyboard input report data

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

USB_HIDMouseReportInSend()

RETURN_CODE_t USB_HIDMouseReportInSend (USB_MOUSE_REPORT_DATA_t * data)

Sends a HID mouse input report to the interrupt IN endpoint.

Parameters:
data

- Mouse input report data

Returns:

SUCCESS or an Error code according to RETURN_CODE_t

2.11.5.4.13 USB Peripheral Hardware Abstraction Layer (HAL)

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

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
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

2.11.5.4.14 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.

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
Definition Documentation
ALWAYS_INLINE

#define ALWAYS_INLINE __attribute__((always_inline)) inline

Alias that makes always inline function definitions more readable.

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.

2.11.5.4.15 USB Peripheral Endpoint

API module for usb_peripheral_endpoint covering endpoint-related functions.

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.

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

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

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.

2.11.5.4.16 USB Peripheral Read/Write

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

Module description

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

Version: USB Device Stack HAL Driver Version 1.0.0
Functions
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

2.11.5.4.17 USB Vendor Class

Contains the prototypes and data types for the vendor application drivers.

Function Documentation
USB_VendorClassInit()

void USB_VendorClassInit (USB_SETUP_EVENT_CALLBACK_t interfaceEnabledCallback, USB_SETUP_PROCESS_CALLBACK_t vendorControlRequest, USB_EVENT_CALLBACK_t interfaceDisabledCallback)

Sets up interfaces for use with the Vendor class.

Parameters:
interfaceEnabledCallback

- Callback to the interface enable function

vendorControlRequest

- Callback to the control request function

interfaceDisabledCallback

- Callback to the interface disable function

Returns:

None.

2.11.5.5 Data Structure Documentation

2.11.5.5.1 CIRCULAR_BUFFER_struct Struct Reference

#include <circular_buffer.h>

Field Documentation

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

source/source-files/circular_buffer/

circular_buffer.h

content

uint8_t* content

Actual buffer data

head

uint16_t head

Index of first empty slot in buffer

maxLength

const uint16_t maxLength

Maximum length of buffer

tail

uint16_t tail

Index of first occupied buffer slot

2.11.5.5.2 CIRCULAR_BUFFER_t Struct Reference

Type define for circular buffers of varying length.

Detailed Description

Type define for circular buffers of varying length.

#include <circular_buffer.h>

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

source/source-files/circular_buffer/

circular_buffer.h

2.11.5.5.3 USB_ASSOCIATION_DESC_struct Struct Reference

#include <usb_protocol_headers.h>

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

bFirstInterface

uint8_t bFirstInterface

Number of interface

bFunctionClass

uint8_t bFunctionClass

Class code assigned by the USB

bFunctionProtocol

uint8_t bFunctionProtocol

Protocol code assigned by the USB

bFunctionSubClass

uint8_t bFunctionSubClass

Sub-class code assigned by the USB

bInterfaceCount

uint8_t bInterfaceCount

Value to select alternate setting

header

USB_DESCRIPTOR_HEADER_t header

Descriptor type and size

iFunction

uint8_t iFunction

Index of string descriptor

2.11.5.5.4 USB_CDC_ACM_FUNCTIONAL_DESCRIPTOR_struct Struct Reference

#include <usb_protocol_cdc.h>

Field Documentation

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

source/source-files/

usb_protocol_cdc.h

bDescriptorSubtype

uint8_t bDescriptorSubtype

CDC functional descriptor subtype

bDescriptorType

uint8_t bDescriptorType

CDC functional descriptor type

bLength

uint8_t bLength

Size of this descriptor in bytes

bmCapabilities

uint8_t bmCapabilities

The capabilities that this configuration supports. A bit value of zero means that the request is not supported.

2.11.5.5.5 USB_CDC_ACM_FUNCTIONAL_DESCRIPTOR_t Struct Reference

Type define for the CDC Abstract Control Management functional descriptor subtype.

Detailed Description

Type define for the CDC Abstract Control Management functional descriptor subtype.

#include <usb_protocol_cdc.h>

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

source/source-files/

usb_protocol_cdc.h

2.11.5.5.6 USB_CDC_COUNTRY_SELECTION_FUNCTIONAL_DESCRIPTOR_struct Struct Reference

#include <usb_protocol_cdc.h>

Field Documentation

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

source/source-files/

usb_protocol_cdc.h

bDescriptorSubtype

uint8_t bDescriptorSubtype

CDC functional descriptor subtype

bDescriptorType

uint8_t bDescriptorType

CDC functional descriptor type

bLength

uint8_t bLength

Size of this descriptor in bytes

iCountryCodeRelDate

uint8_t iCountryCodeRelDate

Index of the release date in ISO 3166 Country Codes

wCountryCode0

uint16_t wCountryCode0

First country code

2.11.5.5.7 USB_CDC_COUNTRY_SELECTION_FUNCTIONAL_DESCRIPTOR_t Struct Reference

Type define for the CDC country selection functional descriptor subtype.

Detailed Description

Type define for the CDC country selection functional descriptor subtype.

#include <usb_protocol_cdc.h>

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

source/source-files/

usb_protocol_cdc.h

2.11.5.5.8 USB_CDC_HEADER_FUNCTIONAL_DESCRIPTOR_struct Struct Reference

#include <usb_protocol_cdc.h>

Field Documentation

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

source/source-files/

usb_protocol_cdc.h

bcdCDC

uint16_t bcdCDC

USB Class Definitions for Communications Devices Specification release number in binary-coded decimal

bDescriptorSubtype

uint8_t bDescriptorSubtype

CDC functional descriptor subtype

bDescriptorType

uint8_t bDescriptorType

CDC functional descriptor type

bLength

uint8_t bLength

Size of this descriptor in bytes

2.11.5.5.9 USB_CDC_HEADER_FUNCTIONAL_DESCRIPTOR_t Struct Reference

Type define for the CDC Header functional descriptor subtype.

Detailed Description

Type define for the CDC Header functional descriptor subtype.

#include <usb_protocol_cdc.h>

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

source/source-files/

usb_protocol_cdc.h

2.11.5.5.10 USB_CDC_LINE_CODING_struct Struct Reference

#include <usb_protocol_cdc.h>

Field Documentation

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

source/source-files/

usb_protocol_cdc.h

bCharFormat

USB_CDC_LINE_CODING_STOP_BITS_t bCharFormat

Number of stop bits

bDataBits

USD_CDC_LINE_CODING_DATA_BITS_t bDataBits

Number of data bits

bParityType

USD_CDC_LINE_CODING_PARITY_t bParityType

Parity control mode

dwDTERate

uint32_t dwDTERate

Data terminal rate, in bits per second

2.11.5.5.11 USB_CDC_LINE_CODING_t Struct Reference

Type define for CDC Line Encoding.

Detailed Description

Type define for CDC Line Encoding.

#include <usb_protocol_cdc.h>

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

source/source-files/

usb_protocol_cdc.h

2.11.5.5.12 USB_CONFIGURATION_DESCRIPTOR_struct Struct Reference

#include <usb_protocol_headers.h>

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

bConfigurationValue

uint8_t bConfigurationValue

bmAttributes

uint8_t bmAttributes

bMaxPower

uint8_t bMaxPower

bNumInterfaces

uint8_t bNumInterfaces

header

USB_DESCRIPTOR_HEADER_t header

Descriptor type and size

iConfiguration

uint8_t iConfiguration

wTotalLength

uint16_t wTotalLength

2.11.5.5.13 USB_CONTROL_TRANSFER_struct Struct Reference

#include <usb_peripheral.h>

Field Documentation

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

source/source-files/usb_peripheral/

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

2.11.5.5.14 USB_CONTROL_TRANSFER_t Struct Reference

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

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/source-files/usb_peripheral/

usb_peripheral.h

2.11.5.5.15 USB_DESCRIPTOR_HEADER_struct Struct Reference

#include <usb_protocol_headers.h>

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

bDescriptorType

uint8_t bDescriptorType

Descriptor type constant - USB_DESCRIPTOR_TYPE_DEVICE

bLength

uint8_t bLength

Descriptor size in bytes - sizeof(USB_DEVICE_DESCRIPTOR_t)

2.11.5.5.16 USB_DESCRIPTOR_POINTERS_struct Struct Reference

#include <usb_protocol_headers.h>

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

configurationsPtr

USB_CONFIGURATION_DESCRIPTOR_t* configurationsPtr

deviceBOSptr

USB_DEV_BOS_DESC_t* deviceBOSptr

devicePtr

USB_DEVICE_DESCRIPTOR_t* devicePtr

langIDptr

USB_STRING_LANG_ID_DESCRIPTOR_t* langIDptr

stringPtrs

USB_DESCRIPTOR_HEADER_t* stringPtrs[LANG_ID_NUM]

2.11.5.5.17 USB_DESCRIPTOR_PTR_union Union Reference

Field Documentation

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

source/source-files/usb_common/

usb_core_descriptors.c

bytePtr

uint8_t* bytePtr

configurationPtr

USB_CONFIGURATION_DESCRIPTOR_t* configurationPtr

endpointPtr

USB_ENDPOINT_DESCRIPTOR_t* endpointPtr

headerPtr

USB_DESCRIPTOR_HEADER_t* headerPtr

interfacePtr

USB_INTERFACE_DESCRIPTOR_t* interfacePtr

2.11.5.5.18 USB_DEV_BOS_DESC_struct Struct Reference

#include <usb_protocol_headers.h>

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

bNumDeviceCaps

uint8_t bNumDeviceCaps

header

USB_DESCRIPTOR_HEADER_t header

Descriptor type and size

wTotalLength

uint16_t wTotalLength

2.11.5.5.19 USB_DEV_CAPA_EXT_DESC_struct Struct Reference

#include <usb_protocol_headers.h>

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

bDevCapabilityType

uint8_t bDevCapabilityType

bmAttributes

uint32_t bmAttributes

header

USB_DESCRIPTOR_HEADER_t header

Descriptor type and size

2.11.5.5.21 USB_DEV_QUAL_DESC_struct Struct Reference

#include <usb_protocol_headers.h>

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

bcdUSB

uint16_t bcdUSB

bDeviceClass

uint8_t bDeviceClass

bDeviceProtocol

uint8_t bDeviceProtocol

bDeviceSubClass

uint8_t bDeviceSubClass

bMaxPacketSize0

uint8_t bMaxPacketSize0

bNumConfigurations

uint8_t bNumConfigurations

bReserved

uint8_t bReserved

header

USB_DESCRIPTOR_HEADER_t header

Descriptor type and size

2.11.5.5.22 USB_DEVICE_DESCRIPTOR_struct Struct Reference

#include <usb_protocol_headers.h>

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

bcdDevice

uint16_t bcdDevice

Device release number in BCD format

bcdUSB

uint16_t bcdUSB

USB spec release number in BCD format

bDeviceClass

uint8_t bDeviceClass

Device Class Code

bDeviceProtocol

uint8_t bDeviceProtocol

Device Protocol Code

bDeviceSubClass

uint8_t bDeviceSubClass

Device SubClass Code

bMaxPacketSize0

uint8_t bMaxPacketSize0

Maximum packet size for endpoint 0

bNumConfigurations

uint8_t bNumConfigurations

Number of possible configurations

header

USB_DESCRIPTOR_HEADER_t header

Descriptor type and size

idProduct

uint16_t idProduct

Product ID

idVendor

uint16_t idVendor

Vendor ID

iManufacturer

uint8_t iManufacturer

Manufacturer string descriptor index

iProduct

uint8_t iProduct

Product string descriptor index

iSerialNumber

uint8_t iSerialNumber

Device serial number string descriptor index

2.11.5.5.23 USB_ENDPOINT_DESCRIPTOR_struct Struct Reference

#include <usb_protocol_headers.h>

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

bEndpointAddress

USB_PIPE_t bEndpointAddress

bInterval

uint8_t bInterval

bmAttributes

struct { ... } bmAttributes

header

USB_DESCRIPTOR_HEADER_t header

Descriptor type and size

reserved

uint8_t reserved

synchronisation

uint8_t synchronisation

type

uint8_t type

usage

uint8_t usage

wMaxPacketSize

uint16_t wMaxPacketSize

2.11.5.5.24 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.

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

Field Documentation

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

source/source-files/usb_peripheral/

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

2.11.5.5.25 USB_EVENT_HANDLERS_struct Struct Reference

Represents the event callbacks, the configuration and the enumeration setups.

Detailed Description

Represents the event callbacks, the configuration and the enumeration setups.

#include <usb_core_events.h>

Field Documentation

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

source/source-files/usb_common/

usb_core_events.h

ClassRequest

USB_SETUP_PROCESS_CALLBACK_t ClassRequest

InterfaceDisabled

USB_EVENT_CALLBACK_t InterfaceDisabled

OtherRequest

USB_SETUP_PROCESS_CALLBACK_t OtherRequest

ResetCallback

USB_EVENT_CALLBACK_t ResetCallback

ResumeCallback

USB_EVENT_CALLBACK_t ResumeCallback

SetConfiguration

USB_SETUP_EVENT_CALLBACK_t SetConfiguration

SetInterface

USB_SETUP_EVENT_CALLBACK_t SetInterface

SOFCallback

USB_EVENT_CALLBACK_t SOFCallback

SuspendCallback

USB_EVENT_CALLBACK_t SuspendCallback

VendorRequest

USB_SETUP_PROCESS_CALLBACK_t VendorRequest

2.11.5.5.26 USB_HID_DESCRIPTOR_t Struct Reference

Type defines for a standard HID descriptor.

Field Documentation

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

source/source-files/

usb_protocol_hid.h

bcdHID

uint16_t bcdHID

Binary Coded Decimal Spec. release

bCountryCode

uint8_t bCountryCode

Hardware target country

bNumDescriptors

uint8_t bNumDescriptors

Number of HID class descriptors to follow

bRDescriptorType

uint8_t bRDescriptorType

Report descriptor type

header

USB_DESCRIPTOR_HEADER_t header

Descriptor type and size

wDescriptorLength

uint16_t wDescriptorLength

Total length of the Report descriptor

2.11.5.5.27 USB_HID_REPORT_DESCRIPTOR_t Struct Reference

Report descriptor for a HID application.

Detailed Description

Report descriptor for a HID application.

#include <usb_protocol_hid.h>

Data Fields
  • uint8_t array [USB_HID_REPORT_DESCRIPTOR_SIZE]

Field Documentation

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

source/source-files/

usb_protocol_hid.h

array

uint8_t array[USB_HID_REPORT_DESCRIPTOR_SIZE]

2.11.5.5.28 USB_IAD_DESC_struct Struct Reference

Standard USB association descriptor structure.

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

bFirstInterface

uint8_t bFirstInterface

Number of interface

bFunctionClass

uint8_t bFunctionClass

Class code assigned by the USB

bFunctionProtocol

uint8_t bFunctionProtocol

Protocol code assigned by the USB

bFunctionSubClass

uint8_t bFunctionSubClass

Sub-class code assigned by the USB

bInterfaceCount

uint8_t bInterfaceCount

Value to select alternate setting

header

USB_DESCRIPTOR_HEADER_t header

Descriptor type and size

iFunction

uint8_t iFunction

Index of string descriptor

2.11.5.5.29 USB_INTERFACE_DESCRIPTOR_struct Struct Reference

Ch. 9.6.5 Standard USB interface descriptor structure.

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

bAlternateSetting

uint8_t bAlternateSetting

bInterfaceClass

uint8_t bInterfaceClass

bInterfaceNumber

uint8_t bInterfaceNumber

bInterfaceProtocol

uint8_t bInterfaceProtocol

bInterfaceSubClass

uint8_t bInterfaceSubClass

bNumEndpoints

uint8_t bNumEndpoints

header

USB_DESCRIPTOR_HEADER_t header

Descriptor type and size

iInterface

uint8_t iInterface

2.11.5.5.30 USB_KEYBOARD_REPORT_DATA_t Struct Reference

Type defines for a standard keyboard input report.

Detailed Description

Type defines for a standard keyboard input report.

#include <usb_protocol_hid.h>

Field Documentation

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

source/source-files/

usb_protocol_hid.h

KeyCode

uint8_t KeyCode[6]

Key codes of the currently pressed keys

Modifier

uint8_t Modifier

Keyboard modifier byte

Reserved

uint8_t Reserved

Reserved for OEM use, always set to 0

2.11.5.5.31 USB_MOUSE_REPORT_DATA_t Struct Reference

Type defines for a standard mouse input report.

Detailed Description

Type defines for a standard mouse input report.

#include <usb_protocol_hid.h>

Data Fields
Field Documentation

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

source/source-files/

usb_protocol_hid.h

Button

uint8_t Button

Button mask for currently pressed buttons in the mouse

X

int8_t X

Current delta X movement of the mouse

Y

int8_t Y

Current delta Y movement of the mouse

2.11.5.5.32 USB_PIPE_struct Struct Reference

Structure for a pipe which has an address and direction.

Detailed Description

Structure for a pipe which has an address and direction.

#include <usb_protocol_headers.h>

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

address

uint8_t address

direction

uint8_t direction

2.11.5.5.33 USB_PIPE_TRANSFER_struct Struct Reference

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

Field Documentation

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

source/source-files/usb_peripheral/

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

2.11.5.5.34 USB_SETUP_REQUEST_struct Struct Reference

#include <usb_protocol_headers.h>

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

bmRequestType

struct { ... } bmRequestType

bRequest

uint8_t bRequest

Request identifier

dataPhaseTransferDirection

uint8_t dataPhaseTransferDirection

Data stage direction bit field

recipient

uint8_t recipient

Recipient type bit field

type

uint8_t type

Request type bit field

wIndex

uint16_t wIndex

Request specific index

wLength

uint16_t wLength

Number of bytes to transfer in data stage

wValue

uint16_t wValue

Request specific value

2.11.5.5.35 USB_STRING_DESCRIPTOR_struct Struct Reference

Structure with pointers to the standard USB descriptors.

Detailed Description

Structure with pointers to the standard USB descriptors.

#include <usb_protocol_headers.h>

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

source/source-files/usb_common/

usb_protocol_headers.h

2.11.5.5.36 USB_STRING_LANG_ID_DESCRIPTOR_struct Struct Reference

Structure for the USB string Language ID descriptor.

Field Documentation

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

source/source-files/usb_common/

usb_protocol_headers.h

header

USB_DESCRIPTOR_HEADER_t header

Descriptor type and size

id_array

uint16_t id_array[LANG_ID_NUM]

2.11.5.6 File Documentation

2.11.5.6.1 source/source-files/circular_buffer/circular_buffer.c File Reference

This file contains the implementation for a circular buffer.

#include "circular_buffer.h"
Functions
Detailed Description

This file contains the implementation for a circular buffer.

CIRCULARBUFFER CDC Circular Buffer Source File

Version: USB Device Stack Driver Version 1.0.0

2.11.5.6.2 source/source-files/circular_buffer/circular_buffer.h File Reference

This file contains prototypes and datatypes for a circular buffer.

#include <stdint.h>
#include <stdbool.h>
#include <usb_common_elements.h>
Functions
Detailed Description

This file contains prototypes and datatypes for a circular buffer.

CIRCULARBUFFER CDC Circular Buffer Header File

Version: USB Device Stack Driver Version 1.0.0
Typedef Documentation
BUFFER_RETURN_CODE_t

typedef enum BUFFER_RETURN_CODE_enum BUFFER_RETURN_CODE_t

CIRCULAR_BUFFER_t

typedef struct CIRCULAR_BUFFER_struct CIRCULAR_BUFFER_t

Enumeration Type Documentation
BUFFER_RETURN_CODE_enum

enum BUFFER_RETURN_CODE_enum

BUFFER_SUCCESS

Action successfully executed

BUFFER_FULL

Error triggered by full buffer

BUFFER_EMPTY

Error triggered by empty buffer

2.11.5.6.3 source/source-files/misra_project_deviations.txt File Reference

2.11.5.6.4 source/source-files/misra_specific_deviations.txt File Reference

2.11.5.6.5 source/source-files/misra_supported_rules.txt File Reference

2.11.5.6.6 source/source-files/usb_cdc.c File Reference

This file contains implementation for CDC.

#include <stddef.h>
#include <usb_cdc.h>
#include <usb_common_elements.h>
#include <usb_core.h>
#include <usb_core_requests.h>
#include <usb_core_transfer.h>
#include <usb_protocol_cdc.h>
#include <usb_protocol_headers.h>
#include <usb_config.h>
Functions
Detailed Description

This file contains implementation for CDC.

USBCDC CDC Source File

Version: USB Device Stack Driver Version 1.0.0
Variable Documentation
usbCDCControlLineState

STATIC uint16_t usbCDCControlLineState

usbCDCLineCoding

STATIC USB_CDC_LINE_CODING_t usbCDCLineCoding

2.11.5.6.7 source/source-files/usb_cdc.h File Reference

#include <usb_common_elements.h>
#include <usb_protocol_cdc.h>
#include <usb_protocol_headers.h>
Functions
Detailed Description

USBCDC CDC Header File

2.11.5.6.8 source/source-files/usb_cdc_virtual_serial_port.c File Reference

This file contains implementation for a CDC application.

#include <usb_cdc_virtual_serial_port.h>
#include <usb_cdc.h>
#include <stddef.h>
#include <string.h>
#include <stdbool.h>
#include <usb_config.h>
#include <circular_buffer.h>
Functions
Detailed Description

This file contains implementation for a CDC application.

USBCDCVIRTUALSERIALPORT CDC Virtual Serial Port Source File

Version: USB Device Stack Driver Version 1.0.0
Variable Documentation
CDCRxPipe

STATIC USB_PIPE_t CDCRxPipe

Initial value:

= {
    .address = USB_CDC_BULK_EP_OUT,
    .direction = USB_EP_DIR_OUT,
}
CDCTxPipe

STATIC USB_PIPE_t CDCTxPipe

Initial value:

= {
    .address = USB_CDC_BULK_EP_IN,
    .direction = USB_EP_DIR_IN,
}
usbCDCReceiveArray

STATIC uint8_t usbCDCReceiveArray[USB_CDC_RX_BUFFER_SIZE]

usbCDCReceiveBuffer

STATIC CIRCULAR_BUFFER_t usbCDCReceiveBuffer

Initial value:

= {
    .content = usbCDCReceiveArray,
    .head = 0,
    .tail = 0,
    .maxLength = USB_CDC_RX_BUFFER_SIZE,
}
usbCDCReceiveTempBuffer

STATIC uint8_t usbCDCReceiveTempBuffer[USB_CDC_RX_PACKET_SIZE]

usbCDCTransmitArray

STATIC uint8_t usbCDCTransmitArray[USB_CDC_TX_BUFFER_SIZE]

usbCDCTransmitBuffer

STATIC CIRCULAR_BUFFER_t usbCDCTransmitBuffer

Initial value:

= {
    .content = usbCDCTransmitArray,
    .head = 0,
    .tail = 0,
    .maxLength = USB_CDC_TX_BUFFER_SIZE,
}
zlpStateTX

bool zlpStateTX = true[static]

2.11.5.6.9 source/source-files/usb_cdc_virtual_serial_port.h File Reference

This file contains prototypes and datatypes for a CDC application.

#include <stdint.h>
#include <stdbool.h>
#include <usb_core.h>
#include <usb_common_elements.h>
#include <usb_protocol_cdc.h>
Functions
Detailed Description

This file contains prototypes and datatypes for a CDC application.

USBCDCVIRTUALSERIAL CDC Virtual Serial Port Header File

Version: USB Device Stack Driver Version 1.0.0
Typedef Documentation
CDC_RETURN_CODE_t

typedef enum CDC_RETURN_CODE_enum CDC_RETURN_CODE_t

Enumeration Type Documentation
CDC_RETURN_CODE_enum

enum CDC_RETURN_CODE_enum

CDC_SUCCESS

Action successfully executed

CDC_BUFFER_FULL

Error triggered by full CDC buffer

CDC_BUFFER_EMPTY

Error triggered by empty CDC buffer

2.11.5.6.10 source/source-files/usb_common/usb_common_elements.h File Reference

Macros
Enumerations
Detailed Description

USBCOMMONELEMENTS Common Elements Header File

Macro Definition Documentation
STATIC

#define STATIC static

Typedef Documentation
RETURN_CODE_t

typedef enum RETURN_CODE_enum RETURN_CODE_t

2.11.5.6.11 source/source-files/usb_common/usb_core.c File Reference

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <usb_common_elements.h>
#include <usb_config.h>
#include <usb_core.h>
#include <usb_core_descriptors.h>
#include <usb_core_events.h>
#include <usb_core_requests.h>
#include <usb_core_transfer.h>
#include <usb_peripheral.h>
#include <usb_protocol_headers.h>

2.11.5.6.12 source/source-files/usb_common/usb_core.h File Reference

Core functionality for the USB stack.

#include <stdbool.h>
#include <stdint.h>
#include <usb_common_elements.h>
#include <usb_core_events.h>
#include <usb_core_transfer.h>
#include <usb_protocol_headers.h>
Detailed Description

Core functionality for the USB stack.

USBCORE CORE Source File

Version: USB Device Core Version 1.0.0

USBCORE CORE Header File

2.11.5.6.13 source/source-files/usb_common/usb_core_descriptors.c File Reference

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <usb_common_elements.h>
#include <usb_config.h>
#include <usb_core.h>
#include <usb_core_descriptors.h>
#include <usb_core_events.h>
#include <usb_peripheral.h>
#include <usb_protocol_headers.h>
Functions
Typedef Documentation
USB_DESCRIPTOR_PTR_t

USB_DESCRIPTOR_PTR_t

Union of a uint8_t pointer and pointers to the different descriptor types.

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

Justification: Needed for the stack to parse through the configuration descriptors without pointer casting between the different descriptor types and uint8_t.

Variable Documentation
activeConfigurationPtr

STATIC USB_CONFIGURATION_DESCRIPTOR_t* activeConfigurationPtr = NULL

activeInterfaces

STATIC uint8_t activeInterfaces[USB_INTERFACE_NUM]

applicationPointers

STATIC USB_DESCRIPTOR_POINTERS_t* applicationPointers = NULL

2.11.5.6.14 source/source-files/usb_common/usb_core_descriptors.h File Reference

descriptors for the USB Core Stack.

#include <stdbool.h>
#include <usb_common_elements.h>
#include <usb_protocol_headers.h>
Functions
Detailed Description

descriptors for the USB Core Stack.

USBCOREDESCRIPTOR Core Descriptors Source File

Version: USB Device Core Version 1.0.0

USBCOREDESCRIPTOR Core Descriptors Header File

2.11.5.6.15 source/source-files/usb_common/usb_core_events.c File Reference

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <usb_common_elements.h>
#include <usb_config.h>
#include <usb_core.h>
#include <usb_core_events.h>
#include <usb_peripheral.h>
#include <usb_protocol_headers.h>
Functions
Variable Documentation
event

USB_EVENT_HANDLERS_t event

2.11.5.6.16 source/source-files/usb_common/usb_core_events.h File Reference

Event handling for the USB Core Stack.

#include <stdbool.h>
#include <stdint.h>
#include <usb_common_elements.h>
#include <usb_core_descriptors.h>
#include <usb_core_requests.h>
#include <usb_core_transfer.h>
#include <usb_peripheral.h>
#include <usb_protocol_headers.h>
Data structures
Functions
Detailed Description

Event handling for the USB Core Stack.

USBCOREEVENTS USB Core Events Source File

Version: USB Device Core Version 1.0.0

USBCOREEVENTS USB Core Events Header File

Typedef Documentation
USB_EVENT_HANDLERS_t

typedef struct USB_EVENT_HANDLERS_struct USB_EVENT_HANDLERS_t

Variable Documentation
event

USB_EVENT_HANDLERS_t event

2.11.5.6.17 source/source-files/usb_common/usb_core_requests.c File Reference

USB Device Core Requests handling.

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <usb_core_requests.h>
#include <usb_common_elements.h>
#include <usb_protocol_headers.h>
#include <usb_config.h>
#include <usb_peripheral.h>
#include <usb_core.h>
Detailed Description

USB Device Core Requests handling.

USBCOREREQUESTS USB Core Requests Source File

Version: USB Device Core Version 1.0.0

2.11.5.6.18 source/source-files/usb_common/usb_core_requests.h File Reference

#include <stdbool.h>
#include <stdint.h>
#include <usb_core_requests_device.h>
#include <usb_core_requests_interface.h>
#include <usb_core_requests_endpoint.h>
#include <usb_protocol_headers.h>
#include <usb_common_elements.h>
Detailed Description

USBCOREREQUESTS USB Core Requests Header File

2.11.5.6.19 source/source-files/usb_common/usb_core_requests_device.c File Reference

USB Device Core Requests handling.

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <usb_core_requests_device.h>
#include <usb_common_elements.h>
#include <usb_protocol_headers.h>
#include <usb_config.h>
#include <usb_peripheral.h>
#include <usb_core.h>
#include <usb_core_descriptors.h>
Functions
Detailed Description

USB Device Core Requests handling.

USBCOREREQUESTSDEVICE USB Core Requests Device Core File

Version: USB Device Core Version 1.0.0
Variable Documentation
deviceAddress

STATIC uint8_t deviceAddress = 0

2.11.5.6.20 source/source-files/usb_common/usb_core_requests_device.h File Reference

USB Device Core Requests handling.

#include <stdbool.h>
#include <stdint.h>
#include "usb_protocol_headers.h"
#include "usb_common_elements.h"
Functions
Detailed Description

USB Device Core Requests handling.

USBCOREREQUESTSDEVICE USB Core Requests Device Header File

Version: USB Device Core Version 1.0.0

2.11.5.6.21 source/source-files/usb_common/usb_core_requests_endpoint.c File Reference

USB Endpoint Core Requests handling.

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <usb_core_requests.h>
#include <usb_common_elements.h>
#include <usb_protocol_headers.h>
#include <usb_config.h>
#include <usb_peripheral.h>
#include <usb_core.h>
#include <usb_core_transfer.h>
Functions
Detailed Description

USB Endpoint Core Requests handling.

USBCOREREQUESTSENDPOINT USB Core Requests Endpoint Source File

Version: USB Device Core Version USB 1.0.0

2.11.5.6.22 source/source-files/usb_common/usb_core_requests_endpoint.h File Reference

USB Endpoint Core Requests handling.

#include <stdbool.h>
#include <stdint.h>
#include "usb_protocol_headers.h"
#include "usb_common_elements.h"
Functions
Detailed Description

USB Endpoint Core Requests handling.

USBCOREREQUESTSENDPOINT USB Core Requests Endpoint Header File

Version: USB Device Core Version USB 1.0.0

2.11.5.6.23 source/source-files/usb_common/usb_core_requests_interface.c File Reference

USB Interface Core Requests handling.

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <usb_core_requests_interface.h>
#include <usb_common_elements.h>
#include <usb_protocol_headers.h>
#include <usb_config.h>
#include <usb_peripheral.h>
#include <usb_core.h>
#include <usb_core_events.h>
Functions
Detailed Description

USB Interface Core Requests handling.

USBCOREREQUESTSINTERFACE USB Core Requests Interface Source File

Version: USB Device Core Version 1.0.0

2.11.5.6.24 source/source-files/usb_common/usb_core_requests_interface.h File Reference

USB Interface Core Requests handling.

#include <stdbool.h>
#include <stdint.h>
#include "usb_protocol_headers.h"
#include "usb_common_elements.h"
Functions
Detailed Description

USB Interface Core Requests handling.

USBCOREREQUESTSINTERFACE USB Core Requests Interface Header File

Version: USB Device Core Version 1.0.0

2.11.5.6.25 source/source-files/usb_common/usb_core_transfer.c File Reference

USB core layer implementation file.

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <usb_core.h>
#include <usb_protocol_headers.h>
#include <usb_common_elements.h>
#include <usb_config.h>
#include <usb_peripheral.h>
Functions
Detailed Description

USB core layer implementation file.

USBCORETRANSFER USB Core Transfer Source File

Version: USB Core Version 1.0.0

2.11.5.6.26 source/source-files/usb_common/usb_core_transfer.h File Reference

#include <stdbool.h>
#include <stdint.h>
#include <usb_protocol_headers.h>
#include <usb_common_elements.h>
#include <usb_core_transfer.h>
#include <usb_core_requests.h>
#include <usb_core_descriptors.h>
#include <usb_peripheral.h>
Functions
Detailed Description

USBCORETRANSFER USB Core Transfer Header File

2.11.5.6.27 source/source-files/usb_common/usb_protocol_headers.h File Reference

#include "usb_common_elements.h"
#include <stdbool.h>
#include <stdint.h>
#include <usb_config.h>
Data structures
Macros
Typedefs
Enumerations
Detailed Description

USBPROTOCOLHEADERS USB Protocol Headers Header File

Macro Definition Documentation
USB_REQUEST_DEVICE_DISABLE_CONFIGURATION

#define USB_REQUEST_DEVICE_DISABLE_CONFIGURATION (0u)

USB_REQUEST_DEVICE_REMOTE_WAKEUP

#define USB_REQUEST_DEVICE_REMOTE_WAKEUP (1u << 1u)

Remote Wake-up supported

USB_REQUEST_DEVICE_SELF_POWERED

#define USB_REQUEST_DEVICE_SELF_POWERED (1u << 0u)

Self-Powered

Typedef Documentation
USB_ASSOCIATION_DESC_t

typedef struct USB_ASSOCIATION_DESC_struct USB_ASSOCIATION_DESC_t

USB_CONFIGURATION_DESCRIPTOR_t

typedef struct USB_CONFIGURATION_DESCRIPTOR_struct USB_CONFIGURATION_DESCRIPTOR_t

USB_CONTROL_STATUS_t

typedef enum USB_CONTROL_STATUS_enum USB_CONTROL_STATUS_t

USB_DESCRIPTOR_HEADER_t

typedef struct USB_DESCRIPTOR_HEADER_struct USB_DESCRIPTOR_HEADER_t

USB_DESCRIPTOR_POINTERS_t

typedef struct USB_DESCRIPTOR_POINTERS_struct USB_DESCRIPTOR_POINTERS_t

USB_DESCRIPTOR_TYPE_t

typedef enum USB_DESCRIPTOR_TYPE_enum USB_DESCRIPTOR_TYPE_t

USB_DEV_BOS_DESC_t

typedef struct USB_DEV_BOS_DESC_struct USB_DEV_BOS_DESC_t

USB_DEV_CAPA_EXT_DESC_t

typedef struct USB_DEV_CAPA_EXT_DESC_struct USB_DEV_CAPA_EXT_DESC_t

USB_DEV_LPM_DESC_t

typedef struct USB_DEV_LPM_DESC_struct USB_DEV_LPM_DESC_t

USB_DEV_QUAL_DESC_t

typedef struct USB_DEV_QUAL_DESC_struct USB_DEV_QUAL_DESC_t

USB_DEVICE_CLASS_t

typedef enum USB_DEVICE_CLASS_enum USB_DEVICE_CLASS_t

USB_DEVICE_DESCRIPTOR_t

typedef struct USB_DEVICE_DESCRIPTOR_struct USB_DEVICE_DESCRIPTOR_t

USB_ENDPOINT_DESCRIPTOR_t

typedef struct USB_ENDPOINT_DESCRIPTOR_struct USB_ENDPOINT_DESCRIPTOR_t

USB_ENDPOINT_t

typedef enum USB_ENDPOINT_enum USB_ENDPOINT_t

USB_IAD_DESC_t

typedef struct USB_IAD_DESC_struct USB_IAD_DESC_t

USB_INTERFACE_DESCRIPTOR_t

typedef struct USB_INTERFACE_DESCRIPTOR_struct USB_INTERFACE_DESCRIPTOR_t

USB_PIPE_t

typedef struct USB_PIPE_struct USB_PIPE_t

USB_REQUEST_DIR_t

typedef enum USB_REQUEST_DIR_enum USB_REQUEST_DIR_t

USB_REQUEST_ID_t

typedef enum USB_REQUEST_ID_enum USB_REQUEST_ID_t

USB_REQUEST_RECIPIENT_t

typedef enum USB_REQUEST_RECIPIENT_enum USB_REQUEST_RECIPIENT_t

USB_REQUEST_TYPE_t

typedef enum USB_REQUEST_TYPE_enum USB_REQUEST_TYPE_t

USB_SETUP_REQUEST_t

typedef struct USB_SETUP_REQUEST_struct USB_SETUP_REQUEST_t

USB_STRING_LANG_ID_DESCRIPTOR_t

typedef struct USB_STRING_LANG_ID_DESCRIPTOR_struct USB_STRING_LANG_ID_DESCRIPTOR_t

USB_TRANSFER_STATUS_t

typedef enum USB_TRANSFER_STATUS_enum USB_TRANSFER_STATUS_t

Enumeration Type Documentation
USB_DEVICE_CLASS_enum

enum USB_DEVICE_CLASS_enum

USB_NO_DEVICE_CLASS

Use class code info from Interface Descriptors

USB_AUDIO_DEVICE_CLASS

Audio device

USB_CDC_DEVICE_CLASS

Communications and CDC Control

USB_HID_DEVICE_CLASS

HID (Human Interface Device)

USB_PHYSICAL_DEVICE_CLASS

Physical device

USB_IMAGE_DEVICE_CLASS

Still imaging device

USB_PRINTER_DEVICE_CLASS

Printer device

USB_MASS_STORAGE_DEVICE_CLASS

Mass storage device

USB_HUB_DEVICE_CLASS

Hub

USB_CDC_DATA_DEVICE_CLASS

CDC data device

USB_SMART_CARD_DEVICE_CLASS

Smart Card device

USB_CONTENT_SECURITY_DEVICE_CLASS

Content security device

USB_VIDEO_DEVICE_CLASS

Video device

USB_PERSONAL_HEALTHCARE_DEVICE_CLASS

Personal healthcare device

USB_AUDIO_VIDEO_DEVICE_CLASS

Audio/Video devices

USB_BILLBOARD_DEVICE_CLASS

Billboard device

USB_TYPE_C_BRIDGE_DEVICE_CLASS

USB Type-C bridge device

USB_BULK_DISPLAY_PROTOCOL_DEVICE_CLASS

USB Bulk display protocol device

USB_MCTP_DEVICE_CLASS

MCTP over USB protocol endpoint device

USB_I3C_DEVICE_CLASS

I3C device

USB_DIAGNOSTIC_DEVICE_CLASS

Diagnostic device

USB_WIRELESS_DEVICE_CLASS

Wireless controller

USB_MISC_DEVICE_CLASS

Miscellaneous

USB_APPLICATION_DEVICE_CLASS

Application specific

USB_VENDOR_DEVICE_CLASS

Vendor specific

2.11.5.6.28 source/source-files/usb_hid.c File Reference

Contains the implementation for the HID generic drivers.

#include <usb_hid.h>
#include <stddef.h>
#include <usb_common_elements.h>
#include <usb_protocol_hid.h>
#include <usb_core.h>
#include <usb_config.h>
Functions
Detailed Description

Contains the implementation for the HID generic drivers.

USBHID HID Source File

Version: USB Device Stack HID Driver Version 1.0.0
Variable Documentation
descriptorLength

STATIC uint16_t descriptorLength = 0

descriptorPtr

STATIC uint8_t* descriptorPtr = NULL

descriptorType

STATIC USB_DESCRIPTOR_TYPE_HID_t descriptorType

protocol

STATIC uint8_t* protocol = NULL

rate

STATIC uint8_t* rate = NULL

reportCallback

STATIC USB_HID_REPORT_CALLBACK_t reportCallback = NULL

reportData

STATIC uint16_t reportData = 0

reportDescriptor

STATIC uint8_t* reportDescriptor = NULL

2.11.5.6.29 source/source-files/usb_hid.h File Reference

#include <usb_common_elements.h>
#include <usb_protocol_headers.h>
#include <usb_protocol_hid.h>
Functions
Detailed Description

USBHID HID Header File

2.11.5.6.30 source/source-files/usb_hid_keyboard.c File Reference

Contains the implementation for the USB Keyboard drivers.

#include <usb_hid_keyboard.h>
#include <usb_hid_keycodes.h>
#include <stddef.h>
#include <string.h>
#include <usb_common_elements.h>
#include <usb_hid.h>
#include <usb_hid_transfer.h>
#include <usb_core.h>
#include <usb_config.h>
#include <usb_protocol_hid.h>
Functions
Detailed Description

Contains the implementation for the USB Keyboard drivers.

USBHIDKEYBOARD HID Keyboard Source File

Version: USB Device Stack HID Driver Version 1.0.0
Variable Documentation
keyboardInputReport

STATIC USB_KEYBOARD_REPORT_DATA_t keyboardInputReport

usbHIDKeyboardProtocol

STATIC uint8_t usbHIDKeyboardProtocol

usbHIDKeyboardRate

STATIC uint8_t usbHIDKeyboardRate

2.11.5.6.31 source/source-files/usb_hid_keyboard.h File Reference

#include <usb_protocol_hid.h>
#include <usb_common_elements.h>
Keyboard input report sizes

Macros for the input report for a standard HID keyboard.

Detailed Description

USBHIDKEYBOARD HID Keyboard Header File

2.11.5.6.32 source/source-files/usb_hid_keycodes.h File Reference

USB Human Interface Device (HID) keycode definitions.

Macros
HID keyboard key codes

Macros for the key codes used in HID applications

Detailed Description

USB Human Interface Device (HID) keycode definitions.

USBHIDKEYCODES HID Keycodes Header File

Version: USB Device Stack HID Driver Version 1.0.0
Macro Definition Documentation
HID_0

#define HID_0 0x27

HID_1

#define HID_1 0x1E

HID_1K_SEPARATOR

#define HID_1K_SEPARATOR 0xB2

HID_2

#define HID_2 0x1F

HID_3

#define HID_3 0x20

HID_4

#define HID_4 0x21

HID_5

#define HID_5 0x22

HID_6

#define HID_6 0x23

HID_7

#define HID_7 0x24

HID_8

#define HID_8 0x25

HID_9

#define HID_9 0x26

HID_A

#define HID_A 0x04

HID_AGAIN

#define HID_AGAIN 0x79

HID_APOSTROPHE

#define HID_APOSTROPHE 0x34

HID_APPLICATION

#define HID_APPLICATION 0x65

HID_AT102

#define HID_AT102 0x64

HID_B

#define HID_B 0x05

HID_BACKSLASH

#define HID_BACKSLASH 0x31

HID_BACKSPACE

#define HID_BACKSPACE 0x2A

HID_C

#define HID_C 0x06

HID_CAPS_LOCK

#define HID_CAPS_LOCK 0x39

HID_CLOSE_BRACE

#define HID_CLOSE_BRACE 0x30

HID_COMMA

#define HID_COMMA 0x36

HID_COPY

#define HID_COPY 0x7C

HID_CURRENCY_SUB_UNIT

#define HID_CURRENCY_SUB_UNIT 0xB5

HID_CURRENCY_UNIT

#define HID_CURRENCY_UNIT 0xB4

HID_CUT

#define HID_CUT 0x7B

HID_D

#define HID_D 0x07

HID_DECIMAL_SEPARATOR

#define HID_DECIMAL_SEPARATOR 0xB3

HID_DELETE

#define HID_DELETE 0x4C

HID_DOT

#define HID_DOT 0x37

HID_DOWN

#define HID_DOWN 0x51

HID_E

#define HID_E 0x08

HID_END

#define HID_END 0x4D

HID_EQUAL

#define HID_EQUAL 0x2E

HID_ERROR_ROLLOVER

#define HID_ERROR_ROLLOVER 0x01

HID_ERROR_UNDEFINED

#define HID_ERROR_UNDEFINED 0x03

HID_ESCAPE

#define HID_ESCAPE 0x29

HID_EXECUTE

#define HID_EXECUTE 0x74

HID_F

#define HID_F 0x09

HID_F1

#define HID_F1 0x3A

HID_F10

#define HID_F10 0x43

HID_F11

#define HID_F11 0x44

HID_F12

#define HID_F12 0x45

HID_F13

#define HID_F13 0x68

HID_F14

#define HID_F14 0x69

HID_F15

#define HID_F15 0x6A

HID_F16

#define HID_F16 0x6B

HID_F17

#define HID_F17 0x6C

HID_F18

#define HID_F18 0x6D

HID_F19

#define HID_F19 0x6E

HID_F2

#define HID_F2 0x3B

HID_F20

#define HID_F20 0x6F

HID_F21

#define HID_F21 0x70

HID_F22

#define HID_F22 0x71

HID_F23

#define HID_F23 0x72

HID_F24

#define HID_F24 0x73

HID_F3

#define HID_F3 0x3C

HID_F4

#define HID_F4 0x3D

HID_F5

#define HID_F5 0x3E

HID_F6

#define HID_F6 0x3F

HID_F7

#define HID_F7 0x40

HID_F8

#define HID_F8 0x41

HID_F9

#define HID_F9 0x42

HID_FIND

#define HID_FIND 0x7E

HID_G

#define HID_G 0x0A

HID_GRAVE_TILDE

#define HID_GRAVE_TILDE 0x35

HID_H

#define HID_H 0x0B

HID_HASH_TILDE

#define HID_HASH_TILDE 0x32

HID_HELP

#define HID_HELP 0x75

HID_HOME

#define HID_HOME 0x4A

HID_I

#define HID_I 0x0C

HID_INSERT

#define HID_INSERT 0x49

HID_INTERNATIONAL_1

#define HID_INTERNATIONAL_1 0x87

HID_INTERNATIONAL_2

#define HID_INTERNATIONAL_2 0x88

HID_INTERNATIONAL_3

#define HID_INTERNATIONAL_3 0x89

HID_INTERNATIONAL_4

#define HID_INTERNATIONAL_4 0x8A

HID_INTERNATIONAL_5

#define HID_INTERNATIONAL_5 0x8B

HID_INTERNATIONAL_6

#define HID_INTERNATIONAL_6 0x8C

HID_INTERNATIONAL_7

#define HID_INTERNATIONAL_7 0x8D

HID_INTERNATIONAL_8

#define HID_INTERNATIONAL_8 0x8E

HID_INTERNATIONAL_9

#define HID_INTERNATIONAL_9 0x8F

HID_J

#define HID_J 0x0D

HID_K

#define HID_K 0x0E

HID_KB_ALT_ERASE

#define HID_KB_ALT_ERASE 0x99

HID_KB_CANCEL

#define HID_KB_CANCEL 0x9B

HID_KB_CLEAR

#define HID_KB_CLEAR 0x9C

HID_KB_CLEAR_AGAIN

#define HID_KB_CLEAR_AGAIN 0xA2

HID_KB_CRSEL

#define HID_KB_CRSEL 0xA3

HID_KB_EXSEL

#define HID_KB_EXSEL 0xA4

HID_KB_OPER

#define HID_KB_OPER 0xA1

HID_KB_OUT

#define HID_KB_OUT 0xA0

HID_KB_PRIOR

#define HID_KB_PRIOR 0x9D

HID_KB_RETURN

#define HID_KB_RETURN 0x9E

HID_KB_SEPARATOR

#define HID_KB_SEPARATOR 0x9F

HID_KB_SYSREQ

#define HID_KB_SYSREQ 0x9A

HID_KEY_NONE

#define HID_KEY_NONE 0x00

HID_KEYID_NOT_FOUND

#define HID_KEYID_NOT_FOUND (-1)

HID_KEYPAD_0

#define HID_KEYPAD_0 0x62

HID_KEYPAD_00

#define HID_KEYPAD_00 0xB0

HID_KEYPAD_000

#define HID_KEYPAD_000 0xB1

HID_KEYPAD_1

#define HID_KEYPAD_1 0x59

HID_KEYPAD_2

#define HID_KEYPAD_2 0x5A

HID_KEYPAD_3

#define HID_KEYPAD_3 0x5B

HID_KEYPAD_4

#define HID_KEYPAD_4 0x5C

HID_KEYPAD_5

#define HID_KEYPAD_5 0x5D

HID_KEYPAD_6

#define HID_KEYPAD_6 0x5E

HID_KEYPAD_7

#define HID_KEYPAD_7 0x5F

HID_KEYPAD_8

#define HID_KEYPAD_8 0x60

HID_KEYPAD_9

#define HID_KEYPAD_9 0x61

HID_KEYPAD_A

#define HID_KEYPAD_A 0xBC

HID_KEYPAD_AND

#define HID_KEYPAD_AND 0xC7

HID_KEYPAD_AND_AND

#define HID_KEYPAD_AND_AND 0xC8

HID_KEYPAD_ASTERISK

#define HID_KEYPAD_ASTERISK 0x55

HID_KEYPAD_AT

#define HID_KEYPAD_AT 0xCE

HID_KEYPAD_B

#define HID_KEYPAD_B 0xBD

HID_KEYPAD_BACKSPACE

#define HID_KEYPAD_BACKSPACE 0xBB

HID_KEYPAD_BINARY

#define HID_KEYPAD_BINARY 0xDA

HID_KEYPAD_C

#define HID_KEYPAD_C 0xBE

HID_KEYPAD_CLEAR

#define HID_KEYPAD_CLEAR 0xD8

HID_KEYPAD_CLEAR_ENTRY

#define HID_KEYPAD_CLEAR_ENTRY 0xD9

HID_KEYPAD_CLOSE_BRACE

#define HID_KEYPAD_CLOSE_BRACE 0xB9

HID_KEYPAD_COLON

#define HID_KEYPAD_COLON 0xCB

HID_KEYPAD_COMMA

#define HID_KEYPAD_COMMA 0x85

HID_KEYPAD_D

#define HID_KEYPAD_D 0xBF

HID_KEYPAD_DECIMAL

#define HID_KEYPAD_DECIMAL 0xDC

HID_KEYPAD_DOT

#define HID_KEYPAD_DOT 0x63

HID_KEYPAD_E

#define HID_KEYPAD_E 0xC0

HID_KEYPAD_ENTER

#define HID_KEYPAD_ENTER 0x58

HID_KEYPAD_EQUAL

#define HID_KEYPAD_EQUAL 0x67

HID_KEYPAD_EQUALSIGN

#define HID_KEYPAD_EQUALSIGN 0x86

HID_KEYPAD_EXCLAMATION

#define HID_KEYPAD_EXCLAMATION 0xCF

HID_KEYPAD_F

#define HID_KEYPAD_F 0xC1

HID_KEYPAD_HASH

#define HID_KEYPAD_HASH 0xCC

HID_KEYPAD_HEXADECIMAL

#define HID_KEYPAD_HEXADECIMAL 0xDD

HID_KEYPAD_LEFT_ANGLE_BRACE

#define HID_KEYPAD_LEFT_ANGLE_BRACE 0xC5

HID_KEYPAD_LEFT_PARENTHESIS

#define HID_KEYPAD_LEFT_PARENTHESIS 0xB6

HID_KEYPAD_MEM_ADD

#define HID_KEYPAD_MEM_ADD 0xD3

HID_KEYPAD_MEM_CLEAR

#define HID_KEYPAD_MEM_CLEAR 0xD2

HID_KEYPAD_MEM_DIVIDE

#define HID_KEYPAD_MEM_DIVIDE 0xD6

HID_KEYPAD_MEM_MULTIPLY

#define HID_KEYPAD_MEM_MULTIPLY 0xD5

HID_KEYPAD_MEM_RECALL

#define HID_KEYPAD_MEM_RECALL 0xD1

HID_KEYPAD_MEM_STORE

#define HID_KEYPAD_MEM_STORE 0xD0

HID_KEYPAD_MEM_SUBTRACT

#define HID_KEYPAD_MEM_SUBTRACT 0xD4

HID_KEYPAD_MINUS

#define HID_KEYPAD_MINUS 0x56

HID_KEYPAD_NUM_LOCK

#define HID_KEYPAD_NUM_LOCK 0x53

HID_KEYPAD_OCTAL

#define HID_KEYPAD_OCTAL 0xDB

HID_KEYPAD_OPEN_BRACE

#define HID_KEYPAD_OPEN_BRACE 0xB8

HID_KEYPAD_OR

#define HID_KEYPAD_OR 0xC9

HID_KEYPAD_OR_OR

#define HID_KEYPAD_OR_OR 0xCA

HID_KEYPAD_PERCENT

#define HID_KEYPAD_PERCENT 0xC4

HID_KEYPAD_PLUS

#define HID_KEYPAD_PLUS 0x57

HID_KEYPAD_PLUS_MINUS

#define HID_KEYPAD_PLUS_MINUS 0xD7

HID_KEYPAD_POWER_TO

#define HID_KEYPAD_POWER_TO 0xC3

HID_KEYPAD_RIGHT_ANGLE_BRACE

#define HID_KEYPAD_RIGHT_ANGLE_BRACE 0xC6

HID_KEYPAD_RIGHT_PARENTHESIS

#define HID_KEYPAD_RIGHT_PARENTHESIS 0xB7

HID_KEYPAD_SLASH

#define HID_KEYPAD_SLASH 0x54

HID_KEYPAD_SPACE

#define HID_KEYPAD_SPACE 0xCD

HID_KEYPAD_TAB

#define HID_KEYPAD_TAB 0xBA

HID_KEYPAD_XOR

#define HID_KEYPAD_XOR 0xC2

HID_L

#define HID_L 0x0F

HID_LANG_1

#define HID_LANG_1 0x90

HID_LANG_2

#define HID_LANG_2 0x91

HID_LANG_3

#define HID_LANG_3 0x92

HID_LANG_4

#define HID_LANG_4 0x93

HID_LANG_5

#define HID_LANG_5 0x94

HID_LANG_6

#define HID_LANG_6 0x95

HID_LANG_7

#define HID_LANG_7 0x96

HID_LANG_8

#define HID_LANG_8 0x97

HID_LANG_9

#define HID_LANG_9 0x98

HID_LED_CAPS_LOCK

#define HID_LED_CAPS_LOCK (1 << 1)

HID_LED_COMPOSE

#define HID_LED_COMPOSE (1 << 3)

HID_LED_KANA

#define HID_LED_KANA (1 << 4)

HID_LED_NUM_LOCK

#define HID_LED_NUM_LOCK (1 << 0)

HID_LED_SCROLL_LOCK

#define HID_LED_SCROLL_LOCK (1 << 2)

HID_LEFT

#define HID_LEFT 0x50

HID_LEFT_ALT

#define HID_LEFT_ALT 0xE2

HID_LEFT_CTRL

#define HID_LEFT_CTRL 0xE0

HID_LEFT_GUI

#define HID_LEFT_GUI 0xE3

HID_LEFT_SHIFT

#define HID_LEFT_SHIFT 0xE1

HID_LOCK_CAPS_LOCK

#define HID_LOCK_CAPS_LOCK 0x82

HID_LOCK_NUM_LOCK

#define HID_LOCK_NUM_LOCK 0x83

HID_LOCK_SCROLL_LOCK

#define HID_LOCK_SCROLL_LOCK 0x84

HID_M

#define HID_M 0x10

HID_MEDIA_BACK

#define HID_MEDIA_BACK 0xF1

HID_MEDIA_CALC

#define HID_MEDIA_CALC 0xFB

HID_MEDIA_COFFEE

#define HID_MEDIA_COFFEE 0xF9

HID_MEDIA_EDIT

#define HID_MEDIA_EDIT 0xF7

HID_MEDIA_EJECTCD

#define HID_MEDIA_EJECTCD 0xEC

HID_MEDIA_FIND

#define HID_MEDIA_FIND 0xF4

HID_MEDIA_FORWARD

#define HID_MEDIA_FORWARD 0xF2

HID_MEDIA_MUTE

#define HID_MEDIA_MUTE 0xEF

HID_MEDIA_NEXTSONG

#define HID_MEDIA_NEXTSONG 0xEB

HID_MEDIA_PLAYPAUSE

#define HID_MEDIA_PLAYPAUSE 0xE8

HID_MEDIA_PREVIOUSSONG

#define HID_MEDIA_PREVIOUSSONG 0xEA

HID_MEDIA_REFRESH

#define HID_MEDIA_REFRESH 0xFA

HID_MEDIA_SCROLLDOWN

#define HID_MEDIA_SCROLLDOWN 0xF6

HID_MEDIA_SCROLLUP

#define HID_MEDIA_SCROLLUP 0xF5

HID_MEDIA_SLEEP

#define HID_MEDIA_SLEEP 0xF8

HID_MEDIA_STOP

#define HID_MEDIA_STOP 0xF3

HID_MEDIA_STOPCD

#define HID_MEDIA_STOPCD 0xE9

HID_MEDIA_VOLUMEDOWN

#define HID_MEDIA_VOLUMEDOWN 0xEE

HID_MEDIA_VOLUMEUP

#define HID_MEDIA_VOLUMEUP 0xED

HID_MEDIA_WWW

#define HID_MEDIA_WWW 0xF0

HID_MENU

#define HID_MENU 0x76

HID_MODIFIER_LEFT_ALT

#define HID_MODIFIER_LEFT_ALT 0x04

HID_MODIFIER_LEFT_CTRL

#define HID_MODIFIER_LEFT_CTRL 0x01

HID_MODIFIER_LEFT_SHIFT

#define HID_MODIFIER_LEFT_SHIFT 0x02

HID_MODIFIER_LEFT_UI

#define HID_MODIFIER_LEFT_UI 0x08

HID_MODIFIER_NONE

#define HID_MODIFIER_NONE 0x00

HID_MODIFIER_RIGHT_ALT

#define HID_MODIFIER_RIGHT_ALT 0x40

HID_MODIFIER_RIGHT_CTRL

#define HID_MODIFIER_RIGHT_CTRL 0x10

HID_MODIFIER_RIGHT_SHIFT

#define HID_MODIFIER_RIGHT_SHIFT 0x20

HID_MODIFIER_RIGHT_UI

#define HID_MODIFIER_RIGHT_UI 0x80

HID_MUTE

#define HID_MUTE 0x7F

HID_N

#define HID_N 0x11

HID_O

#define HID_O 0x12

HID_OPEN_BRACE

#define HID_OPEN_BRACE 0x2F

HID_P

#define HID_P 0x13

HID_PAGEDOWN

#define HID_PAGEDOWN 0x4E

HID_PAGEUP

#define HID_PAGEUP 0x4B

HID_PASTE

#define HID_PASTE 0x7D

HID_PAUSE

#define HID_PAUSE 0x48

HID_POST_FAIL

#define HID_POST_FAIL 0x02

HID_POWER

#define HID_POWER 0x66

HID_PRINTSCREEN

#define HID_PRINTSCREEN 0x46

HID_Q

#define HID_Q 0x14

HID_R

#define HID_R 0x15

HID_RETURN

#define HID_RETURN 0x28

HID_RIGHT

#define HID_RIGHT 0x4F

HID_RIGHT_ALT

#define HID_RIGHT_ALT 0xE6

HID_RIGHT_CTRL

#define HID_RIGHT_CTRL 0xE4

HID_RIGHT_GUI

#define HID_RIGHT_GUI 0xE7

HID_RIGHT_SHIFT

#define HID_RIGHT_SHIFT 0xE5

HID_S

#define HID_S 0x16

HID_SCROLL_LOCK

#define HID_SCROLL_LOCK 0x47

HID_SELECT

#define HID_SELECT 0x77

HID_SEMICOLON

#define HID_SEMICOLON 0x33

HID_SLASH

#define HID_SLASH 0x38

HID_SPACEBAR

#define HID_SPACEBAR 0x2C

HID_STOP

#define HID_STOP 0x78

HID_T

#define HID_T 0x17

HID_TAB

#define HID_TAB 0x2B

HID_U

#define HID_U 0x18

HID_UNDERSCORE

#define HID_UNDERSCORE 0x2D

HID_UNDO

#define HID_UNDO 0x7A

HID_UP

#define HID_UP 0x52

HID_V

#define HID_V 0x19

HID_VOLUME_DOWN

#define HID_VOLUME_DOWN 0x81

HID_VOLUME_UP

#define HID_VOLUME_UP 0x80

HID_W

#define HID_W 0x1A

HID_X

#define HID_X 0x1B

HID_Y

#define HID_Y 0x1C

HID_Z

#define HID_Z 0x1D

2.11.5.6.33 source/source-files/usb_hid_mouse.c File Reference

Contains the implementation for the USB Mouse drivers.

#include <usb_hid_mouse.h>
#include <stddef.h>
#include <usb_common_elements.h>
#include <usb_hid.h>
#include <usb_hid_transfer.h>
#include <usb_core.h>
#include <usb_config.h>
#include <usb_protocol_hid.h>
Functions
Detailed Description

Contains the implementation for the USB Mouse drivers.

USBHIDMOUSE HID Mouse Source File

Version: USB Device Stack Driver Version 1.0.0
Variable Documentation
mouseInputReport

STATIC USB_MOUSE_REPORT_DATA_t mouseInputReport

usbHIDMouseProtocol

STATIC uint8_t usbHIDMouseProtocol

usbHIDMouseRate

STATIC uint8_t usbHIDMouseRate

2.11.5.6.34 source/source-files/usb_hid_mouse.h File Reference

#include <usb_common_elements.h>
#include <usb_protocol_hid.h>
#include <stdbool.h>
Functions
Detailed Description

USBHIDMOUSE HID Mouse Header File

2.11.5.6.35 source/source-files/usb_hid_transfer.c File Reference

Contains the implementation for the USB HID Transfer drivers.

#include <usb_hid_transfer.h>
#include <stddef.h>
#include <string.h>
#include <usb_common_elements.h>
#include <usb_hid.h>
#include <usb_core.h>
#include <usb_core_events.h>
#include <usb_core_transfer.h>
#include <usb_peripheral_read_write.h>
#include <usb_protocol_hid.h>
#include <usb_config.h>
Detailed Description

Contains the implementation for the USB HID Transfer drivers.

USBHIDTRANSFER HID Transfer Source File

Version: USB Device Stack HID Driver Version 1.0.0
Variable Documentation
keyboardPipe

STATIC USB_PIPE_t keyboardPipe = {.address = USB_HID_INTERRUPT_EP, .direction = USB_EP_DIR_IN}

keyboardReportBuffer

STATIC USB_KEYBOARD_REPORT_DATA_t keyboardReportBuffer

mousePipe

STATIC USB_PIPE_t mousePipe = {.address = USB_HID_INTERRUPT_EP, .direction = USB_EP_DIR_IN}

mouseReportBuffer

STATIC USB_MOUSE_REPORT_DATA_t mouseReportBuffer

nextKeyboardReport

STATIC USB_KEYBOARD_REPORT_DATA_t* nextKeyboardReport = NULL

2.11.5.6.36 source/source-files/usb_hid_transfer.h File Reference

#include <usb_common_elements.h>
#include <usb_protocol_hid.h>
#include <stdbool.h>
Detailed Description

USBHIDKTRANSFER HID Transfer Header File

2.11.5.6.37 source/source-files/usb_peripheral/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>
Functions
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
Variable Documentation
controlTransfer

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

2.11.5.6.38 source/source-files/usb_peripheral/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>
Functions
Detailed Description

USBPERIPHERAL Peripheral Header File

Typedef Documentation
USB_CONTROL_TRANSFER_t

typedef struct USB_CONTROL_TRANSFER_struct USB_CONTROL_TRANSFER_t

2.11.5.6.39 source/source-files/usb_peripheral/usb_peripheral_avr_du.h File Reference

#include <avr/io.h>
#include <usb_config.h>
#include <usb_protocol_headers.h>
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.

Functions
Macros
  • #define ALWAYS_INLINE __attribute__((always_inline)) inline

    Alias that makes always inline function definitions more readable.

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.

Detailed Description

USBPERIPHERALAVRDU Peripheral AVR DU Specific Header File

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

2.11.5.6.40 source/source-files/usb_peripheral/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>
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.

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.

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.

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

2.11.5.6.41 source/source-files/usb_peripheral/usb_peripheral_endpoint.h File Reference

#include <stdbool.h>
#include <stdint.h>
#include "usb_common_elements.h"
#include "usb_protocol_headers.h"
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.

Detailed Description

USBPERIPHERALENDPOINT Peripheral Endpoint Header File

2.11.5.6.42 source/source-files/usb_peripheral/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>
Functions
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
Macro Definition Documentation
PipeTransferIndexGet

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

Variable Documentation
pipeTransfer

STATIC USB_PIPE_TRANSFER_t pipeTransfer[USB_EP_NUM *2]

2.11.5.6.43 source/source-files/usb_peripheral/usb_peripheral_read_write.h File Reference

#include <stdbool.h>
#include <stdint.h>
#include "usb_common_elements.h"
#include "usb_protocol_headers.h"
Functions
Detailed Description

USBPERIPHERALREADWRITE Peripheral Read/Write Header File

2.11.5.6.44 source/source-files/usb_protocol_cdc.h File Reference

USB Communications Device Class (CDC) protocol definitions.

#include <stdint.h>
#include <usb_config.h>
Typedefs
Enumerations
Detailed Description

USB Communications Device Class (CDC) protocol definitions.

USBPROTOCOLCDC CDC Protocol Header File

Version: USB Device Stack Driver Version 1.0.0
Typedef Documentation
USB_CDC_ACM_FUNCTIONAL_CAPABILITIES_t

typedef enum USB_CDC_ACM_FUNCTIONAL_CAPABILITIES_enum USB_CDC_ACM_FUNCTIONAL_CAPABILITIES_t

USB_CDC_ACM_FUNCTIONAL_DESCRIPTOR_t

typedef struct USB_CDC_ACM_FUNCTIONAL_DESCRIPTOR_struct USB_CDC_ACM_FUNCTIONAL_DESCRIPTOR_t

USB_CDC_COMM_FUNCTIONAL_DESCRIPTOR_SUBTYPE_t

typedef enum USB_CDC_COMM_FUNCTIONAL_DESCRIPTOR_SUBTYPE_enum USB_CDC_COMM_FUNCTIONAL_DESCRIPTOR_SUBTYPE_t

USB_CDC_COMM_PROTOCOL_t

typedef enum USB_CDC_COMM_PROTOCOL_enum USB_CDC_COMM_PROTOCOL_t

USB_CDC_COMM_SUBCLASS_t

typedef enum USB_CDC_COMM_SUBCLASS_enum USB_CDC_COMM_SUBCLASS_t

USB_CDC_COUNTRY_SELECTION_FUNCTIONAL_DESCRIPTOR_t

typedef struct USB_CDC_COUNTRY_SELECTION_FUNCTIONAL_DESCRIPTOR_struct USB_CDC_COUNTRY_SELECTION_FUNCTIONAL_DESCRIPTOR_t

USB_CDC_DATA_FUNCTIONAL_DESCRIPTOR_SUBTYPE_t

typedef enum USB_CDC_DATA_FUNCTIONAL_DESCRIPTOR_SUBTYPE_enum USB_CDC_DATA_FUNCTIONAL_DESCRIPTOR_SUBTYPE_t

USB_CDC_DATA_PROTOCOL_t

typedef enum USB_CDC_DATA_PROTOCOL_enum USB_CDC_DATA_PROTOCOL_t

USB_CDC_DATA_SUBCLASS_t

typedef enum USB_CDC_DATA_SUBCLASS_enum USB_CDC_DATA_SUBCLASS_t

USB_CDC_FUNCTIONAL_DESCRIPTOR_t

typedef enum USB_CDC_FUNCTIONAL_DESCRIPTOR_enum USB_CDC_FUNCTIONAL_DESCRIPTOR_t

USB_CDC_HEADER_FUNCTIONAL_DESCRIPTOR_t

typedef struct USB_CDC_HEADER_FUNCTIONAL_DESCRIPTOR_struct USB_CDC_HEADER_FUNCTIONAL_DESCRIPTOR_t

USB_CDC_INTERFACE_CLASS_t

typedef enum USB_CDC_INTERFACE_CLASS_enum USB_CDC_INTERFACE_CLASS_t

USB_CDC_LINE_CODING_STOP_BITS_t

typedef enum USB_CDC_LINE_CODING_STOP_BITS_enum USB_CDC_LINE_CODING_STOP_BITS_t

USB_CDC_LINE_CODING_t

typedef struct USB_CDC_LINE_CODING_struct USB_CDC_LINE_CODING_t

USB_CDC_NOTIFICATION_ID_t

typedef enum USB_CDC_NOTIFICATION_ID_enum USB_CDC_NOTIFICATION_ID_t

USB_CDC_REQUEST_ID_t

typedef enum USB_CDC_REQUEST_ID_enum USB_CDC_REQUEST_ID_t

USD_CDC_CONTROL_LINE_STATE_t

typedef enum USD_CDC_CONTROL_LINE_STATE_enum USD_CDC_CONTROL_LINE_STATE_t

USD_CDC_LINE_CODING_DATA_BITS_t

typedef enum USD_CDC_LINE_CODING_DATA_BITS_enum USD_CDC_LINE_CODING_DATA_BITS_t

USD_CDC_LINE_CODING_PARITY_t

typedef enum USD_CDC_LINE_CODING_PARITY_enum USD_CDC_LINE_CODING_PARITY_t

Enumeration Type Documentation
USB_CDC_ACM_FUNCTIONAL_CAPABILITIES_enum

enum USB_CDC_ACM_FUNCTIONAL_CAPABILITIES_enum

USB_CDC_ACM_FUNCTIONAL_CAPABILITIES_COMM_FEATURE

Device supports the request combination of Set_Comm_Feature, Clear_Comm_Feature, and Get_Comm_Feature

USB_CDC_ACM_FUNCTIONAL_CAPABILITIES_CONTROL_LINE_CODING

Device supports the request combination of Set_Line_Coding, Set_Control_Line_State, Get_Line_Coding, and the notification Serial_State

USB_CDC_ACM_FUNCTIONAL_CAPABILITIES_SEND_BREAK_bm

Device supports the request Send_Break

USB_CDC_ACM_FUNCTIONAL_CAPABILITIES_NETWORK_CONNECTION_bm

Device supports the notification Network_Connection

USB_CDC_COMM_FUNCTIONAL_DESCRIPTOR_SUBTYPE_enum

enum USB_CDC_COMM_FUNCTIONAL_DESCRIPTOR_SUBTYPE_enum

USB_CDC_COMM_FD_SUBTYPE_HEADER

Functional descriptor subtype: Header, which marks the beginning of the concatenated set of functional descriptors for the interface

USB_CDC_COMM_FD_SUBTYPE_CALL_MANAGEMENT

Functional descriptor subtype: Call Management

USB_CDC_COMM_FD_SUBTYPE_ABSTRACT_CONTROL_MANAGEMENT

Functional descriptor subtype: Abstract Control Management

USB_CDC_COMM_FD_SUBTYPE_DIRECT_LINE_MANAGEMENT

Functional descriptor subtype: Direct Line Management

USB_CDC_COMM_FD_SUBTYPE_TELEPHONE_RINGER

Functional descriptor subtype: Telephone Ringer

USB_CDC_COMM_FD_SUBTYPE_TELEPHONE_CALL_AND_LINE_STATE_REPORTING_CAPABILITIES

Functional descriptor subtype: Telephone Call and Line State Reporting Capabilities

USB_CDC_COMM_FD_SUBTYPE_UNION

Functional descriptor subtype: Union

USB_CDC_COMM_FD_SUBTYPE_COUNTRY_SELECTION

Functional descriptor subtype: Country Selection

USB_CDC_COMM_FD_SUBTYPE_TELEPHONE_OPERATIONAL_MODES

Functional descriptor subtype: Telephone Operational Modes

USB_CDC_COMM_FD_SUBTYPE_USB_TERMINAL

Functional descriptor subtype: USB Terminal

USB_CDC_COMM_FD_SUBTYPE_NETWORK_CHANNEL

Functional descriptor subtype: Network Channel Terminal

USB_CDC_COMM_FD_SUBTYPE_PROTOCOL_UNIT

Functional descriptor subtype: Protocol Unit

USB_CDC_COMM_FD_SUBTYPE_EXTENSION_UNIT

Functional descriptor subtype: Extension Unit

USB_CDC_COMM_FD_SUBTYPE_MULTI_CHANNEL_MANAGEMENT

Functional descriptor subtype: Multi-Channel Management

USB_CDC_COMM_FD_SUBTYPE_CAPI_CONTROL_MANAGEMENT

Functional descriptor subtype: Common application programming interface Control Management

USB_CDC_COMM_FD_SUBTYPE_ETHERNET_NETWORKING

Functional descriptor subtype: Ethernet Networking

USB_CDC_COMM_FD_SUBTYPE_ATM_NETWORKING

Functional descriptor subtype: ATM Networking

USB_CDC_COMM_FD_SUBTYPE_WIRELESS_HANDSET_CONTROL_MODEL

Functional descriptor subtype: Wireless Handset Control Model

USB_CDC_COMM_FD_SUBTYPE_MOBILE_DIRECT_LINE_MODEL

Functional descriptor subtype: Mobile Direct Line Model

USB_CDC_COMM_FD_SUBTYPE_MDLM_DETAIL

Functional descriptor subtype: Mobile Direct Line Model Detail

USB_CDC_COMM_FD_SUBTYPE_DEVICE_MANAGEMENT_MODEL

Functional descriptor subtype: Device Management Model

USB_CDC_COMM_FD_SUBTYPE_OBEX

Functional descriptor subtype: Object exchange

USB_CDC_COMM_FD_SUBTYPE_COMMAND_SET

Functional descriptor subtype: Command Set

USB_CDC_COMM_FD_SUBTYPE_COMMAND_SET_DETAIL

Functional descriptor subtype: Command Set Detail

USB_CDC_COMM_FD_SUBTYPE_TELEPHONE_CONTROL_MODEL

Functional descriptor subtype: Telephone Control Model

USB_CDC_COMM_FD_SUBTYPE_OBEX_SERVICE_IDENTIFIER

Functional descriptor subtype: Object exchange Service Identifier

USB_CDC_COMM_FD_SUBTYPE_NCM

Functional descriptor subtype: Network control model

USB_CDC_COMM_PROTOCOL_enum

enum USB_CDC_COMM_PROTOCOL_enum

USB_CDC_COMM_NO_PROTOCOL

Communication interface protocol: No protocol

USB_CDC_COMM_PROTOCOL_USB_SPECIFICATION_COMMUNICATIONS

Communication interface protocol: USB specification communication

USB_CDC_COMM_PROTOCOL_AT_COMMAND_ITU_T_V_250

Communication interface protocol: AT Commands V.250 etc

USB_CDC_COMM_PROTOCOL_AT_COMMAND_PCCA_101

Communication interface protocol: AT Commands defined by PCCA-101

USB_CDC_COMM_PROTOCOL_AT_COMMAND_PCCA_101_ANNEX_O

Communication interface protocol: AT Commands defined by PCCA-101 & Annex O

USB_CDC_COMM_PROTOCOL_AT_COMMAND_GSM_7_07

Communication interface protocol: AT Commands defined by GSM 07.07

USB_CDC_COMM_PROTOCOL_AT_COMMAND_3GPP_27_07

Communication interface protocol: AT Commands defined by 3GPP 27.007

USB_CDC_COMM_PROTOCOL_AT_COMMAND_C_S0017_0

Communication interface protocol: AT Commands defined by TIA for CDMA

USB_CDC_COMM_PROTOCOL_USB_EEM

Communication interface protocol: Ethernet Emulation Model

USB_CDC_COMM_PROTOCOL_USB_EXTERNAL_PROTOCOL

Communication interface protocol: External Protocol, commands defined by Command Set functional descriptor

USB_CDC_COMM_PROTOCOL_USB_SPECIFICATION_VENDOR

Communication interface protocol: Vendor-specific

USB_CDC_COMM_SUBCLASS_enum

enum USB_CDC_COMM_SUBCLASS_enum

USB_CDC_COMM_SUBCLASS_DIRECT_LINE_CONTROL_MODE

Communication interface subclass: Direct line control model

USB_CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL

Communication interface subclass: Abstract control model

USB_CDC_COMM_SUBCLASS_TELEPHONE_CONTROL_MODEL

Communication interface subclass: Telephone control model

USB_CDC_COMM_SUBCLASS_MULTI_CHANNEL_CONTROL_MODEL

Communication interface subclass: Multi channel control model

USB_CDC_COMM_SUBCLASS_CAPI_CONTROL_MODEL

Communication interface subclass: Common application programming interface control model

USB_CDC_COMM_SUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL

Communication interface subclass: Ethernet networking control model

USB_CDC_COMM_SUBCLASS_ATM_NETWORKING_CONTROL_MODEL

Communication interface subclass: ATM networking control model

USB_CDC_COMM_SUBCLASS_WIRELESS_HANDSET_CONTROL_MODEL

Communication interface subclass: Wireless handset control model

USB_CDC_COMM_SUBCLASS_DEVICE_MANAGEMENT

Communication interface subclass: Device management

USB_CDC_COMM_SUBCLASS_MOBILE_DIRECT_LINE_MODEL

Communication interface subclass: Mobile direct line model

USB_CDC_COMM_SUBCLASS_OBEX

Communication interface subclass: Object exchange

USB_CDC_COMM_SUBCLASS_ETHERNET_EMULATION_MODEL

Communication interface subclass: Ethernet emulation model

USB_CDC_COMM_SUBCLASS_NETWORK_CONTROL_MODEL

Communication interface subclass: Network control model

USB_CDC_DATA_FUNCTIONAL_DESCRIPTOR_SUBTYPE_enum

enum USB_CDC_DATA_FUNCTIONAL_DESCRIPTOR_SUBTYPE_enum

USB_CDC_DATA_FD_HEADER

functional descriptor subtype: Header, which marks the beginning of the concatenated set of functional descriptors for the interface

USB_CDC_DATA_PROTOCOL_enum

enum USB_CDC_DATA_PROTOCOL_enum

USB_CDC_DATA_NO_PROTOCOL

Data interface protocol: No protocol

USB_CDC_DATA_PROTOCOL_USB_SPECIFICATION_DATA

Data interface protocol: USB specification communication

USB_CDC_DATA_PROTOCOL_USBNCM1_0

Data interface protocol: Network Transfer Block

USB_CDC_DATA_PROTOCOL_I_430

Data interface protocol: Physical interface protocol for ISDN BRI

USB_CDC_DATA_PROTOCOL_ISO_IEC_3309_1993

Data interface protocol: High-level data link control

USB_CDC_DATA_PROTOCOL_TRANSPARENT

Data interface protocol: Transparent

USB_CDC_DATA_PROTOCOL_Q_921M

Data interface protocol: Management protocol for Q.921 data link protocol

USB_CDC_DATA_PROTOCOL_Q_921

Data interface protocol: Data link protocol for Q.931

USB_CDC_DATA_PROTOCOL_Q_921TM

Data interface protocol: TEI-multiplexor for Q.921 data link protocol

USB_CDC_DATA_PROTOCOL_V_42BIS

Data interface protocol: Data compression procedures

USB_CDC_DATA_PROTOCOL_Q_931_EURO_ISDN

Data interface protocol: Euro-ISDN protocol control

USB_CDC_DATA_PROTOCOL_V_120

Data interface protocol: V.24 rate adaptation to ISDN

USB_CDC_DATA_PROTOCOL_CAPI2_0

Data interface protocol: Common application programming interface commands

USB_CDC_DATA_PROTOCOL_HOST_BASED_DRIVER

Data interface protocol: Host based driver

USB_CDC_DATA_PROTOCOL_CDC_SPECIFICATION_DATA

Data interface protocol: Protocol Unit functional descriptors on Communications Class Interface

USB_CDC_DATA_PROTOCOL_USB_SPECIFICATION_DATA_VENDOR

Data interface protocol: Vendor-specific

USB_CDC_DATA_SUBCLASS_enum

enum USB_CDC_DATA_SUBCLASS_enum

USB_CDC_DATA_NO_SUBCLASS

Data interface subclass: No subclass

USB_CDC_FUNCTIONAL_DESCRIPTOR_enum

enum USB_CDC_FUNCTIONAL_DESCRIPTOR_enum

USB_CDC_FD_CS_INTERFACE

Functional descriptor is connected to interface

USB_CDC_FD_CS_ENDPOINT

Functional descriptor is connected to endpoint

USB_CDC_INTERFACE_CLASS_enum

enum USB_CDC_INTERFACE_CLASS_enum

USB_CDC_NO_INTERFACE_CLASS

Interface level: No class

USB_CDC_COMMUNICATION_INTERFACE_CLASS

Interface level: Communication class

USB_CDC_DATA_INTERFACE_CLASS

Interface level: Data class

USB_CDC_LINE_CODING_STOP_BITS_enum

enum USB_CDC_LINE_CODING_STOP_BITS_enum

USB_CDC_LINE_CODING_ONE_STOP_BIT

Number of stop bits: one

USB_CDC_LINE_CODING_ONE_AND_ONE_HALF_STOP_BIT

Number of stop bits: one and a half

USB_CDC_LINE_CODING_TWO_STOP_BITS

Number of stop bits: two

USB_CDC_NOTIFICATION_ID_enum

enum USB_CDC_NOTIFICATION_ID_enum

USB_CDC_NOTIFICATION_NETWORK_CONNECTION

Notifies the host about network connection status

USB_CDC_NOTIFICATION_RESPONSE_AVAILABLE

Notifies the host that a response is available

USB_CDC_NOTIFICATION_AUX_JACK_HOOK_STATE

Indicates that the loop has changed on the auxiliary phone interface of the USB device

USB_CDC_NOTIFICATION_RING_DETECT

Indicates ring voltage on the POTS line interface of the USB device

USB_CDC_NOTIFICATION_SERIAL_STATE

Sends asynchronous notification of UART status

USB_CDC_NOTIFICATION_CALL_STATE_CHANGE

Identifies that a change has occurred to the state of a call on the line corresponding to the interface or union for the line

USB_CDC_NOTIFICATION_LINE_STATE_CHANGE

Identifies that a change has occurred to the state of the line corresponding to the interface or main interface of a union sending the notification message

USB_CDC_NOTIFICATION_CONNECTION_SPEED_CHANGE

Informs the host-networking driver that a change in either the uplink or the downlink bit rate of the connection has occurred

USB_CDC_NOTIFICATION_MDML_SEMANTIC_MODEL_SPECIFIC_NOTIFICATION

Notification code 40h-5Fh for MDLM Semantic-Model specific notifications

USB_CDC_REQUEST_ID_enum

enum USB_CDC_REQUEST_ID_enum

USB_CDC_REQUEST_SEND_ENCAPSULATED_COMMAND

Request code to transmit protocol supported command from host to device

USB_CDC_REQUEST_GET_ENCAPSULATED_RESPONSE

Request code to transmit protocol supported command from device to host

USB_CDC_REQUEST_SET_COMM_FEATURE

Request code to update settings for given communication feature

USB_CDC_REQUEST_GET_COMM_FEATURE

Request code to get the current settings for given communication feature

USB_CDC_REQUEST_CLEAR_COMM_FEATURE

Request code to clear custom settings to given communication feature

USB_CDC_REQUEST_SET_AUX_LINE_STATE

Request code to connect or disconnect a secondary jack to POTS circuit or CODEC

USB_CDC_REQUEST_SET_HOOK_STATE

Request code to set the necessary PSTN line relay code for on-hook, off-hook, and caller ID states

USB_CDC_REQUEST_PULSE_SETUP

Request code to prepare for a pulse-dialing cycle

USB_CDC_REQUEST_SEND_PULSE

Request code to generate a specified number of make/break pulse cycles

USB_CDC_REQUEST_SET_PULSE_TIME

Request code to set the timing of the make and break periods for pulse dialing

USB_CDC_REQUEST_RING_AUX_JACK

Request code to generate a ring signal on a secondary phone jack

USB_CDC_REQUEST_SET_LINE_CODING

Request code to specify typical asynchronous line-character formatting properties

USB_CDC_REQUEST_GET_LINE_CODING

Request code to get the current asynchronous line-character formatting properties

USB_CDC_REQUEST_SET_CONTROL_LINE_STATE

Request code to set RS-232/V.24 style control signals

USB_CDC_REQUEST_SEND_BREAK

Request code to send special carrier modulation that generates an RS-232 style break

USB_CDC_REQUEST_SET_RINGER_PARMS

Request code to configure the ringer for the communications device

USB_CDC_REQUEST_GET_RINGER_PARMS

Request code to return the ringer capabilities of the device and the current status of the device’s ringer

USB_CDC_REQUEST_SET_OPERATION_PARMS

Request code to set the operational mode for the device

USB_CDC_REQUEST_GET_OPERATION_PARMS

Request code to get the current operational mode for the device

USB_CDC_REQUEST_SET_LINE_PARMS

Request code to change the state of the line for the given interface

USB_CDC_REQUEST_GET_LINE_PARMS

Request code to report the state of the line for the given interface

USB_CDC_REQUEST_DIAL_DIGITS

Request code to dial the DTMF digits over the specified line

USB_CDC_REQUEST_SET_UNIT_PARAMETER

Request code to set the value of a parameter belonging to a Unit identified by Unit Parameter Structure

USB_CDC_REQUEST_GET_UNIT_PARAMETER

Request code to return the current value of a parameter belonging to a Unit pointed out by Unit Parameter Structure

USB_CDC_REQUEST_CLEAR_UNIT_PARAMETER

Request code to restore the default value of a parameter belonging to a Unit identified by Unit Parameter Structure

USB_CDC_REQUEST_GET_PROFILE

Request code to return the profile information as defined by CAPI 2.0

USB_CDC_REQUEST_SET_ETHERNET_MULTICAST_FILTERS

Request code to set the Ethernet device multicast filters as specified in the sequential list of 48 bit Ethernet multicast addresses

USB_CDC_REQUEST_SET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER

Request code to set up the specified Ethernet power management pattern filter as described in the data structure

USB_CDC_REQUEST_GET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER

Request code to retrieve the status of the specified Ethernet power management pattern filter from the device

USB_CDC_REQUEST_SET_ETHERNET_PACKET_FILTER

Request code to configure device Ethernet packet filter settings

USB_CDC_REQUEST_GET_ETHERNET_STATISTIC

Request code to retrieve a statistic based on the feature selector

USB_CDC_REQUEST_SET_ATM_DATA_FORMAT

Request code to set the data format selected by the host

USB_CDC_REQUEST_GET_ATM_DEVICE_STATISTICS

Request code to retrieve the device statistics based on the feature selector

USB_CDC_REQUEST_SET_ATM_DEFAULT_VC

Request code to pre-select the VPI/VCI value for subsequent GetATMVCStatistics requests

USB_CDC_REQUEST_GET_ATM_VC_STATISTICS

Request code to retrieve the ATM device statistics based on the feature selector for a pre-selected VPI/VCI as stipulated in latest preceding SetATMDefaultVC request

USB_CDC_REQUEST_MDLM_SEMANTIC_MODEL_SPECIFIC_REQUESTS

Request code 0x60 to 0x7F for MDLM Semantic-Model specific requests

USB_CDC_REQUEST_GET_NTB_PARAMETERS

Request code to retrieve the parameters that describe NTBs for each direction

USB_CDC_REQUEST_GET_NET_ADDRESS

Request code to return the function’s current EUI-48 station address

USB_CDC_REQUEST_SET_NET_ADDRESS

Request code to set the function’s current EUI-48 station address

USB_CDC_REQUEST_GET_NTB_FORMAT

Request code to return the NTB data format currently being used by the function

USB_CDC_REQUEST_SET_NTB_FORMAT

Request code to select the format of NTB to be used for NTBs transmitted from the function to the host

USB_CDC_REQUEST_GET_NTB_INPUT_SIZE

Request code to return NTB input size currently being used by the function

USB_CDC_REQUEST_SET_NTB_INPUT_SIZE

Request code to select the maximum size of NTB that the device is permitted to send to the host

USB_CDC_REQUEST_GET_MAX_DATAGRAM_SIZE

Request code to return the currently effective maximum datagram size that the function has in effect

USB_CDC_REQUEST_SET_MAX_DATAGRAM_SIZE

Request code to select the maximum datagram size that either host or function will send in an NTB

USB_CDC_REQUEST_GET_CRC_MODE

Request code to return the currently selected CRC mode for NTBs formatted by the function

USB_CDC_REQUEST_SET_CRC_MODE

Request code to control whether the function will append CRCs to datagrams when formatting NTBs to be sent to the host

USD_CDC_CONTROL_LINE_STATE_enum

enum USD_CDC_CONTROL_LINE_STATE_enum

USB_CDC_DATA_TERMINAL_READY_bm

Indicates to DCE if DTE is present or not. This signal corresponds to V.24 signal 108/2 and RS-232 signal DTR.

USB_CDC_REQUEST_TO_SEND_bm

Carrier control for half duplex modems. This signal corresponds to V.24 signal 105 and RS-232 signal RTS.

USD_CDC_LINE_CODING_DATA_BITS_enum

enum USD_CDC_LINE_CODING_DATA_BITS_enum

USB_CDC_LINE_CODING_5_DATA_BITS

Data transmission size: five bits

USB_CDC_LINE_CODING_6_DATA_BITS

Data transmission size: six bits

USB_CDC_LINE_CODING_7_DATA_BITS

Data transmission size: seven bits

USB_CDC_LINE_CODING_8_DATA_BITS

Data transmission size: eight bits

USB_CDC_LINE_CODING_16_DATA_BITS

Data transmission size: sixteen bits

USD_CDC_LINE_CODING_PARITY_enum

enum USD_CDC_LINE_CODING_PARITY_enum

USB_CDC_LINE_CODING_PARITY_NONE

Parity mode: none

USB_CDC_LINE_CODING_PARITY_ODD

Parity mode: odd

USB_CDC_LINE_CODING_PARITY_EVEN

Parity mode: even

USB_CDC_LINE_CODING_PARITY_MARK

Parity mode: mark

USB_CDC_LINE_CODING_PARITY_SPACE

Parity mode: space

2.11.5.6.45 source/source-files/usb_protocol_hid.h File Reference

USB Human Interface Device (HID) protocol definitions.

#include <usb_common_elements.h>
#include <usb_config.h>
#include <usb_protocol_headers.h>
HID Country codes
Enumerations
Detailed Description

USB Human Interface Device (HID) protocol definitions.

USBPROTOCOLHID HID Protocols Header File

Version: USB Device Stack HID Driver Version 1.0.0
Macro Definition Documentation
HID_PROTOCOL_GENERIC

#define HID_PROTOCOL_GENERIC 0x00

HID_PROTOCOL_KEYBOARD

#define HID_PROTOCOL_KEYBOARD 0x01

HID_PROTOCOL_MOUSE

#define HID_PROTOCOL_MOUSE 0x02

HID_SUB_CLASS_BOOT

#define HID_SUB_CLASS_BOOT 0x01

HID_SUB_CLASS_NOBOOT

#define HID_SUB_CLASS_NOBOOT 0x00

USB_HID_BCD_V1_11

#define USB_HID_BCD_V1_11 0x0111

USB_HID_COUNTRY_ARABIC

#define USB_HID_COUNTRY_ARABIC 1

USB_HID_COUNTRY_BELGIAN

#define USB_HID_COUNTRY_BELGIAN 2

USB_HID_COUNTRY_CANADIAN_BILINGUAL

#define USB_HID_COUNTRY_CANADIAN_BILINGUAL 3

USB_HID_COUNTRY_CANADIAN_FRENCH

#define USB_HID_COUNTRY_CANADIAN_FRENCH 4

USB_HID_COUNTRY_CZECH_REPUBLIC

#define USB_HID_COUNTRY_CZECH_REPUBLIC 5

USB_HID_COUNTRY_DANISH

#define USB_HID_COUNTRY_DANISH 6

USB_HID_COUNTRY_FINNISH

#define USB_HID_COUNTRY_FINNISH 7

USB_HID_COUNTRY_FRENCH

#define USB_HID_COUNTRY_FRENCH 8

USB_HID_COUNTRY_GERMAN

#define USB_HID_COUNTRY_GERMAN 9

USB_HID_COUNTRY_GREEK

#define USB_HID_COUNTRY_GREEK 10

USB_HID_COUNTRY_HEBREW

#define USB_HID_COUNTRY_HEBREW 11

USB_HID_COUNTRY_HUNGARY

#define USB_HID_COUNTRY_HUNGARY 12

USB_HID_COUNTRY_INTERNATIONAL_ISO

#define USB_HID_COUNTRY_INTERNATIONAL_ISO 13

USB_HID_COUNTRY_ITALIAN

#define USB_HID_COUNTRY_ITALIAN 14

USB_HID_COUNTRY_JAPAN_KATAKANA

#define USB_HID_COUNTRY_JAPAN_KATAKANA 15

USB_HID_COUNTRY_KOREAN

#define USB_HID_COUNTRY_KOREAN 16

USB_HID_COUNTRY_LATIN_AMERICAN

#define USB_HID_COUNTRY_LATIN_AMERICAN 17

USB_HID_COUNTRY_NETHERLANDS_DUTCH

#define USB_HID_COUNTRY_NETHERLANDS_DUTCH 18

USB_HID_COUNTRY_NORWEGIAN

#define USB_HID_COUNTRY_NORWEGIAN 19

USB_HID_COUNTRY_PERSIAN_FARSI

#define USB_HID_COUNTRY_PERSIAN_FARSI 20

USB_HID_COUNTRY_POLAND

#define USB_HID_COUNTRY_POLAND 21

USB_HID_COUNTRY_PORTUGUESE

#define USB_HID_COUNTRY_PORTUGUESE 22

USB_HID_COUNTRY_RUSSIA

#define USB_HID_COUNTRY_RUSSIA 23

USB_HID_COUNTRY_SLOVAKIA

#define USB_HID_COUNTRY_SLOVAKIA 24

USB_HID_COUNTRY_SPANISH

#define USB_HID_COUNTRY_SPANISH 25

USB_HID_COUNTRY_SWEDISH

#define USB_HID_COUNTRY_SWEDISH 26

USB_HID_COUNTRY_SWISS_FRENCH

#define USB_HID_COUNTRY_SWISS_FRENCH 27

USB_HID_COUNTRY_SWISS_GERMAN

#define USB_HID_COUNTRY_SWISS_GERMAN 28

USB_HID_COUNTRY_SWITZERLAND

#define USB_HID_COUNTRY_SWITZERLAND 29

USB_HID_COUNTRY_TAIWAN

#define USB_HID_COUNTRY_TAIWAN 30

USB_HID_COUNTRY_TURKISH_F

#define USB_HID_COUNTRY_TURKISH_F 35

USB_HID_COUNTRY_TURKISH_Q

#define USB_HID_COUNTRY_TURKISH_Q 31

USB_HID_COUNTRY_UK

#define USB_HID_COUNTRY_UK 32

USB_HID_COUNTRY_US

#define USB_HID_COUNTRY_US 33

USB_HID_COUNTRY_YUGOSLAVIA

#define USB_HID_COUNTRY_YUGOSLAVIA 34

USB_HID_NO_COUNTRY_CODE

#define USB_HID_NO_COUNTRY_CODE 0

USB_HID_NUM_DESC

#define USB_HID_NUM_DESC 0x01

Typedef Documentation
USB_DESCRIPTOR_TYPE_HID_t

typedef enum USB_DESCRIPTOR_TYPE_HID_enum USB_DESCRIPTOR_TYPE_HID_t

USB_HID_ITEM_REPORT_TYPE_t

typedef enum USB_HID_ITEM_REPORT_TYPE_enum USB_HID_ITEM_REPORT_TYPE_t

USB_HID_PROTOCOL_t

typedef enum USB_HID_PROTOCOL_enum USB_HID_PROTOCOL_t

USB_HID_REPORT_TYPE_t

typedef enum USB_HID_REPORT_TYPE_enum USB_HID_REPORT_TYPE_t

USB_REQUEST_ID_HID_t

typedef enum USB_REQUEST_ID_HID_enum USB_REQUEST_ID_HID_t

Enumeration Type Documentation
USB_DESCRIPTOR_TYPE_HID_enum

enum USB_DESCRIPTOR_TYPE_HID_enum

USB_DT_HID

Descriptor type for HID class. Used to describe HID device information such as country code and HID class specification release.

USB_DT_HID_REPORT

Descriptor type for HID report. Used to define the data format and the controls used by the HID device.

USB_DT_HID_PHYSICAL

Descriptor type for HID physical descriptors (optional). Used to describe the physical characteristics of a device.

USB_HID_ITEM_REPORT_TYPE_enum

enum USB_HID_ITEM_REPORT_TYPE_enum

USB_HID_ITEM_REPORT_TYPE_MAIN

Main items are used to define the data fields in HID reports, such as Input, Output and Feature reports

USB_HID_ITEM_REPORT_TYPE_GLOBAL

Global items apply to all the subsequent items in the report descriptor and define characteristics such as usage page, logical minimum, logical maximum, etc

USB_HID_ITEM_REPORT_TYPE_LOCAL

Local items define characteristics that are specific to a particular item, such as usage or designator index

USB_HID_ITEM_REPORT_TYPE_LONG

Long items are not commonly used but are available for future expansion and allow for extended data fields that are not defined by the standard HID item types

USB_HID_PROTOCOL_enum

enum USB_HID_PROTOCOL_enum

USB_HID_PROTOCOL_BOOT

Boot protocol is a simplified protocol that supports a limited set of HID devices

USB_HID_PROTOCOL_REPORT

Report protocol provides a more complex and feature-rich means of communication between the HID device and the host

USB_HID_REPORT_TYPE_enum

enum USB_HID_REPORT_TYPE_enum

USB_HID_REPORT_TYPE_INPUT

Input reports are sent by the HID device to the host to report the state of the input controls

USB_HID_REPORT_TYPE_OUTPUT

Output reports are sent by the host to the HID device to control the state of the output controls

USB_HID_REPORT_TYPE_FEATURE

Feature reports are used to exchange feature data between the host and the HID device that may not be directly tied to input or output, such as configuration data

USB_REQUEST_ID_HID_enum

enum USB_REQUEST_ID_HID_enum

USB_REQ_HID_GET_REPORT

Request to get the current report from the HID device

USB_REQ_HID_GET_IDLE

Request to get the current idle rate for a particular HID report

USB_REQ_HID_GET_PROTOCOL

Request to get the current protocol in use by the HID device

USB_REQ_HID_SET_REPORT

Request to send a report to the HID device

USB_REQ_HID_SET_IDLE

Request to set the idle rate for a particular HID report

USB_REQ_HID_SET_PROTOCOL

Request to set the protocol to be used by the HID device

2.11.5.6.46 source/source-files/usb_vendor.c File Reference

Contains implementation for USB Vendor drivers.

#include <usb_vendor.h>
#include <usb_core.h>
#include <usb_protocol_headers.h>
Detailed Description

Contains implementation for USB Vendor drivers.

USBVENDOR Vendor Source File

Version: USB Device Stack Driver Version 1.0.0