dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_usb_defs.h File Reference
#include "board_usb_ids.h"
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  usb_device_desc
 
struct  usb_configuration_desc
 
struct  usb_interface_association_desc
 
struct  usb_interface_desc
 
struct  usb_hid_desc
 
struct  usb_endpoint_desc
 
struct  usb_setup_request
 
struct  usb_cdc_header_func_desc
 
struct  usb_cdc_callmgmt_func_desc
 
struct  usb_cdc_acm_func_desc
 
struct  usb_cdc_union_func_desc
 
struct  usb_string_langid
 
struct  usb_cdc_line_coding
 
struct  usb_cdc_serial_state_report
 

Macros

#define htousbs(v)   (v)
 
#define htousbl(v)   (v)
 
#define USB_EP_IN(ep)   ((uint8_t) (0x80 | ((ep) & 0xF)))
 
#define USB_EP_OUT(ep)   ((uint8_t) (0x00 | ((ep) & 0xF)))
 
#define HID_ITEM_TYPE_MAIN   0x0
 
#define HID_ITEM_TYPE_GLOBAL   0x1
 
#define HID_ITEM_TYPE_LOCAL   0x2
 
#define HID_ITEM_TYPE_RSVD   0x3
 
#define HID_TAG_GLOBAL_USAGE_PAGE   0x0 /* 0b0000 */
 
#define HID_TAG_GLOBAL_LOGICAL_MIN   0x1 /* 0b0001 */
 
#define HID_TAG_GLOBAL_LOGICAL_MAX   0x2 /* 0b0010 */
 
#define HID_TAG_GLOBAL_PHYS_MIN   0x3 /* 0b0011 */
 
#define HID_TAG_GLOBAL_PHYS_MAX   0x4 /* 0b0100 */
 
#define HID_TAG_GLOBAL_UNIT_EXP   0x5 /* 0b0101 */
 
#define HID_TAG_GLOBAL_UNIT   0x6 /* 0b0110 */
 
#define HID_TAG_GLOBAL_REPORT_SIZE   0x7 /* 0b0111 */
 
#define HID_TAG_GLOBAL_REPORT_ID   0x8 /* 0b1000 */
 
#define HID_TAG_GLOBAL_REPORT_CNT   0x9 /* 0b1001 */
 
#define HID_TAG_GLOBAL_PUSH   0xA /* 0b1010 */
 
#define HID_TAG_GLOBAL_POP   0xB /* 0b1011 */
 
#define HID_TAG_MAIN_INPUT   0x8 /* 0b1000 */
 
#define HID_TAG_MAIN_OUTPUT   0x9 /* 0b1001 */
 
#define HID_TAG_MAIN_COLLECTION   0xA /* 0b1010 */
 
#define HID_TAG_MAIN_FEATURE   0xB /* 0b1011 */
 
#define HID_TAG_MAIN_ENDCOLLECTION   0xC /* 0b1100 */
 
#define HID_TAG_LOCAL_USAGE   0x0 /* 0b0000 */
 
#define HID_TAG_LOCAL_USAGE_MIN   0x1 /* 0b0001 */
 
#define HID_TAG_LOCAL_USAGE_MAX   0x2 /* 0b0010 */
 
#define HID_TAG_LOCAL_DESIG_INDEX   0x3 /* 0b0011 */
 
#define HID_TAG_LOCAL_DESIG_MIN   0x4 /* 0b0100 */
 
#define HID_TAG_LOCAL_DESIG_MAX   0x5 /* 0b0101 */
 
#define HID_TAG_LOCAL_STRING_INDEX   0x7 /* 0b0111 */
 
#define HID_TAG_LOCAL_STRING_MIN   0x8 /* 0b1000 */
 
#define HID_TAG_LOCAL_STRING_MAX   0x9 /* 0b1001 */
 
#define HID_TAG_LOCAL_DELIMITER   0xA /* 0b1010 */
 
#define HID_TAG_RSVD   0xF /* 0b1111 */
 
#define HID_ITEM_SIZE_0   0
 
#define HID_ITEM_SIZE_1   1
 
#define HID_ITEM_SIZE_2   2
 
#define HID_ITEM_SIZE_4   3 /* Yes, 4 bytes is represented with a size field = 3 */
 
#define HID_SHORT_ITEM(tag, type, size)
 
#define HID_LONG_ITEM   HID_SHORT_ITEM(HID_TAG_RSVD, HID_ITEM_TYPE_RSVD, HID_ITEM_SIZE_2)
 
#define HID_MAIN_ITEM_0(tag)   HID_SHORT_ITEM((tag), HID_ITEM_TYPE_MAIN, HID_ITEM_SIZE_0)
 
#define HID_MAIN_ITEM_1(tag)   HID_SHORT_ITEM((tag), HID_ITEM_TYPE_MAIN, HID_ITEM_SIZE_1)
 
