USBMSD SD card Hello World for Mbed platforms

Dependencies:   mbed USBMSD_SD USBDevice

Committer:
samux
Date:
Tue Dec 06 12:07:12 2011 +0000
Revision:
14:757226626acb
Parent:
2:27a7e7f8d399
protection enabled when usb cable plugged. filesystem has no access when plugged

Who changed what in which revision?

UserRevisionLine numberNew contents of line
samux 2:27a7e7f8d399 1 /* USBDescriptor.h */
samux 2:27a7e7f8d399 2 /* Definitions and macros for constructing USB descriptors */
samux 2:27a7e7f8d399 3 /* Copyright (c) 2011 ARM Limited. All rights reserved. */
samux 2:27a7e7f8d399 4
samux 2:27a7e7f8d399 5 /* Standard descriptor types */
samux 2:27a7e7f8d399 6 #define DEVICE_DESCRIPTOR (1)
samux 2:27a7e7f8d399 7 #define CONFIGURATION_DESCRIPTOR (2)
samux 2:27a7e7f8d399 8 #define STRING_DESCRIPTOR (3)
samux 2:27a7e7f8d399 9 #define INTERFACE_DESCRIPTOR (4)
samux 2:27a7e7f8d399 10 #define ENDPOINT_DESCRIPTOR (5)
samux 2:27a7e7f8d399 11 #define QUALIFIER_DESCRIPTOR (6)
samux 2:27a7e7f8d399 12
samux 2:27a7e7f8d399 13 /* Standard descriptor lengths */
samux 2:27a7e7f8d399 14 #define DEVICE_DESCRIPTOR_LENGTH (0x12)
samux 2:27a7e7f8d399 15 #define CONFIGURATION_DESCRIPTOR_LENGTH (0x09)
samux 2:27a7e7f8d399 16 #define INTERFACE_DESCRIPTOR_LENGTH (0x09)
samux 2:27a7e7f8d399 17 #define ENDPOINT_DESCRIPTOR_LENGTH (0x07)
samux 2:27a7e7f8d399 18
samux 2:27a7e7f8d399 19
samux 2:27a7e7f8d399 20 /*string offset*/
samux 2:27a7e7f8d399 21 #define STRING_OFFSET_LANGID (0)
samux 2:27a7e7f8d399 22 #define STRING_OFFSET_IMANUFACTURER (1)
samux 2:27a7e7f8d399 23 #define STRING_OFFSET_IPRODUCT (2)
samux 2:27a7e7f8d399 24 #define STRING_OFFSET_ISERIAL (3)
samux 2:27a7e7f8d399 25 #define STRING_OFFSET_ICONFIGURATION (4)
samux 2:27a7e7f8d399 26 #define STRING_OFFSET_IINTERFACE (5)
samux 2:27a7e7f8d399 27
samux 2:27a7e7f8d399 28 /* USB Specification Release Number */
samux 2:27a7e7f8d399 29 #define USB_VERSION_2_0 (0x0200)
samux 2:27a7e7f8d399 30
samux 2:27a7e7f8d399 31 /* Least/Most significant byte of short integer */
samux 2:27a7e7f8d399 32 #define LSB(n) ((n)&0xff)
samux 2:27a7e7f8d399 33 #define MSB(n) (((n)&0xff00)>>8)
samux 2:27a7e7f8d399 34
samux 2:27a7e7f8d399 35 /* Convert physical endpoint number to descriptor endpoint number */
samux 2:27a7e7f8d399 36 #define PHY_TO_DESC(endpoint) (((endpoint)>>1) | (((endpoint) & 1) ? 0x80:0))
samux 2:27a7e7f8d399 37
samux 2:27a7e7f8d399 38 /* bmAttributes in configuration descriptor */
samux 2:27a7e7f8d399 39 /* C_RESERVED must always be set */
samux 2:27a7e7f8d399 40 #define C_RESERVED (1U<<7)
samux 2:27a7e7f8d399 41 #define C_SELF_POWERED (1U<<6)
samux 2:27a7e7f8d399 42 #define C_REMOTE_WAKEUP (1U<<5)
samux 2:27a7e7f8d399 43
samux 2:27a7e7f8d399 44 /* bMaxPower in configuration descriptor */
samux 2:27a7e7f8d399 45 #define C_POWER(mA) ((mA)/2)
samux 2:27a7e7f8d399 46
samux 2:27a7e7f8d399 47 /* bmAttributes in endpoint descriptor */
samux 2:27a7e7f8d399 48 #define E_CONTROL (0x00)
samux 2:27a7e7f8d399 49 #define E_ISOCHRONOUS (0x01)
samux 2:27a7e7f8d399 50 #define E_BULK (0x02)
samux 2:27a7e7f8d399 51 #define E_INTERRUPT (0x03)
samux 2:27a7e7f8d399 52
samux 2:27a7e7f8d399 53 /* For isochronous endpoints only: */
samux 2:27a7e7f8d399 54 #define E_NO_SYNCHRONIZATION (0x00)
samux 2:27a7e7f8d399 55 #define E_ASYNCHRONOUS (0x04)
samux 2:27a7e7f8d399 56 #define E_ADAPTIVE (0x08)
samux 2:27a7e7f8d399 57 #define E_SYNCHRONOUS (0x0C)
samux 2:27a7e7f8d399 58 #define E_DATA (0x00)
samux 2:27a7e7f8d399 59 #define E_FEEDBACK (0x10)
samux 2:27a7e7f8d399 60 #define E_IMPLICIT_FEEDBACK (0x20)