USBLibAPIGuide  1.00.00.01
Data Structures | Macros
Usblib_events

Data Structures

struct  tEventInfo
 

Macros

#define USB_EVENT_BASE   0x0000
 
#define USB_CLASS_EVENT_BASE   0x8000
 
#define USBD_CDC_EVENT_BASE   (USB_CLASS_EVENT_BASE + 0)
 
#define USBD_HID_EVENT_BASE   (USB_CLASS_EVENT_BASE + 0x1000)
 
#define USBD_HID_KEYB_EVENT_BASE   (USBD_HID_EVENT_BASE + 0x100)
 
#define USBD_BULK_EVENT_BASE   (USB_CLASS_EVENT_BASE + 0x2000)
 
#define USBD_MSC_EVENT_BASE   (USB_CLASS_EVENT_BASE + 0x3000)
 
#define USBD_AUDIO_EVENT_BASE   (USB_CLASS_EVENT_BASE + 0x4000)
 
#define USBD_DFU_EVENT_BASE   (USB_CLASS_EVENT_BASE + 0x5000)
 
#define USBH_CDC_EVENT_BASE   (USBD_CDC_EVENT_BASE + 0x800)
 
#define USBH_HID_EVENT_BASE   (USBD_HID_EVENT_BASE + 0x800)
 
#define USBH_BULK_EVENT_BASE   (USBD_BULK_EVENT_BASE + 0x800)
 
#define USBH_MSC_EVENT_BASE   (USBD_MSC_EVENT_BASE + 0x800)
 
#define USBH_AUDIO_EVENT_BASE   (USBD_AUDIO_EVENT_BASE + 0x800)
 
#define USB_EVENT_CONNECTED   (USB_EVENT_BASE + 0)
 
#define USB_EVENT_DISCONNECTED   (USB_EVENT_BASE + 1)
 
#define USB_EVENT_RX_AVAILABLE   (USB_EVENT_BASE + 2)
 
#define USB_EVENT_DATA_REMAINING   (USB_EVENT_BASE + 3)
 
#define USB_EVENT_REQUEST_BUFFER   (USB_EVENT_BASE + 4)
 
#define USB_EVENT_TX_COMPLETE   (USB_EVENT_BASE + 5)
 
#define USB_EVENT_ERROR   (USB_EVENT_BASE + 6)
 
#define USB_EVENT_SUSPEND   (USB_EVENT_BASE + 7)
 The bus has entered suspend state. More...
 
#define USB_EVENT_RESUME   (USB_EVENT_BASE + 8)
 The bus has left suspend state. More...
 
#define USB_EVENT_SCHEDULER   (USB_EVENT_BASE + 9)
 A scheduler event has occurred. More...
 
#define USB_EVENT_STALL   (USB_EVENT_BASE + 10)
 A device or host has detected a stall condition. More...
 
#define USB_EVENT_POWER_FAULT   (USB_EVENT_BASE + 11)
 The host detected a power fault condition. More...
 
#define USB_EVENT_POWER_ENABLE   (USB_EVENT_BASE + 12)
 
#define USB_EVENT_POWER_DISABLE   (USB_EVENT_BASE + 13)
 
#define USB_EVENT_COMP_IFACE_CHANGE   (USB_EVENT_BASE + 14)
 
#define USB_EVENT_COMP_EP_CHANGE   (USB_EVENT_BASE + 15)
 
#define USB_EVENT_COMP_STR_CHANGE   (USB_EVENT_BASE + 16)
 
#define USB_EVENT_COMP_CONFIG   (USB_EVENT_BASE + 17)
 
#define USB_EVENT_UNKNOWN_CONNECTED   (USB_EVENT_BASE + 18)
 
#define USB_EVENT_SOF   (USB_EVENT_BASE + 19)
 
#define USB_EVENT_LPM_SLEEP   (USB_EVENT_BASE + 20)
 This event occurs when a device enters LPM sleep mode. More...
 
#define USB_EVENT_LPM_RESUME   (USB_EVENT_BASE + 21)
 This event occurs when a device is resumed from LPM sleep mode. More...
 
#define USB_EVENT_LPM_ERROR   (USB_EVENT_BASE + 22)
 
#define USB_EVENT_CONFIG_CHANGE   (USB_EVENT_BASE + 23)
 This event occurs when a device has been issued a configuration change. More...
 

Detailed Description

Macro Definition Documentation

§ USB_EVENT_BASE

#define USB_EVENT_BASE   0x0000

§ USB_CLASS_EVENT_BASE

#define USB_CLASS_EVENT_BASE   0x8000

§ USBD_CDC_EVENT_BASE

#define USBD_CDC_EVENT_BASE   (USB_CLASS_EVENT_BASE + 0)

§ USBD_HID_EVENT_BASE

#define USBD_HID_EVENT_BASE   (USB_CLASS_EVENT_BASE + 0x1000)

