mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-26 12:14:56 +00:00
Add support for RM2 with STM32F (429, 746)
This commit is contained in:
1 parent
fb69016196
commit
fbc1708000
26 files changed
+1387
-17
No files matched your search
+6
-5
@@ -7,7 +7,7 @@
|
||||
static struct mg_tcpip_if *s_ifp;
|
||||
static bool s_link, s_auth, s_join;
|
||||
|
||||
static bool cyw_init(struct mg_tcpip_driver_cyw_firmware *fw, uint8_t *mac);
|
||||
static bool cyw_init(uint8_t *mac);
|
||||
static void cyw_poll(void);
|
||||
|
||||
static bool mg_tcpip_driver_cyw_init(struct mg_tcpip_if *ifp) {
|
||||
@@ -19,7 +19,7 @@ static bool mg_tcpip_driver_cyw_init(struct mg_tcpip_if *ifp) {
|
||||
}
|
||||
s_ifp = ifp;
|
||||
s_link = s_auth = s_join = false;
|
||||
if (!cyw_init(d->fw, ifp->mac)) return false;
|
||||
if (!cyw_init(ifp->mac)) return false;
|
||||
|
||||
if (d->apmode) {
|
||||
MG_DEBUG(("Starting AP '%s' (%u)", d->apssid, d->apchannel));
|
||||
@@ -723,7 +723,7 @@ static const uint32_t country_code = 'X' + ('X' << 8) + (0 << 16);
|
||||
static bool cyw_spi_init();
|
||||
|
||||
// clang-format off
|
||||
static bool cyw_init(struct mg_tcpip_driver_cyw_firmware *fw, uint8_t *mac) {
|
||||
static bool cyw_init(uint8_t *mac) {
|
||||
uint32_t val = 0;
|
||||
if (!cyw_spi_init()) return false; // BUS DEPENDENCY
|
||||
// BT-ENABLED DEPENDENCY
|
||||
@@ -1010,12 +1010,13 @@ static bool cyw_spi_init() {
|
||||
if (times == ~0) return false;
|
||||
// DS 4.2.3 Table 6. Chip starts in 16-bit little-endian mode.
|
||||
// Configure SPI and switch to 32-bit big-endian mode:
|
||||
// - High-speed mode
|
||||
// - High-speed mode: d->hs true
|
||||
// - IRQ POLARITY high
|
||||
// - SPI RESPONSE DELAY 4 bytes time [not in DS] TODO(scaprile): logic ana
|
||||
// - Status not sent after command, IRQ with status
|
||||
val = sw16_2(0x000204b3); // 4 reg content
|
||||
val = sw16_2(0x000204a3 | (d->hs ? MG_BIT(4) : 0)); // 4 reg content
|
||||
cyw_spi_write(CYW_SD_FUNC_BUS | CYW_SD_16bMODE, CYW_BUS_SPI_BUSCTRL, &val, sizeof(val));
|
||||
mg_tcpip_call(s_ifp, MG_TCPIP_EV_DRIVER, NULL);
|
||||
cyw_spi_read(CYW_SD_FUNC_BUS, CYW_BUS_SPI_TEST, &val, sizeof(val));
|
||||
if (val != 0xFEEDBEAD) return false;
|
||||
val = 4; cyw_spi_write(CYW_SD_FUNC_BUS, CYW_BUS_SPI_RESPDLY_F1, &val, 1);
|
||||
|
||||
+4
-3
@@ -11,11 +11,11 @@ struct mg_tcpip_spi_ {
|
||||
};
|
||||
|
||||
struct mg_tcpip_driver_cyw_firmware {
|
||||
const uint8_t * code_addr;
|
||||
const uint8_t *code_addr;
|
||||
size_t code_len;
|
||||
const uint8_t * nvram_addr;
|
||||
const uint8_t *nvram_addr;
|
||||
size_t nvram_len;
|
||||
const uint8_t * clm_addr;
|
||||
const uint8_t *clm_addr;
|
||||
size_t clm_len;
|
||||
};
|
||||
|
||||
@@ -30,6 +30,7 @@ struct mg_tcpip_driver_cyw_data {
|
||||
uint8_t apsecurity; // TBD
|
||||
uint8_t apchannel;
|
||||
bool apmode; // start in AP mode; 'false' starts connection to 'ssid' if not NULL
|
||||
bool hs; // use chip "high-speed" mode; otherwise SPI CPOL0 CPHA0 (DS 4.2.3 Table 6)
|
||||
};
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -26,6 +26,7 @@ enum {
|
||||
MG_TCPIP_EV_WIFI_SCAN_RESULT, // Wi-Fi scan results struct mg_wifi_scan_bss_data *
|
||||
MG_TCPIP_EV_WIFI_SCAN_END, // Wi-Fi scan has finished NULL
|
||||
MG_TCPIP_EV_WIFI_CONNECT_ERR, // Wi-Fi connect has failed driver and chip specific
|
||||
MG_TCPIP_EV_DRIVER, // Driver event driver specific
|
||||
MG_TCPIP_EV_USER // Starting ID for user events
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user