3 * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the author nor the names of any co-contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY DUNCAN BARCLAY AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL DUNCAN BARCLAY OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 /* $NetBSD: if_rayreg.h,v 1.1 2000/01/23 23:59:22 chopps Exp $ */
37 * Copyright (c) 2000 Christian E. Hopps
38 * All rights reserved.
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
43 * 1. Redistributions of source code must retain the above copyright
44 * notice, this list of conditions and the following disclaimer.
45 * 2. Redistributions in binary form must reproduce the above copyright
46 * notice, this list of conditions and the following disclaimer in the
47 * documentation and/or other materials provided with the distribution.
48 * 3. Neither the name of the author nor the names of any co-contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
52 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
66 * CCR registers, appearing in the attribute memory space
68 #define RAY_CCR 0xf00 /* CCR register offset */
69 #define RAY_COR (RAY_CCR + 0x00) /* config option register */
70 #define RAY_CCSR (RAY_CCR + 0x01) /* config/status register */
71 #define RAY_PIN (RAY_CCR + 0x02) /* not used by hw */
72 #define RAY_SOCKETCOPY (RAY_CCR + 0x03) /* not used by hw */
73 #define RAY_HCSIR (RAY_CCR + 0x05) /* HCS intr register */
74 #define RAY_ECFIR (RAY_CCR + 0x06) /* ECF intr register */
76 * We don't seem to be able to access these in a simple manner
78 #define RAY_AR0 (RAY_CCR + 0x08) /* authorization register 0 (unused) */
79 #define RAY_AR1 (RAY_CCR + 0x09) /* authorization register 1 (unused) */
80 #define RAY_PMR (RAY_CCR + 0x0a) /* program mode register (unused) */
81 #define RAY_TMR (RAY_CCR + 0x0b) /* pc test mode register (unused) */
82 #define RAY_FCWR (RAY_CCR + 0x10) /* frequency control word register */
83 #define RAY_TMC1 (RAY_CCR + 0x14) /* test mode control 1 (unused) */
84 #define RAY_TMC2 (RAY_CCR + 0x15) /* test mode control 1 (unused) */
85 #define RAY_TMC3 (RAY_CCR + 0x16) /* test mode control 1 (unused) */
86 #define RAY_TMC4 (RAY_CCR + 0x17) /* test mode control 1 (unused) */
91 #define RAY_COR_CFG_NUM 0x01 /* currently ignored and set */
92 #define RAY_COR_CFG_MASK 0x3f /* mask for function */
93 #define RAY_COR_LEVEL_IRQ 0x40 /* currently ignored and set */
94 #define RAY_COR_RESET 0x80 /* soft-reset the card */
95 #define RAY_COR_DEFAULT (RAY_COR_CFG_NUM | RAY_COR_LEVEL_IRQ)
100 #define RAY_CCS_NORMAL 0x00 /* normal operation */
101 #define RAY_CCS_IRQ 0x02 /* interrupt pending */
102 #define RAY_CCS_POWER_DOWN 0x04 /* when written powers down card */
107 * the host can only clear this bit.
109 #define RAY_HCSIR_IRQ 0x01 /* indicates an interrupt */
114 #define RAY_ECFIR_IRQ 0x01 /* interrupt the card */
118 * used for testing/programming the card (unused)
120 #define RAY_AR0_ON 0x57
124 * used for testing/programming the card (unused)
126 #define RAY_AR1_ON 0x82
130 * these are used to program the card (unused)
132 #define RAY_PMR_NORMAL 0x00 /* normal operation */
133 #define RAY_PMR_PC2PM 0x02 /* grant access to firmware flash */
134 #define RAY_PMR_PC2CAL 0x10 /* read access to the A/D modem inp */
135 #define RAY_PMR_MLSE 0x20 /* read access to the MSLE prom */
139 * get access to test modes (unused)
141 #define RAY_TMR_NORMAL 0x00 /* normal operation */
142 #define RAY_TMR_TEST 0x08 /* test mode */
145 * FCWR -- frequency control word, values from [0x02,0xA6] map to
146 * RF frequency values.
152 #define RAY_SRAM_MEM_BASE 0
153 #define RAY_SRAM_MEM_SIZE 0xc000
156 * offsets into shared ram
158 #define RAY_SCB_BASE 0x0000 /* cfg/status/ctl area */
159 #define RAY_STATUS_BASE 0x0100
160 #define RAY_HOST_TO_ECF_BASE 0x0200
161 #define RAY_ECF_TO_HOST_BASE 0x0300
162 #define RAY_CCS_BASE 0x0400
163 #define RAY_RCS_BASE 0x0800
164 #define RAY_APOINT_TIM_BASE 0x0c00
165 #define RAY_SSID_LIST_BASE 0x0d00
166 #define RAY_TX_BASE 0x1000
167 #define RAY_TX_SIZE 0x7000
168 #define RAY_TX_END 0x8000
169 #define RAY_RX_BASE 0x8000
170 #define RAY_RX_END 0xc000
171 #define RAY_RX_MASK 0x3fff
174 * Startup reporting stucture
176 struct ray_ecf_startup_v4 {
178 u_int8_t e_station_addr[ETHER_ADDR_LEN];
179 u_int8_t e_prg_cksum;
180 u_int8_t e_cis_cksum;
182 u_int8_t e_japan_callsign[12];
184 struct ray_ecf_startup_v5 {
186 u_int8_t e_station_addr[ETHER_ADDR_LEN];
189 u_int8_t e_japan_callsign[12];
190 u_int8_t e_prg_cksum;
191 u_int8_t e_cis_cksum;
192 u_int8_t e_fw_build_string;
195 u_int8_t e_asic_version;
197 u_int8_t e_resv1[29];
201 * Startup status word result codes
203 #define RAY_ECFS_RESERVED0 0x01
204 #define RAY_ECFS_PROC_SELF_TEST 0x02
205 #define RAY_ECFS_PROG_MEM_CHECKSUM 0x04
206 #define RAY_ECFS_DATA_MEM_TEST 0x08
207 #define RAY_ECFS_RX_CALIBRATION 0x10
208 #define RAY_ECFS_FW_VERSION_COMPAT 0x20
209 #define RAY_ECFS_RERSERVED1 0x40
210 #define RAY_ECFS_TEST_COMPLETE 0x80
211 #define RAY_ECFS_CARD_OK RAY_ECFS_TEST_COMPLETE
212 #define RAY_ECFS_PRINTFB \
215 "\002PROC_SELF_TEST" \
216 "\003PROG_MEM_CHECKSUM" \
217 "\004DATA_MEM_TEST" \
218 "\005RX_CALIBRATION" \
219 "\006FW_VERSION_COMPAT" \
224 * Firmware build codes
226 #define RAY_ECFS_BUILD_4 0x55
227 #define RAY_ECFS_BUILD_5 0x5
230 * System Control Block
232 #define RAY_SCB_CCSI 0x00 /* host CCS index */
233 #define RAY_SCB_RCSI 0x01 /* ecf RCS index */
236 * command control structures (for CCSR commands)
242 #define RAY_CMD_DOWNLOAD_PARAMS 0x01 /* download start params */
243 #define RAY_CMD_UPDATE_PARAMS 0x02 /* update params */
244 #define RAY_CMD_REPORT_PARAMS 0x03 /* report params */
245 #define RAY_CMD_UPDATE_MCAST 0x04 /* update mcast list */
246 #define RAY_CMD_UPDATE_APM 0x05 /* update power saving mode */
247 #define RAY_CMD_START_NET 0x06
248 #define RAY_CMD_JOIN_NET 0x07
249 #define RAY_CMD_START_ASSOC 0x08
250 #define RAY_CMD_TX_REQ 0x09
251 #define RAY_CMD_TEST_MEM 0x0a
252 #define RAY_CMD_SHUTDOWN 0x0b
253 #define RAY_CMD_DUMP_MEM 0x0c
254 #define RAY_CMD_START_TIMER 0x0d
255 #define RAY_CMD_MAX 0x0e
258 * unsolicted commands from the ECF
260 #define RAY_ECMD_RX_DONE 0x80 /* process rx packet */
261 #define RAY_ECMD_REJOIN_DONE 0x81 /* rejoined the network */
262 #define RAY_ECMD_ROAM_START 0x82 /* romaining started */
263 #define RAY_ECMD_JAPAN_CALL_SIGNAL 0x83 /* japan test thing */
267 * Configure/status/control memory
270 u_int8_t csc_mrxo_own; /* 0 ECF writes, 1 host write */
271 u_int8_t csc_mrxc_own; /* 0 ECF writes, 1 host write */
272 u_int8_t csc_rxhc_own; /* 0 ECF writes, 1 host write */
274 u_int16_t csc_mrx_overflow; /* ECF incs on rx overflow */
275 u_int16_t csc_mrx_cksum; /* ECF incs on cksum error */
276 u_int16_t csc_rx_hcksum; /* ECF incs on header cksum error */
277 u_int8_t csc_rx_noise; /* average RSL measuremant */
283 #define RAY_CCS_LINK_NULL 0xff
284 #define RAY_CCS_SIZE 16
286 #define RAY_CCS_TX_FIRST 0
287 #define RAY_CCS_TX_LAST 13
288 #define RAY_CCS_NTX (RAY_CCS_TX_LAST - RAY_CCS_TX_FIRST + 1)
289 #define RAY_TX_BUF_SIZE 2048
290 #define RAY_CCS_CMD_FIRST 14
291 #define RAY_CCS_CMD_LAST 63
292 #define RAY_CCS_NCMD (RAY_CCS_CMD_LAST - RAY_CCS_CMD_FIRST + 1)
293 #define RAY_CCS_LAST 63
295 #define RAY_CCS_INDEX(ccs) (((ccs) - RAY_CCS_BASE) / RAY_CCS_SIZE)
296 #define RAY_CCS_ADDRESS(i) (RAY_CCS_BASE + (i) * RAY_CCS_SIZE)
301 #define RAY_RCS_FIRST 64
302 #define RAY_RCS_LAST 127
308 u_int8_t c_status; /* ccs generic header */
309 u_int8_t c_cmd; /* " */
310 u_int8_t c_link; /* " */
313 #define RAY_CCS_STATUS_FREE 0x0
314 #define RAY_CCS_STATUS_BUSY 0x1
315 #define RAY_CCS_STATUS_COMPLETE 0x2
316 #define RAY_CCS_STATUS_FAIL 0x3
317 #define RAY_CCS_STATUS_STRINGS { \
324 /* RAY_CMD_UPDATE_PARAMS */
325 struct ray_cmd_update {
326 u_int8_t c_status; /* ccs generic header */
327 u_int8_t c_cmd; /* " */
328 u_int8_t c_link; /* " */
331 u_int8_t c_failcause;
334 /* RAY_CMD_REPORT_PARAMS */
335 struct ray_cmd_report {
336 u_int8_t c_status; /* ccs generic header */
337 u_int8_t c_cmd; /* " */
338 u_int8_t c_link; /* " */
341 u_int8_t c_failcause;
345 /* RAY_CMD_UPDATE_MCAST */
346 struct ray_cmd_update_mcast {
347 u_int8_t c_status; /* ccs generic header */
348 u_int8_t c_cmd; /* " */
349 u_int8_t c_link; /* " */
353 /* RAY_CMD_UPDATE_APM */
354 struct ray_cmd_udpate_apm {
355 u_int8_t c_status; /* ccs generic header */
356 u_int8_t c_cmd; /* " */
357 u_int8_t c_link; /* " */
361 /* RAY_CMD_START_NET and RAY_CMD_JOIN_NET */
363 u_int8_t c_status; /* ccs generic header */
364 u_int8_t c_cmd; /* " */
365 u_int8_t c_link; /* " */
366 u_int8_t c_upd_param;
367 u_int8_t c_bss_id[ETHER_ADDR_LEN];
369 u_int8_t c_def_txrate;
372 /* Parameters passed in HOST_TO_ECF section when c_upd_param is set in
374 struct ray_net_params {
377 u_int8_t p_privacy_must_start;
378 u_int8_t p_privacy_can_join;
381 /* RAY_CMD_START_ASSOC */
382 struct ray_cmd_update_assoc {
383 u_int8_t c_status; /* ccs generic header */
384 u_int8_t c_cmd; /* " */
385 u_int8_t c_link; /* " */
392 u_int8_t c_status; /* ccs generic header */
393 u_int8_t c_cmd; /* " */
394 u_int8_t c_link; /* " */
403 struct ray_cmd_tx_4 {
404 u_int8_t c_status; /* ccs generic header */
405 u_int8_t c_cmd; /* " */
406 u_int8_t c_link; /* " */
409 u_int8_t c_addr[ETHER_ADDR_LEN];
415 /* RAY_CMD_DUMP_MEM */
416 struct ray_cmd_dump_mem {
417 u_int8_t c_status; /* ccs generic header */
418 u_int8_t c_cmd; /* " */
419 u_int8_t c_link; /* " */
425 /* RAY_CMD_START_TIMER */
426 struct ray_cmd_start_timer {
427 u_int8_t c_status; /* ccs generic header */
428 u_int8_t c_cmd; /* " */
429 u_int8_t c_link; /* " */
430 u_int8_t c_duration[2];
433 /* RAY_ECMD_RX_DONE */
435 u_int8_t c_status; /* ccs generic header */
436 u_int8_t c_cmd; /* " */
437 u_int8_t c_link; /* " */
438 u_int8_t c_bufp[2]; /* buffer pointer */
439 u_int8_t c_len[2]; /* length */
440 u_int8_t c_siglev; /* signal level */
441 u_int8_t c_nextfrag; /* next fragment in packet */
442 u_int8_t c_pktlen[2]; /* total packet length */
443 u_int8_t c_antenna; /* ant. with best reception */
444 u_int8_t c_updbss; /* only 1 for beacon messages */
448 * Transmit scratch space and phy header structures
451 u_int8_t t_ccs_index;
453 u_int8_t t_pass_fail;
454 u_int8_t t_retry_count;
455 u_int8_t t_max_retries;
456 u_int8_t t_frags_remaining;
459 u_int8_t t_csma_tx_cntrl_2;
460 u_int8_t t_sifs_tx_cntrl_2;
461 u_int8_t t_tx_dma_addr_1[2];
462 u_int8_t t_tx_dma_addr_2[2];
463 u_int8_t t_var_dur_2mhz[2];
464 u_int8_t t_var_dur_1mhz[2];
465 u_int8_t t_max_dur_2mhz[2];
466 u_int8_t t_max_dur_1mhz[2];
468 u_int8_t t_max_frag_len[2];
469 u_int8_t t_var_len[2];
470 u_int8_t t_phy_hdr_4;
471 u_int8_t t_mac_hdr_1;
472 u_int8_t t_mac_hdr_2;
476 struct ray_tx_phy_header {