1 | // pcmcia.h - Header file for PCMCIA support
|
---|
2 |
|
---|
3 | #ifndef INCLUDE_PCMCIA_H
|
---|
4 | #define INCLUDE_PCMCIA_H 1
|
---|
5 | #include "etherboot.h"
|
---|
6 |
|
---|
7 | typedef unsigned char u_char;
|
---|
8 | typedef unsigned short u_short;
|
---|
9 | typedef unsigned int u_int;
|
---|
10 | typedef unsigned long u_long;
|
---|
11 |
|
---|
12 | typedef u_short ioaddr_t;
|
---|
13 | extern int sockets;
|
---|
14 |
|
---|
15 | #define MAXPCCSOCKS 8
|
---|
16 | #define MAXPCCCONFIGS 8
|
---|
17 |
|
---|
18 | typedef enum ebpdriver_t { I82365, SOMEDRIVER } ebpdriver_t;
|
---|
19 | typedef enum interface_func_t { INIT, SHUTDOWN, MAPATTRMEM, UNMAPATTRMEM, SELECTCONFIG } interface_func_t;
|
---|
20 | typedef enum ebpstatus_t { EMPTY, HASCARD, INITIALIZED, SUSPENDED, OTHERDEVICE, UNKNOWN } ebpstatus_t;
|
---|
21 |
|
---|
22 | struct driver_interact_t {
|
---|
23 | ebpdriver_t id;
|
---|
24 | int (*f)(interface_func_t,int,int,int,int);
|
---|
25 | char *name;
|
---|
26 | };
|
---|
27 | struct pccsock_t {
|
---|
28 | ebpdriver_t device;
|
---|
29 | int drivernum;
|
---|
30 | ebpstatus_t status;
|
---|
31 | // Internal usage of the drivers:
|
---|
32 | int internalid;
|
---|
33 | int flags;
|
---|
34 | int ioaddr;
|
---|
35 | int type;
|
---|
36 | int configoffset;
|
---|
37 | int possibleconfignum;
|
---|
38 | int stringoffset;
|
---|
39 | u_int stringlength;
|
---|
40 | int rmask0;
|
---|
41 | };
|
---|
42 |
|
---|
43 | extern struct pccsock_t pccsock[MAXPCCSOCKS];
|
---|
44 | extern u_int pccsocks;
|
---|
45 |
|
---|
46 | struct pcc_config_t {
|
---|
47 | u_char index;
|
---|
48 | u_char irq;
|
---|
49 | int iowin;
|
---|
50 | int iolen;
|
---|
51 | };
|
---|
52 |
|
---|
53 |
|
---|
54 | int i82365_interfacer(interface_func_t,int,int,int,void *);
|
---|
55 | void sleepticks(int);
|
---|
56 |
|
---|
57 | #define EINVAL 22
|
---|
58 |
|
---|
59 |
|
---|
60 | //*********************************************************** cc.h:
|
---|
61 | /* Definitions for card status flags for GetStatus */
|
---|
62 | #define SS_WRPROT 0x0001
|
---|
63 | #define SS_CARDLOCK 0x0002
|
---|
64 | #define SS_EJECTION 0x0004
|
---|
65 | #define SS_INSERTION 0x0008
|
---|
66 | #define SS_BATDEAD 0x0010
|
---|
67 | #define SS_BATWARN 0x0020
|
---|
68 | #define SS_READY 0x0040
|
---|
69 | #define SS_DETECT 0x0080
|
---|
70 | #define SS_POWERON 0x0100
|
---|
71 | #define SS_GPI 0x0200
|
---|
72 | #define SS_STSCHG 0x0400
|
---|
73 | #define SS_CARDBUS 0x0800
|
---|
74 | #define SS_3VCARD 0x1000
|
---|
75 | #define SS_XVCARD 0x2000
|
---|
76 | #define SS_PENDING 0x4000
|
---|
77 |
|
---|
78 | /* cc.h: for InquireSocket */
|
---|
79 | typedef struct socket_cap_t {
|
---|
80 | u_int features;
|
---|
81 | u_int irq_mask;
|
---|
82 | u_int map_size;
|
---|
83 | ioaddr_t io_offset;
|
---|
84 | u_char pci_irq;
|
---|
85 | //struct pci_dev *cb_dev;
|
---|
86 | //struct bus_operations *bus;
|
---|
87 | void *cb_dev;
|
---|
88 | void *bus;
|
---|
89 | } socket_cap_t;
|
---|
90 | /* InquireSocket capabilities */
|
---|
91 | #define SS_CAP_PAGE_REGS 0x0001
|
---|
92 | #define SS_CAP_VIRTUAL_BUS 0x0002
|
---|
93 | #define SS_CAP_MEM_ALIGN 0x0004
|
---|
94 | #define SS_CAP_STATIC_MAP 0x0008
|
---|
95 | #define SS_CAP_PCCARD 0x4000
|
---|
96 | #define SS_CAP_CARDBUS 0x8000
|
---|
97 |
|
---|
98 | /* for GetSocket, SetSocket */
|
---|
99 | typedef struct socket_state_t {
|
---|
100 | u_int flags;
|
---|
101 | u_int csc_mask;
|
---|
102 | u_char Vcc, Vpp;
|
---|
103 | u_char io_irq;
|
---|
104 | } socket_state_t;
|
---|
105 |
|
---|
106 | extern socket_state_t dead_socket;
|
---|
107 |
|
---|
108 | /* Socket configuration flags */
|
---|
109 | #define SS_PWR_AUTO 0x0010
|
---|
110 | #define SS_IOCARD 0x0020
|
---|
111 | #define SS_RESET 0x0040
|
---|
112 | #define SS_DMA_MODE 0x0080
|
---|
113 | #define SS_SPKR_ENA 0x0100
|
---|
114 | #define SS_OUTPUT_ENA 0x0200
|
---|
115 | #define SS_DEBOUNCED 0x0400 /* Tell driver that the debounce delay has ended */
|
---|
116 | #define SS_ZVCARD 0x0800
|
---|
117 |
|
---|
118 | /* Flags for I/O port and memory windows */
|
---|
119 | #define MAP_ACTIVE 0x01
|
---|
120 | #define MAP_16BIT 0x02
|
---|
121 | #define MAP_AUTOSZ 0x04
|
---|
122 | #define MAP_0WS 0x08
|
---|
123 | #define MAP_WRPROT 0x10
|
---|
124 | #define MAP_ATTRIB 0x20
|
---|
125 | #define MAP_USE_WAIT 0x40
|
---|
126 | #define MAP_PREFETCH 0x80
|
---|
127 |
|
---|
128 | /* Use this just for bridge windows */
|
---|
129 | #define MAP_IOSPACE 0x20
|
---|
130 |
|
---|
131 | typedef struct pccard_io_map {
|
---|
132 | u_char map;
|
---|
133 | u_char flags;
|
---|
134 | u_short speed;
|
---|
135 | ioaddr_t start, stop;
|
---|
136 | } pccard_io_map;
|
---|
137 |
|
---|
138 |
|
---|
139 | typedef struct pccard_mem_map {
|
---|
140 | u_char map;
|
---|
141 | u_char flags;
|
---|
142 | u_short speed;
|
---|
143 | u_long sys_start, sys_stop;
|
---|
144 | u_int card_start;
|
---|
145 | } pccard_mem_map;
|
---|
146 |
|
---|
147 | typedef struct cb_bridge_map {
|
---|
148 | u_char map;
|
---|
149 | u_char flags;
|
---|
150 | u_int start, stop;
|
---|
151 | } cb_bridge_map;
|
---|
152 | // need the global function pointer struct? *TODO*
|
---|
153 | //************************************* end cc.h
|
---|
154 |
|
---|
155 |
|
---|
156 |
|
---|
157 | #endif
|
---|