1 /**
2 * \file usb_msc_structs.c
3 *
4 * \brief This file contains the data structures defining the
5 * USB mass storage device.
6 */
8 /**
9 * \copyright Copyright (C) 2013 Texas Instruments Incorporated -
10 * http://www.ti.com/
11 */
13 /**
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 *
18 * Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 *
21 * Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the
24 * distribution.
25 *
26 * Neither the name of Texas Instruments Incorporated nor the names of
27 * its contributors may be used to endorse or promote products derived
28 * from this software without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 */
43 /* ========================================================================== */
44 /* Include Files */
45 /* ========================================================================== */
47 #include "types.h"
48 #include "usblib.h"
49 #include "usbdevice.h"
50 #include "usbdmsc.h"
51 #include "usb_msc_structs.h"
52 #include "usbdmscglue.h"
53 #include "usb-ids.h"
56 /* ========================================================================== */
57 /* Macros and Typedefs */
58 /* ========================================================================== */
60 /* Size of the transmit and receive buffers used */
61 #define MSC_BUFFER_SIZE 512
63 /* ========================================================================== */
64 /* Structures and Enums */
65 /* ========================================================================== */
68 /* ========================================================================== */
69 /* Internal Function Declarations */
70 /* ========================================================================== */
72 /* ========================================================================== */
73 /* Global Variables */
74 /* ========================================================================== */
76 tMSCInstance g_sMSCInstance;
78 /* The manufacturer string */
79 uint8_t g_pManufacturerString[] =
80 {
81 (17 + 1) * 2,
82 USB_DTYPE_STRING,
83 'T', 0, 'e', 0, 'x', 0, 'a', 0, 's', 0, ' ', 0, 'I', 0, 'n', 0, 's', 0,
84 't', 0, 'r', 0, 'u', 0, 'm', 0, 'e', 0, 'n', 0, 't', 0, 's', 0,
85 };
87 /* The product string */
88 uint8_t g_pProductString[] =
89 {
90 (19 + 1) * 2,
91 USB_DTYPE_STRING,
92 'M', 0, 'a', 0, 's', 0, 's', 0, ' ', 0, 'S', 0, 't', 0, 'o', 0, 'r', 0,
93 'a', 0, 'g', 0, 'e', 0, ' ', 0, 'D', 0, 'e', 0, 'v', 0, 'i', 0, 'c', 0,
94 'e', 0
95 };
97 /* Serial number string */
99 uint8_t g_pSerialNumberString[] =
100 {
101 (8 + 1) * 2,
102 USB_DTYPE_STRING,
103 '1', 0, '2', 0, '3', 0, '4', 0, '5', 0, '6', 0, '7', 0, '8', 0
104 };
106 /* Data interface description String */
107 uint8_t g_pDataInterfaceString[] =
108 {
109 (19 + 1) * 2,
110 USB_DTYPE_STRING,
111 'B', 0, 'u', 0, 'l', 0, 'k', 0, ' ', 0, 'D', 0, 'a', 0, 't', 0,
112 'a', 0, ' ', 0, 'I', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0,
113 'a', 0, 'c', 0, 'e', 0
114 };
116 /* Configuration description String */
118 uint8_t g_pConfigString[] =
119 {
120 (23 + 1) * 2,
121 USB_DTYPE_STRING,
122 'B', 0, 'u', 0, 'l', 0, 'k', 0, ' ', 0, 'D', 0, 'a', 0, 't', 0,
123 'a', 0, ' ', 0, 'C', 0, 'o', 0, 'n', 0, 'f', 0, 'i', 0, 'g', 0,
124 'u', 0, 'r', 0, 'a', 0, 't', 0, 'i', 0, 'o', 0, 'n', 0
125 };
128 /* The languages supported by this device */
129 uint8_t g_pLangDescriptor[] =
130 {
131 4,
132 USB_DTYPE_STRING,
133 USBShort(USB_LANG_EN_US)
134 };
136 /* String descriptor supported by this device */
137 uint8_t * g_pStringDescriptors[] =
138 {
139 g_pLangDescriptor,
140 g_pManufacturerString,
141 g_pProductString,
142 g_pSerialNumberString,
143 g_pDataInterfaceString,
144 g_pConfigString
145 };
148 #define NUM_STRING_DESCRIPTORS (sizeof(g_pStringDescriptors) / \
149 sizeof(uint8_t *))
151 const tUSBDMSCDevice g_sMSCDevice =
152 {
153 USB_VID_STELLARIS, /* Vendor ID */
155 USB_PID_MSC, /* Product Id */
157 "TI ", /* Vendor information */
159 "Mass Storage ", /* Product identification */
161 "1.00", /* Revision */
162 500,
163 USB_CONF_ATTR_SELF_PWR,
164 g_pStringDescriptors,
165 NUM_STRING_DESCRIPTORS,
166 {
167 USBDMSCStorageOpen,
168 USBDMSCStorageClose,
169 USBDMSCStorageRead,
170 USBDMSCStorageWrite,
171 USBDMSCStorageNumBlocks
172 },
173 NULL,/*USBDMscEventCallback, */
174 &g_sMSCInstance
175 };
176 /* ========================================================================== */
177 /* Function Definitions */
178 /* ========================================================================== */
180 /* None */
182 /* -------------------------------------------------------------------------- */
183 /* Internal Function Definitions */
184 /* -------------------------------------------------------------------------- */
186 /* None */