1#ifndef _DOWNLOAD_H_
2
3#define _DOWNLOAD_H_
4
5typedef	void	VOID ;
6typedef	char	CHAR;
7typedef	unsigned	char	BYTE;
8typedef	unsigned	short	WORD;
9typedef	unsigned	long	DWORD;
10typedef	int	INT;
11//typedef	short	INT;
12typedef	unsigned	int	UINT;
13//typedef	unsigned	short	UINT;
14typedef	long	LONG;
15typedef	unsigned long	ULONG;
16
17//#define _DEBUG_
18#define INTERFACE	"ixp0"
19#define TIMEOUT		4
20#define xchgs(x) (WORD)((((WORD)((WORD)x)&0x0ff)<<8)|(((WORD)((WORD)x)&0x0ff00)>>8))
21#define PACKET_SIZE         512
22
23#define  MIN_PACKET_LENGTH  64
24#define  DL_ACK_LEN 80
25#define PACK
26#define PACKED __attribute__((packed))
27
28typedef struct{
29	BYTE dbDestAddress[6];
30	BYTE dbSrcAddress[6];
31	WORD dwID;
32	WORD dwCmd;
33	WORD dwSeq;
34	WORD dwOff;
35	WORD dwSeg;
36	WORD dwLen;
37	BYTE dbData[512];
38}PACKED DOWNLOADHead;
39
40typedef struct S_HWID {
41#ifdef _BIG_ENDIAN_
42  /*----- Interface --------------------------*/
43  BYTE  fPrn      :2;  /* Printer */
44  BYTE  fMIO      :1;  /* MIO */
45  BYTE  fChinese  :1;  /* Chinese */
46  BYTE  fSCSI     :2;  /* SCSI */
47  BYTE  fPrnIn    :2;  /* Printer port in */
48
49  BYTE  fNetworkNo:4;  /* Number of network */
50  BYTE  fSerialNo :4;  /* Number of serial port */
51
52  /*----- System -----------------------------*/
53  BYTE  fRomType  :1;  /* 0= Fladsh, 1= OTROM */
54  BYTE  fRAM      :3;  /* 000= 32K, 001= 128K, 010= 256K, 011= 1024K */
55  BYTE  fNVRAM    :2;  /* 00= 256B, 01= 512B, 10= 8192B */
56  BYTE  fRsv_2    :2;
57
58  BYTE  fCPU      :3;  /* 000= 188, 001= 186, 010= 386DX */
59
60  BYTE  fSpeed    :2;  /*      188/186   386DX
61                           00   12MHz    16MHz
62                           01   16MHz    25MHz
63                           10   25MHz    33MHz
64                           11   40MHz    40MHz  */
65  BYTE  fRomSize  :3;  /* 000= 64K, 001= 128K, 010= 256K, 011= 512K */
66
67  /*----- Card number ------------------------*/
68  BYTE  bVersion  :4;
69  BYTE  bRsv_1    :4;
70
71  BYTE  fProduct2 :4;
72  BYTE  fDetail   :4;
73
74  BYTE  fProduct0 :4;
75  BYTE  fProduct1 :4;
76#else
77  /*----- Card number ------------------------*/
78  BYTE  fProduct1 :4;
79  BYTE  fProduct0 :4;
80
81  BYTE  fDetail   :4;
82  BYTE  fProduct2 :4;
83
84  BYTE  bRsv_1    :4;
85  BYTE  bVersion  :4;
86
87  /*----- System -----------------------------*/
88  BYTE  fRomSize  :3;  /* 000= 64K, 001= 128K, 010= 256K, 011= 512K */
89  BYTE  fSpeed    :2;  /*      188/186   386DX
90                           00   12MHz    16MHz
91                           01   16MHz    25MHz
92                           10   25MHz    33MHz
93                           11   40MHz    40MHz  */
94  BYTE  fCPU      :3;  /* 000= 188, 001= 186, 010= 386DX */
95
96  BYTE  fRsv_2    :2;
97  BYTE  fNVRAM    :2;  /* 00= 256B, 01= 512B, 10= 8192B */
98  BYTE  fRAM      :3;  /* 000= 32K, 001= 128K, 010= 256K, 011= 1024K */
99  BYTE  fRomType  :1;  /* 0= Fladsh, 1= OTROM */
100
101  /*----- Interface --------------------------*/
102  BYTE  fSerialNo :4;  /* Number of serial port */
103  BYTE  fNetworkNo:4;  /* Number of network */
104
105  BYTE  fPrnIn    :2;  /* Printer port in */
106  BYTE  fSCSI     :2;  /* SCSI */
107  BYTE  fChinese  :1;  /* Chinese */
108  BYTE  fMIO      :1;  /* MIO */
109  BYTE  fPrn      :2;  /* Printer */
110#endif
111
112  WORD  wRsv_3;
113
114  /*----- description ------------------------*/
115  BYTE  bComment[23];
116
117} PACKED HWID;
118
119typedef struct S_PID {
120
121  /*----- PID version ------------------------*/
122  WORD  wPidVersion;        /* Motorola format */
123
124  /*----- D/L control ------------------------*/
125  BYTE  fReserved;
126#ifdef _BIG_ENDIAN_
127  BYTE  fRsv        :  4;
128  BYTE  fChkFunction:  1;
129  BYTE  fChkProtocol:  1;
130  BYTE  fChkProduct:   1;
131  BYTE  fChkHw:        1;
132#else
133  BYTE  fChkHw:        1;
134  BYTE  fChkProduct:   1;
135  BYTE  fChkProtocol:  1;
136  BYTE  fChkFunction:  1;
137  BYTE  fRsv        :  4;
138#endif
139  /*----- Hardware ID ------------------------*/
140  HWID  hw;
141
142  /*----- Reserver ---------------------------*/
143  WORD  wRsv;
144
145  /*----- Product ID & mask ------------------*/
146  WORD  wProductID;         /* Motorola format */
147  WORD  wProductMask;       /* Motorola format */
148
149  /*----- Protocol ID & mask -----------------*/
150  WORD  wProtocolID;        /* Motorola format */
151  WORD  wProtocolMask;      /* Motorola format */
152
153  /*----- Function ID & mask -----------------*/
154  WORD  wFunctionID;        /* Motorola format */
155  WORD  wFunctionMask;      /* Motorola format */
156
157  /*----- F/W version ------------------------*/
158  WORD  wFwVersion;         /* Motorola format */
159
160  /*----- Code address -----------------------*/
161  WORD  wSegment;           /* Intel format */
162  WORD  wOffset;            /* Intel format */
163
164} PACKED PID;
165
166typedef  struct  VCI  {
167    WORD    VerControl;
168    WORD    DownControl;
169    BYTE    Hid[32];
170    WORD    Hver;
171    WORD    ProdID;
172    WORD    ProdIDmask;
173    WORD    ProtID;
174    WORD    ProtIDmask;
175    WORD    FuncID;
176    WORD    FuncIDmask;
177    WORD    Fver;
178    WORD    Cseg;
179	WORD    Csize;
180} PACKED VCI_TABLE;
181
182#define  VCI_LEN         56
183
184#endif
185