X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao_usb.h;h=6633dafc7809763ffb23ebae1fa508e506f0b536;hp=cbd0f3a720d2c7ab021bb5d9eb7c9c7a5d2f9e27;hb=97cecb517cd7bf75e1219c76a93bfe6964c07052;hpb=c5c1e3fb1c253d387be02c127253ac2a55d577b4 diff --git a/ao_usb.h b/ao_usb.h index cbd0f3a7..6633dafc 100644 --- a/ao_usb.h +++ b/ao_usb.h @@ -18,13 +18,17 @@ #ifndef _AO_USB_H_ #define _AO_USB_H_ +#define AO_USB_SETUP_DIR_MASK (0x01 << 7) +#define AO_USB_SETUP_TYPE_MASK (0x03 << 5) +#define AO_USB_SETUP_RECIP_MASK (0x1f) + #define AO_USB_DIR_OUT 0 -#define AO_USB_DIR_IN 1 +#define AO_USB_DIR_IN (1 << 7) #define AO_USB_TYPE_STANDARD 0 -#define AO_USB_TYPE_CLASS 1 -#define AO_USB_TYPE_VENDOR 2 -#define AO_USB_TYPE_RESERVED 3 +#define AO_USB_TYPE_CLASS (1 << 5) +#define AO_USB_TYPE_VENDOR (2 << 5) +#define AO_USB_TYPE_RESERVED (3 << 5) #define AO_USB_RECIP_DEVICE 0 #define AO_USB_RECIP_INTERFACE 1 @@ -56,4 +60,41 @@ #define AO_USB_GET_DESC_TYPE(x) (((x)>>8)&0xFF) #define AO_USB_GET_DESC_INDEX(x) ((x)&0xFF) +#define AO_USB_CONTROL_EP 0 +#define AO_USB_INT_EP 1 +#define AO_USB_OUT_EP 4 +#define AO_USB_IN_EP 5 +#define AO_USB_CONTROL_SIZE 32 +/* + * Double buffer IN and OUT EPs, so each + * gets half of the available space + * + * Ah, but USB bulk packets can only come in 8, 16, 32 and 64 + * byte sizes, so we'll use 64 for everything + */ +#define AO_USB_IN_SIZE 64 +#define AO_USB_OUT_SIZE 64 + +#define AO_USB_EP0_IDLE 0 +#define AO_USB_EP0_DATA_IN 1 +#define AO_USB_EP0_DATA_OUT 2 + +#define LE_WORD(x) ((x)&0xFF),((uint8_t) (((uint16_t) (x))>>8)) + +/* CDC definitions */ +#define CS_INTERFACE 0x24 +#define CS_ENDPOINT 0x25 + +#define SET_LINE_CODING 0x20 +#define GET_LINE_CODING 0x21 +#define SET_CONTROL_LINE_STATE 0x22 + +/* Data structure for GET_LINE_CODING / SET_LINE_CODING class requests */ +struct ao_usb_line_coding { + uint32_t rate; + uint8_t char_format; + uint8_t parity; + uint8_t data_bits; +} ; + #endif /* _AO_USB_H_ */