22 #include <asm/byteorder.h>
29 #define BANKLEN 0x01FFU
31 #define LOAD_ZONE_START 0x03f8U
32 #define LOAD_ZONE_END 0x03fdU
34 #define LOAD_RETRY 18000000
41 #define FRAME_HDR_LEN 8
43 #define MSG_CONN_REQ 0x08000100
44 #define MSG_CONN_CONF 0x00000101
45 #define MSG_CONN_IND 0x00000102
46 #define MSG_CONN_RESP 0x08000103
48 #define MSG_CONN_ACTV_REQ 0x08000300
49 #define MSG_CONN_ACTV_CONF 0x00000301
50 #define MSG_CONN_ACTV_IND 0x00000302
51 #define MSG_CONN_ACTV_RESP 0x08000303
53 #define MSG_DISC_REQ 0x08000400
54 #define MSG_DISC_CONF 0x00000401
55 #define MSG_DISC_IND 0x00000402
56 #define MSG_DISC_RESP 0x08000403
58 #define MSG_TDATA_REQ 0x0908E200
59 #define MSG_TDATA_CONF 0x0000E201
60 #define MSG_TDATA_IND 0x0000E202
61 #define MSG_TDATA_RESP 0x0908E203
63 #define MSG_SELP_REQ 0x09004000
64 #define MSG_SELP_CONF 0x00004001
66 #define MSG_ACT_TRANSP_REQ 0x0908E000
67 #define MSG_ACT_TRANSP_CONF 0x0000E001
69 #define MSG_STPROT_REQ 0x09004100
70 #define MSG_STPROT_CONF 0x00004101
72 #define MSG_PING188_REQ 0x09030500
73 #define MSG_PING188_CONF 0x000005bc
75 #define MSG_WATCH188 0x09030400
77 #define MSG_API_ON 0x08020102
78 #define MSG_POOL_PCBIT 0x08020400
79 #define MSG_POOL_PCBIT_CONF 0x00000401
81 #define MSG_INFO_IND 0x00002602
82 #define MSG_INFO_RESP 0x08002603
84 #define MSG_DEBUG_188 0x0000ff00
92 #ifdef __LITTLE_ENDIAN
93 #define SET_MSG_SCMD(msg, ch) (msg = (msg & 0xffffff00) | (((ch) & 0xff)))
94 #define SET_MSG_CMD(msg, ch) (msg = (msg & 0xffff00ff) | (((ch) & 0xff) << 8))
95 #define SET_MSG_PROC(msg, ch) (msg = (msg & 0xff00ffff) | (((ch) & 0xff) << 16))
96 #define SET_MSG_CPU(msg, ch) (msg = (msg & 0x00ffffff) | (((ch) & 0xff) << 24))
98 #define GET_MSG_SCMD(msg) ((msg) & 0xFF)
99 #define GET_MSG_CMD(msg) ((msg) >> 8 & 0xFF)
100 #define GET_MSG_PROC(msg) ((msg) >> 16 & 0xFF)
101 #define GET_MSG_CPU(msg) ((msg) >> 24)
104 #error "Non-Intel CPU"
109 #define SCHED_READ 0x01
110 #define SCHED_WRITE 0x02
112 #define SET_RUN_TIMEOUT 2 * HZ
134 (
ulong) (dev->writeptr - dev->sh_mem));
136 (
ulong) (dev->readptr - (dev->sh_mem +
BANK2)));
138 dev->rcv_seq, dev->send_seq, dev->unack_seq);
142 static __inline__ struct pcbit_dev *chan2dev(
struct pcbit_chan *
chan)
144 struct pcbit_dev *
dev;
150 if (dev->b1 == chan || dev->b2 == chan)
156 static __inline__ struct pcbit_dev *finddev(
int id)
158 struct pcbit_dev *
dev;
173 static __inline__ void pcbit_writeb(
struct pcbit_dev *dev,
unsigned char dt)
175 writeb(dt, dev->writeptr++);
176 if (dev->writeptr == dev->sh_mem +
BANKLEN)
177 dev->writeptr = dev->sh_mem;
180 static __inline__ void pcbit_writew(
struct pcbit_dev *dev,
unsigned short dt)
184 dist =
BANKLEN - (dev->writeptr - dev->sh_mem);
187 writew(dt, dev->writeptr);
188 dev->writeptr = dev->sh_mem;
192 dev->writeptr = dev->sh_mem;
196 writew(dt, dev->writeptr);
207 diff = len - (
BANKLEN - (dev->writeptr - dev->sh_mem));
213 dev->writeptr = dev->sh_mem + diff;
219 dev->writeptr +=
len;
221 dev->writeptr = dev->sh_mem;
225 static __inline__ unsigned char pcbit_readb(
struct pcbit_dev *dev)
229 val =
readb(dev->readptr++);
231 dev->readptr = dev->sh_mem +
BANK2;
236 static __inline__ unsigned short pcbit_readw(
struct pcbit_dev *dev)
241 dist =
BANKLEN - (dev->readptr - (dev->sh_mem +
BANK2));
244 val =
readw(dev->readptr);
245 dev->readptr = dev->sh_mem +
BANK2;
248 val =
readb(dev->readptr);
249 dev->readptr = dev->sh_mem +
BANK2;
250 val = (
readb(dev->readptr++) << 8) | val;
253 val =
readw(dev->readptr);
264 diff = len - (
BANKLEN - (dev->readptr - (dev->sh_mem +
BANK2)));
269 dev->readptr = dev->sh_mem +
BANK2 + diff;
276 dev->readptr = dev->sh_mem +
BANK2;