comparison packages/io/common/current/include/devtab.h @ 2:443894e2e912 ecos-v1_2_1-release

Block commit of eCos version 1.2.1
author jlarmour
date Tue, 11 May 1999 12:24:34 +0000
parents
children c38311975d4f
comparison
equal deleted inserted replaced
1:72f549f0d891 2:443894e2e912
1 #ifndef CYGONCE_IO_DEVTAB_H
2 #define CYGONCE_IO_DEVTAB_H
3 // ====================================================================
4 //
5 // devtab.h
6 //
7 // Device I/O Table
8 //
9 // ====================================================================
10 //####COPYRIGHTBEGIN####
11 //
12 // -------------------------------------------
13 // The contents of this file are subject to the Cygnus eCos Public License
14 // Version 1.0 (the "License"); you may not use this file except in
15 // compliance with the License. You may obtain a copy of the License at
16 // http://sourceware.cygnus.com/ecos
17 //
18 // Software distributed under the License is distributed on an "AS IS"
19 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
20 // License for the specific language governing rights and limitations under
21 // the License.
22 //
23 // The Original Code is eCos - Embedded Cygnus Operating System, released
24 // September 30, 1998.
25 //
26 // The Initial Developer of the Original Code is Cygnus. Portions created
27 // by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved.
28 // -------------------------------------------
29 //
30 //####COPYRIGHTEND####
31 // ====================================================================
32 //#####DESCRIPTIONBEGIN####
33 //
34 // Author(s): gthomas
35 // Contributors: gthomas
36 // Date: 1999-02-04
37 // Purpose: Describe low level I/O interfaces.
38 // Description:
39 //
40 //####DESCRIPTIONEND####
41 //
42 // ====================================================================
43
44 // Private include file. This file should only be used by device
45 // drivers, not application code.
46
47 #include <pkgconf/system.h>
48 #include <cyg/io/io.h>
49 #include <cyg/hal/drv_api.h>
50
51 // Set of functions which handle top level I/O functions
52 typedef struct {
53 Cyg_ErrNo (*write)(cyg_io_handle_t handle,
54 const void *buf,
55 cyg_uint32 *len);
56 Cyg_ErrNo (*read)(cyg_io_handle_t handle,
57 void *buf,
58 cyg_uint32 *len);
59 Cyg_ErrNo (*get_config)(cyg_io_handle_t handle,
60 cyg_uint32 key,
61 void *buf,
62 cyg_uint32 *len);
63 Cyg_ErrNo (*set_config)(cyg_io_handle_t handle,
64 cyg_uint32 key,
65 const void *buf,
66 cyg_uint32 *len);
67 } cyg_devio_table_t;
68
69 #define DEVIO_TABLE(_l,_write,_read,_get_config,_set_config) \
70 cyg_devio_table_t _l = { \
71 _write, \
72 _read, \
73 _get_config, \
74 _set_config, \
75 };
76
77 typedef struct cyg_devtab_entry {
78 const char *name;
79 const char *dep_name;
80 cyg_devio_table_t *handlers;
81 bool (*init)(struct cyg_devtab_entry *tab);
82 Cyg_ErrNo (*lookup)(struct cyg_devtab_entry **tab,
83 struct cyg_devtab_entry *sub_tab,
84 const char *name);
85 void *priv;
86 unsigned long status;
87 } cyg_devtab_entry_t;
88
89 #define CYG_DEVTAB_STATUS_AVAIL 0x0001
90
91 extern cyg_devtab_entry_t __DEVTAB__[], __DEVTAB_END__;
92
93 #define DEVTAB_ENTRY(_l,_name,_dep_name,_handlers,_init,_lookup,_priv) \
94 cyg_devtab_entry_t _l __attribute__ ((section(".devtab"))) = { \
95 _name, \
96 _dep_name, \
97 _handlers, \
98 _init, \
99 _lookup, \
100 _priv \
101 };
102
103 #define DEVTAB_ENTRY_NO_INIT(_l,_name,_dep_name,_handlers,_init,_lookup,_priv) \
104 cyg_devtab_entry_t _l = { \
105 _name, \
106 _dep_name, \
107 _handlers, \
108 _init, \
109 _lookup, \
110 _priv \
111 };
112
113 #endif // CYGONCE_IO_DEVTAB_H