1 //==========================================================================
5 // Static data for the NEC uPD9850x USB device driver
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.
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.
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
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.
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.
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.
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####
44 // Contributors: bartv
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.
51 //####DESCRIPTIONEND####
52 //==========================================================================
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>
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.
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
73 extern "C" void usbs_upd985xx_init(void);
75 #ifndef CYGVAR_DEVS_USB_UPD985XX_EP0_DEVTAB_ENTRY
76 class usbs_upd985xx_initialization {
78 usbs_upd985xx_initialization() {
83 static usbs_upd985xx_initialization usbs_upd985xx_init_object CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO);
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.
91 #ifdef CYGVAR_DEVS_USB_UPD985XX_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.
97 usbs_upd985xx_devtab_ep0_init(struct cyg_devtab_entry* tab)
99 CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab);
100 usbs_upd985xx_init();
104 static CHAR_DEVIO_TABLE(usbs_upd985xx_ep0_devtab_functions,
108 &usbs_devtab_get_config,
109 &usbs_devtab_set_config);
111 static CHAR_DEVTAB_ENTRY(usbs_upd985xx_ep0_devtab_entry,
112 CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "0c",
114 &usbs_upd985xx_ep0_devtab_functions,
115 &usbs_upd985xx_devtab_ep0_init,
117 (void*) &usbs_upd985xx_ep0);
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)
126 usbs_upd985xx_devtab_dummy_init(struct cyg_devtab_entry* tab)
128 CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab);
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
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,
144 &usbs_devtab_get_config,
145 &usbs_devtab_set_config);
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",
151 &usbs_upd985xx_ep35_devtab_functions,
152 &usbs_upd985xx_devtab_dummy_init,
154 (void*) &usbs_upd985xx_ep3);
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",
162 &usbs_upd985xx_ep35_devtab_functions,
163 &usbs_upd985xx_devtab_dummy_init,
165 (void*) &usbs_upd985xx_ep5);
169 // ----------------------------------------------------------------------------
170 // ep4 devtab entry. This can only be used for host->slave, so only the
171 // cread() function makes sense.
173 #ifdef CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY
175 static CHAR_DEVIO_TABLE(usbs_upd985xx_ep4_devtab_functions,
179 &usbs_devtab_get_config,
180 &usbs_devtab_set_config);
182 static CHAR_DEVTAB_ENTRY(usbs_upd985xx_ep4_devtab_entry,
183 CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "4r",
185 &usbs_upd985xx_ep4_devtab_functions,
186 &usbs_upd985xx_devtab_dummy_init,
188 (void*) &usbs_upd985xx_ep4);