Contiki-NG
Loading...
Searching...
No Matches
cdc-acm-descriptors.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009, Simon Berg
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28 * OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30/**
31 * \addtogroup cc2538-usb
32 * @{
33 *
34 * \file
35 * CDC-ACM mode USB descriptor for the cc2538 USB controller
36 *
37 * This file is a copy of cpu/arm/common/usb/cdc-acm/cdc-acm-descriptors.c
38 * with the only change being the values for VID and PID
39 */
40#include "descriptors.h"
41#include "contiki.h"
42#include "cdc.h"
43#include "usb-arch.h"
44
45const struct usb_st_device_descriptor device_descriptor =
46 {
47 sizeof(struct usb_st_device_descriptor),
48 DEVICE,
49 0x0200,
50 CDC,
51 0,
52 0,
53 CTRL_EP_SIZE,
54 0x0451, /* Vendor: TI */
55 0x16C8, /* Product: cc2538EM ("CC2538 USB CDC") */
56 0x0000,
57 1,
58 2,
59 3,
60 1
61 };
62
63const struct configuration_st {
64 struct usb_st_configuration_descriptor configuration;
65 struct usb_st_interface_descriptor comm;
66 struct usb_cdc_header_func_descriptor header;
67 struct usb_cdc_abstract_ctrl_mgmnt_func_descriptor abstract_ctrl;
68 struct usb_cdc_union_func_descriptor union_descr;
69 struct usb_cdc_call_mgmnt_func_descriptor call_mgmt;
70#if 1
71 struct usb_st_endpoint_descriptor ep_notification;
72#endif
73 struct usb_st_interface_descriptor data;
74 struct usb_st_endpoint_descriptor ep_in;
75 struct usb_st_endpoint_descriptor ep_out;
76} configuration_block =
77 {
78 /* Configuration */
79 {
80 sizeof(configuration_block.configuration),
81 CONFIGURATION,
82 sizeof(configuration_block),
83 2,
84 1,
85 0,
86 0x80,
87 250
88 },
89 {
90 sizeof(configuration_block.comm),
91 INTERFACE,
92 0,
93 0,
94 1,
95 CDC,
96 ABSTRACT_CONTROL_MODEL,
97 V_25TER_PROTOCOL,
98 0
99 },
100 {
101 sizeof(configuration_block.header),
102 CS_INTERFACE,
103 CDC_FUNC_DESCR_HEADER,
104 0x0110
105 },
106 {
107 sizeof(configuration_block.abstract_ctrl),
108 CS_INTERFACE,
109 CDC_FUNC_DESCR_ABSTRACT_CTRL_MGMNT,
110 0x2, /** Set line coding */
111 },
112 {
113 sizeof(configuration_block.union_descr),
114 CS_INTERFACE,
115 CDC_FUNC_DESCR_UNION,
116 0, /** Master */
117 {1} /** Slave */
118 },
119 {
120 sizeof(configuration_block.call_mgmt),
121 CS_INTERFACE,
122 CDC_FUNC_DESCR_CALL_MGMNT,
123 0x00,
124 1 /** data interface */
125 },
126 {
127 sizeof(configuration_block.ep_notification),
128 ENDPOINT,
129 0x81,
130 0x03,
131 USB_EP1_SIZE,
132 255 /** 255ms polling, not really used so maximum value used */
133 },
134 {
135 sizeof(configuration_block.data),
136 INTERFACE,
137 1,
138 0,
139 2,
140 CDC_DATA,
141 0,
142 0, /** TRANSPARENT_PROTOCOL*/
143 0
144 },
145 {
146 sizeof(configuration_block.ep_in),
147 ENDPOINT,
148 0x82,
149 0x02,
150 USB_EP2_SIZE,
151 0
152 },
153 {
154 sizeof(configuration_block.ep_out),
155 ENDPOINT,
156 0x03,
157 0x02,
158 USB_EP3_SIZE,
159 0
160 }
161
162 };
163
164const struct usb_st_configuration_descriptor* const configuration_head =
165(const struct usb_st_configuration_descriptor*)&configuration_block;
166
167/** @} */