Skip to content

Commit 710e7b2

Browse files
committed
less verbose cyw driver
1 parent 666a3b6 commit 710e7b2

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

mongoose.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21729,7 +21729,7 @@ static bool cyw_wifi_connect(char *ssid, char *pass) {
2172921729
uint32_t data[64/4 + 1]; // max pass length: 64 for WPA, 128 for WPA3 SAE
2173021730
uint16_t *da = (uint16_t *) data;
2173121731
unsigned int len;
21732-
uint32_t val;
21732+
uint32_t val;
2173321733
val = 4; // security type: 0 for none, 2 for WPA, 4 for WPA2/WPA3, 6 for mixed WPA/WPA2
2173421734
// sup_wpa[1] = 0 if not using security
2173521735
if (!(cyw_ioctl_set(134 /* SET_WSEC */, (uint8_t *)&val, sizeof(val))
@@ -21771,7 +21771,7 @@ static bool cyw_wifi_ap_start(char *ssid, char *pass, unsigned int channel) {
2177121771
uint32_t data[64/4 + 2]; // max pass length: 64 for WPA, 128 for WPA3 SAE
2177221772
uint16_t *da = (uint16_t *) data;
2177321773
unsigned int len;
21774-
uint32_t val;
21774+
uint32_t val;
2177521775
// CHIP DEPENDENCY
2177621776
// RPi set the AMPDU parameter for AP (window size = 2) *****************
2177721777
// val = 2 ; cyw_ioctl_iovar_set_(0, "ampdu_ba_wsize", (uint8_t *)&val, sizeof(val));
@@ -21800,10 +21800,10 @@ static bool cyw_wifi_ap_start(char *ssid, char *pass, unsigned int channel) {
2180021800
da[1] = 1; // indicates wireless security key, skip for WPA3 SAE
2180121801
memcpy((uint8_t *)data + 2 * sizeof(uint16_t), pass, len); // skip for WPA3 SAE
2180221802
if (!cyw_ioctl_set_(1, 268 /* SET_WSEC_PMK */, data, sizeof(data))) return false; // skip for WPA3 SAE, sizeof/2 if supporting SAE but using WPA
21803-
/* for WPA3 SAE:
21803+
/* for WPA3 SAE:
2180421804
memcpy((uint8_t *)data + sizeof(uint16_t), pass, len);
2180521805
cyw_ioctl_iovar_set_(1, "sae_password", data, sizeof(data)); */
21806-
/* for WPA3 or mixed WPA2/WPA3:
21806+
/* for WPA3 or mixed WPA2/WPA3:
2180721807
val = 5 ; cyw_ioctl_iovar_set_(1, "sae_max_pwe_loop", (uint8_t *)&val, sizeof(val)); // Some chipsets do not support this */
2180821808
// resume if not using auth
2180921809

@@ -21949,7 +21949,7 @@ static void cyw_handle_scan_result(uint32_t status, struct scan_result *data, si
2194921949
bss.band = band & CYW_BSS_BAND2G ? MG_WIFI_BAND_2G : MG_WIFI_BAND_5G;
2195021950
bss.security = (sbss->capability & MG_BIT(4) /* CAP_PRIVACY */) ? MG_WIFI_SECURITY_WEP : MG_WIFI_SECURITY_OPEN;
2195121951
{ // travel IEs (Information Elements) in search of security definitions
21952-
const uint8_t wot1[4] = {0x00, 0x50, 0xf2, 0x01}; // WPA_OUI_TYPE1
21952+
const uint8_t wot1[4] = {0x00, 0x50, 0xf2, 0x01}; // WPA_OUI_TYPE1
2195321953
uint8_t *ie = (uint8_t *)sbss + sbss->ie_offset;
2195421954
int bytes = (int) sbss->ie_length;
2195521955
while (bytes > 0 && ie[1] + 2 < bytes) { // ie[0] -> type, ie[1] -> bytes from ie[2]
@@ -21960,11 +21960,11 @@ static void cyw_handle_scan_result(uint32_t status, struct scan_result *data, si
2196021960
bytes -= ie[1] + 2;
2196121961
}
2196221962
}
21963-
MG_VERBOSE(("BSS: %.*s (%u) (%M) %d dBm %u", bss.SSID.len, bss.SSID.buf, bss.channel, mg_print_mac, bss.BSSID, (int) bss.RSSI, bss.security));
21963+
MG_VERBOSE(("BSS: %.*s (%u) (%M) %d dBm %u", bss.SSID.len, bss.SSID.buf, bss.channel, mg_print_mac, bss.BSSID, (int) bss.RSSI, bss.security));
2196421964
mg_tcpip_call(s_ifp, MG_TCPIP_EV_WIFI_SCAN_RESULT, &bss);
2196521965
} else {
2196621966
MG_ERROR(("scan error"));
21967-
}
21967+
}
2196821968
}
2196921969
// clang-format on
2197021970

@@ -21986,7 +21986,7 @@ static void cyw_handle_cdc(struct cdc_hdr *cdc, size_t len) {
2198621986
return;
2198721987
}
2198821988
if (mg_log_level >= MG_LL_VERBOSE) mg_hexdump((void *) cdc, len);
21989-
MG_DEBUG(("IOCTL result: %02x %02x %02x %02x ...", r[0], r[1], r[2], r[3]));
21989+
MG_VERBOSE(("IOCTL result: %02x %02x %02x %02x ..", r[0], r[1], r[2], r[3]));
2199021990
s_ioctl_resp = r;
2199121991
}
2199221992
// NOTE(): alt no loop handler dispatching IOCTL response to current handler:
@@ -22156,7 +22156,7 @@ static bool cyw_init(uint8_t *mac) {
2215622156
// CHIP DEPENDENCY
2215722157
val = 8 ; cyw_ioctl_iovar_set("ampdu_ba_wsize", (uint8_t *)&val, sizeof(val));
2215822158
val = 4 ; cyw_ioctl_iovar_set("ampdu_mpdu", (uint8_t *)&val, sizeof(val));
22159-
val = 0 /* 8K */; cyw_ioctl_iovar_set("ampdu_rx_factor", (uint8_t *)&val, sizeof(val));
22159+
val = 0 /* 8K */; cyw_ioctl_iovar_set("ampdu_rx_factor", (uint8_t *)&val, sizeof(val));
2216022160
//
2216122161
{
2216222162
struct cyw_country c;
@@ -22374,7 +22374,7 @@ static bool cyw_load_fwll(void *fwdata, size_t fwlen, void *nvramdata, size_t nv
2237422374
cyw_load_data(CYW_CHIP_ATCMRAM_BASE, fwdata, fwlen);
2237522375
mg_delayms(5); // TODO(scaprile): CHECK IF THIS IS ACTUALLY NEEDED
2237622376
// Load NVRAM and place 'length ~length' at the end; end of chip RAM
22377-
{
22377+
{
2237822378
const uint32_t start = CYW_CHIP_RAM_SIZE - 4 - nvramlen;
2237922379
cyw_load_data(start, nvramdata, nvramlen); // nvramlen must be a multiple of 4
2238022380
// RAM_SIZE is a multiple of WINSZ, so the place for len ~len will be at the end of the window
@@ -22665,7 +22665,7 @@ static bool cyw_sdio_init() {
2266522665
struct mg_tcpip_sdio *s = (struct mg_tcpip_sdio *) d->bus;
2266622666
uint32_t val = 0;
2266722667
if (!mg_sdio_init(s)) return false;
22668-
// no block transfers on F0. if (!mg_sdio_set_blksz(s, CYW_SDIO_FUNC_BUS, 32)) return false;
22668+
// no block transfers on F0. if (!mg_sdio_set_blksz(s, CYW_SDIO_FUNC_BUS, 32)) return false;
2266922669
if (!mg_sdio_set_blksz(s, CYW_SDIO_FUNC_CHIP, 64)) return false;
2267022670
if (!mg_sdio_set_blksz(s, CYW_SDIO_FUNC_WLAN, 64)) return false;
2267122671
// TODO(scaprile): we don't handle SDIO interrupts, study CCCR INTEN and SDIO support (SDIO 6.3, 8)

src/drivers/cyw.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ static bool cyw_wifi_connect(char *ssid, char *pass) {
359359
uint32_t data[64/4 + 1]; // max pass length: 64 for WPA, 128 for WPA3 SAE
360360
uint16_t *da = (uint16_t *) data;
361361
unsigned int len;
362-
uint32_t val;
362+
uint32_t val;
363363
val = 4; // security type: 0 for none, 2 for WPA, 4 for WPA2/WPA3, 6 for mixed WPA/WPA2
364364
// sup_wpa[1] = 0 if not using security
365365
if (!(cyw_ioctl_set(134 /* SET_WSEC */, (uint8_t *)&val, sizeof(val))
@@ -401,7 +401,7 @@ static bool cyw_wifi_ap_start(char *ssid, char *pass, unsigned int channel) {
401401
uint32_t data[64/4 + 2]; // max pass length: 64 for WPA, 128 for WPA3 SAE
402402
uint16_t *da = (uint16_t *) data;
403403
unsigned int len;
404-
uint32_t val;
404+
uint32_t val;
405405
// CHIP DEPENDENCY
406406
// RPi set the AMPDU parameter for AP (window size = 2) *****************
407407
// val = 2 ; cyw_ioctl_iovar_set_(0, "ampdu_ba_wsize", (uint8_t *)&val, sizeof(val));
@@ -430,10 +430,10 @@ static bool cyw_wifi_ap_start(char *ssid, char *pass, unsigned int channel) {
430430
da[1] = 1; // indicates wireless security key, skip for WPA3 SAE
431431
memcpy((uint8_t *)data + 2 * sizeof(uint16_t), pass, len); // skip for WPA3 SAE
432432
if (!cyw_ioctl_set_(1, 268 /* SET_WSEC_PMK */, data, sizeof(data))) return false; // skip for WPA3 SAE, sizeof/2 if supporting SAE but using WPA
433-
/* for WPA3 SAE:
433+
/* for WPA3 SAE:
434434
memcpy((uint8_t *)data + sizeof(uint16_t), pass, len);
435435
cyw_ioctl_iovar_set_(1, "sae_password", data, sizeof(data)); */
436-
/* for WPA3 or mixed WPA2/WPA3:
436+
/* for WPA3 or mixed WPA2/WPA3:
437437
val = 5 ; cyw_ioctl_iovar_set_(1, "sae_max_pwe_loop", (uint8_t *)&val, sizeof(val)); // Some chipsets do not support this */
438438
// resume if not using auth
439439

@@ -579,7 +579,7 @@ static void cyw_handle_scan_result(uint32_t status, struct scan_result *data, si
579579
bss.band = band & CYW_BSS_BAND2G ? MG_WIFI_BAND_2G : MG_WIFI_BAND_5G;
580580
bss.security = (sbss->capability & MG_BIT(4) /* CAP_PRIVACY */) ? MG_WIFI_SECURITY_WEP : MG_WIFI_SECURITY_OPEN;
581581
{ // travel IEs (Information Elements) in search of security definitions
582-
const uint8_t wot1[4] = {0x00, 0x50, 0xf2, 0x01}; // WPA_OUI_TYPE1
582+
const uint8_t wot1[4] = {0x00, 0x50, 0xf2, 0x01}; // WPA_OUI_TYPE1
583583
uint8_t *ie = (uint8_t *)sbss + sbss->ie_offset;
584584
int bytes = (int) sbss->ie_length;
585585
while (bytes > 0 && ie[1] + 2 < bytes) { // ie[0] -> type, ie[1] -> bytes from ie[2]
@@ -590,11 +590,11 @@ static void cyw_handle_scan_result(uint32_t status, struct scan_result *data, si
590590
bytes -= ie[1] + 2;
591591
}
592592
}
593-
MG_VERBOSE(("BSS: %.*s (%u) (%M) %d dBm %u", bss.SSID.len, bss.SSID.buf, bss.channel, mg_print_mac, bss.BSSID, (int) bss.RSSI, bss.security));
593+
MG_VERBOSE(("BSS: %.*s (%u) (%M) %d dBm %u", bss.SSID.len, bss.SSID.buf, bss.channel, mg_print_mac, bss.BSSID, (int) bss.RSSI, bss.security));
594594
mg_tcpip_call(s_ifp, MG_TCPIP_EV_WIFI_SCAN_RESULT, &bss);
595595
} else {
596596
MG_ERROR(("scan error"));
597-
}
597+
}
598598
}
599599
// clang-format on
600600

@@ -616,7 +616,7 @@ static void cyw_handle_cdc(struct cdc_hdr *cdc, size_t len) {
616616
return;
617617
}
618618
if (mg_log_level >= MG_LL_VERBOSE) mg_hexdump((void *) cdc, len);
619-
MG_DEBUG(("IOCTL result: %02x %02x %02x %02x ...", r[0], r[1], r[2], r[3]));
619+
MG_VERBOSE(("IOCTL result: %02x %02x %02x %02x ..", r[0], r[1], r[2], r[3]));
620620
s_ioctl_resp = r;
621621
}
622622
// NOTE(): alt no loop handler dispatching IOCTL response to current handler:
@@ -786,7 +786,7 @@ static bool cyw_init(uint8_t *mac) {
786786
// CHIP DEPENDENCY
787787
val = 8 ; cyw_ioctl_iovar_set("ampdu_ba_wsize", (uint8_t *)&val, sizeof(val));
788788
val = 4 ; cyw_ioctl_iovar_set("ampdu_mpdu", (uint8_t *)&val, sizeof(val));
789-
val = 0 /* 8K */; cyw_ioctl_iovar_set("ampdu_rx_factor", (uint8_t *)&val, sizeof(val));
789+
val = 0 /* 8K */; cyw_ioctl_iovar_set("ampdu_rx_factor", (uint8_t *)&val, sizeof(val));
790790
//
791791
{
792792
struct cyw_country c;
@@ -1004,7 +1004,7 @@ static bool cyw_load_fwll(void *fwdata, size_t fwlen, void *nvramdata, size_t nv
10041004
cyw_load_data(CYW_CHIP_ATCMRAM_BASE, fwdata, fwlen);
10051005
mg_delayms(5); // TODO(scaprile): CHECK IF THIS IS ACTUALLY NEEDED
10061006
// Load NVRAM and place 'length ~length' at the end; end of chip RAM
1007-
{
1007+
{
10081008
const uint32_t start = CYW_CHIP_RAM_SIZE - 4 - nvramlen;
10091009
cyw_load_data(start, nvramdata, nvramlen); // nvramlen must be a multiple of 4
10101010
// RAM_SIZE is a multiple of WINSZ, so the place for len ~len will be at the end of the window
@@ -1295,7 +1295,7 @@ static bool cyw_sdio_init() {
12951295
struct mg_tcpip_sdio *s = (struct mg_tcpip_sdio *) d->bus;
12961296
uint32_t val = 0;
12971297
if (!mg_sdio_init(s)) return false;
1298-
// no block transfers on F0. if (!mg_sdio_set_blksz(s, CYW_SDIO_FUNC_BUS, 32)) return false;
1298+
// no block transfers on F0. if (!mg_sdio_set_blksz(s, CYW_SDIO_FUNC_BUS, 32)) return false;
12991299
if (!mg_sdio_set_blksz(s, CYW_SDIO_FUNC_CHIP, 64)) return false;
13001300
if (!mg_sdio_set_blksz(s, CYW_SDIO_FUNC_WLAN, 64)) return false;
13011301
// TODO(scaprile): we don't handle SDIO interrupts, study CCCR INTEN and SDIO support (SDIO 6.3, 8)

0 commit comments

Comments
 (0)