@@ -4374,7 +4374,7 @@ static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req,
43744374 if (ifp->enable_req_dns) *p++ = 6; // DNS
43754375 if (ifp->enable_req_sntp) *p++ = 42; // SNTP
43764376 *p++ = 255; // End of options
4377- assert((size_t) (p - opts) < olen);
4377+ // assert((size_t) (p - opts) < olen);
43784378 tx_dhcp(ifp, (uint8_t *) broadcast, 0, 0xffffffff, opts, olen, 0);
43794379 MG_DEBUG(("DHCP req sent"));
43804380}
@@ -19794,7 +19794,7 @@ static size_t cmsis_rx(void *buf, size_t buflen, struct mg_tcpip_if *ifp) {
1979419794static struct mg_tcpip_if *s_ifp;
1979519795static bool s_link, s_auth, s_join;
1979619796
19797- static bool cyw_init(struct mg_tcpip_driver_cyw_firmware *fw, uint8_t *mac);
19797+ static bool cyw_init(uint8_t *mac);
1979819798static void cyw_poll(void);
1979919799
1980019800static bool mg_tcpip_driver_cyw_init(struct mg_tcpip_if *ifp) {
@@ -19806,7 +19806,7 @@ static bool mg_tcpip_driver_cyw_init(struct mg_tcpip_if *ifp) {
1980619806 }
1980719807 s_ifp = ifp;
1980819808 s_link = s_auth = s_join = false;
19809- if (!cyw_init(d->fw, ifp->mac)) return false;
19809+ if (!cyw_init(ifp->mac)) return false;
1981019810
1981119811 if (d->apmode) {
1981219812 MG_DEBUG(("Starting AP '%s' (%u)", d->apssid, d->apchannel));
@@ -20510,7 +20510,7 @@ static const uint32_t country_code = 'X' + ('X' << 8) + (0 << 16);
2051020510static bool cyw_spi_init();
2051120511
2051220512// clang-format off
20513- static bool cyw_init(struct mg_tcpip_driver_cyw_firmware *fw, uint8_t *mac) {
20513+ static bool cyw_init(uint8_t *mac) {
2051420514 uint32_t val = 0;
2051520515 if (!cyw_spi_init()) return false; // BUS DEPENDENCY
2051620516 // BT-ENABLED DEPENDENCY
@@ -20797,12 +20797,13 @@ static bool cyw_spi_init() {
2079720797 if (times == ~0) return false;
2079820798 // DS 4.2.3 Table 6. Chip starts in 16-bit little-endian mode.
2079920799 // Configure SPI and switch to 32-bit big-endian mode:
20800- // - High-speed mode
20800+ // - High-speed mode: d->hs true
2080120801 // - IRQ POLARITY high
2080220802 // - SPI RESPONSE DELAY 4 bytes time [not in DS] TODO(scaprile): logic ana
2080320803 // - Status not sent after command, IRQ with status
20804- val = sw16_2(0x000204b3 ); // 4 reg content
20804+ val = sw16_2(0x000204a3 | (d->hs ? MG_BIT(4) : 0) ); // 4 reg content
2080520805 cyw_spi_write(CYW_SD_FUNC_BUS | CYW_SD_16bMODE, CYW_BUS_SPI_BUSCTRL, &val, sizeof(val));
20806+ mg_tcpip_call(s_ifp, MG_TCPIP_EV_DRIVER, NULL);
2080620807 cyw_spi_read(CYW_SD_FUNC_BUS, CYW_BUS_SPI_TEST, &val, sizeof(val));
2080720808 if (val != 0xFEEDBEAD) return false;
2080820809 val = 4; cyw_spi_write(CYW_SD_FUNC_BUS, CYW_BUS_SPI_RESPDLY_F1, &val, 1);
0 commit comments