Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

linux_pcmcia.h

Go to the documentation of this file.
00001 #ifndef _LINUX_PCMCIA_H
00002 #define _LINUX_PCMCIA_H
00003 
00004 // condensed pcmcia card services header file
00005 
00006 #ifdef __KERNEL__
00007 #include <linux/types.h>
00008 #else
00009 #include <sys/types.h>
00010 #endif
00011 
00012 #ifdef __arm__
00013 typedef u_int   ioaddr_t;
00014 #else
00015 typedef u_short ioaddr_t;
00016 #endif
00017 
00018 typedef u_short socket_t;
00019 typedef u_int   event_t;
00020 typedef u_char  cisdata_t;
00021 typedef u_short page_t;
00022 
00023 struct client_t;
00024 typedef struct client_t *client_handle_t;
00025 
00026 struct window_t;
00027 typedef struct window_t *window_handle_t;
00028 
00029 struct region_t;
00030 typedef struct region_t *memory_handle_t;
00031 
00032 struct eraseq_t;
00033 typedef struct eraseq_t *eraseq_handle_t;
00034 
00035 #ifndef DEV_NAME_LEN
00036 #define DEV_NAME_LEN 32
00037 #endif
00038 
00039 typedef char dev_info_t[DEV_NAME_LEN];
00040 
00041 #define CISTPL_NULL     0x00
00042 #define CISTPL_DEVICE       0x01
00043 #define CISTPL_LONGLINK_CB  0x02
00044 #define CISTPL_INDIRECT     0x03
00045 #define CISTPL_CONFIG_CB    0x04
00046 #define CISTPL_CFTABLE_ENTRY_CB 0x05
00047 #define CISTPL_LONGLINK_MFC 0x06
00048 #define CISTPL_BAR      0x07
00049 #define CISTPL_PWR_MGMNT    0x08
00050 #define CISTPL_EXTDEVICE    0x09
00051 #define CISTPL_CHECKSUM     0x10
00052 #define CISTPL_LONGLINK_A   0x11
00053 #define CISTPL_LONGLINK_C   0x12
00054 #define CISTPL_LINKTARGET   0x13
00055 #define CISTPL_NO_LINK      0x14
00056 #define CISTPL_VERS_1       0x15
00057 #define CISTPL_ALTSTR       0x16
00058 #define CISTPL_DEVICE_A     0x17
00059 #define CISTPL_JEDEC_C      0x18
00060 #define CISTPL_JEDEC_A      0x19
00061 #define CISTPL_CONFIG       0x1a
00062 #define CISTPL_CFTABLE_ENTRY    0x1b
00063 #define CISTPL_DEVICE_OC    0x1c
00064 #define CISTPL_DEVICE_OA    0x1d
00065 #define CISTPL_DEVICE_GEO   0x1e
00066 #define CISTPL_DEVICE_GEO_A 0x1f
00067 #define CISTPL_MANFID       0x20
00068 #define CISTPL_FUNCID       0x21
00069 #define CISTPL_FUNCE        0x22
00070 #define CISTPL_SWIL     0x23
00071 #define CISTPL_END      0xff
00072 /* Layer 2 tuples */
00073 #define CISTPL_VERS_2       0x40
00074 #define CISTPL_FORMAT       0x41
00075 #define CISTPL_GEOMETRY     0x42
00076 #define CISTPL_BYTEORDER    0x43
00077 #define CISTPL_DATE     0x44
00078 #define CISTPL_BATTERY      0x45
00079 #define CISTPL_FORMAT_A     0x47
00080 /* Layer 3 tuples */
00081 #define CISTPL_ORG      0x46
00082 #define CISTPL_SPCL     0x90
00083 
00084 typedef struct cistpl_longlink_t {
00085     u_int   addr;
00086 } cistpl_longlink_t;
00087 
00088 typedef struct cistpl_checksum_t {
00089     u_short addr;
00090     u_short len;
00091     u_char  sum;
00092 } cistpl_checksum_t;
00093 
00094 #define CISTPL_MAX_FUNCTIONS    8
00095 #define CISTPL_MFC_ATTR     0x00
00096 #define CISTPL_MFC_COMMON   0x01
00097 
00098 typedef struct cistpl_longlink_mfc_t {
00099     u_char  nfn;
00100     struct {
00101     u_char  space;
00102     u_int   addr;
00103     } fn[CISTPL_MAX_FUNCTIONS];
00104 } cistpl_longlink_mfc_t;
00105 
00106 #define CISTPL_MAX_ALTSTR_STRINGS   4
00107 
00108 typedef struct cistpl_altstr_t {
00109     u_char  ns;
00110     u_char  ofs[CISTPL_MAX_ALTSTR_STRINGS];
00111     char    str[254];
00112 } cistpl_altstr_t;
00113 
00114 #define CISTPL_DTYPE_NULL   0x00
00115 #define CISTPL_DTYPE_ROM    0x01
00116 #define CISTPL_DTYPE_OTPROM 0x02
00117 #define CISTPL_DTYPE_EPROM  0x03
00118 #define CISTPL_DTYPE_EEPROM 0x04
00119 #define CISTPL_DTYPE_FLASH  0x05
00120 #define CISTPL_DTYPE_SRAM   0x06
00121 #define CISTPL_DTYPE_DRAM   0x07
00122 #define CISTPL_DTYPE_FUNCSPEC   0x0d
00123 #define CISTPL_DTYPE_EXTEND 0x0e
00124 
00125 #define CISTPL_MAX_DEVICES  4
00126 
00127 typedef struct cistpl_device_t {
00128     u_char  ndev;
00129     struct {
00130     u_char  type;
00131     u_char  wp;
00132     u_int   speed;
00133     u_int   size;
00134     } dev[CISTPL_MAX_DEVICES];
00135 } cistpl_device_t;
00136 
00137 #define CISTPL_DEVICE_MWAIT 0x01
00138 #define CISTPL_DEVICE_3VCC  0x02
00139 
00140 typedef struct cistpl_device_o_t {
00141     u_char      flags;
00142     cistpl_device_t device;
00143 } cistpl_device_o_t;
00144 
00145 #define CISTPL_VERS_1_MAX_PROD_STRINGS  4
00146 
00147 typedef struct cistpl_vers_1_t {
00148     u_char  major;
00149     u_char  minor;
00150     u_char  ns;
00151     u_char  ofs[CISTPL_VERS_1_MAX_PROD_STRINGS];
00152     char    str[254];
00153 } cistpl_vers_1_t;
00154 
00155 typedef struct cistpl_jedec_t {
00156     u_char  nid;
00157     struct {
00158     u_char  mfr;
00159     u_char  info;
00160     } id[CISTPL_MAX_DEVICES];
00161 } cistpl_jedec_t;
00162 
00163 typedef struct cistpl_manfid_t {
00164     u_short manf;
00165     u_short card;
00166 } cistpl_manfid_t;
00167 
00168 #define CISTPL_FUNCID_MULTI 0x00
00169 #define CISTPL_FUNCID_MEMORY    0x01
00170 #define CISTPL_FUNCID_SERIAL    0x02
00171 #define CISTPL_FUNCID_PARALLEL  0x03
00172 #define CISTPL_FUNCID_FIXED 0x04
00173 #define CISTPL_FUNCID_VIDEO 0x05
00174 #define CISTPL_FUNCID_NETWORK   0x06
00175 #define CISTPL_FUNCID_AIMS  0x07
00176 #define CISTPL_FUNCID_SCSI  0x08
00177 
00178 #define CISTPL_SYSINIT_POST 0x01
00179 #define CISTPL_SYSINIT_ROM  0x02
00180 
00181 typedef struct cistpl_funcid_t {
00182     u_char  func;
00183     u_char  sysinit;
00184 } cistpl_funcid_t;
00185 
00186 typedef struct cistpl_funce_t {
00187     u_char  type;
00188     u_char  data[0];
00189 } cistpl_funce_t;
00190 
00191 /*======================================================================
00192 
00193     Modem Function Extension Tuples
00194 
00195 ======================================================================*/
00196 
00197 #define CISTPL_FUNCE_SERIAL_IF      0x00
00198 #define CISTPL_FUNCE_SERIAL_CAP     0x01
00199 #define CISTPL_FUNCE_SERIAL_SERV_DATA   0x02
00200 #define CISTPL_FUNCE_SERIAL_SERV_FAX    0x03
00201 #define CISTPL_FUNCE_SERIAL_SERV_VOICE  0x04
00202 #define CISTPL_FUNCE_SERIAL_CAP_DATA    0x05
00203 #define CISTPL_FUNCE_SERIAL_CAP_FAX 0x06
00204 #define CISTPL_FUNCE_SERIAL_CAP_VOICE   0x07
00205 #define CISTPL_FUNCE_SERIAL_IF_DATA 0x08
00206 #define CISTPL_FUNCE_SERIAL_IF_FAX  0x09
00207 #define CISTPL_FUNCE_SERIAL_IF_VOICE    0x0a
00208 
00209 /* UART identification */
00210 #define CISTPL_SERIAL_UART_8250     0x00
00211 #define CISTPL_SERIAL_UART_16450    0x01
00212 #define CISTPL_SERIAL_UART_16550    0x02
00213 #define CISTPL_SERIAL_UART_8251     0x03
00214 #define CISTPL_SERIAL_UART_8530     0x04
00215 #define CISTPL_SERIAL_UART_85230    0x05
00216 
00217 /* UART capabilities */
00218 #define CISTPL_SERIAL_UART_SPACE    0x01
00219 #define CISTPL_SERIAL_UART_MARK     0x02
00220 #define CISTPL_SERIAL_UART_ODD      0x04
00221 #define CISTPL_SERIAL_UART_EVEN     0x08
00222 #define CISTPL_SERIAL_UART_5BIT     0x01
00223 #define CISTPL_SERIAL_UART_6BIT     0x02
00224 #define CISTPL_SERIAL_UART_7BIT     0x04
00225 #define CISTPL_SERIAL_UART_8BIT     0x08
00226 #define CISTPL_SERIAL_UART_1STOP    0x10
00227 #define CISTPL_SERIAL_UART_MSTOP    0x20
00228 #define CISTPL_SERIAL_UART_2STOP    0x40
00229 
00230 typedef struct cistpl_serial_t {
00231     u_char  uart_type;
00232     u_char  uart_cap_0;
00233     u_char  uart_cap_1;
00234 } cistpl_serial_t;
00235 
00236 typedef struct cistpl_modem_cap_t {
00237     u_char  flow;
00238     u_char  cmd_buf;
00239     u_char  rcv_buf_0, rcv_buf_1, rcv_buf_2;
00240     u_char  xmit_buf_0, xmit_buf_1, xmit_buf_2;
00241 } cistpl_modem_cap_t;
00242 
00243 #define CISTPL_SERIAL_MOD_103       0x01
00244 #define CISTPL_SERIAL_MOD_V21       0x02
00245 #define CISTPL_SERIAL_MOD_V23       0x04
00246 #define CISTPL_SERIAL_MOD_V22       0x08
00247 #define CISTPL_SERIAL_MOD_212A      0x10
00248 #define CISTPL_SERIAL_MOD_V22BIS    0x20
00249 #define CISTPL_SERIAL_MOD_V26       0x40
00250 #define CISTPL_SERIAL_MOD_V26BIS    0x80
00251 #define CISTPL_SERIAL_MOD_V27BIS    0x01
00252 #define CISTPL_SERIAL_MOD_V29       0x02
00253 #define CISTPL_SERIAL_MOD_V32       0x04
00254 #define CISTPL_SERIAL_MOD_V32BIS    0x08
00255 #define CISTPL_SERIAL_MOD_V34       0x10
00256 
00257 #define CISTPL_SERIAL_ERR_MNP2_4    0x01
00258 #define CISTPL_SERIAL_ERR_V42_LAPM  0x02
00259 
00260 #define CISTPL_SERIAL_CMPR_V42BIS   0x01
00261 #define CISTPL_SERIAL_CMPR_MNP5     0x02
00262 
00263 #define CISTPL_SERIAL_CMD_AT1       0x01
00264 #define CISTPL_SERIAL_CMD_AT2       0x02
00265 #define CISTPL_SERIAL_CMD_AT3       0x04
00266 #define CISTPL_SERIAL_CMD_MNP_AT    0x08
00267 #define CISTPL_SERIAL_CMD_V25BIS    0x10
00268 #define CISTPL_SERIAL_CMD_V25A      0x20
00269 #define CISTPL_SERIAL_CMD_DMCL      0x40
00270 
00271 typedef struct cistpl_data_serv_t {
00272     u_char  max_data_0;
00273     u_char  max_data_1;
00274     u_char  modulation_0;
00275     u_char  modulation_1;
00276     u_char  error_control;
00277     u_char  compression;
00278     u_char  cmd_protocol;
00279     u_char  escape;
00280     u_char  encrypt;
00281     u_char  misc_features;
00282     u_char  ccitt_code[0];
00283 } cistpl_data_serv_t;
00284 
00285 typedef struct cistpl_fax_serv_t {
00286     u_char  max_data_0;
00287     u_char  max_data_1;
00288     u_char  modulation;
00289     u_char  encrypt;
00290     u_char  features_0;
00291     u_char  features_1;
00292     u_char  ccitt_code[0];
00293 } cistpl_fax_serv_t;
00294 
00295 typedef struct cistpl_voice_serv_t {
00296     u_char  max_data_0;
00297     u_char  max_data_1;
00298 } cistpl_voice_serv_t;
00299 
00300 /*======================================================================
00301 
00302     LAN Function Extension Tuples
00303 
00304 ======================================================================*/
00305 
00306 #define CISTPL_FUNCE_LAN_TECH       0x01
00307 #define CISTPL_FUNCE_LAN_SPEED      0x02
00308 #define CISTPL_FUNCE_LAN_MEDIA      0x03
00309 #define CISTPL_FUNCE_LAN_NODE_ID    0x04
00310 #define CISTPL_FUNCE_LAN_CONNECTOR  0x05
00311 
00312 /* LAN technologies */
00313 #define CISTPL_LAN_TECH_ARCNET      0x01
00314 #define CISTPL_LAN_TECH_ETHERNET    0x02
00315 #define CISTPL_LAN_TECH_TOKENRING   0x03
00316 #define CISTPL_LAN_TECH_LOCALTALK   0x04
00317 #define CISTPL_LAN_TECH_FDDI        0x05
00318 #define CISTPL_LAN_TECH_ATM     0x06
00319 #define CISTPL_LAN_TECH_WIRELESS    0x07
00320 
00321 typedef struct cistpl_lan_tech_t {
00322     u_char  tech;
00323 } cistpl_lan_tech_t;
00324 
00325 typedef struct cistpl_lan_speed_t {
00326     u_int   speed;
00327 } cistpl_lan_speed_t;
00328 
00329 /* LAN media definitions */
00330 #define CISTPL_LAN_MEDIA_UTP        0x01
00331 #define CISTPL_LAN_MEDIA_STP        0x02
00332 #define CISTPL_LAN_MEDIA_THIN_COAX  0x03
00333 #define CISTPL_LAN_MEDIA_THICK_COAX 0x04
00334 #define CISTPL_LAN_MEDIA_FIBER      0x05
00335 #define CISTPL_LAN_MEDIA_900MHZ     0x06
00336 #define CISTPL_LAN_MEDIA_2GHZ       0x07
00337 #define CISTPL_LAN_MEDIA_5GHZ       0x08
00338 #define CISTPL_LAN_MEDIA_DIFF_IR    0x09
00339 #define CISTPL_LAN_MEDIA_PTP_IR     0x0a
00340 
00341 typedef struct cistpl_lan_media_t {
00342     u_char  media;
00343 } cistpl_lan_media_t;
00344 
00345 typedef struct cistpl_lan_node_id_t {
00346     u_char  nb;
00347     u_char  id[16];
00348 } cistpl_lan_node_id_t;
00349 
00350 typedef struct cistpl_lan_connector_t {
00351     u_char  code;
00352 } cistpl_lan_connector_t;
00353 
00354 /*======================================================================
00355 
00356     IDE Function Extension Tuples
00357 
00358 ======================================================================*/
00359 
00360 #define CISTPL_IDE_INTERFACE        0x01
00361 
00362 typedef struct cistpl_ide_interface_t {
00363     u_char  interface;
00364 } cistpl_ide_interface_t;
00365 
00366 /* First feature byte */
00367 #define CISTPL_IDE_SILICON      0x04
00368 #define CISTPL_IDE_UNIQUE       0x08
00369 #define CISTPL_IDE_DUAL         0x10
00370 
00371 /* Second feature byte */
00372 #define CISTPL_IDE_HAS_SLEEP        0x01
00373 #define CISTPL_IDE_HAS_STANDBY      0x02
00374 #define CISTPL_IDE_HAS_IDLE     0x04
00375 #define CISTPL_IDE_LOW_POWER        0x08
00376 #define CISTPL_IDE_REG_INHIBIT      0x10
00377 #define CISTPL_IDE_HAS_INDEX        0x20
00378 #define CISTPL_IDE_IOIS16       0x40
00379 
00380 typedef struct cistpl_ide_feature_t {
00381     u_char  feature1;
00382     u_char  feature2;
00383 } cistpl_ide_feature_t;
00384 
00385 #define CISTPL_FUNCE_IDE_IFACE      0x01
00386 #define CISTPL_FUNCE_IDE_MASTER     0x02
00387 #define CISTPL_FUNCE_IDE_SLAVE      0x03
00388 
00389 /*======================================================================
00390 
00391     Configuration Table Entries
00392 
00393 ======================================================================*/
00394 
00395 #define CISTPL_BAR_SPACE    0x07
00396 #define CISTPL_BAR_SPACE_IO 0x10
00397 #define CISTPL_BAR_PREFETCH 0x20
00398 #define CISTPL_BAR_CACHEABLE    0x40
00399 #define CISTPL_BAR_1MEG_MAP 0x80
00400 
00401 typedef struct cistpl_bar_t {
00402     u_char  attr;
00403     u_int   size;
00404 } cistpl_bar_t;
00405 
00406 typedef struct cistpl_config_t {
00407     u_char  last_idx;
00408     u_int   base;
00409     u_int   rmask[4];
00410     u_char  subtuples;
00411 } cistpl_config_t;
00412 
00413 /* These are bits in the 'present' field, and indices in 'param' */
00414 #define CISTPL_POWER_VNOM   0
00415 #define CISTPL_POWER_VMIN   1
00416 #define CISTPL_POWER_VMAX   2
00417 #define CISTPL_POWER_ISTATIC    3
00418 #define CISTPL_POWER_IAVG   4
00419 #define CISTPL_POWER_IPEAK  5
00420 #define CISTPL_POWER_IDOWN  6
00421 
00422 #define CISTPL_POWER_HIGHZ_OK   0x01
00423 #define CISTPL_POWER_HIGHZ_REQ  0x02
00424 
00425 typedef struct cistpl_power_t {
00426     u_char  present;
00427     u_char  flags;
00428     u_int   param[7];
00429 } cistpl_power_t;
00430 
00431 typedef struct cistpl_timing_t {
00432     u_int   wait, waitscale;
00433     u_int   ready, rdyscale;
00434     u_int   reserved, rsvscale;
00435 } cistpl_timing_t;
00436 
00437 #define CISTPL_IO_LINES_MASK    0x1f
00438 #define CISTPL_IO_8BIT      0x20
00439 #define CISTPL_IO_16BIT     0x40
00440 #define CISTPL_IO_RANGE     0x80
00441 
00442 #define CISTPL_IO_MAX_WIN   16
00443 
00444 typedef struct cistpl_io_t {
00445     u_char  flags;
00446     u_char  nwin;
00447     struct {
00448     u_int   base;
00449     u_int   len;
00450     } win[CISTPL_IO_MAX_WIN];
00451 } cistpl_io_t;
00452 
00453 typedef struct cistpl_irq_t {
00454     u_int   IRQInfo1;
00455     u_int   IRQInfo2;
00456 } cistpl_irq_t;
00457 
00458 #define CISTPL_MEM_MAX_WIN  8
00459 
00460 typedef struct cistpl_mem_t {
00461     u_char  flags;
00462     u_char  nwin;
00463     struct {
00464     u_int   len;
00465     u_int   card_addr;
00466     u_int   host_addr;
00467     } win[CISTPL_MEM_MAX_WIN];
00468 } cistpl_mem_t;
00469 
00470 #define CISTPL_CFTABLE_DEFAULT      0x0001
00471 #define CISTPL_CFTABLE_BVDS     0x0002
00472 #define CISTPL_CFTABLE_WP       0x0004
00473 #define CISTPL_CFTABLE_RDYBSY       0x0008
00474 #define CISTPL_CFTABLE_MWAIT        0x0010
00475 #define CISTPL_CFTABLE_AUDIO        0x0800
00476 #define CISTPL_CFTABLE_READONLY     0x1000
00477 #define CISTPL_CFTABLE_PWRDOWN      0x2000
00478 
00479 typedef struct cistpl_cftable_entry_t {
00480     u_char      index;
00481     u_short     flags;
00482     u_char      interface;
00483     cistpl_power_t  vcc, vpp1, vpp2;
00484     cistpl_timing_t timing;
00485     cistpl_io_t     io;
00486     cistpl_irq_t    irq;
00487     cistpl_mem_t    mem;
00488     u_char      subtuples;
00489 } cistpl_cftable_entry_t;
00490 
00491 #define CISTPL_CFTABLE_MASTER       0x000100
00492 #define CISTPL_CFTABLE_INVALIDATE   0x000200
00493 #define CISTPL_CFTABLE_VGA_PALETTE  0x000400
00494 #define CISTPL_CFTABLE_PARITY       0x000800
00495 #define CISTPL_CFTABLE_WAIT     0x001000
00496 #define CISTPL_CFTABLE_SERR     0x002000
00497 #define CISTPL_CFTABLE_FAST_BACK    0x004000
00498 #define CISTPL_CFTABLE_BINARY_AUDIO 0x010000
00499 #define CISTPL_CFTABLE_PWM_AUDIO    0x020000
00500 
00501 typedef struct cistpl_cftable_entry_cb_t {
00502     u_char      index;
00503     u_int       flags;
00504     cistpl_power_t  vcc, vpp1, vpp2;
00505     u_char      io;
00506     cistpl_irq_t    irq;
00507     u_char      mem;
00508     u_char      subtuples;
00509 } cistpl_cftable_entry_cb_t;
00510 
00511 typedef struct cistpl_device_geo_t {
00512     u_char      ngeo;
00513     struct {
00514     u_char      buswidth;
00515     u_int       erase_block;
00516     u_int       read_block;
00517     u_int       write_block;
00518     u_int       partition;
00519     u_int       interleave;
00520     } geo[CISTPL_MAX_DEVICES];
00521 } cistpl_device_geo_t;
00522 
00523 typedef struct cistpl_vers_2_t {
00524     u_char  vers;
00525     u_char  comply;
00526     u_short dindex;
00527     u_char  vspec8, vspec9;
00528     u_char  nhdr;
00529     u_char  vendor, info;
00530     char    str[244];
00531 } cistpl_vers_2_t;
00532 
00533 typedef struct cistpl_org_t {
00534     u_char  data_org;
00535     char    desc[30];
00536 } cistpl_org_t;
00537 
00538 #define CISTPL_ORG_FS       0x00
00539 #define CISTPL_ORG_APPSPEC  0x01
00540 #define CISTPL_ORG_XIP      0x02
00541 
00542 typedef struct cistpl_format_t {
00543     u_char  type;
00544     u_char  edc;
00545     u_int   offset;
00546     u_int   length;
00547 } cistpl_format_t;
00548 
00549 #define CISTPL_FORMAT_DISK  0x00
00550 #define CISTPL_FORMAT_MEM   0x01
00551 
00552 #define CISTPL_EDC_NONE     0x00
00553 #define CISTPL_EDC_CKSUM    0x01
00554 #define CISTPL_EDC_CRC      0x02
00555 #define CISTPL_EDC_PCC      0x03
00556 
00557 typedef union cisparse_t {
00558     cistpl_device_t     device;
00559     cistpl_checksum_t       checksum;
00560     cistpl_longlink_t       longlink;
00561     cistpl_longlink_mfc_t   longlink_mfc;
00562     cistpl_vers_1_t     version_1;
00563     cistpl_altstr_t     altstr;
00564     cistpl_jedec_t      jedec;
00565     cistpl_manfid_t     manfid;
00566     cistpl_funcid_t     funcid;
00567     cistpl_funce_t      funce;
00568     cistpl_bar_t        bar;
00569     cistpl_config_t     config;
00570     cistpl_cftable_entry_t  cftable_entry;
00571     cistpl_cftable_entry_cb_t   cftable_entry_cb;
00572     cistpl_device_geo_t     device_geo;
00573     cistpl_vers_2_t     vers_2;
00574     cistpl_org_t        org;
00575     cistpl_format_t     format;
00576 } cisparse_t;
00577 
00578 typedef struct tuple_t {
00579     u_int   Attributes;
00580     cisdata_t   DesiredTuple;
00581     u_int   Flags;      /* internal use */
00582     u_int   LinkOffset; /* internal use */
00583     u_int   CISOffset;  /* internal use */
00584     cisdata_t   TupleCode;
00585     cisdata_t   TupleLink;
00586     cisdata_t   TupleOffset;
00587     cisdata_t   TupleDataMax;
00588     cisdata_t   TupleDataLen;
00589     cisdata_t   *TupleData;
00590 } tuple_t;
00591 
00592 /* Special cisdata_t value */
00593 #define RETURN_FIRST_TUPLE  0xff
00594 
00595 /* Attributes for tuple calls */
00596 #define TUPLE_RETURN_LINK   0x01
00597 #define TUPLE_RETURN_COMMON 0x02
00598 
00599 /* For ValidateCIS */
00600 typedef struct cisinfo_t {
00601     u_int   Chains;
00602 } cisinfo_t;
00603 
00604 #define CISTPL_MAX_CIS_SIZE 0x200
00605 
00606 /* For ReplaceCIS */
00607 typedef struct cisdump_t {
00608     u_int   Length;
00609     cisdata_t   Data[CISTPL_MAX_CIS_SIZE];
00610 } cisdump_t;
00611 
00612 #endif /* LINUX_CISTPL_H */
00613 
00614 /* For AccessConfigurationRegister */
00615 typedef struct conf_reg_t {
00616     u_char  Function;
00617     u_int   Action;
00618     off_t   Offset;
00619     u_int   Value;
00620 } conf_reg_t;
00621 
00622 /* Actions */
00623 #define CS_READ     1
00624 #define CS_WRITE    2
00625 
00626 /* for AdjustResourceInfo */
00627 typedef struct adjust_t {
00628     u_int   Action;
00629     u_int   Resource;
00630     u_int   Attributes;
00631     union {
00632     struct memory {
00633         u_long  Base;
00634         u_long  Size;
00635     } memory;
00636     struct io {
00637         ioaddr_t    BasePort;
00638         ioaddr_t    NumPorts;
00639         u_int   IOAddrLines;
00640     } io;
00641     struct irq {
00642         u_int   IRQ;
00643     } irq;
00644     } resource;
00645 } adjust_t;
00646 
00647 /* Action field */
00648 #define REMOVE_MANAGED_RESOURCE     1
00649 #define ADD_MANAGED_RESOURCE        2
00650 #define GET_FIRST_MANAGED_RESOURCE  3
00651 #define GET_NEXT_MANAGED_RESOURCE   4
00652 /* Resource field */
00653 #define RES_MEMORY_RANGE        1
00654 #define RES_IO_RANGE            2
00655 #define RES_IRQ             3
00656 /* Attribute field */
00657 #define RES_IRQ_TYPE            0x03
00658 #define RES_IRQ_TYPE_EXCLUSIVE      0
00659 #define RES_IRQ_TYPE_TIME       1
00660 #define RES_IRQ_TYPE_DYNAMIC        2
00661 #define RES_IRQ_CSC         0x04
00662 #define RES_SHARED          0x08
00663 #define RES_RESERVED            0x10
00664 #define RES_ALLOCATED           0x20
00665 #define RES_REMOVED         0x40
00666 
00667 typedef struct servinfo_t {
00668     char    Signature[2];
00669     u_int   Count;
00670     u_int   Revision;
00671     u_int   CSLevel;
00672     char    *VendorString;
00673 } servinfo_t;
00674 
00675 typedef struct event_callback_args_t {
00676     client_handle_t client_handle;
00677     void    *info;
00678     void    *mtdrequest;
00679     void    *buffer;
00680     void    *misc;
00681     void    *client_data;
00682     struct bus_operations *bus;
00683 } event_callback_args_t;
00684 
00685 /* for GetConfigurationInfo */
00686 typedef struct config_info_t {
00687     u_char  Function;
00688     u_int   Attributes;
00689     u_int   Vcc, Vpp1, Vpp2;
00690     u_int   IntType;
00691     u_int   ConfigBase;
00692     u_char  Status, Pin, Copy, Option, ExtStatus;
00693     u_int   Present;
00694     u_int   CardValues;
00695     u_int   AssignedIRQ;
00696     u_int   IRQAttributes;
00697     ioaddr_t    BasePort1;
00698     ioaddr_t    NumPorts1;
00699     u_int   Attributes1;
00700     ioaddr_t    BasePort2;
00701     ioaddr_t    NumPorts2;
00702     u_int   Attributes2;
00703     u_int   IOAddrLines;
00704 } config_info_t;
00705 
00706 /* For CardValues field */
00707 #define CV_OPTION_VALUE     0x01
00708 #define CV_STATUS_VALUE     0x02
00709 #define CV_PIN_REPLACEMENT  0x04
00710 #define CV_COPY_VALUE       0x08
00711 #define CV_EXT_STATUS       0x10
00712 
00713 /* For GetFirst/NextClient */
00714 typedef struct client_req_t {
00715     socket_t    Socket;
00716     u_int   Attributes;
00717 } client_req_t;
00718 
00719 #define CLIENT_THIS_SOCKET  0x01
00720 
00721 /* For RegisterClient */
00722 typedef struct client_reg_t {
00723     dev_info_t  *dev_info;
00724     u_int   Attributes;
00725     u_int   EventMask;
00726     int     (*event_handler)(event_t event, int priority,
00727                  event_callback_args_t *);
00728     event_callback_args_t event_callback_args;
00729     u_int   Version;
00730 } client_reg_t;
00731 
00732 /* ModifyConfiguration */
00733 typedef struct modconf_t {
00734     u_int   Attributes;
00735     u_int   Vcc, Vpp1, Vpp2;
00736 } modconf_t;
00737 
00738 /* Attributes for ModifyConfiguration */
00739 #define CONF_IRQ_CHANGE_VALID   0x100
00740 #define CONF_VCC_CHANGE_VALID   0x200
00741 #define CONF_VPP1_CHANGE_VALID  0x400
00742 #define CONF_VPP2_CHANGE_VALID  0x800
00743 
00744 /* For RequestConfiguration */
00745 typedef struct config_req_t {
00746     u_int   Attributes;
00747     u_int   Vcc, Vpp1, Vpp2;
00748     u_int   IntType;
00749     u_int   ConfigBase;
00750     u_char  Status, Pin, Copy, ExtStatus;
00751     u_char  ConfigIndex;
00752     u_int   Present;
00753 } config_req_t;
00754 
00755 /* Attributes for RequestConfiguration */
00756 #define CONF_ENABLE_IRQ     0x01
00757 #define CONF_ENABLE_DMA     0x02
00758 #define CONF_ENABLE_SPKR    0x04
00759 #define CONF_VALID_CLIENT   0x100
00760 
00761 /* IntType field */
00762 #define INT_MEMORY      0x01
00763 #define INT_MEMORY_AND_IO   0x02
00764 #define INT_CARDBUS     0x04
00765 #define INT_ZOOMED_VIDEO    0x08
00766 
00767 /* For RequestIO and ReleaseIO */
00768 typedef struct io_req_t {
00769     ioaddr_t    BasePort1;
00770     ioaddr_t    NumPorts1;
00771     u_int   Attributes1;
00772     ioaddr_t    BasePort2;
00773     ioaddr_t    NumPorts2;
00774     u_int   Attributes2;
00775     u_int   IOAddrLines;
00776 } io_req_t;
00777 
00778 /* Attributes for RequestIO and ReleaseIO */
00779 #define IO_SHARED       0x01
00780 #define IO_FIRST_SHARED     0x02
00781 #define IO_FORCE_ALIAS_ACCESS   0x04
00782 #define IO_DATA_PATH_WIDTH  0x18
00783 #define IO_DATA_PATH_WIDTH_8    0x00
00784 #define IO_DATA_PATH_WIDTH_16   0x08
00785 #define IO_DATA_PATH_WIDTH_AUTO 0x10
00786 
00787 /* For RequestIRQ and ReleaseIRQ */
00788 typedef struct irq_req_t {
00789     u_int   Attributes;
00790     u_int   AssignedIRQ;
00791     u_int   IRQInfo1, IRQInfo2;
00792     void    *Handler;
00793     void    *Instance;
00794 } irq_req_t;
00795 
00796 /* Attributes for RequestIRQ and ReleaseIRQ */
00797 #define IRQ_TYPE            0x03
00798 #define IRQ_TYPE_EXCLUSIVE      0x00
00799 #define IRQ_TYPE_TIME           0x01
00800 #define IRQ_TYPE_DYNAMIC_SHARING    0x02
00801 #define IRQ_FORCED_PULSE        0x04
00802 #define IRQ_FIRST_SHARED        0x08
00803 #define IRQ_HANDLE_PRESENT      0x10
00804 #define IRQ_PULSE_ALLOCATED     0x100
00805 
00806 /* Bits in IRQInfo1 field */
00807 #define IRQ_MASK        0x0f
00808 #define IRQ_NMI_ID      0x01
00809 #define IRQ_IOCK_ID     0x02
00810 #define IRQ_BERR_ID     0x04
00811 #define IRQ_VEND_ID     0x08
00812 #define IRQ_INFO2_VALID     0x10
00813 #define IRQ_LEVEL_ID        0x20
00814 #define IRQ_PULSE_ID        0x40
00815 #define IRQ_SHARE_ID        0x80
00816 
00817 typedef struct eventmask_t {
00818     u_int   Attributes;
00819     u_int   EventMask;
00820 } eventmask_t;
00821 
00822 #define CONF_EVENT_MASK_VALID   0x01
00823 
00824 /* Configuration registers present */
00825 #define PRESENT_OPTION      0x001
00826 #define PRESENT_STATUS      0x002
00827 #define PRESENT_PIN_REPLACE 0x004
00828 #define PRESENT_COPY        0x008
00829 #define PRESENT_EXT_STATUS  0x010
00830 #define PRESENT_IOBASE_0    0x020
00831 #define PRESENT_IOBASE_1    0x040
00832 #define PRESENT_IOBASE_2    0x080
00833 #define PRESENT_IOBASE_3    0x100
00834 #define PRESENT_IOSIZE      0x200
00835 
00836 /* For GetMemPage, MapMemPage */
00837 typedef struct memreq_t {
00838     u_int   CardOffset;
00839     page_t  Page;
00840 } memreq_t;
00841 
00842 /* For ModifyWindow */
00843 typedef struct modwin_t {
00844     u_int   Attributes;
00845     u_int   AccessSpeed;
00846 } modwin_t;
00847 
00848 /* For RequestWindow */
00849 typedef struct win_req_t {
00850     u_int   Attributes;
00851     u_long  Base;
00852     u_int   Size;
00853     u_int   AccessSpeed;
00854 } win_req_t;
00855 
00856 /* Attributes for RequestWindow */
00857 #define WIN_ADDR_SPACE      0x0001
00858 #define WIN_ADDR_SPACE_MEM  0x0000
00859 #define WIN_ADDR_SPACE_IO   0x0001
00860 #define WIN_MEMORY_TYPE     0x0002
00861 #define WIN_MEMORY_TYPE_CM  0x0000
00862 #define WIN_MEMORY_TYPE_AM  0x0002
00863 #define WIN_ENABLE      0x0004
00864 #define WIN_DATA_WIDTH      0x0018
00865 #define WIN_DATA_WIDTH_8    0x0000
00866 #define WIN_DATA_WIDTH_16   0x0008
00867 #define WIN_DATA_WIDTH_32   0x0010
00868 #define WIN_PAGED       0x0020
00869 #define WIN_SHARED      0x0040
00870 #define WIN_FIRST_SHARED    0x0080
00871 #define WIN_USE_WAIT        0x0100
00872 #define WIN_STRICT_ALIGN    0x0200
00873 #define WIN_MAP_BELOW_1MB   0x0400
00874 #define WIN_PREFETCH        0x0800
00875 #define WIN_CACHEABLE       0x1000
00876 #define WIN_BAR_MASK        0xe000
00877 #define WIN_BAR_SHIFT       13
00878 
00879 /* Attributes for RegisterClient */
00880 #define INFO_MASTER_CLIENT  0x01
00881 #define INFO_IO_CLIENT      0x02
00882 #define INFO_MTD_CLIENT     0x04
00883 #define INFO_MEM_CLIENT     0x08
00884 #define MAX_NUM_CLIENTS     3
00885 
00886 #define INFO_CARD_SHARE     0x10
00887 #define INFO_CARD_EXCL      0x20
00888 
00889 typedef struct cs_status_t {
00890     u_char  Function;
00891     event_t     CardState;
00892     event_t SocketState;
00893 } cs_status_t;
00894 
00895 typedef struct error_info_t {
00896     int     func;
00897     int     retcode;
00898 } error_info_t;
00899 
00900 /* Special stuff for binding drivers to sockets */
00901 typedef struct bind_req_t {
00902     socket_t    Socket;
00903     u_char  Function;
00904     dev_info_t  *dev_info;
00905 } bind_req_t;
00906 
00907 /* Flag to bind to all functions */
00908 #define BIND_FN_ALL 0xff
00909 
00910 typedef struct mtd_bind_t {
00911     socket_t    Socket;
00912     u_int   Attributes;
00913     u_int   CardOffset;
00914     dev_info_t  *dev_info;
00915 } mtd_bind_t;
00916 
00917 /* For GetFirstRegion and GetNextRegion */
00918 typedef struct region_info_t {
00919     u_int               Attributes;
00920     u_int               CardOffset;
00921     u_int               RegionSize;
00922     u_int               AccessSpeed;
00923     u_int               BlockSize;
00924     u_int               PartMultiple;
00925     u_char              JedecMfr, JedecInfo;
00926     memory_handle_t     next;
00927 } region_info_t;
00928 
00929 #define REGION_TYPE             0x0001
00930 #define REGION_TYPE_CM          0x0000
00931 #define REGION_TYPE_AM          0x0001
00932 #define REGION_PREFETCH         0x0008
00933 #define REGION_CACHEABLE        0x0010
00934 #define REGION_BAR_MASK         0xe000
00935 #define REGION_BAR_SHIFT        13
00936 
00937 /* For OpenMemory */
00938 typedef struct open_mem_t {
00939     u_int               Attributes;
00940     u_int               Offset;
00941 } open_mem_t;
00942 
00943 /* Attributes for OpenMemory */
00944 #define MEMORY_TYPE             0x0001
00945 #define MEMORY_TYPE_CM          0x0000
00946 #define MEMORY_TYPE_AM          0x0001
00947 #define MEMORY_EXCLUSIVE        0x0002
00948 #define MEMORY_PREFETCH         0x0008
00949 #define MEMORY_CACHEABLE        0x0010
00950 #define MEMORY_BAR_MASK         0xe000
00951 #define MEMORY_BAR_SHIFT        13
00952 
00953 typedef struct eraseq_entry_t {
00954     memory_handle_t     Handle;
00955     u_char              State;
00956     u_int               Size;
00957     u_int               Offset;
00958     void                *Optional;
00959 } eraseq_entry_t;
00960 
00961 typedef struct eraseq_hdr_t {
00962     int                 QueueEntryCnt;
00963     eraseq_entry_t      *QueueEntryArray;
00964 } eraseq_hdr_t;
00965 
00966 /* Events */
00967 #define CS_EVENT_PRI_LOW        0
00968 #define CS_EVENT_PRI_HIGH       1
00969 
00970 #define CS_EVENT_WRITE_PROTECT      0x000001
00971 #define CS_EVENT_CARD_LOCK      0x000002
00972 #define CS_EVENT_CARD_INSERTION     0x000004
00973 #define CS_EVENT_CARD_REMOVAL       0x000008
00974 #define CS_EVENT_BATTERY_DEAD       0x000010
00975 #define CS_EVENT_BATTERY_LOW        0x000020
00976 #define CS_EVENT_READY_CHANGE       0x000040
00977 #define CS_EVENT_CARD_DETECT        0x000080
00978 #define CS_EVENT_RESET_REQUEST      0x000100
00979 #define CS_EVENT_RESET_PHYSICAL     0x000200
00980 #define CS_EVENT_CARD_RESET     0x000400
00981 #define CS_EVENT_REGISTRATION_COMPLETE  0x000800
00982 #define CS_EVENT_RESET_COMPLETE     0x001000
00983 #define CS_EVENT_PM_SUSPEND     0x002000
00984 #define CS_EVENT_PM_RESUME      0x004000
00985 #define CS_EVENT_INSERTION_REQUEST  0x008000
00986 #define CS_EVENT_EJECTION_REQUEST   0x010000
00987 #define CS_EVENT_MTD_REQUEST        0x020000
00988 #define CS_EVENT_ERASE_COMPLETE     0x040000
00989 #define CS_EVENT_REQUEST_ATTENTION  0x080000
00990 #define CS_EVENT_CB_DETECT      0x100000
00991 #define CS_EVENT_3VCARD         0x200000
00992 #define CS_EVENT_XVCARD         0x400000
00993 
00994 /* Return codes */
00995 #define CS_SUCCESS      0x00
00996 #define CS_BAD_ADAPTER      0x01
00997 #define CS_BAD_ATTRIBUTE    0x02
00998 #define CS_BAD_BASE     0x03
00999 #define CS_BAD_EDC      0x04
01000 #define CS_BAD_IRQ      0x06
01001 #define CS_BAD_OFFSET       0x07
01002 #define CS_BAD_PAGE     0x08
01003 #define CS_READ_FAILURE     0x09
01004 #define CS_BAD_SIZE     0x0a
01005 #define CS_BAD_SOCKET       0x0b
01006 #define CS_BAD_TYPE     0x0d
01007 #define CS_BAD_VCC      0x0e
01008 #define CS_BAD_VPP      0x0f
01009 #define CS_BAD_WINDOW       0x11
01010 #define CS_WRITE_FAILURE    0x12
01011 #define CS_NO_CARD      0x14
01012 #define CS_UNSUPPORTED_FUNCTION 0x15
01013 #define CS_UNSUPPORTED_MODE 0x16
01014 #define CS_BAD_SPEED        0x17
01015 #define CS_BUSY         0x18
01016 #define CS_GENERAL_FAILURE  0x19
01017 #define CS_WRITE_PROTECTED  0x1a
01018 #define CS_BAD_ARG_LENGTH   0x1b
01019 #define CS_BAD_ARGS     0x1c
01020 #define CS_CONFIGURATION_LOCKED 0x1d
01021 #define CS_IN_USE       0x1e
01022 #define CS_NO_MORE_ITEMS    0x1f
01023 #define CS_OUT_OF_RESOURCE  0x20
01024 #define CS_BAD_HANDLE       0x21
01025 
01026 #define CS_BAD_TUPLE        0x40
01027 
01028 
01029 
01030 typedef struct tuple_parse_t {
01031     tuple_t             tuple;
01032     cisdata_t           data[255];
01033     cisparse_t          parse;
01034 } tuple_parse_t;
01035 
01036 typedef struct win_info_t {
01037     window_handle_t     handle;
01038     win_req_t           window;
01039     memreq_t            map;
01040 } win_info_t;
01041 
01042 typedef struct bind_info_t {
01043     dev_info_t          dev_info;
01044     u_char              function;
01045     struct dev_link_t   *instance;
01046     char                name[DEV_NAME_LEN];
01047     u_short             major, minor;
01048     void                *next;
01049 } bind_info_t;
01050 
01051 typedef struct mtd_info_t {
01052     dev_info_t          dev_info;
01053     u_int               Attributes;
01054     u_int               CardOffset;
01055 } mtd_info_t;
01056 
01057 typedef union ds_ioctl_arg_t {
01058     servinfo_t          servinfo;
01059     adjust_t            adjust;
01060     config_info_t       config;
01061     tuple_t             tuple;
01062     tuple_parse_t       tuple_parse;
01063     client_req_t        client_req;
01064     cs_status_t         status;
01065     conf_reg_t          conf_reg;
01066     cisinfo_t           cisinfo;
01067     region_info_t       region;
01068     bind_info_t         bind_info;
01069     mtd_info_t          mtd_info;
01070     win_info_t          win_info;
01071     cisdump_t           cisdump;
01072 } ds_ioctl_arg_t;
01073 
01074 #define DS_GET_CARD_SERVICES_INFO       _IOR ('d', 1, servinfo_t)
01075 #define DS_ADJUST_RESOURCE_INFO         _IOWR('d', 2, adjust_t)
01076 #define DS_GET_CONFIGURATION_INFO       _IOWR('d', 3, config_info_t)
01077 #define DS_GET_FIRST_TUPLE              _IOWR('d', 4, tuple_t)
01078 #define DS_GET_NEXT_TUPLE               _IOWR('d', 5, tuple_t)
01079 #define DS_GET_TUPLE_DATA               _IOWR('d', 6, tuple_parse_t)
01080 #define DS_PARSE_TUPLE                  _IOWR('d', 7, tuple_parse_t)
01081 #define DS_RESET_CARD                   _IO  ('d', 8)
01082 #define DS_GET_STATUS                   _IOWR('d', 9, cs_status_t)
01083 #define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t)
01084 #define DS_VALIDATE_CIS                 _IOR ('d', 11, cisinfo_t)
01085 #define DS_SUSPEND_CARD                 _IO  ('d', 12)
01086 #define DS_RESUME_CARD                  _IO  ('d', 13)
01087 #define DS_EJECT_CARD                   _IO  ('d', 14)
01088 #define DS_INSERT_CARD                  _IO  ('d', 15)
01089 #define DS_GET_FIRST_REGION             _IOWR('d', 16, region_info_t)
01090 #define DS_GET_NEXT_REGION              _IOWR('d', 17, region_info_t)
01091 #define DS_REPLACE_CIS                  _IOWR('d', 18, cisdump_t)
01092 #define DS_GET_FIRST_WINDOW             _IOR ('d', 19, win_info_t)
01093 #define DS_GET_NEXT_WINDOW              _IOWR('d', 20, win_info_t)
01094 #define DS_GET_MEM_PAGE                 _IOWR('d', 21, win_info_t)
01095 
01096 #define DS_BIND_REQUEST                 _IOWR('d', 60, bind_info_t)
01097 #define DS_GET_DEVICE_INFO              _IOWR('d', 61, bind_info_t)
01098 #define DS_GET_NEXT_DEVICE              _IOWR('d', 62, bind_info_t)
01099 #define DS_UNBIND_REQUEST               _IOW ('d', 63, bind_info_t)
01100 #define DS_BIND_MTD                     _IOWR('d', 64, mtd_info_t)

Generated on Sat Nov 5 16:16:07 2005 for OPIE by  doxygen 1.4.2