§ USBD_HID_KEYB_EVENT_BASE

#define USBD_HID_KEYB_EVENT_BASE   (USBD_HID_EVENT_BASE + 0x100)

§ USBD_BULK_EVENT_BASE

#define USBD_BULK_EVENT_BASE   (USB_CLASS_EVENT_BASE + 0x2000)

§ USBD_MSC_EVENT_BASE

#define USBD_MSC_EVENT_BASE   (USB_CLASS_EVENT_BASE + 0x3000)

§ USBD_AUDIO_EVENT_BASE

#define USBD_AUDIO_EVENT_BASE   (USB_CLASS_EVENT_BASE + 0x4000)

§ USBD_DFU_EVENT_BASE

#define USBD_DFU_EVENT_BASE   (USB_CLASS_EVENT_BASE + 0x5000)

§ USBH_CDC_EVENT_BASE

#define USBH_CDC_EVENT_BASE   (USBD_CDC_EVENT_BASE + 0x800)

§ USBH_HID_EVENT_BASE

#define USBH_HID_EVENT_BASE   (USBD_HID_EVENT_BASE + 0x800)

§ USBH_BULK_EVENT_BASE

#define USBH_BULK_EVENT_BASE   (USBD_BULK_EVENT_BASE + 0x800)

§ USBH_MSC_EVENT_BASE

#define USBH_MSC_EVENT_BASE   (USBD_MSC_EVENT_BASE + 0x800)

§ USBH_AUDIO_EVENT_BASE

#define USBH_AUDIO_EVENT_BASE   (USBD_AUDIO_EVENT_BASE + 0x800)

§ USB_EVENT_CONNECTED

#define USB_EVENT_CONNECTED   (USB_EVENT_BASE + 0)

The device is now attached to a USB host and ready to begin sending and receiving data (used by device classes only).

§ USB_EVENT_DISCONNECTED

#define USB_EVENT_DISCONNECTED   (USB_EVENT_BASE + 1)

The device has been disconnected from the USB host (used by device classes only).

Note
In device mode, the USB_EVENT_DISCONNECTED will not be reported if the MCU's PB1/USB0VBUS pin is connected to a fixed +5 Volts rather than directly to the VBUS pin on the USB connector.

§ USB_EVENT_RX_AVAILABLE

#define USB_EVENT_RX_AVAILABLE   (USB_EVENT_BASE + 2)

Data has been received and is in the buffer provided or is ready to be read from the FIFO. If the pvMsgData value is 0 then the ui32MsgParam value contains the amount of data in bytes ready to be read from the device. If the pvMsgData value is not 0 then pvMsgData is a pointer to the data that was read and ui32MsgParam is the number of valid bytes in the array pointed to by pvMsgData.

Referenced by USBBufferEventCallback().

§ USB_EVENT_DATA_REMAINING

#define USB_EVENT_DATA_REMAINING   (USB_EVENT_BASE + 3)

This event is sent by a lower layer to inquire about the amount of unprocessed data buffered in the layers above. It is used in cases where a low level driver needs to ensure that all preceding data has been processed prior to performing some action or making some notification. Clients receiving this event should return the number of bytes of data that are unprocessed or 0 if no outstanding data remains.

§ USB_EVENT_REQUEST_BUFFER

#define USB_EVENT_REQUEST_BUFFER   (USB_EVENT_BASE + 4)

This event is sent by a lower layer supporting DMA to request a buffer in which the next received packet may be stored. The ui32MsgValue parameter indicates the maximum size of packet that can be received in this channel and pvMsgData points to storage which should be written with the returned buffer pointer. The return value from the callback should be the size of the buffer allocated (which may be less than the maximum size passed in ui32MsgValue if the client knows that fewer bytes are expected to be received) or 0 if no buffer is being returned.

§ USB_EVENT_TX_COMPLETE

#define USB_EVENT_TX_COMPLETE   (USB_EVENT_BASE + 5)

Data has been sent and acknowledged. If this event is received via the USB buffer callback, the ui32MsgValue parameter indicates the number of bytes from the transmit buffer that have been successfully transmitted and acknowledged.

§ USB_EVENT_ERROR

#define USB_EVENT_ERROR   (USB_EVENT_BASE + 6)

An error has been reported on the channel or pipe. The ui32MsgValue parameter indicates the source(s) of the error and is the logical OR combination of "USBERR_" flags defined below.

§ USB_EVENT_SUSPEND

#define USB_EVENT_SUSPEND   (USB_EVENT_BASE + 7)

The bus has entered suspend state.

§ USB_EVENT_RESUME

#define USB_EVENT_RESUME   (USB_EVENT_BASE + 8)

The bus has left suspend state.

§ USB_EVENT_SCHEDULER

#define USB_EVENT_SCHEDULER   (USB_EVENT_BASE + 9)