#define HID_MAIN_ITEM_2(tag)   HID_SHORT_ITEM((tag), HID_ITEM_TYPE_MAIN, HID_ITEM_SIZE_2)
 
#define HID_MAIN_ITEM_4(tag)   HID_SHORT_ITEM((tag), HID_ITEM_TYPE_MAIN, HID_ITEM_SIZE_4)
 
#define HID_GLOBAL_ITEM_0(tag)   HID_SHORT_ITEM((tag), HID_ITEM_TYPE_GLOBAL, HID_ITEM_SIZE_0)
 
#define HID_GLOBAL_ITEM_1(tag)   HID_SHORT_ITEM((tag), HID_ITEM_TYPE_GLOBAL, HID_ITEM_SIZE_1)
 
#define HID_GLOBAL_ITEM_2(tag)   HID_SHORT_ITEM((tag), HID_ITEM_TYPE_GLOBAL, HID_ITEM_SIZE_2)
 
#define HID_GLOBAL_ITEM_4(tag)   HID_SHORT_ITEM((tag), HID_ITEM_TYPE_GLOBAL, HID_ITEM_SIZE_4)
 
#define HID_LOCAL_ITEM_0(tag)   HID_SHORT_ITEM((tag), HID_ITEM_TYPE_LOCAL, HID_ITEM_SIZE_0)
 
#define HID_LOCAL_ITEM_1(tag)   HID_SHORT_ITEM((tag), HID_ITEM_TYPE_LOCAL, HID_ITEM_SIZE_1)
 
#define HID_LOCAL_ITEM_2(tag)   HID_SHORT_ITEM((tag), HID_ITEM_TYPE_LOCAL, HID_ITEM_SIZE_2)
 
#define HID_LOCAL_ITEM_4(tag)   HID_SHORT_ITEM((tag), HID_ITEM_TYPE_LOCAL, HID_ITEM_SIZE_4)
 
#define USB_REQ_TYPE_STANDARD   0x00
 
#define USB_REQ_TYPE_CLASS   0x20
 
#define USB_REQ_TYPE_VENDOR   0x40
 
#define USB_REQ_TYPE_MASK   0x60
 
#define USB_REQ_RECIPIENT_DEVICE   0x00
 
#define USB_REQ_RECIPIENT_INTERFACE   0x01
 
#define USB_REQ_RECIPIENT_ENDPOINT   0x02
 
#define USB_REQ_RECIPIENT_MASK   0x03
 
#define USB_LANGID_ENGLISH_US   0x0409
 
#define USB_OP_DEVICE_VER(board_id, board_mode)
 

Enumerations

enum  usb_desc_types
 
enum  usb_interface_class
 
enum  usb_cdc_desc_subtypes
 
enum  usb_ep_attr
 
enum  usb_standard_requests {
  USB_REQ_GET_STATUS = 0x00, USB_REQ_CLEAR_FEATURE = 0x01, USB_REQ_SET_FEATURE = 0x03, USB_REQ_SET_ADDRESS = 0x05,
  USB_REQ_GET_DESCRIPTOR = 0x06, USB_REQ_SET_DESCRIPTOR = 0x07, USB_REQ_GET_CONFIGURATION = 0x08, USB_REQ_SET_CONFIGURATION = 0x09,
  USB_REQ_GET_INTERFACE = 0x0A, USB_REQ_SET_INTERFACE = 0x0B, USB_REQ_SYNCH_FRAME = 0x0C
}
 
enum  usb_hid_requests {
  USB_HID_REQ_GET_REPORT = 0x01, USB_HID_REQ_GET_IDLE = 0x02, USB_HID_REQ_GET_PROTOCOL = 0x03, USB_HID_REQ_SET_REPORT = 0x09,
  USB_HID_REQ_SET_IDLE = 0x0A, USB_HID_REQ_SET_PROTOCOL = 0x0B
}
 
enum  usb_cdc_requests { USB_CDC_REQ_SET_LINE_CODING = 0x20, USB_CDC_REQ_GET_LINE_CODING = 0x21, USB_CDC_REQ_SET_CONTROL_LINE_STATE = 0x22 }
 
enum  usb_cdc_line_coding_stop
 
enum  usb_cdc_line_coding_parity
 
enum  usb_cdc_notification
 
enum  usb_op_board_ids
 
enum  usb_op_board_modes
 

Functions

enum usb_desc_types __attribute__ ((packed))
 

