Lines Matching +full:mac +full:-
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2009-2010 Weongyo Jeong <weongyo@freebsd.org>
48 (((phy)->rev >= 2) && ((phy)->rf_ver == 0x2050) && \
49 ((phy)->rf_rev == 8))
51 (((phy)->rev > 1) || ((phy)->gmode))
58 #define BWN_ISOLDFMT(mac) ((mac)->mac_fw.rev <= 351) argument
61 #define BWN_HDRSIZE(mac) bwn_tx_hdrsize(mac) argument
65 ((uint16_t)((((uint16_t)tq->tq_index + 1) << 12) | tp->tp_index))
67 ((uint16_t)(((uint16_t)dr->dr_index + 1) << 12) | (uint16_t)slot)
68 #define BWN_READ_2(mac, o) \ argument
69 (bus_read_2((mac)->mac_sc->sc_mem_res, (o)))
70 #define BWN_READ_4(mac, o) \ argument
71 (bus_read_4((mac)->mac_sc->sc_mem_res, (o)))
72 #define BWN_WRITE_2(mac, o, v) \ argument
73 (bus_write_2((mac)->mac_sc->sc_mem_res, (o), (v)))
74 #define BWN_WRITE_2_F(mac, o, v) do { \ argument
75 (BWN_WRITE_2(mac, o, v)); \
76 BWN_READ_2(mac, o); \
78 #define BWN_WRITE_SETMASK2(mac, offset, mask, set) \ argument
79 BWN_WRITE_2(mac, offset, (BWN_READ_2(mac, offset) & mask) | set)
80 #define BWN_WRITE_4(mac, o, v) \ argument
81 (bus_write_4((mac)->mac_sc->sc_mem_res, (o), (v)))
82 #define BWN_WRITE_SETMASK4(mac, offset, mask, set) \ argument
83 BWN_WRITE_4(mac, offset, (BWN_READ_4(mac, offset) & mask) | set)
84 #define BWN_PIO_TXQOFFSET(mac) \ argument
85 ((bhnd_get_hwrev(mac->mac_sc->sc_dev) >= 11) ? 0x18 : 0)
86 #define BWN_PIO_RXQOFFSET(mac) \ argument
87 ((bhnd_get_hwrev(mac->mac_sc->sc_dev) >= 11) ? 0x38 : 8)
88 #define BWN_SEC_NEWAPI(mac) (mac->mac_fw.rev >= 351) argument
89 #define BWN_SEC_KEY2FW(mac, idx) \ argument
90 (BWN_SEC_NEWAPI(mac) ? idx : ((idx >= 4) ? idx - 4 : idx))
91 #define BWN_RF_READ(mac, r) (mac->mac_phy.rf_read(mac, r)) argument
92 #define BWN_RF_WRITE(mac, r, v) (mac->mac_phy.rf_write(mac, r, v)) argument
93 #define BWN_RF_MASK(mac, o, m) \ argument
94 BWN_RF_WRITE(mac, o, BWN_RF_READ(mac, o) & m)
95 #define BWN_RF_SETMASK(mac, offset, mask, set) \ argument
96 BWN_RF_WRITE(mac, offset, (BWN_RF_READ(mac, offset) & mask) | set)
97 #define BWN_RF_SET(mac, offset, set) \ argument
98 BWN_RF_WRITE(mac, offset, BWN_RF_READ(mac, offset) | set)
99 #define BWN_PHY_READ(mac, r) (mac->mac_phy.phy_read(mac, r)) argument
100 #define BWN_PHY_WRITE(mac, r, v) \ argument
101 (mac->mac_phy.phy_write(mac, r, v))
102 #define BWN_PHY_SET(mac, offset, set) do { \ argument
103 if (mac->mac_phy.phy_maskset != NULL) { \
104 KASSERT(mac->mac_status < BWN_MAC_STATUS_INITED || \
105 mac->mac_suspended > 0, \
106 ("dont access PHY or RF registers after turning on MAC")); \
107 mac->mac_phy.phy_maskset(mac, offset, 0xffff, set); \
109 BWN_PHY_WRITE(mac, offset, \
110 BWN_PHY_READ(mac, offset) | (set)); \
112 #define BWN_PHY_SETMASK(mac, offset, mask, set) do { \ argument
113 if (mac->mac_phy.phy_maskset != NULL) { \
114 KASSERT(mac->mac_status < BWN_MAC_STATUS_INITED || \
115 mac->mac_suspended > 0, \
116 ("dont access PHY or RF registers after turning on MAC")); \
117 mac->mac_phy.phy_maskset(mac, offset, mask, set); \
119 BWN_PHY_WRITE(mac, offset, \
120 (BWN_PHY_READ(mac, offset) & (mask)) | (set)); \
122 #define BWN_PHY_MASK(mac, offset, mask) do { \ argument
123 if (mac->mac_phy.phy_maskset != NULL) { \
124 KASSERT(mac->mac_status < BWN_MAC_STATUS_INITED || \
125 mac->mac_suspended > 0, \
126 ("dont access PHY or RF registers after turning on MAC")); \
127 mac->mac_phy.phy_maskset(mac, offset, mask, 0); \
129 BWN_PHY_WRITE(mac, offset, \
130 BWN_PHY_READ(mac, offset) & (mask)); \
132 #define BWN_PHY_COPY(mac, dst, src) do { \ argument
133 KASSERT(mac->mac_status < BWN_MAC_STATUS_INITED || \
134 mac->mac_suspended > 0, \
135 ("dont access PHY or RF registers after turning on MAC")); \
136 BWN_PHY_WRITE(mac, dst, BWN_PHY_READ(mac, src)); \
138 #define BWN_LO_CALIB_EXPIRE (1000 * (30 - 2))
139 #define BWN_LO_PWRVEC_EXPIRE (1000 * (30 - 2))
140 #define BWN_LO_TXCTL_EXPIRE (1000 * (180 - 4))
144 #define BWN_BBATTCMP(a, b) ((a)->att == (b)->att)
146 (((a)->att == (b)->att) && ((a)->padmix == (b)->padmix))
147 #define BWN_PIO_WRITE_2(mac, tq, offset, value) \ argument
148 BWN_WRITE_2(mac, (tq)->tq_base + offset, value)
149 #define BWN_PIO_READ_4(mac, tq, offset) \ argument
150 BWN_READ_4(mac, tq->tq_base + offset)
155 #define BWN_BARRIER(mac, offset, length, flags) \ argument
156 bus_barrier((mac)->mac_sc->sc_mem_res, (offset), (length), (flags))
158 (BWN_READ_4(dr->dr_mac, dr->dr_base + offset))
160 (BWN_WRITE_4(dr->dr_mac, dr->dr_base + offset, value))
476 * I'd like the newer PHY code to not hide in the top-level
910 #define BWN_LED_EVENT_NONE -1
975 bwn_tx_hdrsize(struct bwn_mac *mac) in bwn_tx_hdrsize() argument
977 switch (mac->mac_fw.fw_hdr_format) { in bwn_tx_hdrsize()
986 mac->mac_fw.fw_hdr_format); in bwn_tx_hdrsize()
992 * Driver-specific vap state.
1077 mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->sc_dev), \
1079 #define BWN_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_mtx)
1080 #define BWN_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
1081 #define BWN_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
1082 #define BWN_ASSERT_LOCKED(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED)
1085 bwn_channel_band(struct bwn_mac *mac, struct ieee80211_channel *c) in bwn_channel_band() argument
1094 bwn_current_band(struct bwn_mac *mac) in bwn_current_band() argument
1096 struct ieee80211com *ic = &mac->mac_sc->sc_ic; in bwn_current_band()
1097 if (IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan)) in bwn_current_band()
1104 bwn_is_40mhz(struct bwn_mac *mac) in bwn_is_40mhz() argument
1106 struct ieee80211com *ic = &mac->mac_sc->sc_ic; in bwn_is_40mhz()
1108 return !! (IEEE80211_IS_CHAN_HT40(ic->ic_curchan)); in bwn_is_40mhz()
1112 bwn_get_centre_freq(struct bwn_mac *mac) in bwn_get_centre_freq() argument
1115 struct ieee80211com *ic = &mac->mac_sc->sc_ic; in bwn_get_centre_freq()
1117 return ic->ic_curchan->ic_freq; in bwn_get_centre_freq()
1121 bwn_get_chan_centre_freq(struct bwn_mac *mac, struct ieee80211_channel *chan) in bwn_get_chan_centre_freq() argument
1125 return chan->ic_freq; in bwn_get_chan_centre_freq()
1129 bwn_get_chan(struct bwn_mac *mac) in bwn_get_chan() argument
1132 struct ieee80211com *ic = &mac->mac_sc->sc_ic; in bwn_get_chan()
1134 return ic->ic_curchan->ic_ieee; in bwn_get_chan()
1138 bwn_get_channel(struct bwn_mac *mac) in bwn_get_channel() argument
1141 struct ieee80211com *ic = &mac->mac_sc->sc_ic; in bwn_get_channel()
1142 return ic->ic_curchan; in bwn_get_channel()
1146 bwn_is_chan_passive(struct bwn_mac *mac) in bwn_is_chan_passive() argument
1149 struct ieee80211com *ic = &mac->mac_sc->sc_ic; in bwn_is_chan_passive()
1150 return !! IEEE80211_IS_CHAN_PASSIVE(ic->ic_curchan); in bwn_is_chan_passive()
1154 bwn_get_chan_type(struct bwn_mac *mac, struct ieee80211_channel *c) in bwn_get_chan_type() argument
1156 struct ieee80211com *ic = &mac->mac_sc->sc_ic; in bwn_get_chan_type()
1158 c = ic->ic_curchan; in bwn_get_chan_type()
1170 bwn_get_chan_power(struct bwn_mac *mac, struct ieee80211_channel *c) in bwn_get_chan_power() argument
1174 return c->ic_maxpower / 2; in bwn_get_chan_power()