- Try adjusting TX power as much as possible when doing the initial TX power
[dragonfly.git] / sys / dev / netif / bwi / bwimac.h
blob73add905f7c526cef819fd54f4280216c124a41f
1 /*
2 * Copyright (c) 2007 The DragonFly Project. All rights reserved.
3 *
4 * This code is derived from software contributed to The DragonFly Project
5 * by Sepherosa Ziehau <sepherosa@gmail.com>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
34 * $DragonFly: src/sys/dev/netif/bwi/bwimac.h,v 1.2 2008/02/15 11:15:38 sephe Exp $
37 #ifndef _BWI_MAC_H
38 #define _BWI_MAC_H
40 int bwi_mac_attach(struct bwi_softc *, int, uint8_t);
41 int bwi_mac_lateattach(struct bwi_mac *);
42 void bwi_mac_detach(struct bwi_mac *);
43 int bwi_mac_init(struct bwi_mac *);
44 void bwi_mac_reset(struct bwi_mac *, int);
45 int bwi_mac_start(struct bwi_mac *);
46 int bwi_mac_stop(struct bwi_mac *);
47 void bwi_mac_shutdown(struct bwi_mac *);
48 void bwi_mac_updateslot(struct bwi_mac *, int);
49 void bwi_mac_set_promisc(struct bwi_mac *, int);
51 void bwi_mac_calibrate_txpower(struct bwi_mac *,
52 enum bwi_txpwrcb_type);
53 void bwi_mac_set_tpctl_11bg(struct bwi_mac *,
54 const struct bwi_tpctl *);
55 void bwi_mac_init_tpctl_11bg(struct bwi_mac *);
56 void bwi_mac_dummy_xmit(struct bwi_mac *);
57 void bwi_mac_reset_hwkeys(struct bwi_mac *);
58 int bwi_mac_config_ps(struct bwi_mac *);
60 uint16_t bwi_memobj_read_2(struct bwi_mac *, uint16_t, uint16_t);
61 uint32_t bwi_memobj_read_4(struct bwi_mac *, uint16_t, uint16_t);
62 void bwi_memobj_write_2(struct bwi_mac *, uint16_t, uint16_t,
63 uint16_t);
64 void bwi_memobj_write_4(struct bwi_mac *, uint16_t, uint16_t,
65 uint32_t);
66 void bwi_tmplt_write_4(struct bwi_mac *, uint32_t, uint32_t);
67 void bwi_hostflags_write(struct bwi_mac *, uint64_t);
68 uint64_t bwi_hostflags_read(struct bwi_mac *);
70 #define MOBJ_WRITE_2(mac, objid, ofs, val) \
71 bwi_memobj_write_2((mac), (objid), (ofs), (val))
72 #define MOBJ_WRITE_4(mac, objid, ofs, val) \
73 bwi_memobj_write_4((mac), (objid), (ofs), (val))
74 #define MOBJ_READ_2(mac, objid, ofs) \
75 bwi_memobj_read_2((mac), (objid), (ofs))
76 #define MOBJ_READ_4(mac, objid, ofs) \
77 bwi_memobj_read_4((mac), (objid), (ofs))
79 #define MOBJ_SETBITS_4(mac, objid, ofs, bits) \
80 MOBJ_WRITE_4((mac), (objid), (ofs), \
81 MOBJ_READ_4((mac), (objid), (ofs)) | (bits))
82 #define MOBJ_CLRBITS_4(mac, objid, ofs, bits) \
83 MOBJ_WRITE_4((mac), (objid), (ofs), \
84 MOBJ_READ_4((mac), (objid), (ofs)) & ~(bits))
86 #define MOBJ_FILT_SETBITS_2(mac, objid, ofs, filt, bits) \
87 MOBJ_WRITE_2((mac), (objid), (ofs), \
88 (MOBJ_READ_2((mac), (objid), (ofs)) & (filt)) | (bits))
90 #define TMPLT_WRITE_4(mac, ofs, val) bwi_tmplt_write_4((mac), (ofs), (val))
92 #define HFLAGS_WRITE(mac, flags) bwi_hostflags_write((mac), (flags))
93 #define HFLAGS_READ(mac) bwi_hostflags_read((mac))
94 #define HFLAGS_CLRBITS(mac, bits) \
95 HFLAGS_WRITE((mac), HFLAGS_READ((mac)) | (bits))
96 #define HFLAGS_SETBITS(mac, bits) \
97 HFLAGS_WRITE((mac), HFLAGS_READ((mac)) & ~(bits))
99 #endif /* !_BWI_MAC_H */