1 |
27 |
unneback |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// usbs_nec_upd9850x.c
|
4 |
|
|
//
|
5 |
|
|
// Static data for the NEC uPD9850x 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 Red Hat, 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 version.
|
16 |
|
|
//
|
17 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
18 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
19 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
20 |
|
|
// for more details.
|
21 |
|
|
//
|
22 |
|
|
// You should have received a copy of the GNU General Public License along
|
23 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
24 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
25 |
|
|
//
|
26 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
27 |
|
|
// or inline functions from this file, or you compile this file and link it
|
28 |
|
|
// with other works to produce a work based on this file, this file does not
|
29 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
30 |
|
|
// License. However the source code for this file must still be made available
|
31 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
32 |
|
|
//
|
33 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
34 |
|
|
// this file might be covered by the GNU General Public License.
|
35 |
|
|
//
|
36 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
37 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
38 |
|
|
// -------------------------------------------
|
39 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
40 |
|
|
//==========================================================================
|
41 |
|
|
//#####DESCRIPTIONBEGIN####
|
42 |
|
|
//
|
43 |
|
|
// Author(s): bartv
|
44 |
|
|
// Contributors: bartv
|
45 |
|
|
// Date: 2001-05-22
|
46 |
|
|
//
|
47 |
|
|
// This file contains various objects that should go into extras.o
|
48 |
|
|
// rather than libtarget.a, e.g. devtab entries that would normally
|
49 |
|
|
// be eliminated by the selective linking.
|
50 |
|
|
//
|
51 |
|
|
//####DESCRIPTIONEND####
|
52 |
|
|
//==========================================================================
|
53 |
|
|
|
54 |
|
|
#include <cyg/infra/diag.h>
|
55 |
|
|
#include <cyg/io/devtab.h>
|
56 |
|
|
#include <cyg/io/usb/usbs_upd985xx.h>
|
57 |
|
|
#include <pkgconf/devs_usb_upd985xx.h>
|
58 |
|
|
|
59 |
|
|
// ----------------------------------------------------------------------------
|
60 |
|
|
// Initialization. The goal here is to call usbs_upd985xx_init()
|
61 |
|
|
// early on during system startup, to take care of things like
|
62 |
|
|
// registering interrupt handlers etc. which are best done
|
63 |
|
|
// during system init.
|
64 |
|
|
//
|
65 |
|
|
// If the endpoint 0 devtab entry is available then its init()
|
66 |
|
|
// function can be used to take care of this. However the devtab
|
67 |
|
|
// entries are optional so an alternative mechanism must be
|
68 |
|
|
// provided. Unfortunately although it is possible to give
|
69 |
|
|
// a C function the constructor attribute, it cannot be given
|
70 |
|
|
// an initpri attribute. Instead it is necessary to define a
|
71 |
|
|
// dummy C++ class.
|
72 |
|
|
|
73 |
|
|
extern "C" void usbs_upd985xx_init(void);
|
74 |
|
|
|
75 |
|
|
#ifndef CYGVAR_DEVS_USB_UPD985XX_EP0_DEVTAB_ENTRY
|
76 |
|
|
class usbs_upd985xx_initialization {
|
77 |
|
|
public:
|
78 |
|
|
usbs_upd985xx_initialization() {
|
79 |
|
|
usbs_upd985xx_init();
|
80 |
|
|
}
|
81 |
|
|
};
|
82 |
|
|
|
83 |
|
|
static usbs_upd985xx_initialization usbs_upd985xx_init_object CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO);
|
84 |
|
|
#endif
|
85 |
|
|
|
86 |
|
|
// ----------------------------------------------------------------------------
|
87 |
|
|
// The devtab entries. Each of these is optional, many applications
|
88 |
|
|
// will want to use the lower-level API rather than go via
|
89 |
|
|
// open/read/write/ioctl.
|
90 |
|
|
|
91 |
|
|
#ifdef CYGVAR_DEVS_USB_UPD985XX_EP0_DEVTAB_ENTRY
|
92 |
|
|
|
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
|
97 |
|
|
usbs_upd985xx_devtab_ep0_init(struct cyg_devtab_entry* tab)
|
98 |
|
|
{
|
99 |
|
|
CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab);
|
100 |
|
|
usbs_upd985xx_init();
|
101 |
|
|
return true;
|
102 |
|
|
}
|
103 |
|
|
|
104 |
|
|
static CHAR_DEVIO_TABLE(usbs_upd985xx_ep0_devtab_functions,
|
105 |
|
|
&cyg_devio_cwrite,
|
106 |
|
|
&cyg_devio_cread,
|
107 |
|
|
&cyg_devio_select,
|
108 |
|
|
&usbs_devtab_get_config,
|
109 |
|
|
&usbs_devtab_set_config);
|
110 |
|
|
|
111 |
|
|
static CHAR_DEVTAB_ENTRY(usbs_upd985xx_ep0_devtab_entry,
|
112 |
|
|
CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "0c",
|
113 |
|
|
0,
|
114 |
|
|
&usbs_upd985xx_ep0_devtab_functions,
|
115 |
|
|
&usbs_upd985xx_devtab_ep0_init,
|
116 |
|
|
0,
|
117 |
|
|
(void*) &usbs_upd985xx_ep0);
|
118 |
|
|
#endif
|
119 |
|
|
|
120 |
|
|
// ----------------------------------------------------------------------------
|
121 |
|
|
// Common routines for ep3, ep4 and ep5
|
122 |
|
|
#if defined(CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY) || \
|
123 |
|
|
defined(CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY) || \
|
124 |
|
|
defined(CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY)
|
125 |
|
|
static bool
|
126 |
|
|
usbs_upd985xx_devtab_dummy_init(struct cyg_devtab_entry* tab)
|
127 |
|
|
{
|
128 |
|
|
CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab);
|
129 |
|
|
return true;
|
130 |
|
|
}
|
131 |
|
|
#endif
|
132 |
|
|
|
133 |
|
|
// ----------------------------------------------------------------------------
|
134 |
|
|
// ep3 devtab entry. This can only be used for slave->host, so only
|
135 |
|
|
// the cwrite() function makes sense. The same function table can be
|
136 |
|
|
// used for ep5.
|
137 |
|
|
|
138 |
|
|
#if defined(CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY) || \
|
139 |
|
|
defined(CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY)
|
140 |
|
|
static CHAR_DEVIO_TABLE(usbs_upd985xx_ep35_devtab_functions,
|
141 |
|
|
&usbs_devtab_cwrite,
|
142 |
|
|
&cyg_devio_cread,
|
143 |
|
|
&cyg_devio_select,
|
144 |
|
|
&usbs_devtab_get_config,
|
145 |
|
|
&usbs_devtab_set_config);
|
146 |
|
|
|
147 |
|
|
# if defined(CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY)
|
148 |
|
|
static CHAR_DEVTAB_ENTRY(usbs_upd985xx_ep3_devtab_entry,
|
149 |
|
|
CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "3w",
|
150 |
|
|
0,
|
151 |
|
|
&usbs_upd985xx_ep35_devtab_functions,
|
152 |
|
|
&usbs_upd985xx_devtab_dummy_init,
|
153 |
|
|
0,
|
154 |
|
|
(void*) &usbs_upd985xx_ep3);
|
155 |
|
|
|
156 |
|
|
# endif
|
157 |
|
|
|
158 |
|
|
# if defined(CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY)
|
159 |
|
|
static CHAR_DEVTAB_ENTRY(usbs_upd985xx_ep5_devtab_entry,
|
160 |
|
|
CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "5w",
|
161 |
|
|
0,
|
162 |
|
|
&usbs_upd985xx_ep35_devtab_functions,
|
163 |
|
|
&usbs_upd985xx_devtab_dummy_init,
|
164 |
|
|
0,
|
165 |
|
|
(void*) &usbs_upd985xx_ep5);
|
166 |
|
|
# endif
|
167 |
|
|
#endif
|
168 |
|
|
|
169 |
|
|
// ----------------------------------------------------------------------------
|
170 |
|
|
// ep4 devtab entry. This can only be used for host->slave, so only the
|
171 |
|
|
// cread() function makes sense.
|
172 |
|
|
|
173 |
|
|
#ifdef CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY
|
174 |
|
|
|
175 |
|
|
static CHAR_DEVIO_TABLE(usbs_upd985xx_ep4_devtab_functions,
|
176 |
|
|
&cyg_devio_cwrite,
|
177 |
|
|
&usbs_devtab_cread,
|
178 |
|
|
&cyg_devio_select,
|
179 |
|
|
&usbs_devtab_get_config,
|
180 |
|
|
&usbs_devtab_set_config);
|
181 |
|
|
|
182 |
|
|
static CHAR_DEVTAB_ENTRY(usbs_upd985xx_ep4_devtab_entry,
|
183 |
|
|
CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "4r",
|
184 |
|
|
0,
|
185 |
|
|
&usbs_upd985xx_ep4_devtab_functions,
|
186 |
|
|
&usbs_upd985xx_devtab_dummy_init,
|
187 |
|
|
0,
|
188 |
|
|
(void*) &usbs_upd985xx_ep4);
|
189 |
|
|
#endif
|
190 |
|
|
|