Mercurial > ecos
comparison packages/devs/common/current/include/table.h @ 0:3111d98ba7b3 ecos-v1_1-release
Initial commit of eCos version 1.1
| author | jlarmour |
|---|---|
| date | Tue, 11 May 1999 11:16:07 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:3111d98ba7b3 |
|---|---|
| 1 #ifndef CYGONCE_DEVS_COMMON_TABLE_H | |
| 2 #define CYGONCE_DEVS_COMMON_TABLE_H | |
| 3 | |
| 4 //========================================================================== | |
| 5 // | |
| 6 // table.h | |
| 7 // | |
| 8 // Header file for the device table | |
| 9 // | |
| 10 //========================================================================== | |
| 11 //####COPYRIGHTBEGIN#### | |
| 12 // | |
| 13 // ------------------------------------------- | |
| 14 // The contents of this file are subject to the Cygnus eCos Public License | |
| 15 // Version 1.0 (the "License"); you may not use this file except in | |
| 16 // compliance with the License. You may obtain a copy of the License at | |
| 17 // http://sourceware.cygnus.com/ecos | |
| 18 // | |
| 19 // Software distributed under the License is distributed on an "AS IS" | |
| 20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 21 // License for the specific language governing rights and limitations under | |
| 22 // the License. | |
| 23 // | |
| 24 // The Original Code is eCos - Embedded Cygnus Operating System, released | |
| 25 // September 30, 1998. | |
| 26 // | |
| 27 // The Initial Developer of the Original Code is Cygnus. Portions created | |
| 28 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. | |
| 29 // ------------------------------------------- | |
| 30 // | |
| 31 //####COPYRIGHTEND#### | |
| 32 //========================================================================== | |
| 33 //#####DESCRIPTIONBEGIN#### | |
| 34 // | |
| 35 // Author(s): proven | |
| 36 // Contributors: proven | |
| 37 // Date: 1998-04-20 | |
| 38 // Purpose: Define Device Table | |
| 39 // Description: This file contains the device table structure | |
| 40 // Usage: #include <cyg/devs/common/table.h> | |
| 41 // | |
| 42 //####DESCRIPTIONEND#### | |
| 43 // | |
| 44 //========================================================================== | |
| 45 | |
| 46 /* | |
| 47 * devs.h should be replaced by an appropriate ECC Hardy package. | |
| 48 * and this file should mostly be auto generated -- proven 19980625 | |
| 49 */ | |
| 50 #include <pkgconf/devs.h> // What devices do we need. | |
| 51 | |
| 52 #include <cyg/infra/cyg_type.h> // Common type definitions and support | |
| 53 #include <cyg/devs/common/iorb.h> // Cyg_IORB definition | |
| 54 #include <cyg/error/codes.h> // Standard error codes | |
| 55 | |
| 56 // Handles to some of the device entries. | |
| 57 // These shouldn't go here and should be generated by ECC-Hardy | |
| 58 // --proven 19980625 | |
| 59 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_1 | |
| 60 extern CYG_ADDRWORD stdeval1_serial1; | |
| 61 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_2 | |
| 62 extern CYG_ADDRWORD stdeval1_serial2; | |
| 63 #endif | |
| 64 #else | |
| 65 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_2 | |
| 66 extern CYG_ADDRWORD stdeval1_serial2; | |
| 67 #endif | |
| 68 #endif | |
| 69 | |
| 70 #ifdef CYG_DEVICE_SERIAL_RS232_TX39 | |
| 71 extern CYG_ADDRWORD jmr3904_serial; | |
| 72 #endif | |
| 73 | |
| 74 // Mode for opening | |
| 75 | |
| 76 typedef enum { | |
| 77 CYG_DEVICE_OPEN_MODE_TEXT, | |
| 78 CYG_DEVICE_OPEN_MODE_RAW | |
| 79 } Cyg_DeviceOpenMode; | |
| 80 | |
| 81 // ------------------------------------------------------------------------- | |
| 82 // Cyg_Device_Table_t | |
| 83 | |
| 84 /* | |
| 85 * Device table. | |
| 86 */ | |
| 87 struct Cyg_Device_Table_t | |
| 88 { | |
| 89 char * name; | |
| 90 CYG_ADDRWORD cookie; | |
| 91 // cyg_off_t seek_position; // Not implemented yet | |
| 92 | |
| 93 /* | |
| 94 * Note: The cookie is necessary for the function to differentiate | |
| 95 * between various instantiations of the same device type. | |
| 96 * | |
| 97 * Also note that open() will be called before the kernel scheduler | |
| 98 * (and hence the interrupt system) starts, so it must be safe for this | |
| 99 */ | |
| 100 Cyg_ErrNo (*open) (CYG_ADDRWORD cookie, Cyg_DeviceOpenMode); | |
| 101 Cyg_ErrNo (*read_cancel) (CYG_ADDRWORD cookie, Cyg_IORB *); | |
| 102 Cyg_ErrNo (*write_cancel) (CYG_ADDRWORD cookie, Cyg_IORB *); | |
| 103 Cyg_ErrNo (*read_blocking) (CYG_ADDRWORD cookie, Cyg_IORB *); | |
| 104 Cyg_ErrNo (*write_blocking) (CYG_ADDRWORD cookie, Cyg_IORB *); | |
| 105 Cyg_ErrNo (*read_asynchronous) (CYG_ADDRWORD cookie, Cyg_IORB *); | |
| 106 Cyg_ErrNo (*write_asynchronous) (CYG_ADDRWORD cookie, Cyg_IORB *); | |
| 107 Cyg_ErrNo (*close) (CYG_ADDRWORD cookie); | |
| 108 | |
| 109 CYG_ADDRWORD ioctl; | |
| 110 }; | |
| 111 | |
| 112 externC struct Cyg_Device_Table_t Cyg_Device_Table[]; | |
| 113 | |
| 114 struct Cyg_Device_Serial_RS232_Table_t | |
| 115 { | |
| 116 Cyg_ErrNo (*set_kmode) (CYG_ADDRWORD cookie, cyg_uint32); | |
| 117 Cyg_ErrNo (*get_baud_rate) (CYG_ADDRWORD cookie, cyg_int32 * ); | |
| 118 Cyg_ErrNo (*set_baud_rate) (CYG_ADDRWORD cookie, cyg_int32, cyg_int32 *); | |
| 119 Cyg_ErrNo (*get_line_mode) (CYG_ADDRWORD cookie, cyg_int32 * ); | |
| 120 Cyg_ErrNo (*set_line_mode) (CYG_ADDRWORD cookie, cyg_int32, cyg_int32 *); | |
| 121 | |
| 122 Cyg_ErrNo (*get_read_mode) (CYG_ADDRWORD cookie, cyg_int32 * ); | |
| 123 Cyg_ErrNo (*set_read_mode) (CYG_ADDRWORD cookie, cyg_int32, cyg_int32 *); | |
| 124 Cyg_ErrNo (*set_read_data) (CYG_ADDRWORD cookie, cyg_int32, char *, cyg_uint32); | |
| 125 }; | |
| 126 | |
| 127 /* | |
| 128 * C API is just a set of macros | |
| 129 */ | |
| 130 #define cyg_read_cancel(x, y) \ | |
| 131 ((struct Cyg_Device_Table_t *)x)->read_cancel(((struct Cyg_Device_Table_t *)x)->cookie, y) | |
| 132 | |
| 133 #define cyg_write_cancel(x, y) \ | |
| 134 ((struct Cyg_Device_Table_t *)x)->write_cancel(((struct Cyg_Device_Table_t *)x)->cookie, y) | |
| 135 | |
| 136 #define cyg_read_blocking(x, y) \ | |
| 137 ((struct Cyg_Device_Table_t *)x)->read_blocking(((struct Cyg_Device_Table_t *)x)->cookie, y) | |
| 138 | |
| 139 #define cyg_write_blocking(x, y) \ | |
| 140 ((struct Cyg_Device_Table_t *)x)->write_blocking(((struct Cyg_Device_Table_t *)x)->cookie, y) | |
| 141 | |
| 142 #define cyg_read_asynchronous(x, y) \ | |
| 143 ((struct Cyg_Device_Table_t *)x)->read_asynchronous(((struct Cyg_Device_Table_t *)x)->cookie, y) | |
| 144 | |
| 145 #define cyg_write_asynchronous(x, y) \ | |
| 146 ((struct Cyg_Device_Table_t *)x)->write_asynchronous(((struct Cyg_Device_Table_t *)x)->cookie, y) | |
| 147 | |
| 148 /* | |
| 149 * C API for Serial RS232 devices | |
| 150 */ | |
| 151 #define cyg_serial_rs232_set_kmode(x, y) \ | |
| 152 ((struct Cyg_Device_Serial_RS232_Table_t *)((struct Cyg_Device_Table_t *)x)->ioctl)->set_kmode(((struct Cyg_Device_Table_t *)x)->cookie, y) | |
| 153 | |
| 154 #define cyg_serial_rs232_get_baud_rate(x, y) \ | |
| 155 ((struct Cyg_Device_Serial_RS232_Table_t *)((struct Cyg_Device_Table_t *)x)->ioctl)->get_baud_rate(((struct Cyg_Device_Table_t *)x)->cookie, y) | |
| 156 | |
| 157 #define cyg_serial_rs232_set_baud_rate(x, y, z) \ | |
| 158 ((struct Cyg_Device_Serial_RS232_Table_t *)((struct Cyg_Device_Table_t *)x)->ioctl)->set_baud_rate(((struct Cyg_Device_Table_t *)x)->cookie, y, z) | |
| 159 | |
| 160 #define cyg_serial_rs232_get_line_mode(x, y) \ | |
| 161 ((struct Cyg_Device_Serial_RS232_Table_t *)((struct Cyg_Device_Table_t *)x)->ioctl)->get_line_mode(((struct Cyg_Device_Table_t *)x)->cookie, y) | |
| 162 | |
| 163 #define cyg_serial_rs232_set_line_mode(x, y, z) \ | |
| 164 ((struct Cyg_Device_Serial_RS232_Table_t *)((struct Cyg_Device_Table_t *)x)->ioctl)->set_line_mode(((struct Cyg_Device_Table_t *)x)->cookie, y, z) | |
| 165 | |
| 166 #define cyg_serial_rs232_get_read_mode(x, y) \ | |
| 167 ((struct Cyg_Device_Serial_RS232_Table_t *)((struct Cyg_Device_Table_t *)x)->ioctl)->get_read_mode(((struct Cyg_Device_Table_t *)x)->cookie, y) | |
| 168 | |
| 169 #define cyg_serial_rs232_set_read_mode(x, y, z) \ | |
| 170 ((struct Cyg_Device_Serial_RS232_Table_t *)((struct Cyg_Device_Table_t *)x)->ioctl)->set_read_mode(((struct Cyg_Device_Table_t *)x)->cookie, y, z) | |
| 171 | |
| 172 #define cyg_serial_rs232_set_read_data(x, y, z, a) \ | |
| 173 ((struct Cyg_Device_Serial_RS232_Table_t *)((struct Cyg_Device_Table_t *)x)->ioctl)->set_read_data(((struct Cyg_Device_Table_t *)x)->cookie, y, z, a) | |
| 174 | |
| 175 | |
| 176 | |
| 177 #endif // CYGONCE_DEVS_COMMON_TABLE_H | |
| 178 // End of table.h | |
| 179 |
