USB CDC (serial) and USB MSC (strage) Composite Device. http://mbed.org/users/okini3939/notebook/USB_Device/

Dependencies:   ChaNFSSD mbed ChaNFS

Committer:
okini3939
Date:
Fri Dec 16 15:22:36 2011 +0000
Revision:
0:9b1d17d54055

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okini3939 0:9b1d17d54055 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
okini3939 0:9b1d17d54055 2 *
okini3939 0:9b1d17d54055 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
okini3939 0:9b1d17d54055 4 * and associated documentation files (the "Software"), to deal in the Software without
okini3939 0:9b1d17d54055 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
okini3939 0:9b1d17d54055 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
okini3939 0:9b1d17d54055 7 * Software is furnished to do so, subject to the following conditions:
okini3939 0:9b1d17d54055 8 *
okini3939 0:9b1d17d54055 9 * The above copyright notice and this permission notice shall be included in all copies or
okini3939 0:9b1d17d54055 10 * substantial portions of the Software.
okini3939 0:9b1d17d54055 11 *
okini3939 0:9b1d17d54055 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
okini3939 0:9b1d17d54055 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
okini3939 0:9b1d17d54055 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
okini3939 0:9b1d17d54055 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
okini3939 0:9b1d17d54055 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
okini3939 0:9b1d17d54055 17 */
okini3939 0:9b1d17d54055 18
okini3939 0:9b1d17d54055 19 #ifndef USBCLASS_HID_TYPES
okini3939 0:9b1d17d54055 20 #define USBCLASS_HID_TYPES
okini3939 0:9b1d17d54055 21
okini3939 0:9b1d17d54055 22 #include <stdint.h>
okini3939 0:9b1d17d54055 23
okini3939 0:9b1d17d54055 24 /* */
okini3939 0:9b1d17d54055 25 #define HID_VERSION_1_11 (0x0111)
okini3939 0:9b1d17d54055 26
okini3939 0:9b1d17d54055 27 /* HID Class */
okini3939 0:9b1d17d54055 28 #define HID_CLASS (3)
okini3939 0:9b1d17d54055 29 #define HID_SUBCLASS_NONE (0)
okini3939 0:9b1d17d54055 30 #define HID_PROTOCOL_NONE (0)
okini3939 0:9b1d17d54055 31
okini3939 0:9b1d17d54055 32 /* Descriptors */
okini3939 0:9b1d17d54055 33 #define HID_DESCRIPTOR (33)
okini3939 0:9b1d17d54055 34 #define HID_DESCRIPTOR_LENGTH (0x09)
okini3939 0:9b1d17d54055 35 #define REPORT_DESCRIPTOR (34)
okini3939 0:9b1d17d54055 36
okini3939 0:9b1d17d54055 37 /* Class requests */
okini3939 0:9b1d17d54055 38 #define GET_REPORT (0x1)
okini3939 0:9b1d17d54055 39 #define GET_IDLE (0x2)
okini3939 0:9b1d17d54055 40 #define SET_REPORT (0x9)
okini3939 0:9b1d17d54055 41 #define SET_IDLE (0xa)
okini3939 0:9b1d17d54055 42
okini3939 0:9b1d17d54055 43 /* HID Class Report Descriptor */
okini3939 0:9b1d17d54055 44 /* Short items: size is 0, 1, 2 or 3 specifying 0, 1, 2 or 4 (four) bytes */
okini3939 0:9b1d17d54055 45 /* of data as per HID Class standard */
okini3939 0:9b1d17d54055 46
okini3939 0:9b1d17d54055 47 /* Main items */
okini3939 0:9b1d17d54055 48 #define INPUT(size) (0x80 | size)
okini3939 0:9b1d17d54055 49 #define OUTPUT(size) (0x90 | size)
okini3939 0:9b1d17d54055 50 #define FEATURE(size) (0xb0 | size)
okini3939 0:9b1d17d54055 51 #define COLLECTION(size) (0xa0 | size)
okini3939 0:9b1d17d54055 52 #define END_COLLECTION(size) (0xc0 | size)
okini3939 0:9b1d17d54055 53
okini3939 0:9b1d17d54055 54 /* Global items */
okini3939 0:9b1d17d54055 55 #define USAGE_PAGE(size) (0x04 | size)
okini3939 0:9b1d17d54055 56 #define LOGICAL_MINIMUM(size) (0x14 | size)
okini3939 0:9b1d17d54055 57 #define LOGICAL_MAXIMUM(size) (0x24 | size)
okini3939 0:9b1d17d54055 58 #define PHYSICAL_MINIMUM(size) (0x34 | size)
okini3939 0:9b1d17d54055 59 #define PHYSICAL_MAXIMUM(size) (0x44 | size)
okini3939 0:9b1d17d54055 60 #define UNIT_EXPONENT(size) (0x54 | size)
okini3939 0:9b1d17d54055 61 #define UNIT(size) (0x64 | size)
okini3939 0:9b1d17d54055 62 #define REPORT_SIZE(size) (0x74 | size)
okini3939 0:9b1d17d54055 63 #define REPORT_ID(size) (0x84 | size)
okini3939 0:9b1d17d54055 64 #define REPORT_COUNT(size) (0x94 | size)
okini3939 0:9b1d17d54055 65 #define PUSH(size) (0xa4 | size)
okini3939 0:9b1d17d54055 66 #define POP(size) (0xb4 | size)
okini3939 0:9b1d17d54055 67
okini3939 0:9b1d17d54055 68 /* Local items */
okini3939 0:9b1d17d54055 69 #define USAGE(size) (0x08 | size)
okini3939 0:9b1d17d54055 70 #define USAGE_MINIMUM(size) (0x18 | size)
okini3939 0:9b1d17d54055 71 #define USAGE_MAXIMUM(size) (0x28 | size)
okini3939 0:9b1d17d54055 72 #define DESIGNATOR_INDEX(size) (0x38 | size)
okini3939 0:9b1d17d54055 73 #define DESIGNATOR_MINIMUM(size) (0x48 | size)
okini3939 0:9b1d17d54055 74 #define DESIGNATOR_MAXIMUM(size) (0x58 | size)
okini3939 0:9b1d17d54055 75 #define STRING_INDEX(size) (0x78 | size)
okini3939 0:9b1d17d54055 76 #define STRING_MINIMUM(size) (0x88 | size)
okini3939 0:9b1d17d54055 77 #define STRING_MAXIMUM(size) (0x98 | size)
okini3939 0:9b1d17d54055 78 #define DELIMITER(size) (0xa8 | size)
okini3939 0:9b1d17d54055 79
okini3939 0:9b1d17d54055 80 /* HID Report */
okini3939 0:9b1d17d54055 81 /* Where report IDs are used the first byte of 'data' will be the */
okini3939 0:9b1d17d54055 82 /* report ID and 'length' will include this report ID byte. */
okini3939 0:9b1d17d54055 83
okini3939 0:9b1d17d54055 84 #define MAX_HID_REPORT_SIZE (64)
okini3939 0:9b1d17d54055 85
okini3939 0:9b1d17d54055 86 typedef struct {
okini3939 0:9b1d17d54055 87 uint32_t length;
okini3939 0:9b1d17d54055 88 uint8_t data[MAX_HID_REPORT_SIZE];
okini3939 0:9b1d17d54055 89 } HID_REPORT;
okini3939 0:9b1d17d54055 90
okini3939 0:9b1d17d54055 91 #endif