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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [devs/] [usb/] [nec_upd985xx/] [current/] [src/] [usbs_upd985xx_data.cxx] - Blame information for rev 791

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

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
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 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):    bartv
43
// Contributors: bartv
44
// Date:         2001-05-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_upd985xx.h>
56
#include <pkgconf/devs_usb_upd985xx.h>
57
 
58
// ----------------------------------------------------------------------------
59
// Initialization. The goal here is to call usbs_upd985xx_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_upd985xx_init(void);
73
 
74
#ifndef CYGVAR_DEVS_USB_UPD985XX_EP0_DEVTAB_ENTRY
75
class usbs_upd985xx_initialization {
76
  public:
77
    usbs_upd985xx_initialization() {
78
        usbs_upd985xx_init();
79
    }
80
};
81
 
82
static usbs_upd985xx_initialization usbs_upd985xx_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_UPD985XX_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_upd985xx_devtab_ep0_init(struct cyg_devtab_entry* tab)
97
{
98
    CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab);
99
    usbs_upd985xx_init();
100
    return true;
101
}
102
 
103
static CHAR_DEVIO_TABLE(usbs_upd985xx_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_upd985xx_ep0_devtab_entry,
111
                         CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "0c",
112
                         0,
113
                         &usbs_upd985xx_ep0_devtab_functions,
114
                         &usbs_upd985xx_devtab_ep0_init,
115
                         0,
116
                         (void*) &usbs_upd985xx_ep0);
117
#endif
118
 
119
// ----------------------------------------------------------------------------
120
// Common routines for ep3, ep4 and ep5
121
#if defined(CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY) || \
122
    defined(CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY) || \
123
    defined(CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY)
124
static bool
125
usbs_upd985xx_devtab_dummy_init(struct cyg_devtab_entry* tab)
126
{
127
    CYG_UNUSED_PARAM(struct cyg_devtab_entry*, tab);
128
    return true;
129
}
130
#endif
131
 
132
// ----------------------------------------------------------------------------
133
// ep3 devtab entry. This can only be used for slave->host, so only
134
// the cwrite() function makes sense. The same function table can be
135
// used for ep5.
136
 
137
#if defined(CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY) || \
138
    defined(CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY)
139
static CHAR_DEVIO_TABLE(usbs_upd985xx_ep35_devtab_functions,
140
                        &usbs_devtab_cwrite,
141
                        &cyg_devio_cread,
142
                        &cyg_devio_select,
143
                        &usbs_devtab_get_config,
144
                        &usbs_devtab_set_config);
145
 
146
# if defined(CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY)
147
static CHAR_DEVTAB_ENTRY(usbs_upd985xx_ep3_devtab_entry,
148
                         CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "3w",
149
                         0,
150
                         &usbs_upd985xx_ep35_devtab_functions,
151
                         &usbs_upd985xx_devtab_dummy_init,
152
                         0,
153
                         (void*) &usbs_upd985xx_ep3);
154
 
155
# endif
156
 
157
# if defined(CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY)
158
static CHAR_DEVTAB_ENTRY(usbs_upd985xx_ep5_devtab_entry,
159
                         CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "5w",
160
                         0,
161
                         &usbs_upd985xx_ep35_devtab_functions,
162
                         &usbs_upd985xx_devtab_dummy_init,
163
                         0,
164
                         (void*) &usbs_upd985xx_ep5);
165
# endif
166
#endif
167
 
168
// ----------------------------------------------------------------------------
169
// ep4 devtab entry. This can only be used for host->slave, so only the
170
// cread() function makes sense.
171
 
172
#ifdef CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY
173
 
174
static CHAR_DEVIO_TABLE(usbs_upd985xx_ep4_devtab_functions,
175
                        &cyg_devio_cwrite,
176
                        &usbs_devtab_cread,
177
                        &cyg_devio_select,
178
                        &usbs_devtab_get_config,
179
                        &usbs_devtab_set_config);
180
 
181
static CHAR_DEVTAB_ENTRY(usbs_upd985xx_ep4_devtab_entry,
182
                         CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME "4r",
183
                         0,
184
                         &usbs_upd985xx_ep4_devtab_functions,
185
                         &usbs_upd985xx_devtab_dummy_init,
186
                         0,
187
                         (void*) &usbs_upd985xx_ep4);
188
#endif
189
 

powered by: WebSVN 2.1.0

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