OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [devs/] [usb/] [sa11x0/] [v2_0/] [src/] [usbs_sa11x0_data.cxx] - Blame information for rev 565

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      usbs_sa11x0.c
4
//
5
//      Static data for the SA11x0 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:         2000-10-04
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/io/devtab.h>
55
#include <cyg/io/usb/usbs_sa11x0.h>
56
#include <pkgconf/devs_usb_sa11x0.h>
57
 
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.
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_sa11x0_init(void);
73
 
74
#ifndef CYGVAR_DEVS_USB_SA11X0_EP0_DEVTAB_ENTRY
75
class usbs_sa11x0_initialization {
76
  public:
77
    usbs_sa11x0_initialization() {
78
        usbs_sa11x0_init();
79
    }
80
};
81
 
82
static usbs_sa11x0_initialization usbs_sa11x0_init_object CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO);
83
#endif
84
 
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.
89
 
90
#ifdef CYGVAR_DEVS_USB_SA11X0_EP0_DEVTAB_ENTRY
91
 
92
// For endpoint 0 the only legal operations are get_config() and
93
// set_config(), and these are provided by the common package.
94
 
95
static bool
96
usbs_sa11x0_devtab_ep0_init(struct cyg_devtab_entry* tab)
97
{
98
    CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab);
99
    usbs_sa11x0_init();
100
    return true;
101
}
102
 
103
static CHAR_DEVIO_TABLE(usbs_sa11x0_ep0_devtab_functions,
104
                        &cyg_devio_cwrite,
105
                        &cyg_devio_cread,
106
                        &cyg_devio_select,
107
                        &usbs_devtab_get_config,
108
                        &usbs_devtab_set_config);
109
 
110
static CHAR_DEVTAB_ENTRY(usbs_sa11x0_ep0_devtab_entry,
111
                         CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME "0c",
112
                         0,
113
                         &usbs_sa11x0_ep0_devtab_functions,
114
                         &usbs_sa11x0_devtab_ep0_init,
115
                         0,
116
                         (void*) &usbs_sa11x0_ep0);
117
#endif
118
 
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)
122
static bool
123
usbs_sa11x0_devtab_dummy_init(struct cyg_devtab_entry* tab)
124
{
125
    CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab);
126
    return true;
127
}
128
#endif
129
 
130
// ----------------------------------------------------------------------------
131
// ep1 devtab entry. This can only be used for host->slave, so only the
132
// cread() function makes sense.
133
 
134
#ifdef CYGVAR_DEVS_USB_SA11X0_EP1_DEVTAB_ENTRY
135
 
136
static CHAR_DEVIO_TABLE(usbs_sa11x0_ep1_devtab_functions,
137
                        &cyg_devio_cwrite,
138
                        &usbs_devtab_cread,
139
                        &cyg_devio_select,
140
                        &usbs_devtab_get_config,
141
                        &usbs_devtab_set_config);
142
 
143
static CHAR_DEVTAB_ENTRY(usbs_sa11x0_ep1_devtab_entry,
144
                         CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME "1r",
145
                         0,
146
                         &usbs_sa11x0_ep1_devtab_functions,
147
                         &usbs_sa11x0_devtab_dummy_init,
148
                         0,
149
                         (void*) &usbs_sa11x0_ep1);
150
#endif
151
 
152
// ----------------------------------------------------------------------------
153
// ep2 devtab entry. This can only be used for slave->host, so only
154
// the cwrite() function makes sense.
155
 
156
#ifdef CYGVAR_DEVS_USB_SA11X0_EP2_DEVTAB_ENTRY
157
 
158
static CHAR_DEVIO_TABLE(usbs_sa11x0_ep2_devtab_functions,
159
                        &usbs_devtab_cwrite,
160
                        &cyg_devio_cread,
161
                        &cyg_devio_select,
162
                        &usbs_devtab_get_config,
163
                        &usbs_devtab_set_config);
164
 
165
static DEVTAB_ENTRY(usbs_sa11x0_ep2_devtab_entry,
166
                    CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME "2w",
167
                    0,
168
                    &usbs_sa11x0_ep2_devtab_functions,
169
                    &usbs_sa11x0_devtab_dummy_init,
170
                    0,
171
                    (void*) &usbs_sa11x0_ep2);
172
 
173
#endif
174
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.