Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pcmcia add driver for raylink/aviator wireless 802.1...
details: https://anonhg.NetBSD.org/src/rev/ac2f8b6262e2
branches: trunk
changeset: 481158:ac2f8b6262e2
user: chopps <chopps%NetBSD.org@localhost>
date: Sun Jan 23 23:59:21 2000 +0000
description:
add driver for raylink/aviator wireless 802.11 FH 2Mbps cards, currently only
tested with aviator 2.4
diffstat:
sys/dev/pcmcia/files.pcmcia | 8 +-
sys/dev/pcmcia/if_ray.c | 2987 +++++++++++++++++++++++++++++++++++++++++++
sys/dev/pcmcia/if_rayreg.h | 622 ++++++++
3 files changed, 3616 insertions(+), 1 deletions(-)
diffs (truncated from 3639 to 300 lines):
diff -r 4fdc09467d79 -r ac2f8b6262e2 sys/dev/pcmcia/files.pcmcia
--- a/sys/dev/pcmcia/files.pcmcia Sun Jan 23 23:56:58 2000 +0000
+++ b/sys/dev/pcmcia/files.pcmcia Sun Jan 23 23:59:21 2000 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.pcmcia,v 1.21 2000/01/18 03:11:11 jtk Exp $
+# $NetBSD: files.pcmcia,v 1.22 2000/01/23 23:59:21 chopps Exp $
#
# Config.new file and device description for machine-independent PCMCIA code.
# Included by ports that need it.
@@ -76,6 +76,12 @@
attach sm at mhzc with sm_mhzc
file dev/pcmcia/mhzc.c mhzc | com_mhzc | sm_mhzc
needs-flag
+
+# Raylink/WebGear WLAN IEEE 802.11 FH
+device ray: arp, ether, ifnet
+attach ray at pcmcia
+file dev/pcmcia/if_ray.c ray
+
# AMD 79c930-based 802.11 cards (including BayStack 650 FH card).
device awi: arp, ether, ifnet
attach awi at pcmcia with awi_pcmcia
diff -r 4fdc09467d79 -r ac2f8b6262e2 sys/dev/pcmcia/if_ray.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pcmcia/if_ray.c Sun Jan 23 23:59:21 2000 +0000
@@ -0,0 +1,2987 @@
+/* $NetBSD: if_ray.c,v 1.1 2000/01/23 23:59:21 chopps Exp $ */
+/*
+ * Copyright (c) 2000 Christian E. Hopps
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Driver for the Raylink (Raytheon) / WebGear IEEE 802.11 (FH) WLANs
+ *
+ * 2-way communication with the card is through command structures
+ * stored in shared ram. To communicate with the card a free
+ * command structure is filled in and then the card is interrupted.
+ * The card does the same with a different set of command structures.
+ * Only one command can be processed at a time. This is indicated
+ * by the interrupt having not been cleared since it was last set.
+ * The bit is cleared when the command has been processed (although
+ * it may not yet be complete).
+ *
+ * This driver was only tested with the Aviator 2.4 wireless
+ * The author didn't have the pro version or raylink to test
+ * with.
+ *
+ * N.B. Its unclear yet whether the Aviator 2.4 cards interoperate
+ * with other 802.11 FH 2Mbps cards, since this was also untested.
+ * Given the nature of the buggy build 4 firmware there may be problems.
+ */
+
+#include "opt_inet.h"
+#include "bpfilter.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/errno.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+#include <sys/proc.h>
+
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_ether.h>
+#include <net/if_media.h>
+#include <net/if_llc.h>
+#include <net/if_ieee80211.h>
+#include <net/if_media.h>
+
+#ifdef INET
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/in_var.h>
+#include <netinet/ip.h>
+#include <netinet/if_inarp.h>
+#endif
+
+#if NBPFILTER > 0
+#include <net/bpf.h>
+#include <net/bpfdesc.h>
+#endif
+
+#include <machine/cpu.h>
+#include <machine/bus.h>
+#include <machine/intr.h>
+
+#include <dev/pcmcia/pcmciareg.h>
+#include <dev/pcmcia/pcmciavar.h>
+#include <dev/pcmcia/pcmciadevs.h>
+
+#include <dev/pcmcia/if_rayreg.h>
+
+#define RAY_DEBUG
+
+#ifndef RAY_PID_COUNTRY_CODE_DEFAULT
+#define RAY_PID_COUNTRY_CODE_DEFAULT RAY_PID_COUNTRY_CODE_USA
+#endif
+
+/* amount of time to poll for non-return of certain command status */
+#ifndef RAY_CHECK_CCS_TIMEOUT
+#define RAY_CHECK_CCS_TIMEOUT (hz / 2)
+#endif
+
+/* ammount of time to consider start/join failed */
+#ifndef RAY_START_TIMEOUT
+#define RAY_START_TIMEOUT (3 * hz)
+#endif
+
+/*
+ * if a command cannot execute because device is busy try later
+ * this is also done after interrupts and other command timeouts
+ * so we can use a large value safely.
+ */
+#ifndef RAY_CHECK_SCHED_TIMEOUT
+#define RAY_CHECK_SCHED_TIMEOUT (hz) /* XXX 5 */
+#endif
+
+#ifndef RAY_MODE_DEFAULT
+#define RAY_MODE_DEFAULT SC_MODE_ADHOC
+#endif
+
+#ifndef RAY_DEF_NWID
+#define RAY_DEF_NWID "NETWORK_NAME"
+#endif
+
+/*
+ * the number of times the HW is reset in 30s before disabling
+ * this is needed becuase resets take ~2s and currently pcmcia
+ * spins for the reset
+ */
+#ifndef RAY_MAX_RESETS
+#define RAY_MAX_RESETS 3
+#endif
+
+/*
+ * Types
+ */
+
+struct ray_softc {
+ struct device sc_dev;
+ struct ethercom sc_ec;
+ struct ifmedia sc_media;
+
+ struct pcmcia_function *sc_pf;
+ struct pcmcia_mem_handle sc_mem;
+ int sc_window;
+#if 0
+ struct pcmcia_mem_handle sc_amem;
+ int sc_awindow;
+#endif
+ void *sc_ih;
+ void *sc_sdhook;
+ int sc_resetloop;
+
+ struct ray_ecf_startup sc_ecf_startup;
+ struct ray_startup_params_head sc_startup;
+ union {
+ struct ray_startup_params_tail_5 u_params_5;
+ struct ray_startup_params_tail_4 u_params_4;
+ } sc_u;
+
+ u_int8_t sc_ccsinuse[64]; /* ccs in use -- not for tx */
+ u_int sc_txfree; /* a free count for efficiency */
+
+ u_int8_t sc_bssid[ETHER_ADDR_LEN]; /* current net values */
+ u_int8_t sc_cnwid[IEEE80211_NWID_LEN]; /* last nwid */
+ u_int8_t sc_dnwid[IEEE80211_NWID_LEN]; /* desired nwid */
+ u_int8_t sc_omode; /* old operating mode SC_MODE_xx */
+ u_int8_t sc_mode; /* current operating mode SC_MODE_xx */
+ u_int8_t sc_countrycode; /* current country code */
+ u_int8_t sc_dcountrycode; /* desired country code */
+ int sc_havenet; /* true if we have aquired a network */
+ bus_size_t sc_txpad; /* tib size plus "phy" size */
+ u_int8_t sc_deftxrate; /* default transfer rate */
+ u_int8_t sc_encrypt;
+
+
+ int sc_promisc; /* current set value */
+ int sc_running; /* things we are doing */
+ int sc_scheduled; /* things we need to do */
+ int sc_timoneed; /* set if timeout is sched */
+ int sc_timocheck; /* set if timeout is sched */
+ bus_size_t sc_startccs; /* ccs of start/join */
+ u_int sc_startcmd; /* cmd (start | join) */
+
+ int sc_checkcounters;
+ u_int64_t sc_rxoverflow;
+ u_int64_t sc_rxcksum;
+ u_int64_t sc_rxhcksum;
+ u_int8_t sc_rxnoise;
+
+ /* use to return values to the user */
+ struct ray_param_req *sc_repreq;
+ struct ray_param_req *sc_updreq;
+};
+#define sc_memt sc_mem.memt
+#define sc_memh sc_mem.memh
+#define sc_ccrt sc_pf->pf_ccrt
+#define sc_ccrh sc_pf->pf_ccrh
+#define sc_startup_4 sc_u.u_params_4
+#define sc_startup_5 sc_u.u_params_5
+#define sc_version sc_ecf_startup.e_fw_build_string
+#define sc_tibsize sc_ecf_startup.e_tib_size
+#define sc_if sc_ec.ec_if
+#define sc_xname sc_dev.dv_xname
+
+/* modes of operation */
+#define SC_MODE_ADHOC 0 /* ad-hoc mode */
+#define SC_MODE_INFRA 1 /* infrastructure mode */
+
+/* commands -- priority given to LSB */
+#define SCP_FIRST 0x0001
+#define SCP_UPDATESUBCMD 0x0001
+#define SCP_STARTASSOC 0x0002
+#define SCP_REPORTPARAMS 0x0004
+#define SCP_IFSTART 0x0008
+
+/* update sub commands -- issues are serialized priority to LSB */
+#define SCP_UPD_FIRST 0x0100
+#define SCP_UPD_STARTUP 0x0100
+#define SCP_UPD_STARTJOIN 0x0200
+#define SCP_UPD_PROMISC 0x0400
+#define SCP_UPD_MCAST 0x0800
+#define SCP_UPD_UPDATEPARAMS 0x1000
+#define SCP_UPD_SHIFT 8
+#define SCP_UPD_MASK 0xff00
+
+/* these command (a subset of the update set) require timeout checking */
+#define SCP_TIMOCHECK_CMD_MASK \
+ (SCP_UPD_UPDATEPARAMS | SCP_UPD_STARTUP | SCP_UPD_MCAST | \
+ SCP_UPD_PROMISC)
+
+
+#define IFM_ADHOC \
+ IFM_MAKEWORD(IFM_IEEE80211, IFM_IEEE80211_FH2, IFM_IEEE80211_ADHOC, 0)
+#define IFM_INFRA \
+ IFM_MAKEWORD(IFM_IEEE80211, IFM_IEEE80211_FH2, 0, 0)
+
+typedef void (*ray_cmd_func_t)(struct ray_softc *);
+
+#define SC_BUILD_5 0x5
+#define SC_BUILD_4 0x55
+
+
+static int ray_alloc_ccs __P((struct ray_softc *, bus_size_t *, u_int, u_int));
+static bus_size_t ray_fill_in_tx_ccs __P((struct ray_softc *, size_t,
+ u_int, u_int));
+static void ray_attach __P((struct device *, struct device *, void *));
+static ray_cmd_func_t ray_ccs_done __P((struct ray_softc *, bus_size_t));
+static void ray_check_ccs __P((void *));
+static void ray_check_scheduled __P((void *));
+static void ray_cmd_cancel __P((struct ray_softc *, int));
+static void ray_cmd_schedule __P((struct ray_softc *, int));
+static void ray_cmd_ran __P((struct ray_softc *, int));
+static int ray_cmd_is_running __P((struct ray_softc *, int));
+static int ray_cmd_is_scheduled __P((struct ray_softc *, int));
+static void ray_cmd_done __P((struct ray_softc *, int));
+static int ray_detach __P((struct device *, int));
+static void ray_disable __P((struct ray_softc *));
+static void ray_download_params __P((struct ray_softc *));
+static int ray_enable __P((struct ray_softc *));
+static u_int ray_find_free_tx_ccs __P((struct ray_softc *, u_int));
+static u_int8_t ray_free_ccs __P((struct ray_softc *, bus_size_t));
+static void ray_free_ccs_chain __P((struct ray_softc *, u_int));
+static void ray_if_start __P((struct ifnet *));
+static int ray_init __P((struct ray_softc *));
+static int ray_intr __P((void *));
+static void ray_intr_start __P((struct ray_softc *));
+static int ray_ioctl __P((struct ifnet *, u_long, caddr_t));
+static int ray_issue_cmd __P((struct ray_softc *, bus_size_t, u_int));
+static int ray_match __P((struct device *, struct cfdata *, void *));
Home |
Main Index |
Thread Index |
Old Index