A scheduler event has occurred.

§ USB_EVENT_STALL

#define USB_EVENT_STALL   (USB_EVENT_BASE + 10)

A device or host has detected a stall condition.

§ USB_EVENT_POWER_FAULT

#define USB_EVENT_POWER_FAULT   (USB_EVENT_BASE + 11)

The host detected a power fault condition.

§ USB_EVENT_POWER_ENABLE

#define USB_EVENT_POWER_ENABLE   (USB_EVENT_BASE + 12)

The controller has detected a A-Side cable and needs power applied This is only generated on OTG parts if automatic power control is disabled.

Referenced by USB0_IRQOTGModeHandler().

§ USB_EVENT_POWER_DISABLE

#define USB_EVENT_POWER_DISABLE   (USB_EVENT_BASE + 13)

The controller needs power removed, This is only generated on OTG parts if automatic power control is disabled.

§ USB_EVENT_COMP_IFACE_CHANGE

#define USB_EVENT_COMP_IFACE_CHANGE   (USB_EVENT_BASE + 14)

This define is used with a device class's pfnDeviceHandler handler function to indicate that the USB library has changed the interface number. This event is typically due to the class being included in a composite device.

The pvInstance is a pointer to an instance of the device being accessed.

The ui32Request is USB_EVENT_COMP_IFACE_CHANGE.

The pvRequestData is a pointer to a two byte array where the first value is the old interface number and the second is the new interface number.

§ USB_EVENT_COMP_EP_CHANGE

#define USB_EVENT_COMP_EP_CHANGE   (USB_EVENT_BASE + 15)

This define is used with a device class's pfnDeviceHandler handler function to indicate that the USB library has changed the endpoint number. This event is typically due to the class being included in a composite device.

The pvInstance is a pointer to an instance of the device being accessed.

The ui32Request is USB_EVENT_COMP_EP_CHANGE.

The pvRequestData is a pointer to a two byte array where the first value is the old endpoint number and the second is the new endpoint number. The endpoint numbers should be exactly as USB specification defines them and bit 7 set indicates an IN endpoint and bit 7 clear indicates an OUT endpoint.

§ USB_EVENT_COMP_STR_CHANGE

#define USB_EVENT_COMP_STR_CHANGE   (USB_EVENT_BASE + 16)

This define is used with a device class's pfnDeviceHandler handler function to indicate that the USB library has changed the string index number for a string. This event is typically due to the class being included in a composite device.

The pvInstance is a pointer to an instance of the device being accessed.

The ui32Request is USB_EVENT_COMP_STR_CHANGE.

The pvRequestData is a pointer to a two byte array where the first value is the old string index and the second is the new string index.

§ USB_EVENT_COMP_CONFIG

#define USB_EVENT_COMP_CONFIG   (USB_EVENT_BASE + 17)

This define is used with a device class's pfnDeviceHandler handler function to indicate that the USB library has changed the configuration descriptor. This allows the class to make final adjustments to the configuration descriptor. This event is typically due to the class being included in a composite device.

The pvInstance is a pointer to an instance of the device being accessed.

The ui32Request is USB_EVENT_COMP_CONFIG.

The pvRequestData is a pointer to the beginning of the configuration descriptor for the device instance.

§ USB_EVENT_UNKNOWN_CONNECTED

#define USB_EVENT_UNKNOWN_CONNECTED   (USB_EVENT_BASE + 18)

An unknown device is now attached to a USB host. This value is only valid for the generic event handler and not other device handlers. It is useful for applications that want to know when an unknown device is connected and what the class is of the unknown device.

The ui32Instance is the device instance for the unknown device.

§ USB_EVENT_SOF

#define USB_EVENT_SOF   (USB_EVENT_BASE + 19)

A start of frame event has occurred. This event is disabled by default and must be enabled via a call from the application to USBHCDEventEnable().

§ USB_EVENT_LPM_SLEEP

#define USB_EVENT_LPM_SLEEP   (USB_EVENT_BASE + 20)

This event occurs when a device enters LPM sleep mode.

Referenced by USBDeviceIntHandlerInternal().

§ USB_EVENT_LPM_RESUME

#define USB_EVENT_LPM_RESUME   (USB_EVENT_BASE + 21)

This event occurs when a device is resumed from LPM sleep mode.

Referenced by USBDeviceIntHandlerInternal().

§ USB_EVENT_LPM_ERROR

#define USB_EVENT_LPM_ERROR   (USB_EVENT_BASE + 22)

This event occurs when a device has responded with a NYET to an LPM request because LPM responses were disabled.

Referenced by USBDeviceIntHandlerInternal().

§ USB_EVENT_CONFIG_CHANGE

#define USB_EVENT_CONFIG_CHANGE   (USB_EVENT_BASE + 23)

This event occurs when a device has been issued a configuration change.

© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale