summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2007-06-17 20:00:31 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2007-06-17 20:00:31 +0000
commit8de54ba3a3a9f1a9fb188d951c31faccba48fd9a (patch)
tree06a3533ef510a5d3eae0e116cbf8e559572e4299 /sys/dev
parent52e2410b2daf681c3d211d734b2e52e9dc751244 (diff)
Add background SCAN command.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pcmcia/if_malo.c75
-rw-r--r--sys/dev/pcmcia/if_maloreg.h4
-rw-r--r--sys/dev/pcmcia/if_malovar.h19
3 files changed, 95 insertions, 3 deletions
diff --git a/sys/dev/pcmcia/if_malo.c b/sys/dev/pcmcia/if_malo.c
index 6063c3c3aa8..334a52e9293 100644
--- a/sys/dev/pcmcia/if_malo.c
+++ b/sys/dev/pcmcia/if_malo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_malo.c,v 1.18 2007/06/17 15:11:23 mglocker Exp $ */
+/* $OpenBSD: if_malo.c,v 1.19 2007/06/17 20:00:30 mglocker Exp $ */
/*
* Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
@@ -100,6 +100,8 @@ int cmalo_cmd_set_txpower(struct malo_softc *, int16_t);
int cmalo_cmd_set_antenna(struct malo_softc *, uint16_t);
int cmalo_cmd_set_macctrl(struct malo_softc *);
int cmalo_cmd_set_assoc(struct malo_softc *);
+int cmalo_cmd_set_bgscan_config(struct malo_softc *);
+int cmalo_cmd_set_bgscan_query(struct malo_softc *);
int cmalo_cmd_set_rate(struct malo_softc *);
int cmalo_cmd_request(struct malo_softc *, uint16_t, int);
int cmalo_cmd_response(struct malo_softc *);
@@ -1361,6 +1363,67 @@ cmalo_cmd_set_assoc(struct malo_softc *sc)
}
int
+cmalo_cmd_set_bgscan_config(struct malo_softc *sc)
+{
+ struct malo_cmd_header *hdr = sc->sc_cmd;
+ struct malo_cmd_body_bgscan_config *body;
+ uint16_t psize;
+
+ bzero(sc->sc_cmd, MALO_CMD_BUFFER_SIZE);
+ psize = sizeof(*hdr) + sizeof(*body);
+
+ hdr->cmd = htole16(MALO_CMD_BGSCAN_CONFIG);
+ hdr->size = htole16(sizeof(*body));
+ hdr->seqnum = htole16(1);
+ hdr->result = 0;
+ body = (struct malo_cmd_body_bgscan_config *)(hdr + 1);
+
+ body->action = htole16(1);
+ body->enable = 1;
+ body->bsstype = 0x03;
+ body->chperscan = 12;
+ body->scanintvl = htole32(100);
+ body->maxscanres = htole16(12);
+
+ /* process command request */
+ if (cmalo_cmd_request(sc, psize, 0) != 0)
+ return (EIO);
+
+ /* process command repsonse */
+ cmalo_cmd_response(sc);
+
+ return (0);
+}
+
+int
+cmalo_cmd_set_bgscan_query(struct malo_softc *sc)
+{
+ struct malo_cmd_header *hdr = sc->sc_cmd;
+ struct malo_cmd_body_bgscan_query *body;
+ uint16_t psize;
+
+ bzero(sc->sc_cmd, MALO_CMD_BUFFER_SIZE);
+ psize = sizeof(*hdr) + sizeof(*body);
+
+ hdr->cmd = htole16(MALO_CMD_BGSCAN_QUERY);
+ hdr->size = htole16(sizeof(*body));
+ hdr->seqnum = htole16(1);
+ hdr->result = 0;
+ body = (struct malo_cmd_body_bgscan_query *)(hdr + 1);
+
+ body->flush = 0;
+
+ /* process command request */
+ if (cmalo_cmd_request(sc, psize, 0) != 0)
+ return (EIO);
+
+ /* process command repsonse */
+ cmalo_cmd_response(sc);
+
+ return (0);
+}
+
+int
cmalo_cmd_set_rate(struct malo_softc *sc)
{
struct malo_cmd_header *hdr = sc->sc_cmd;
@@ -1514,6 +1577,16 @@ cmalo_cmd_response(struct malo_softc *sc)
DPRINTF(1, "%s: got macctrl cmd response\n",
sc->sc_dev.dv_xname);
break;
+ case MALO_CMD_BGSCAN_CONFIG:
+ /* do nothing */
+ DPRINTF(1, "%s: got bgscan config cmd response\n",
+ sc->sc_dev.dv_xname);
+ break;
+ case MALO_CMD_BGSCAN_QUERY:
+ /* do nothing */
+ DPRINTF(1, "%s: got bgscan query cmd response\n",
+ sc->sc_dev.dv_xname);
+ break;
case MALO_CMD_RATE:
/* do nothing */
DPRINTF(1, "%s: got rate cmd response\n",
diff --git a/sys/dev/pcmcia/if_maloreg.h b/sys/dev/pcmcia/if_maloreg.h
index 38dd0cc58e5..33206373509 100644
--- a/sys/dev/pcmcia/if_maloreg.h
+++ b/sys/dev/pcmcia/if_maloreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_maloreg.h,v 1.8 2007/06/17 10:18:28 mglocker Exp $ */
+/* $OpenBSD: if_maloreg.h,v 1.9 2007/06/17 20:00:30 mglocker Exp $ */
/*
* Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
@@ -60,6 +60,8 @@
#define MALO_CMD_ANTENNA 0x0020
#define MALO_CMD_MACCTRL 0x0028
#define MALO_CMD_ASSOC 0x0050
+#define MALO_CMD_BGSCAN_CONFIG 0x006b
+#define MALO_CMD_BGSCAN_QUERY 0x006c
#define MALO_CMD_RATE 0x0076
/* FW command values */
diff --git a/sys/dev/pcmcia/if_malovar.h b/sys/dev/pcmcia/if_malovar.h
index 2ec1c063fd4..a14b3b6020f 100644
--- a/sys/dev/pcmcia/if_malovar.h
+++ b/sys/dev/pcmcia/if_malovar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_malovar.h,v 1.11 2007/06/17 10:18:28 mglocker Exp $ */
+/* $OpenBSD: if_malovar.h,v 1.12 2007/06/17 20:00:30 mglocker Exp $ */
/*
* Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
@@ -140,6 +140,23 @@ struct malo_cmd_body_assoc {
/* malo_cmd_tlv_rate */
} __packed;
+struct malo_cmd_body_bgscan_config {
+ uint16_t action;
+ uint8_t enable;
+ uint8_t bsstype;
+ uint8_t chperscan;
+ uint8_t discard;
+ uint16_t reserved;
+ uint32_t scanintvl;
+ uint32_t storecond;
+ uint32_t reportcond;
+ uint16_t maxscanres;
+} __packed;
+
+struct malo_cmd_body_bgscan_query {
+ uint8_t flush;
+} __packed;
+
struct malo_cmd_body_rate {
uint16_t action;
uint16_t hwauto;