Skip to content

Commit a7f64ac

Browse files
nxf58150mmahadevan108
authored andcommitted
mcux: wifi_nxp: Add compiler flag for the wake_timer
Add new compiler flag CONFIG_WAKE_TIMER_ENABLE for the wake_timer. The duration of this timer is 5 seconds and it is used to block low power mode for 5 seconds after device wakes up from low power mode. User can choose to enable this timer or not by controlling this compiler flag. Signed-off-by: Hui Bai <[email protected]>
1 parent b374adf commit a7f64ac

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

mcux/middleware/wifi_nxp/incl/nxp_wifi.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,10 @@ extern "C" {
329329
#define CONFIG_HOST_SLEEP 1
330330
#endif
331331

332+
#if CONFIG_NXP_WIFI_WAKE_TIMER_ENABLE
333+
#define CONFIG_WAKE_TIMER_ENABLE 1
334+
#endif
335+
332336
#if CONFIG_PM
333337
#define CONFIG_POWER_MANAGER 1
334338
#endif

mcux/middleware/wifi_nxp/wlcmgr/wlan.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,10 @@ int wlan_host_sleep_state = HOST_SLEEP_PERIODIC;
281281
*/
282282
bool usart_suspend_flag = false;
283283
#endif
284+
#if CONFIG_WAKE_TIMER_ENABLE
284285
OSA_TIMER_HANDLE_DEFINE(wake_timer);
285286
#endif
287+
#endif
286288
int is_hs_handshake_done = 0;
287289
/* indicate that we did not notify FW after host sleep wake up */
288290
bool skip_hs_handshake = false;
@@ -1029,12 +1031,14 @@ status_t wlan_hs_send_event(int id, void *data)
10291031
#endif
10301032

10311033
#if CONFIG_POWER_MANAGER
1034+
#if CONFIG_WAKE_TIMER_ENABLE
10321035
static void wake_timer_cb(osa_timer_arg_t arg)
10331036
{
10341037
if(wakelock_isheld())
10351038
wakelock_put();
10361039
}
10371040
#endif
1041+
#endif
10381042

10391043
#if CONFIG_MEF_CFG
10401044
int wlan_wowlan_config(uint8_t is_mef, t_u32 wake_up_conds)
@@ -1164,11 +1168,13 @@ void wlan_config_host_sleep(bool is_manual, t_u8 is_periodic)
11641168
#if CONFIG_POWER_MANAGER
11651169
/* Reset flag and stop timer if manual mode is selected without cancel periodic sleep */
11661170
wlan_host_sleep_state = HOST_SLEEP_DISABLE;
1171+
#if CONFIG_WAKE_TIMER_ENABLE
11671172
if (OSA_TimerIsRunning((osa_timer_handle_t)wake_timer))
11681173
{
11691174
OSA_TimerDeactivate((osa_timer_handle_t)wake_timer);
11701175
wakelock_put();
11711176
}
1177+
#endif
11721178
#endif
11731179
}
11741180
}
@@ -1205,13 +1211,15 @@ void wlan_clear_host_sleep_config(void)
12051211
#if CONFIG_UART_INTERRUPT
12061212
usart_suspend_flag = MFALSE;
12071213
#endif
1214+
#if CONFIG_WAKE_TIMER_ENABLE
12081215
if (OSA_TimerIsRunning((osa_timer_handle_t)wake_timer))
12091216
{
12101217
OSA_TimerDeactivate((osa_timer_handle_t)wake_timer);
12111218
wakelock_put();
12121219
}
12131220
is_hs_handshake_done = 0;
12141221
#endif
1222+
#endif
12151223
#if CONFIG_MEF_CFG
12161224
memset(&g_flt_cfg, 0x0, sizeof(wlan_flt_cfg_t));
12171225

@@ -10746,12 +10754,14 @@ static void wlcmgr_mon_task(void * data)
1074610754
struct wlan_message msg;
1074710755

1074810756
#if CONFIG_POWER_MANAGER
10757+
#if CONFIG_WAKE_TIMER_ENABLE
1074910758
status = OSA_TimerCreate((osa_timer_handle_t)wake_timer, MSEC_TO_TICK(WAKE_TIMEOUT),
1075010759
&wake_timer_cb, NULL, KOSA_TimerOnce, OSA_TIMER_NO_ACTIVATE);
1075110760
if (status != KOSA_StatusSuccess)
1075210761
{
1075310762
wlcm_e("Unable to create wake timer");
1075410763
}
10764+
#endif
1075510765
#endif
1075610766
while (1)
1075710767
{
@@ -10775,13 +10785,15 @@ static void wlcmgr_mon_task(void * data)
1077510785
{
1077610786
#if CONFIG_POWER_MANAGER
1077710787
#ifndef CONFIG_BT
10788+
#if CONFIG_WAKE_TIMER_ENABLE
1077810789
if(!wlan_is_manual && wlan_host_sleep_state == HOST_SLEEP_PERIODIC)
1077910790
{
1078010791
wakelock_get();
1078110792
(void)OSA_TimerActivate((osa_timer_handle_t)wake_timer);
1078210793
}
1078310794
#endif
1078410795
#endif
10796+
#endif
1078510797
#ifndef RW610
1078610798
uint16_t hs_wakeup_reason = 0;
1078710799
(void)wifi_get_wakeup_reason(&hs_wakeup_reason);
@@ -10796,6 +10808,7 @@ static void wlcmgr_mon_task(void * data)
1079610808
#endif
1079710809
}
1079810810
#ifndef CONFIG_BT
10811+
#if CONFIG_WAKE_TIMER_ENABLE
1079910812
else if (msg.id == HOST_SLEEP_HANDSHAKE_SKIP)
1080010813
{
1080110814
if(wlan_host_sleep_state == HOST_SLEEP_PERIODIC)
@@ -10806,6 +10819,7 @@ static void wlcmgr_mon_task(void * data)
1080610819
}
1080710820
#endif
1080810821
#endif
10822+
#endif
1080910823
#if CONFIG_WIFI_RECOVERY
1081010824
else if (msg.id == WIFI_RECOVERY_REQ)
1081110825
{

0 commit comments

Comments
 (0)