Variables

 USB_DESC_TYPE_DEVICE = 0x01
 
 USB_DESC_TYPE_CONFIGURATION = 0x02
 
 USB_DESC_TYPE_STRING = 0x03
 
 USB_DESC_TYPE_INTERFACE = 0x04
 
 USB_DESC_TYPE_ENDPOINT = 0x05
 
 USB_DESC_TYPE_IAD = 0x0B
 
 USB_DESC_TYPE_HID = 0x21
 
 USB_DESC_TYPE_REPORT = 0x22
 
 USB_DESC_TYPE_CLASS_SPECIFIC = 0x24
 
 USB_INTERFACE_CLASS_CDC = 0x02
 
 USB_INTERFACE_CLASS_HID = 0x03
 
 USB_INTERFACE_CLASS_DATA = 0x0A
 
 USB_CDC_DESC_SUBTYPE_HEADER = 0x00
 
 USB_CDC_DESC_SUBTYPE_CALLMGMT = 0x01
 
 USB_CDC_DESC_SUBTYPE_ABSTRACT_CTRL = 0x02
 
 USB_CDC_DESC_SUBTYPE_UNION = 0x06
 
 USB_EP_ATTR_TT_CONTROL = 0x00
 
 USB_EP_ATTR_TT_ISOCHRONOUS = 0x01
 
 USB_EP_ATTR_TT_BULK = 0x02
 
 USB_EP_ATTR_TT_INTERRUPT = 0x03
 
uint8_t bLength
 
uint8_t bDescriptorType
 
uint16_t bcdUSB
 
uint8_t bDeviceClass
 
uint8_t bDeviceSubClass
 
uint8_t bDeviceProtocol
 
uint8_t bMaxPacketSize0
 
uint16_t idVendor
 
uint16_t idProduct
 
uint16_t bcdDevice
 
uint8_t iManufacturer
 
uint8_t iProduct
 
uint8_t iSerialNumber
 
uint8_t bNumConfigurations
 
uint16_t wTotalLength
 
uint8_t bNumInterfaces
 
uint8_t bConfigurationValue
 
uint8_t iConfiguration
 
uint8_t bmAttributes
 
uint8_t bMaxPower
 
uint8_t bFirstInterface
 
uint8_t bInterfaceCount
 
uint8_t bFunctionClass
 
uint8_t bFunctionSubClass
 
uint8_t bFunctionProtocol
 
uint8_t iInterface
 
uint8_t bInterfaceNumber
 
uint8_t bAlternateSetting
 
uint8_t bNumEndpoints
 
uint8_t bInterfaceClass
 
uint8_t bInterfaceSubClass
 
uint8_t nInterfaceProtocol
 
uint16_t bcdHID
 
uint8_t bCountryCode
 
uint8_t bNumDescriptors
 
uint8_t bClassDescriptorType
 
uint16_t wItemLength
 
uint8_t bEndpointAddress
 
uint16_t wMaxPacketSize
 
uint8_t bInterval
 
uint8_t bmRequestType
 
uint8_t bRequest
 
uint16_t wValue
 
uint16_t wIndex
 
uint16_t wLength
 
enum usb_standard_requests __attribute__
 
uint8_t bDescriptorSubType
 
uint16_t bcdCDC
 
uint8_t bmCapabilities
 
uint8_t bDataInterface
 
uint8_t bMasterInterface
 
uint8_t bSlaveInterface
 
uint16_t bLangID
 
uint32_t dwDTERate
 
uint8_t bCharFormat
 
uint8_t bParityType
 
uint8_t bDataBits
 
 USB_CDC_LINE_CODING_STOP_1 = 0
 
 USB_CDC_LINE_CODING_STOP_1_5 = 1
 
 USB_CDC_LINE_CODING_STOP_2 = 2
 
 USB_CDC_LINE_CODING_PARITY_NONE = 0
 
 USB_CDC_LINE_CODING_PARITY_ODD = 1
 
 USB_CDC_LINE_CODING_PARITY_EVEN = 2
 
 USB_CDC_LINE_CODING_PARITY_MARK = 3
 
 USB_CDC_LINE_CODING_PARITY_SPACE = 4
 
uint8_t bNotification
 
uint16_t bmUartState
 
 USB_CDC_NOTIFICATION_SERIAL_STATE = 0x20
 
 USB_OP_BOARD_ID_OPENPILOT_MAIN = 1
 
 USB_OP_BOARD_ID_PIPXTREME = 3
 
 USB_OP_BOARD_ID_COPTERCONTROL = 4
 
 USB_OP_BOARD_ID_REVOLUTION = 5
 
 USB_OP_BOARD_ID_OSD = 6
 
 USB_OP_BOARD_MODE_BL = 1
 
 USB_OP_BOARD_MODE_FW = 2
 
 USB_OP_BOARD_MODE_UP = 3
 

Detailed Description

Author
The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
Tau Labs, http://taulabs.org, Copyright (C) 2013
dRonin, http://dRonin.org/, Copyright (C) 2015-2016

Definition in file pios_usb_defs.h.