1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// usbs_at91_data.cxx
|
4 |
|
|
//
|
5 |
|
|
// Static data for the ATMEL AT91 USB device driver
|
6 |
|
|
//
|
7 |
|
|
//==========================================================================
|
8 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
// -------------------------------------------
|
10 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
12 |
|
|
//
|
13 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
// the terms of the GNU General Public License as published by the Free
|
15 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
16 |
|
|
// version.
|
17 |
|
|
//
|
18 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
// for more details.
|
22 |
|
|
//
|
23 |
|
|
// You should have received a copy of the GNU General Public License
|
24 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
//
|
27 |
|
|
// As a special exception, if other files instantiate templates or use
|
28 |
|
|
// macros or inline functions from this file, or you compile this file
|
29 |
|
|
// and link it with other works to produce a work based on this file,
|
30 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
// the GNU General Public License. However the source code for this file
|
32 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
// General Public License v2.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based
|
36 |
|
|
// on this file might be covered by the GNU General Public License.
|
37 |
|
|
// -------------------------------------------
|
38 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
//==========================================================================
|
40 |
|
|
//#####DESCRIPTIONBEGIN####
|
41 |
|
|
//
|
42 |
|
|
// Author(s): Oliver Munz
|
43 |
|
|
// Contributors: bartv
|
44 |
|
|
// Date: 2006-02-22
|
45 |
|
|
//
|
46 |
|
|
// This file contains various objects that should go into extras.o
|
47 |
|
|
// rather than libtarget.a, e.g. devtab entries that would normally
|
48 |
|
|
// be eliminated by the selective linking.
|
49 |
|
|
//
|
50 |
|
|
//####DESCRIPTIONEND####
|
51 |
|
|
//==========================================================================
|
52 |
|
|
|
53 |
|
|
#include <cyg/infra/diag.h>
|
54 |
|
|
#include <cyg/io/devtab.h>
|
55 |
|
|
#include <cyg/io/usb/usbs_at91.h>
|
56 |
|
|
#include <pkgconf/devs_usb_at91.h>
|
57 |
|
|
|
58 |
|
|
// ----------------------------------------------------------------------------
|
59 |
|
|
// Initialization. The goal here is to call usbs_at91_init()
|
60 |
|
|
// early on during system startup, to take care of things like
|
61 |
|
|
// registering interrupt handlers etc. which are best done
|
62 |
|
|
// during system init.
|
63 |
|
|
//
|
64 |
|
|
// If the endpoint 0 devtab entry is available then its init()
|
65 |
|
|
// function can be used to take care of this. However the devtab
|
66 |
|
|
// entries are optional so an alternative mechanism must be
|
67 |
|
|
// provided. Unfortunately although it is possible to give
|
68 |
|
|
// a C function the constructor attribute, it cannot be given
|
69 |
|
|
// an initpri attribute. Instead it is necessary to define a
|
70 |
|
|
// dummy C++ class.
|
71 |
|
|
|
72 |
|
|
extern "C" void usbs_at91_init(void);
|
73 |
|
|
|
74 |
|
|
#ifndef CYGVAR_DEVS_USB_AT91_EP0_DEVTAB_ENTRY
|
75 |
|
|
|
76 |
|
|
class usbs_at91_initialization {
|
77 |
|
|
public:
|
78 |
|
|
usbs_at91_initialization() {
|
79 |
|
|
usbs_at91_init();
|
80 |
|
|
}
|
81 |
|
|
};
|
82 |
|
|
|
83 |
|
|
static usbs_at91_initialization CYGBLD_ATTRIB_INIT_BEFORE(CYG_INIT_IO)
|
84 |
|
|
usbs_at91_init_object;
|
85 |
|
|
#endif
|
86 |
|
|
|
87 |
|
|
// ----------------------------------------------------------------------------
|
88 |
|
|
// The devtab entries. Each of these is optional, many applications
|
89 |
|
|
// will want to use the lower-level API rather than go via
|
90 |
|
|
// open/read/write/ioctl.
|
91 |
|
|
|
92 |
|
|
#ifdef CYGVAR_DEVS_USB_AT91_EP0_DEVTAB_ENTRY
|
93 |
|
|
// For endpoint 0 the only legal operations are get_config() and
|
94 |
|
|
// set_config(), and these are provided by the common package.
|
95 |
|
|
|
96 |
|
|
static bool usbs_at91_devtab_ep0_init(struct cyg_devtab_entry* tab){
|
97 |
|
|
|
98 |
|
|
CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab);
|
99 |
|
|
|
100 |
|
|
usbs_at91_init();
|
101 |
|
|
|
102 |
|
|
return true;
|
103 |
|
|
}
|
104 |
|
|
|
105 |
|
|
CHAR_DEVIO_TABLE(usbs_at91_ep0_devtab_functions,
|
106 |
|
|
&cyg_devio_cwrite,
|
107 |
|
|
&cyg_devio_cread,
|
108 |
|
|
&cyg_devio_select,
|
109 |
|
|
&usbs_devtab_get_config,
|
110 |
|
|
&usbs_devtab_set_config);
|
111 |
|
|
|
112 |
|
|
CHAR_DEVTAB_ENTRY(usbs_at91_ep0_devtab_entry,
|
113 |
|
|
CYGDAT_DEVS_USB_AT91_DEVTAB_BASENAME "0",
|
114 |
|
|
0,
|
115 |
|
|
&usbs_at91_ep0_devtab_functions,
|
116 |
|
|
&usbs_at91_devtab_ep0_init,
|
117 |
|
|
0,
|
118 |
|
|
(void*) &usbs_at91_ep0);
|
119 |
|
|
#endif
|
120 |
|
|
|
121 |
|
|
// ----------------------------------------------------------------------------
|
122 |
|
|
// Common routines for ep1..3
|
123 |
|
|
|
124 |
|
|
#if defined(CYGVAR_DEVS_USB_AT91_EP1_DEVTAB_ENTRY) || \
|
125 |
|
|
defined(CYGVAR_DEVS_USB_AT91_EP2_DEVTAB_ENTRY) || \
|
126 |
|
|
defined(CYGVAR_DEVS_USB_AT91_EP3_DEVTAB_ENTRY) || \
|
127 |
|
|
defined(CYGVAR_DEVS_USB_AT91_EP4_DEVTAB_ENTRY) || \
|
128 |
|
|
defined(CYGVAR_DEVS_USB_AT91_EP5_DEVTAB_ENTRY) || \
|
129 |
|
|
defined(CYGVAR_DEVS_USB_AT91_EP6_DEVTAB_ENTRY) || \
|
130 |
|
|
defined(CYGVAR_DEVS_USB_AT91_EP7_DEVTAB_ENTRY)
|
131 |
|
|
|
132 |
|
|
static bool usbs_at91_devtab_dummy_init(struct cyg_devtab_entry* tab){
|
133 |
|
|
|
134 |
|
|
CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab);
|
135 |
|
|
return true;
|
136 |
|
|
}
|
137 |
|
|
#endif
|
138 |
|
|
|
139 |
|
|
#ifdef CYGVAR_DEVS_USB_AT91_EP1_DEVTAB_ENTRY
|
140 |
|
|
CHAR_DEVIO_TABLE(usbs_at91_ep1_devtab_functions,
|
141 |
|
|
&usbs_devtab_cwrite,
|
142 |
|
|
&usbs_devtab_cread,
|
143 |
|
|
&cyg_devio_select,
|
144 |
|
|
&usbs_devtab_get_config,
|
145 |
|
|
&usbs_devtab_set_config);
|
146 |
|
|
|
147 |
|
|
CHAR_DEVTAB_ENTRY(usbs_at91_ep1_devtab_entry,
|
148 |
|
|
CYGDAT_DEVS_USB_AT91_DEVTAB_BASENAME "1",
|
149 |
|
|
0,
|
150 |
|
|
&usbs_at91_ep1_devtab_functions,
|
151 |
|
|
&usbs_at91_devtab_dummy_init,
|
152 |
|
|
0,
|
153 |
|
|
(void*) &usbs_at91_ep1);
|
154 |
|
|
#endif
|
155 |
|
|
|
156 |
|
|
#ifdef CYGVAR_DEVS_USB_AT91_EP2_DEVTAB_ENTRY
|
157 |
|
|
CHAR_DEVIO_TABLE(usbs_at91_ep2_devtab_functions,
|
158 |
|
|
&usbs_devtab_cwrite,
|
159 |
|
|
&usbs_devtab_cread,
|
160 |
|
|
&cyg_devio_select,
|
161 |
|
|
&usbs_devtab_get_config,
|
162 |
|
|
&usbs_devtab_set_config);
|
163 |
|
|
|
164 |
|
|
CHAR_DEVTAB_ENTRY(usbs_at91_ep2_devtab_entry,
|
165 |
|
|
CYGDAT_DEVS_USB_AT91_DEVTAB_BASENAME "2",
|
166 |
|
|
0,
|
167 |
|
|
&usbs_at91_ep2_devtab_functions,
|
168 |
|
|
&usbs_at91_devtab_dummy_init,
|
169 |
|
|
0,
|
170 |
|
|
(void*) &usbs_at91_ep2);
|
171 |
|
|
#endif
|
172 |
|
|
|
173 |
|
|
#ifdef CYGVAR_DEVS_USB_AT91_EP3_DEVTAB_ENTRY
|
174 |
|
|
CHAR_DEVIO_TABLE(usbs_at91_ep3_devtab_functions,
|
175 |
|
|
&usbs_devtab_cwrite,
|
176 |
|
|
&usbs_devtab_cread,
|
177 |
|
|
&cyg_devio_select,
|
178 |
|
|
&usbs_devtab_get_config,
|
179 |
|
|
&usbs_devtab_set_config);
|
180 |
|
|
|
181 |
|
|
CHAR_DEVTAB_ENTRY(usbs_at91_ep3_devtab_entry,
|
182 |
|
|
CYGDAT_DEVS_USB_AT91_DEVTAB_BASENAME "3",
|
183 |
|
|
0,
|
184 |
|
|
&usbs_at91_ep3_devtab_functions,
|
185 |
|
|
&usbs_at91_devtab_dummy_init,
|
186 |
|
|
0,
|
187 |
|
|
(void*) &usbs_at91_ep3);
|
188 |
|
|
#endif
|
189 |
|
|
|
190 |
|
|
#ifdef CYGVAR_DEVS_USB_AT91_EP4_DEVTAB_ENTRY
|
191 |
|
|
CHAR_DEVIO_TABLE(usbs_at91_ep4_devtab_functions,
|
192 |
|
|
&usbs_devtab_cwrite,
|
193 |
|
|
&usbs_devtab_cread,
|
194 |
|
|
&cyg_devio_select,
|
195 |
|
|
&usbs_devtab_get_config,
|
196 |
|
|
&usbs_devtab_set_config);
|
197 |
|
|
|
198 |
|
|
CHAR_DEVTAB_ENTRY(usbs_at91_ep4_devtab_entry,
|
199 |
|
|
CYGDAT_DEVS_USB_AT91_DEVTAB_BASENAME "4",
|
200 |
|
|
0,
|
201 |
|
|
&usbs_at91_ep4_devtab_functions,
|
202 |
|
|
&usbs_at91_devtab_dummy_init,
|
203 |
|
|
0,
|
204 |
|
|
(void*) &usbs_at91_ep4);
|
205 |
|
|
#endif
|
206 |
|
|
|
207 |
|
|
#ifdef CYGVAR_DEVS_USB_AT91_EP5_DEVTAB_ENTRY
|
208 |
|
|
CHAR_DEVIO_TABLE(usbs_at91_ep5_devtab_functions,
|
209 |
|
|
&usbs_devtab_cwrite,
|
210 |
|
|
&usbs_devtab_cread,
|
211 |
|
|
&cyg_devio_select,
|
212 |
|
|
&usbs_devtab_get_config,
|
213 |
|
|
&usbs_devtab_set_config);
|
214 |
|
|
|
215 |
|
|
CHAR_DEVTAB_ENTRY(usbs_at91_ep5_devtab_entry,
|
216 |
|
|
CYGDAT_DEVS_USB_AT91_DEVTAB_BASENAME "5",
|
217 |
|
|
0,
|
218 |
|
|
&usbs_at91_ep5_devtab_functions,
|
219 |
|
|
&usbs_at91_devtab_dummy_init,
|
220 |
|
|
0,
|
221 |
|
|
(void*) &usbs_at91_ep5);
|
222 |
|
|
#endif
|
223 |
|
|
|
224 |
|
|
#ifdef CYGVAR_DEVS_USB_AT91_EP6_DEVTAB_ENTRY
|
225 |
|
|
CHAR_DEVIO_TABLE(usbs_at91_ep6_devtab_functions,
|
226 |
|
|
&usbs_devtab_cwrite,
|
227 |
|
|
&usbs_devtab_cread,
|
228 |
|
|
&cyg_devio_select,
|
229 |
|
|
&usbs_devtab_get_config,
|
230 |
|
|
&usbs_devtab_set_config);
|
231 |
|
|
|
232 |
|
|
CHAR_DEVTAB_ENTRY(usbs_at91_ep6_devtab_entry,
|
233 |
|
|
CYGDAT_DEVS_USB_AT91_DEVTAB_BASENAME "6",
|
234 |
|
|
0,
|
235 |
|
|
&usbs_at91_ep6_devtab_functions,
|
236 |
|
|
&usbs_at91_devtab_dummy_init,
|
237 |
|
|
0,
|
238 |
|
|
(void*) &usbs_at91_ep6);
|
239 |
|
|
#endif
|
240 |
|
|
|
241 |
|
|
#ifdef CYGVAR_DEVS_USB_AT91_EP7_DEVTAB_ENTRY
|
242 |
|
|
CHAR_DEVIO_TABLE(usbs_at91_ep7_devtab_functions,
|
243 |
|
|
&usbs_devtab_cwrite,
|
244 |
|
|
&usbs_devtab_cread,
|
245 |
|
|
&cyg_devio_select,
|
246 |
|
|
&usbs_devtab_get_config,
|
247 |
|
|
&usbs_devtab_set_config);
|
248 |
|
|
|
249 |
|
|
CHAR_DEVTAB_ENTRY(usbs_at91_ep7_devtab_entry,
|
250 |
|
|
CYGDAT_DEVS_USB_AT91_DEVTAB_BASENAME "7",
|
251 |
|
|
0,
|
252 |
|
|
&usbs_at91_ep7_devtab_functions,
|
253 |
|
|
&usbs_at91_devtab_dummy_init,
|
254 |
|
|
0,
|
255 |
|
|
(void*) &usbs_at91_ep7);
|
256 |
|
|
#endif
|