@@ -279,7 +279,7 @@ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t
279
279
/*
280
280
* We should enable retry.. (Need config variable for this)
281
281
*/
282
- SILABS_LOG ("%s : failed. retry: %d" , __func__ , wfx_rsi .join_retries );
282
+ SILABS_LOG ("wfx_rsi_join_cb : failed. retry: %d" , wfx_rsi .join_retries );
283
283
wfx_retry_interval_handler (is_wifi_disconnection_event , wfx_rsi .join_retries ++ );
284
284
if (is_wifi_disconnection_event || wfx_rsi .join_retries <= WFX_RSI_CONFIG_MAX_JOIN )
285
285
{
@@ -292,8 +292,8 @@ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t
292
292
/*
293
293
* Join was complete - Do the DHCP
294
294
*/
295
+ SILABS_LOG ("wfx_rsi_join_cb: success" );
295
296
memset (& temp_reset , 0 , sizeof (wfx_wifi_scan_ext_t ));
296
- SILABS_LOG ("%s: join completed." , __func__ );
297
297
WfxEvent .eventType = WFX_EVT_STA_CONN ;
298
298
WfxPostEvent (& WfxEvent );
299
299
wfx_rsi .join_retries = 0 ;
@@ -313,7 +313,7 @@ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t
313
313
*********************************************************************/
314
314
static void wfx_rsi_join_fail_cb (uint16_t status , uint8_t * buf , uint32_t len )
315
315
{
316
- SILABS_LOG ("%s: error: failed status: %02x" , __func__ , status );
316
+ SILABS_LOG ("wfx_rsi_join_fail_cb: status: %02x" , status );
317
317
WfxEvent_t WfxEvent ;
318
318
wfx_rsi .join_retries += 1 ;
319
319
wfx_rsi .dev_state &= ~(WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED );
@@ -354,31 +354,28 @@ static int32_t wfx_rsi_init(void)
354
354
uint8_t buf [RSI_RESPONSE_HOLD_BUFF_SIZE ];
355
355
extern void rsi_hal_board_init (void );
356
356
357
- SILABS_LOG ("%s : starting(HEAP_SZ = %d)" , __func__ , SL_HEAP_SIZE );
357
+ SILABS_LOG ("wfx_rsi_init : starting(HEAP_SZ = %d)" , SL_HEAP_SIZE );
358
358
//! Driver initialization
359
359
status = rsi_driver_init (wfx_rsi_drv_buf , WFX_RSI_BUF_SZ );
360
360
if ((status < RSI_DRIVER_STATUS ) || (status > WFX_RSI_BUF_SZ ))
361
361
{
362
- SILABS_LOG ("%s: error: RSI Driver initialization failed with status : %02x" , __func__ , status );
362
+ SILABS_LOG ("wfx_rsi_init: rsi_driver_init failed: %02x" , status );
363
363
return status ;
364
364
}
365
-
366
- SILABS_LOG ("%s: rsi_device_init" , __func__ );
367
365
/* ! Redpine module intialisation */
368
366
if ((status = rsi_device_init (LOAD_NWP_FW )) != RSI_SUCCESS )
369
367
{
370
- SILABS_LOG ("%s: error: rsi_device_init failed with status : %02x" , __func__ , status );
368
+ SILABS_LOG ("wfx_rsi_init: rsi_device_init failed: %02x" , status );
371
369
return status ;
372
370
}
373
- SILABS_LOG ("%s: start wireless drv task" , __func__ );
374
371
/*
375
372
* Create the driver task
376
373
*/
377
374
wfx_rsi .drv_task = xTaskCreateStatic ((TaskFunction_t ) rsi_wireless_driver_task , "rsi_drv" , WFX_RSI_WLAN_TASK_SZ , NULL ,
378
375
WLAN_TASK_PRIORITY , driverRsiTaskStack , & driverRsiTaskBuffer );
379
376
if (NULL == wfx_rsi .drv_task )
380
377
{
381
- SILABS_LOG ("%s: error: rsi_wireless_driver_task failed" , __func__ );
378
+ SILABS_LOG ("wfx_rsi_init: failed to create task" );
382
379
return RSI_ERROR_INVALID_PARAM ;
383
380
}
384
381
@@ -389,40 +386,38 @@ static int32_t wfx_rsi_init(void)
389
386
if ((status = rsi_wireless_init (OPER_MODE_0 , COEX_MODE_0 )) != RSI_SUCCESS )
390
387
{
391
388
#endif
392
- SILABS_LOG ("%s: error: Initialize WiSeConnect failed with status : %02x" , __func__ , status );
389
+ SILABS_LOG ("wfx_rsi_init: rsi_wireless_init failed: %02x" , status );
393
390
return status ;
394
391
}
395
392
396
- SILABS_LOG ("%s: get FW version.." , __func__ );
397
393
/*
398
394
* Get the MAC and other info to let the user know about it.
399
395
*/
400
396
if (rsi_wlan_get (RSI_FW_VERSION , buf , sizeof (buf )) != RSI_SUCCESS )
401
397
{
402
- SILABS_LOG ("%s: error: rsi_wlan_get(RSI_FW_VERSION) failed with status : %02x" , __func__ , status );
398
+ SILABS_LOG ("wfx_rsi_init: rsi_wlan_get(RSI_FW_VERSION) failed: %02x" , status );
403
399
return status ;
404
400
}
405
401
406
402
buf [sizeof (buf ) - 1 ] = 0 ;
407
- SILABS_LOG ("%s: RSI firmware version: %s" , __func__ , buf );
403
+ SILABS_LOG ("RSI firmware version: %s" , buf );
408
404
//! Send feature frame
409
405
if ((status = rsi_send_feature_frame ()) != RSI_SUCCESS )
410
406
{
411
- SILABS_LOG ("%s: error: rsi_send_feature_frame failed with status : %02x" , __func__ , status );
407
+ SILABS_LOG ("error: rsi_send_feature_frame failed: %02x" , status );
412
408
return status ;
413
409
}
414
410
415
- SILABS_LOG ("%s: sent rsi_send_feature_frame" , __func__ );
416
411
/* initializes wlan radio parameters and WLAN supplicant parameters.
417
412
*/
418
413
(void ) rsi_wlan_radio_init (); /* Required so we can get MAC address */
419
414
if ((status = rsi_wlan_get (RSI_MAC_ADDRESS , & wfx_rsi .sta_mac .octet [0 ], RESP_BUFF_SIZE )) != RSI_SUCCESS )
420
415
{
421
- SILABS_LOG ("%s: error: rsi_wlan_get failed with status : %02x" , __func__ , status );
416
+ SILABS_LOG ("wfx_rsi_init: rsi_wlan_get(RSI_MAC_ADDRESS) failed: %02x" , status );
422
417
return status ;
423
418
}
424
419
425
- SILABS_LOG ("%s: WLAN: MAC %02x:%02x:%02x %02x:%02x:%02x" , __func__ , wfx_rsi .sta_mac .octet [0 ], wfx_rsi .sta_mac .octet [1 ],
420
+ SILABS_LOG ("wfx_rsi_init: MAC: %02x:%02x:%02x %02x:%02x:%02x" , wfx_rsi .sta_mac .octet [0 ], wfx_rsi .sta_mac .octet [1 ],
426
421
wfx_rsi .sta_mac .octet [2 ], wfx_rsi .sta_mac .octet [3 ], wfx_rsi .sta_mac .octet [4 ], wfx_rsi .sta_mac .octet [5 ]);
427
422
428
423
// Create the message queue
@@ -445,12 +440,12 @@ static int32_t wfx_rsi_init(void)
445
440
*/
446
441
if ((status = rsi_wlan_register_callbacks (RSI_JOIN_FAIL_CB , wfx_rsi_join_fail_cb )) != RSI_SUCCESS )
447
442
{
448
- SILABS_LOG ("%s: RSI callback register join failed with status : %02x" , __func__ , status );
443
+ SILABS_LOG ("wfx_rsi_init: rsi_wlan_register_callbacks failed: %02x" , status );
449
444
return status ;
450
445
}
451
446
if ((status = rsi_wlan_register_callbacks (RSI_WLAN_DATA_RECEIVE_NOTIFY_CB , wfx_rsi_wlan_pkt_cb )) != RSI_SUCCESS )
452
447
{
453
- SILABS_LOG ("%s: RSI callback register data-notify failed with status: %02x" , __func__ , status );
448
+ SILABS_LOG ("wfx_rsi_init: rsi_wlan_register_callbacks failed with status: %02x" , status );
454
449
return status ;
455
450
}
456
451
@@ -459,7 +454,7 @@ static int32_t wfx_rsi_init(void)
459
454
#endif
460
455
461
456
wfx_rsi .dev_state |= WFX_RSI_ST_DEV_READY ;
462
- SILABS_LOG ("%s: RSI: OK" , __func__ );
457
+ SILABS_LOG ("wfx_rsi_init: success" );
463
458
return RSI_SUCCESS ;
464
459
}
465
460
@@ -488,7 +483,7 @@ static void wfx_rsi_save_ap_info() // translation
488
483
#else /* !WIFI_ENABLE_SECURITY_WPA3_TRANSITION */
489
484
wfx_rsi .sec .security = WFX_SEC_WPA2 ;
490
485
#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */
491
- SILABS_LOG ("%s: warn: failed with status: %02x" , __func__ , status );
486
+ SILABS_LOG ("warn: scan failed with status: %02x" , status );
492
487
return ;
493
488
}
494
489
wfx_rsi .sec .security = WFX_SEC_UNSPECIFIED ;
@@ -524,7 +519,7 @@ static void wfx_rsi_save_ap_info() // translation
524
519
break ;
525
520
}
526
521
527
- SILABS_LOG ("%s: WLAN: connecting to %s, sec=%d, status=%02x" , __func__ , & wfx_rsi .sec .ssid [0 ], wfx_rsi .sec .security , status );
522
+ SILABS_LOG ("wfx_rsi_save_ap_info: connecting to %s, sec=%d, status=%02x" , & wfx_rsi .sec .ssid [0 ], wfx_rsi .sec .security , status );
528
523
}
529
524
530
525
/********************************************************************************************
@@ -541,7 +536,7 @@ static void wfx_rsi_do_join(void)
541
536
542
537
if (wfx_rsi .dev_state & (WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED ))
543
538
{
544
- SILABS_LOG ("%s: not joining - already in progress" , __func__ );
539
+ SILABS_LOG ("wfx_rsi_do_join: already in progress" );
545
540
}
546
541
else
547
542
{
@@ -564,11 +559,11 @@ static void wfx_rsi_do_join(void)
564
559
connect_security_mode = RSI_OPEN ;
565
560
break ;
566
561
default :
567
- SILABS_LOG ("%s : error: unknown security type." , __func__ );
562
+ SILABS_LOG ("wfx_rsi_do_join : error: unknown security type." );
568
563
return ;
569
564
}
570
565
571
- SILABS_LOG ("%s: WLAN: connecting to %s, sec=%d" , __func__ , & wfx_rsi .sec .ssid [0 ], wfx_rsi .sec .security );
566
+ SILABS_LOG ("wfx_rsi_do_join: connecting to %s, sec=%d" , & wfx_rsi .sec .ssid [0 ], wfx_rsi .sec .security );
572
567
573
568
/*
574
569
* Join the network
@@ -580,7 +575,7 @@ static void wfx_rsi_do_join(void)
580
575
581
576
if ((status = rsi_wlan_register_callbacks (RSI_JOIN_FAIL_CB , wfx_rsi_join_fail_cb )) != RSI_SUCCESS )
582
577
{
583
- SILABS_LOG ("%s: RSI callback register join failed with status : %02x" , __func__ , status );
578
+ SILABS_LOG ("wfx_rsi_do_join: rsi_wlan_register_callbacks failed: %02x" , status );
584
579
}
585
580
586
581
/* Try to connect Wifi with given Credentials
@@ -596,14 +591,14 @@ static void wfx_rsi_do_join(void)
596
591
{
597
592
598
593
wfx_rsi .dev_state &= ~WFX_RSI_ST_STA_CONNECTING ;
599
- SILABS_LOG ("%s : rsi_wlan_connect_async failed with status : %02x on try %d" , __func__ , status , wfx_rsi .join_retries );
594
+ SILABS_LOG ("wfx_rsi_do_join : rsi_wlan_connect_async failed: %02x on try %d" , status , wfx_rsi .join_retries );
600
595
601
596
wfx_retry_interval_handler (is_wifi_disconnection_event , wfx_rsi .join_retries );
602
597
wfx_rsi .join_retries ++ ;
603
598
}
604
599
else
605
600
{
606
- SILABS_LOG ("%s : starting JOIN to %s after %d tries\n" , __func__ , (char * ) & wfx_rsi .sec .ssid [0 ],
601
+ SILABS_LOG ("wfx_rsi_do_join : starting join to %s after %d tries" , (char * ) & wfx_rsi .sec .ssid [0 ],
607
602
wfx_rsi .join_retries );
608
603
break ; // exit while loop
609
604
}
@@ -701,7 +696,7 @@ void ProcessEvent(WfxEvent_t inEvent)
701
696
switch (inEvent .eventType )
702
697
{
703
698
case WFX_EVT_STA_CONN :
704
- SILABS_LOG ("%s: starting LwIP STA" , __func__ );
699
+ SILABS_LOG ("_onWFXEvent: WFX_EVT_STA_CONN" );
705
700
wfx_rsi .dev_state |= WFX_RSI_ST_STA_CONNECTED ;
706
701
ResetDHCPNotificationFlags ();
707
702
wfx_lwip_set_sta_link_up ();
@@ -712,10 +707,10 @@ void ProcessEvent(WfxEvent_t inEvent)
712
707
// is independant of IP connectivity.
713
708
break ;
714
709
case WFX_EVT_STA_DISCONN :
710
+ SILABS_LOG ("_onWFXEvent: WFX_EVT_STA_DISCONN" );
715
711
// TODO: This event is not being posted anywhere, seems to be a dead code or we are missing something
716
712
wfx_rsi .dev_state &=
717
713
~(WFX_RSI_ST_STA_READY | WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED | WFX_RSI_ST_STA_DHCP_DONE );
718
- SILABS_LOG ("%s: disconnect notify" , __func__ );
719
714
/* TODO: Implement disconnect notify */
720
715
ResetDHCPNotificationFlags ();
721
716
wfx_lwip_set_sta_link_down (); // Internally dhcpclient_poll(netif) ->
@@ -736,32 +731,30 @@ void ProcessEvent(WfxEvent_t inEvent)
736
731
rsi_rsp_scan_t scan_rsp = { 0 };
737
732
int32_t status = rsi_wlan_bgscan_profile (1 , & scan_rsp , sizeof (scan_rsp ));
738
733
739
- if (status )
734
+ if (status != RSI_SUCCESS )
740
735
{
741
- SILABS_LOG ("SSID scan failed: %02x " , status );
736
+ SILABS_LOG ("rsi_wlan_bgscan failed: %02x " , status );
737
+ return ;
742
738
}
743
- else
739
+ rsi_scan_info_t * scan ;
740
+ wfx_wifi_scan_result_t ap ;
741
+ for (int x = 0 ; x < scan_rsp .scan_count [0 ]; x ++ )
744
742
{
745
- rsi_scan_info_t * scan ;
746
- wfx_wifi_scan_result_t ap ;
747
- for ( int x = 0 ; x < scan_rsp . scan_count [ 0 ]; x ++ )
743
+ scan = & scan_rsp . scan_info [ x ] ;
744
+ // is it a scan all or target scan
745
+ if (! wfx_rsi . scan_ssid || ( wfx_rsi . scan_ssid && strcmp ( wfx_rsi . scan_ssid , ( char * ) scan -> ssid ) == CMP_SUCCESS ) )
748
746
{
749
- scan = & scan_rsp .scan_info [x ];
750
- // is it a scan all or target scan
751
- if (!wfx_rsi .scan_ssid || (wfx_rsi .scan_ssid && strcmp (wfx_rsi .scan_ssid , (char * ) scan -> ssid ) == CMP_SUCCESS ))
747
+ strncpy (ap .ssid , (char * ) scan -> ssid , MIN (sizeof (ap .ssid ), sizeof (scan -> ssid )));
748
+ ap .security = scan -> security_mode ;
749
+ ap .rssi = (-1 ) * scan -> rssi_val ;
750
+ configASSERT (sizeof (ap .bssid ) >= BSSID_LEN );
751
+ configASSERT (sizeof (scan -> bssid ) >= BSSID_LEN );
752
+ memcpy (ap .bssid , scan -> bssid , BSSID_LEN );
753
+ (* wfx_rsi .scan_cb )(& ap );
754
+
755
+ if (wfx_rsi .scan_ssid )
752
756
{
753
- strncpy (ap .ssid , (char * ) scan -> ssid , MIN (sizeof (ap .ssid ), sizeof (scan -> ssid )));
754
- ap .security = scan -> security_mode ;
755
- ap .rssi = (-1 ) * scan -> rssi_val ;
756
- configASSERT (sizeof (ap .bssid ) >= BSSID_LEN );
757
- configASSERT (sizeof (scan -> bssid ) >= BSSID_LEN );
758
- memcpy (ap .bssid , scan -> bssid , BSSID_LEN );
759
- (* wfx_rsi .scan_cb )(& ap );
760
-
761
- if (wfx_rsi .scan_ssid )
762
- {
763
- break ; // we found the targeted ssid.
764
- }
757
+ break ; // we found the targeted ssid.
765
758
}
766
759
}
767
760
}
@@ -813,7 +806,7 @@ void wfx_rsi_task(void * arg)
813
806
uint32_t rsi_status = wfx_rsi_init ();
814
807
if (rsi_status != RSI_SUCCESS )
815
808
{
816
- SILABS_LOG ("%s: error: wfx_rsi_init with status: %02x" , __func__ , rsi_status );
809
+ SILABS_LOG ("error: wfx_rsi_init with status: %02x" , rsi_status );
817
810
return ;
818
811
}
819
812
WfxEvent_t wfxEvent ;
@@ -853,8 +846,7 @@ void wfx_dhcp_got_ipv4(uint32_t ip)
853
846
wfx_rsi .ip4_addr [1 ] = (ip >> 8 ) & HEX_VALUE_FF ;
854
847
wfx_rsi .ip4_addr [2 ] = (ip >> 16 ) & HEX_VALUE_FF ;
855
848
wfx_rsi .ip4_addr [3 ] = (ip >> 24 ) & HEX_VALUE_FF ;
856
- SILABS_LOG ("%s: DHCP OK: IP=%d.%d.%d.%d" , __func__ , wfx_rsi .ip4_addr [0 ], wfx_rsi .ip4_addr [1 ], wfx_rsi .ip4_addr [2 ],
857
- wfx_rsi .ip4_addr [3 ]);
849
+ SILABS_LOG ("DHCP OK: IP=%d.%d.%d.%d" , wfx_rsi .ip4_addr [0 ], wfx_rsi .ip4_addr [1 ], wfx_rsi .ip4_addr [2 ], wfx_rsi .ip4_addr [3 ]);
858
850
/* Notify the Connectivity Manager - via the app */
859
851
wfx_rsi .dev_state |= WFX_RSI_ST_STA_DHCP_DONE ;
860
852
wfx_ip_changed_notify (IP_STATUS_SUCCESS );
0 commit comments