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