EA BaseBoard, playing wav, PC see\'s SD-card through USB port.

Dependencies:   mbed

Committer:
Lerche
Date:
Tue Nov 22 05:45:58 2011 +0000
Revision:
0:fef366d2ed20
Thanks to those who provided EA_WavPlayer and USB_MSC

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Lerche 0:fef366d2ed20 1 /* USBDevice_Types.h */
Lerche 0:fef366d2ed20 2 /* USB Device type definitions, conversions and constants */
Lerche 0:fef366d2ed20 3 /* Copyright (c) 2011 ARM Limited. All rights reserved. */
Lerche 0:fef366d2ed20 4
Lerche 0:fef366d2ed20 5 #ifndef USBDEVICE_TYPES_H
Lerche 0:fef366d2ed20 6 #define USBDEVICE_TYPES_H
Lerche 0:fef366d2ed20 7
Lerche 0:fef366d2ed20 8 /* Standard requests */
Lerche 0:fef366d2ed20 9 #define GET_STATUS (0)
Lerche 0:fef366d2ed20 10 #define CLEAR_FEATURE (1)
Lerche 0:fef366d2ed20 11 #define SET_FEATURE (3)
Lerche 0:fef366d2ed20 12 #define SET_ADDRESS (5)
Lerche 0:fef366d2ed20 13 #define GET_DESCRIPTOR (6)
Lerche 0:fef366d2ed20 14 #define SET_DESCRIPTOR (7)
Lerche 0:fef366d2ed20 15 #define GET_CONFIGURATION (8)
Lerche 0:fef366d2ed20 16 #define SET_CONFIGURATION (9)
Lerche 0:fef366d2ed20 17 #define GET_INTERFACE (10)
Lerche 0:fef366d2ed20 18 #define SET_INTERFACE (11)
Lerche 0:fef366d2ed20 19
Lerche 0:fef366d2ed20 20 /* bmRequestType.dataTransferDirection */
Lerche 0:fef366d2ed20 21 #define HOST_TO_DEVICE (0)
Lerche 0:fef366d2ed20 22 #define DEVICE_TO_HOST (1)
Lerche 0:fef366d2ed20 23
Lerche 0:fef366d2ed20 24 /* bmRequestType.Type*/
Lerche 0:fef366d2ed20 25 #define STANDARD_TYPE (0)
Lerche 0:fef366d2ed20 26 #define CLASS_TYPE (1)
Lerche 0:fef366d2ed20 27 #define VENDOR_TYPE (2)
Lerche 0:fef366d2ed20 28 #define RESERVED_TYPE (3)
Lerche 0:fef366d2ed20 29
Lerche 0:fef366d2ed20 30 /* bmRequestType.Recipient */
Lerche 0:fef366d2ed20 31 #define DEVICE_RECIPIENT (0)
Lerche 0:fef366d2ed20 32 #define INTERFACE_RECIPIENT (1)
Lerche 0:fef366d2ed20 33 #define ENDPOINT_RECIPIENT (2)
Lerche 0:fef366d2ed20 34 #define OTHER_RECIPIENT (3)
Lerche 0:fef366d2ed20 35
Lerche 0:fef366d2ed20 36 /* Descriptors */
Lerche 0:fef366d2ed20 37 #define DESCRIPTOR_TYPE(wValue) (wValue >> 8)
Lerche 0:fef366d2ed20 38 #define DESCRIPTOR_INDEX(wValue) (wValue & 0xf)
Lerche 0:fef366d2ed20 39
Lerche 0:fef366d2ed20 40 typedef struct {
Lerche 0:fef366d2ed20 41 struct {
Lerche 0:fef366d2ed20 42 uint8_t dataTransferDirection;
Lerche 0:fef366d2ed20 43 uint8_t Type;
Lerche 0:fef366d2ed20 44 uint8_t Recipient;
Lerche 0:fef366d2ed20 45 } bmRequestType;
Lerche 0:fef366d2ed20 46 uint8_t bRequest;
Lerche 0:fef366d2ed20 47 uint16_t wValue;
Lerche 0:fef366d2ed20 48 uint16_t wIndex;
Lerche 0:fef366d2ed20 49 uint16_t wLength;
Lerche 0:fef366d2ed20 50 } SETUP_PACKET;
Lerche 0:fef366d2ed20 51
Lerche 0:fef366d2ed20 52 typedef struct {
Lerche 0:fef366d2ed20 53 SETUP_PACKET setup;
Lerche 0:fef366d2ed20 54 uint8_t *ptr;
Lerche 0:fef366d2ed20 55 uint32_t remaining;
Lerche 0:fef366d2ed20 56 uint8_t direction;
Lerche 0:fef366d2ed20 57 bool zlp;
Lerche 0:fef366d2ed20 58 bool notify;
Lerche 0:fef366d2ed20 59 } CONTROL_TRANSFER;
Lerche 0:fef366d2ed20 60
Lerche 0:fef366d2ed20 61 typedef enum {ATTACHED, POWERED, DEFAULT, ADDRESS, CONFIGURED} DEVICE_STATE;
Lerche 0:fef366d2ed20 62
Lerche 0:fef366d2ed20 63 typedef struct {
Lerche 0:fef366d2ed20 64 volatile DEVICE_STATE state;
Lerche 0:fef366d2ed20 65 uint8_t configuration;
Lerche 0:fef366d2ed20 66 bool suspended;
Lerche 0:fef366d2ed20 67 } USB_DEVICE;
Lerche 0:fef366d2ed20 68
Lerche 0:fef366d2ed20 69 #endif