This source file includes following definitions.
- PSvEnablePowerSaving
- PSvDisablePowerSaving
- PSbIsNextTBTTWakeUp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #include "mac.h"
27 #include "device.h"
28 #include "power.h"
29 #include "card.h"
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 void PSvEnablePowerSaving(struct vnt_private *priv,
52 unsigned short wListenInterval)
53 {
54 u16 wAID = priv->current_aid | BIT(14) | BIT(15);
55
56
57 VNSvOutPortW(priv->PortOffset + MAC_REG_PWBT, C_PWBT);
58 if (priv->op_mode != NL80211_IFTYPE_ADHOC) {
59
60 VNSvOutPortW(priv->PortOffset + MAC_REG_AIDATIM, wAID);
61 } else {
62
63 #if 0
64 MACvWriteATIMW(priv->PortOffset, pMgmt->wCurrATIMWindow);
65 #endif
66 }
67
68 MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
69
70 MACvRegBitsOn(priv->PortOffset, MAC_REG_TFTCTL, TFTCTL_HWUTSF);
71
72 if (wListenInterval >= 2) {
73
74 MACvRegBitsOff(priv->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
75
76 MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_LNBCN);
77 } else {
78
79 MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
80 }
81
82
83 MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_PSEN);
84 priv->bEnablePSMode = true;
85
86 priv->bPWBitOn = true;
87 pr_debug("PS:Power Saving Mode Enable...\n");
88 }
89
90
91
92
93
94
95
96
97
98
99
100 void
101 PSvDisablePowerSaving(
102 struct vnt_private *priv
103 )
104 {
105
106 MACbPSWakeup(priv);
107
108 MACvRegBitsOff(priv->PortOffset, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
109
110 MACvRegBitsOff(priv->PortOffset, MAC_REG_TFTCTL, TFTCTL_HWUTSF);
111
112 MACvRegBitsOn(priv->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
113
114 priv->bEnablePSMode = false;
115
116 priv->bPWBitOn = false;
117 }
118
119
120
121
122
123
124
125
126
127
128
129 bool
130 PSbIsNextTBTTWakeUp(
131 struct vnt_private *priv
132 )
133 {
134 struct ieee80211_hw *hw = priv->hw;
135 struct ieee80211_conf *conf = &hw->conf;
136 bool wake_up = false;
137
138 if (conf->listen_interval > 1) {
139 if (!priv->wake_up_count)
140 priv->wake_up_count = conf->listen_interval;
141
142 --priv->wake_up_count;
143
144 if (priv->wake_up_count == 1) {
145
146 MACvRegBitsOn(priv->PortOffset,
147 MAC_REG_PSCTL, PSCTL_LNBCN);
148 wake_up = true;
149 }
150 }
151
152 return wake_up;
153 }