@@ -4374,7 +4374,7 @@ static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req,
4374
4374
if (ifp->enable_req_dns) *p++ = 6; // DNS
4375
4375
if (ifp->enable_req_sntp) *p++ = 42; // SNTP
4376
4376
*p++ = 255; // End of options
4377
- assert((size_t) (p - opts) < olen);
4377
+ // assert((size_t) (p - opts) < olen);
4378
4378
tx_dhcp(ifp, (uint8_t *) broadcast, 0, 0xffffffff, opts, olen, 0);
4379
4379
MG_DEBUG(("DHCP req sent"));
4380
4380
}
@@ -19794,7 +19794,7 @@ static size_t cmsis_rx(void *buf, size_t buflen, struct mg_tcpip_if *ifp) {
19794
19794
static struct mg_tcpip_if *s_ifp;
19795
19795
static bool s_link, s_auth, s_join;
19796
19796
19797
- static bool cyw_init(struct mg_tcpip_driver_cyw_firmware *fw, uint8_t *mac);
19797
+ static bool cyw_init(uint8_t *mac);
19798
19798
static void cyw_poll(void);
19799
19799
19800
19800
static 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) {
19806
19806
}
19807
19807
s_ifp = ifp;
19808
19808
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;
19810
19810
19811
19811
if (d->apmode) {
19812
19812
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);
20510
20510
static bool cyw_spi_init();
20511
20511
20512
20512
// 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) {
20514
20514
uint32_t val = 0;
20515
20515
if (!cyw_spi_init()) return false; // BUS DEPENDENCY
20516
20516
// BT-ENABLED DEPENDENCY
@@ -20797,12 +20797,13 @@ static bool cyw_spi_init() {
20797
20797
if (times == ~0) return false;
20798
20798
// DS 4.2.3 Table 6. Chip starts in 16-bit little-endian mode.
20799
20799
// Configure SPI and switch to 32-bit big-endian mode:
20800
- // - High-speed mode
20800
+ // - High-speed mode: d->hs true
20801
20801
// - IRQ POLARITY high
20802
20802
// - SPI RESPONSE DELAY 4 bytes time [not in DS] TODO(scaprile): logic ana
20803
20803
// - 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
20805
20805
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);
20806
20807
cyw_spi_read(CYW_SD_FUNC_BUS, CYW_BUS_SPI_TEST, &val, sizeof(val));
20807
20808
if (val != 0xFEEDBEAD) return false;
20808
20809
val = 4; cyw_spi_write(CYW_SD_FUNC_BUS, CYW_BUS_SPI_RESPDLY_F1, &val, 1);
0 commit comments