USBMSD SD card Hello World for Mbed platforms
Dependencies: mbed USBMSD_SD USBDevice
USBDevice/USBDevice/USBDevice_Types.h@2:27a7e7f8d399, 2011-11-11 (annotated)
- Committer:
- samux
- Date:
- Fri Nov 11 15:22:53 2011 +0000
- Revision:
- 2:27a7e7f8d399
we have 2MB with the sdcard!!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux |
2:27a7e7f8d399 | 1 | /* USBDevice_Types.h */ |
samux |
2:27a7e7f8d399 | 2 | /* USB Device type definitions, conversions and constants */ |
samux |
2:27a7e7f8d399 | 3 | /* Copyright (c) 2011 ARM Limited. All rights reserved. */ |
samux |
2:27a7e7f8d399 | 4 | |
samux |
2:27a7e7f8d399 | 5 | #ifndef USBDEVICE_TYPES_H |
samux |
2:27a7e7f8d399 | 6 | #define USBDEVICE_TYPES_H |
samux |
2:27a7e7f8d399 | 7 | |
samux |
2:27a7e7f8d399 | 8 | /* Standard requests */ |
samux |
2:27a7e7f8d399 | 9 | #define GET_STATUS (0) |
samux |
2:27a7e7f8d399 | 10 | #define CLEAR_FEATURE (1) |
samux |
2:27a7e7f8d399 | 11 | #define SET_FEATURE (3) |
samux |
2:27a7e7f8d399 | 12 | #define SET_ADDRESS (5) |
samux |
2:27a7e7f8d399 | 13 | #define GET_DESCRIPTOR (6) |
samux |
2:27a7e7f8d399 | 14 | #define SET_DESCRIPTOR (7) |
samux |
2:27a7e7f8d399 | 15 | #define GET_CONFIGURATION (8) |
samux |
2:27a7e7f8d399 | 16 | #define SET_CONFIGURATION (9) |
samux |
2:27a7e7f8d399 | 17 | #define GET_INTERFACE (10) |
samux |
2:27a7e7f8d399 | 18 | #define SET_INTERFACE (11) |
samux |
2:27a7e7f8d399 | 19 | |
samux |
2:27a7e7f8d399 | 20 | /* bmRequestType.dataTransferDirection */ |
samux |
2:27a7e7f8d399 | 21 | #define HOST_TO_DEVICE (0) |
samux |
2:27a7e7f8d399 | 22 | #define DEVICE_TO_HOST (1) |
samux |
2:27a7e7f8d399 | 23 | |
samux |
2:27a7e7f8d399 | 24 | /* bmRequestType.Type*/ |
samux |
2:27a7e7f8d399 | 25 | #define STANDARD_TYPE (0) |
samux |
2:27a7e7f8d399 | 26 | #define CLASS_TYPE (1) |
samux |
2:27a7e7f8d399 | 27 | #define VENDOR_TYPE (2) |
samux |
2:27a7e7f8d399 | 28 | #define RESERVED_TYPE (3) |
samux |
2:27a7e7f8d399 | 29 | |
samux |
2:27a7e7f8d399 | 30 | /* bmRequestType.Recipient */ |
samux |
2:27a7e7f8d399 | 31 | #define DEVICE_RECIPIENT (0) |
samux |
2:27a7e7f8d399 | 32 | #define INTERFACE_RECIPIENT (1) |
samux |
2:27a7e7f8d399 | 33 | #define ENDPOINT_RECIPIENT (2) |
samux |
2:27a7e7f8d399 | 34 | #define OTHER_RECIPIENT (3) |
samux |
2:27a7e7f8d399 | 35 | |
samux |
2:27a7e7f8d399 | 36 | /* Descriptors */ |
samux |
2:27a7e7f8d399 | 37 | #define DESCRIPTOR_TYPE(wValue) (wValue >> 8) |
samux |
2:27a7e7f8d399 | 38 | #define DESCRIPTOR_INDEX(wValue) (wValue & 0xf) |
samux |
2:27a7e7f8d399 | 39 | |
samux |
2:27a7e7f8d399 | 40 | typedef struct { |
samux |
2:27a7e7f8d399 | 41 | struct { |
samux |
2:27a7e7f8d399 | 42 | uint8_t dataTransferDirection; |
samux |
2:27a7e7f8d399 | 43 | uint8_t Type; |
samux |
2:27a7e7f8d399 | 44 | uint8_t Recipient; |
samux |
2:27a7e7f8d399 | 45 | } bmRequestType; |
samux |
2:27a7e7f8d399 | 46 | uint8_t bRequest; |
samux |
2:27a7e7f8d399 | 47 | uint16_t wValue; |
samux |
2:27a7e7f8d399 | 48 | uint16_t wIndex; |
samux |
2:27a7e7f8d399 | 49 | uint16_t wLength; |
samux |
2:27a7e7f8d399 | 50 | } SETUP_PACKET; |
samux |
2:27a7e7f8d399 | 51 | |
samux |
2:27a7e7f8d399 | 52 | typedef struct { |
samux |
2:27a7e7f8d399 | 53 | SETUP_PACKET setup; |
samux |
2:27a7e7f8d399 | 54 | uint8_t *ptr; |
samux |
2:27a7e7f8d399 | 55 | uint32_t remaining; |
samux |
2:27a7e7f8d399 | 56 | uint8_t direction; |
samux |
2:27a7e7f8d399 | 57 | bool zlp; |
samux |
2:27a7e7f8d399 | 58 | bool notify; |
samux |
2:27a7e7f8d399 | 59 | } CONTROL_TRANSFER; |
samux |
2:27a7e7f8d399 | 60 | |
samux |
2:27a7e7f8d399 | 61 | typedef enum {ATTACHED, POWERED, DEFAULT, ADDRESS, CONFIGURED} DEVICE_STATE; |
samux |
2:27a7e7f8d399 | 62 | |
samux |
2:27a7e7f8d399 | 63 | typedef struct { |
samux |
2:27a7e7f8d399 | 64 | volatile DEVICE_STATE state; |
samux |
2:27a7e7f8d399 | 65 | uint8_t configuration; |
samux |
2:27a7e7f8d399 | 66 | bool suspended; |
samux |
2:27a7e7f8d399 | 67 | } USB_DEVICE; |
samux |
2:27a7e7f8d399 | 68 | |
samux |
2:27a7e7f8d399 | 69 | #endif |