1 //==========================================================================
5 // Static data for the SA11x0 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/io/devtab.h>
55 #include <cyg/io/usb/usbs_sa11x0.h>
56 #include <pkgconf/devs_usb_sa11x0.h>
58 // ----------------------------------------------------------------------------
59 // Initialization. The goal here is to call usbs_sa11x0_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.
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
72 extern "C" void usbs_sa11x0_init(void);
74 #ifndef CYGVAR_DEVS_USB_SA11X0_EP0_DEVTAB_ENTRY
75 class usbs_sa11x0_initialization {
77 usbs_sa11x0_initialization() {
82 static usbs_sa11x0_initialization usbs_sa11x0_init_object CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO);
85 // ----------------------------------------------------------------------------
86 // The devtab entries. Each of these is optional, many applications
87 // will want to use the lower-level API rather than go via
88 // open/read/write/ioctl.
90 #ifdef CYGVAR_DEVS_USB_SA11X0_EP0_DEVTAB_ENTRY
92 // For endpoint 0 the only legal operations are get_config() and
93 // set_config(), and these are provided by the common package.
96 usbs_sa11x0_devtab_ep0_init(struct cyg_devtab_entry* tab)
98 CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab);
103 static CHAR_DEVIO_TABLE(usbs_sa11x0_ep0_devtab_functions,
107 &usbs_devtab_get_config,
108 &usbs_devtab_set_config);
110 static CHAR_DEVTAB_ENTRY(usbs_sa11x0_ep0_devtab_entry,
111 CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME "0c",
113 &usbs_sa11x0_ep0_devtab_functions,
114 &usbs_sa11x0_devtab_ep0_init,
116 (void*) &usbs_sa11x0_ep0);
119 // ----------------------------------------------------------------------------
120 // Common routines for ep1 and ep2.
121 #if defined(CYGVAR_DEVS_USB_SA11X0_EP1_DEVTAB_ENTRY) || defined(CYGVAR_DEVS_USB_SA11X0_EP2_DEVTAB_ENTRY)
123 usbs_sa11x0_devtab_dummy_init(struct cyg_devtab_entry* tab)
125 CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab);
130 // ----------------------------------------------------------------------------
131 // ep1 devtab entry. This can only be used for host->slave, so only the
132 // cread() function makes sense.
134 #ifdef CYGVAR_DEVS_USB_SA11X0_EP1_DEVTAB_ENTRY
136 static CHAR_DEVIO_TABLE(usbs_sa11x0_ep1_devtab_functions,
140 &usbs_devtab_get_config,
141 &usbs_devtab_set_config);
143 static CHAR_DEVTAB_ENTRY(usbs_sa11x0_ep1_devtab_entry,
144 CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME "1r",
146 &usbs_sa11x0_ep1_devtab_functions,
147 &usbs_sa11x0_devtab_dummy_init,
149 (void*) &usbs_sa11x0_ep1);
152 // ----------------------------------------------------------------------------
153 // ep2 devtab entry. This can only be used for slave->host, so only
154 // the cwrite() function makes sense.
156 #ifdef CYGVAR_DEVS_USB_SA11X0_EP2_DEVTAB_ENTRY
158 static CHAR_DEVIO_TABLE(usbs_sa11x0_ep2_devtab_functions,
162 &usbs_devtab_get_config,
163 &usbs_devtab_set_config);
165 static DEVTAB_ENTRY(usbs_sa11x0_ep2_devtab_entry,
166 CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME "2w",
168 &usbs_sa11x0_ep2_devtab_functions,
169 &usbs_sa11x0_devtab_dummy_init,
171 (void*) &usbs_sa11x0_ep2);