summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-12-17 21:45:50 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-12-17 21:45:50 +0000
commitcb97e819af08eeeeac1481ad56f19e924be6808e (patch)
tree8af490beb03e8e64724e20a7e65f72e8e9c05551 /sys/dev
parentf4afcc91ac5a6937d5f7309c8d3abbba9dbf8755 (diff)
Kill some more macros. This time ACX_NOARG_FUNC and ACX_INIT_TMPLT_FUNC
bite the dust and make the code easier to read. Help and OK mglocker@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/acx.c40
-rw-r--r--sys/dev/ic/acx100.c7
-rw-r--r--sys/dev/ic/acxreg.h35
3 files changed, 28 insertions, 54 deletions
diff --git a/sys/dev/ic/acx.c b/sys/dev/ic/acx.c
index b76919c9904..b672422215a 100644
--- a/sys/dev/ic/acx.c
+++ b/sys/dev/ic/acx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acx.c,v 1.57 2006/12/13 11:03:54 mglocker Exp $ */
+/* $OpenBSD: acx.c,v 1.58 2006/12/17 21:45:48 claudio Exp $ */
/*
* Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
@@ -1530,7 +1530,7 @@ acx_load_radio_firmware(struct acx_softc *sc, const char *name)
radio_fw_ofs = letoh32(mem_map.code_end);
/* Put ECPU into sleeping state, before loading radio firmware */
- if (acx_sleep(sc) != 0)
+ if (acx_exec_command(sc, ACXCMD_SLEEP, NULL, 0, NULL, 0) != 0)
return (ENXIO);
/* Load radio firmware */
@@ -1542,7 +1542,7 @@ acx_load_radio_firmware(struct acx_softc *sc, const char *name)
DPRINTF(("%s: radio firmware loaded\n", sc->sc_dev.dv_xname));
/* Wake up sleeping ECPU, after radio firmware is loaded */
- if (acx_wakeup(sc) != 0)
+ if (acx_exec_command(sc, ACXCMD_WAKEUP, NULL, 0, NULL, 0) != 0)
return (ENXIO);
/* Initialize radio */
@@ -1792,8 +1792,15 @@ back:
int
acx_init_tmplt_ordered(struct acx_softc *sc)
{
- struct acx_tmplt_tim tim;
-
+ union {
+ struct acx_tmplt_beacon beacon;
+ struct acx_tmplt_null_data null;
+ struct acx_tmplt_probe_req preq;
+ struct acx_tmplt_probe_resp presp;
+ struct acx_tmplt_tim tim;
+ } data;
+
+ bzero(&data, sizeof(data));
/*
* NOTE:
* Order of templates initialization:
@@ -1804,32 +1811,35 @@ acx_init_tmplt_ordered(struct acx_softc *sc)
* 5) Probe response
* Above order is critical to get a correct memory map.
*/
- if (acx_init_probe_req_tmplt(sc) != 0)
+ if (acx_set_tmplt(sc, ACXCMD_TMPLT_PROBE_REQ, &data.preq,
+ sizeof(data.preq)) != 0)
return (1);
- if (acx_init_null_data_tmplt(sc) != 0)
+ if (acx_set_tmplt(sc, ACXCMD_TMPLT_NULL_DATA, &data.null,
+ sizeof(data.null)) != 0)
return (1);
- if (acx_init_beacon_tmplt(sc) != 0)
+ if (acx_set_tmplt(sc, ACXCMD_TMPLT_BEACON, &data.beacon,
+ sizeof(data.beacon)) != 0)
return (1);
- if (acx_init_tim_tmplt(sc) != 0)
+ if (acx_set_tmplt(sc, ACXCMD_TMPLT_TIM, &data.tim,
+ sizeof(data.tim)) != 0)
return (1);
- if (acx_init_probe_resp_tmplt(sc) != 0)
+ if (acx_set_tmplt(sc, ACXCMD_TMPLT_PROBE_RESP, &data.presp,
+ sizeof(data.presp)) != 0)
return (1);
/* Setup TIM template */
- bzero(&tim, sizeof(tim));
- tim.tim_eid = IEEE80211_ELEMID_TIM;
- tim.tim_len = ACX_TIM_LEN(ACX_TIM_BITMAP_LEN);
- if (acx_set_tmplt(sc, ACXCMD_TMPLT_TIM, &tim,
+ data.tim.tim_eid = IEEE80211_ELEMID_TIM;
+ data.tim.tim_len = ACX_TIM_LEN(ACX_TIM_BITMAP_LEN);
+ if (acx_set_tmplt(sc, ACXCMD_TMPLT_TIM, &data.tim,
ACX_TMPLT_TIM_SIZ(ACX_TIM_BITMAP_LEN)) != 0) {
printf("%s: can't set tim tmplt\n", sc->sc_dev.dv_xname);
return (1);
}
-#undef CALL_SET_TMPLT
return (0);
}
diff --git a/sys/dev/ic/acx100.c b/sys/dev/ic/acx100.c
index b65e720a0aa..93b6b722411 100644
--- a/sys/dev/ic/acx100.c
+++ b/sys/dev/ic/acx100.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acx100.c,v 1.16 2006/12/13 11:03:54 mglocker Exp $ */
+/* $OpenBSD: acx100.c,v 1.17 2006/12/17 21:45:49 claudio Exp $ */
/*
* Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
@@ -216,9 +216,6 @@ ACX100_CONF_FUNC(get, ed_thresh);
ACX100_CONF_FUNC(set, ed_thresh);
ACX100_CONF_FUNC(set, wepkey);
-#define ACXCMD_init_mem ACXCMD_INIT_MEM
-ACX_NOARG_FUNC(init_mem);
-
static const uint16_t acx100_reg[ACXREG_MAX] = {
ACXREG(SOFT_RESET, 0x0000),
@@ -526,7 +523,7 @@ acx100_init_memory(struct acx_softc *sc)
}
/* Initialize memory */
- if (acx_init_mem(sc) != 0) {
+ if (acx_exec_command(sc, ACXCMD_INIT_MEM, NULL, 0, NULL, 0) != 0) {
printf("%s: can't init mem\n", ifp->if_xname);
return (1);
}
diff --git a/sys/dev/ic/acxreg.h b/sys/dev/ic/acxreg.h
index af3b5764946..6229a0f4fa5 100644
--- a/sys/dev/ic/acxreg.h
+++ b/sys/dev/ic/acxreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: acxreg.h,v 1.8 2006/12/13 11:03:54 mglocker Exp $ */
+/* $OpenBSD: acxreg.h,v 1.9 2006/12/17 21:45:49 claudio Exp $ */
/*
* Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
@@ -426,19 +426,6 @@ struct acx_tmplt_tim {
#define ACX_TMPLT_TIM_SIZ(bitmap_len) \
(sizeof(uint16_t) + sizeof(struct tim_head) + (bitmap_len))
-
-#define ACX_INIT_TMPLT_FUNC(name) \
-static __inline int \
-acx_init_##name##_tmplt(struct acx_softc *_sc) \
-{ \
- struct acx_tmplt_##name _tmplt; \
- \
- bzero(&_tmplt, sizeof(_tmplt)); \
- return acx_set_tmplt(_sc, ACXCMD_TMPLT_##name, \
- &_tmplt, sizeof(_tmplt)); \
-} \
-struct __hack
-
#define _ACX_CONF_FUNC(sg, name, chip) \
static __inline int \
acx##chip##_##sg##_##name##_conf(struct acx_softc *_sc, \
@@ -449,15 +436,6 @@ acx##chip##_##sg##_##name##_conf(struct acx_softc *_sc, \
} \
struct __hack
-#define ACX_NOARG_FUNC(name) \
-static __inline int \
-acx_##name(struct acx_softc *_sc) \
-{ \
- return acx_exec_command(_sc, ACXCMD_##name, \
- NULL, 0, NULL, 0); \
-} \
-struct __hack
-
#define ACXCMD_TMPLT_tim ACXCMD_TMPLT_TIM
#define ACXCMD_TMPLT_beacon ACXCMD_TMPLT_BEACON
@@ -465,12 +443,6 @@ struct __hack
#define ACXCMD_TMPLT_null_data ACXCMD_TMPLT_NULL_DATA
#define ACXCMD_TMPLT_probe_req ACXCMD_TMPLT_PROBE_REQ
-ACX_INIT_TMPLT_FUNC(tim);
-ACX_INIT_TMPLT_FUNC(null_data);
-ACX_INIT_TMPLT_FUNC(beacon);
-ACX_INIT_TMPLT_FUNC(probe_req);
-ACX_INIT_TMPLT_FUNC(probe_resp);
-
#define ACX_CONF_FUNC(sg, name) _ACX_CONF_FUNC(sg, name,)
#define ACX_CONF_wepopt ACX_CONF_WEPOPT
#define ACX_CONF_mmap ACX_CONF_MMAP
@@ -500,11 +472,6 @@ ACX_CONF_FUNC(set, rate_fallback);
ACX_CONF_FUNC(set, rxopt);
ACX_CONF_FUNC(set, wep_txkey);
-#define ACXCMD_sleep ACXCMD_SLEEP
-#define ACXCMD_wakeup ACXCMD_WAKEUP
-ACX_NOARG_FUNC(sleep);
-ACX_NOARG_FUNC(wakeup);
-
#define CMDPRM_WRITE_REGION_1(sc, r, rlen) \
bus_space_write_region_1((sc)->sc_mem2_bt, \
(sc)->sc_mem2_bh, \