mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-26 20:38:25 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea98da782f | ||
|
|
b79fd39eae |
No files matched your search
+3
-5
@@ -12008,7 +12008,7 @@ static void mg_tcpip_poll(struct mg_tcpip_if *ifp, uint64_t now) {
|
||||
if (expired_1000ms) { // ifp->state rules over state6
|
||||
mg_ip_link(ifp, drv_up, l2_up); // Handle IPv4
|
||||
mg_ip6_link(ifp, drv_up, l2_up); // Handle IPv6
|
||||
if (ifp->state < MG_TCPIP_STATE_UP) MG_ERROR(("Network is down, state %hhu", ifp->state));
|
||||
if (ifp->state < MG_TCPIP_STATE_UP) MG_ERROR(("Network is down"));
|
||||
mg_tcpip_call(ifp, MG_TCPIP_EV_TIMER_1S, NULL);
|
||||
}
|
||||
}
|
||||
@@ -12254,10 +12254,8 @@ static void write_conn(struct mg_connection *c) {
|
||||
}
|
||||
|
||||
static bool can_write(struct mg_connection *c) {
|
||||
struct mg_tcpip_if *ifp = c->mgr->ifp;
|
||||
bool ready = (ifp->ip != 0 && ifp->state == MG_TCPIP_STATE_READY);
|
||||
return ready && c->is_connecting == 0 && c->is_resolving == 0 &&
|
||||
c->send.len > 0 && c->is_tls_hs == 0 && c->is_arplooking == 0;
|
||||
return c->is_connecting == 0 && c->is_resolving == 0 && c->send.len > 0 &&
|
||||
c->is_tls_hs == 0 && c->is_arplooking == 0;
|
||||
}
|
||||
|
||||
void mg_mgr_poll(struct mg_mgr *mgr, int ms) {
|
||||
|
||||
+3
-5
@@ -2200,7 +2200,7 @@ static void mg_tcpip_poll(struct mg_tcpip_if *ifp, uint64_t now) {
|
||||
if (expired_1000ms) { // ifp->state rules over state6
|
||||
mg_ip_link(ifp, drv_up, l2_up); // Handle IPv4
|
||||
mg_ip6_link(ifp, drv_up, l2_up); // Handle IPv6
|
||||
if (ifp->state < MG_TCPIP_STATE_UP) MG_ERROR(("Network is down, state %hhu", ifp->state));
|
||||
if (ifp->state < MG_TCPIP_STATE_UP) MG_ERROR(("Network is down"));
|
||||
mg_tcpip_call(ifp, MG_TCPIP_EV_TIMER_1S, NULL);
|
||||
}
|
||||
}
|
||||
@@ -2446,10 +2446,8 @@ static void write_conn(struct mg_connection *c) {
|
||||
}
|
||||
|
||||
static bool can_write(struct mg_connection *c) {
|
||||
struct mg_tcpip_if *ifp = c->mgr->ifp;
|
||||
bool ready = (ifp->ip != 0 && ifp->state == MG_TCPIP_STATE_READY);
|
||||
return ready && c->is_connecting == 0 && c->is_resolving == 0 &&
|
||||
c->send.len > 0 && c->is_tls_hs == 0 && c->is_arplooking == 0;
|
||||
return c->is_connecting == 0 && c->is_resolving == 0 && c->send.len > 0 &&
|
||||
c->is_tls_hs == 0 && c->is_arplooking == 0;
|
||||
}
|
||||
|
||||
void mg_mgr_poll(struct mg_mgr *mgr, int ms) {
|
||||
|
||||
@@ -1280,8 +1280,6 @@ static void test_frag_send_path(void) {
|
||||
mif.driver = &driver;
|
||||
mif.driver_data = &s_driver_data;
|
||||
mg_tcpip_init(&mgr, &mif);
|
||||
mif.ip = mg_htonl(0xa00001);
|
||||
mif.state = MG_TCPIP_STATE_READY; // so can_write() lets the data out
|
||||
mif.mtu = 500; // force ad hoc small MTU to fragment IP
|
||||
mg_http_listen(&mgr, "http://0.0.0.0:80", frag_send_fn, NULL);
|
||||
mgr.conns->pfn = NULL;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define BOARD_ETH_PHY_ADDR 5U
|
||||
@@ -484,7 +484,9 @@ static inline uint8_t hal_uart_read_byte(LPUART_Type *uart) {
|
||||
return (uint8_t) (uart->DATA & 0xFFU);
|
||||
}
|
||||
|
||||
#define HAL_NETC_PHY0_ADDR 5U
|
||||
// NETC switch link binding needs PHY address, shared with Mongoose config
|
||||
#include "board_config.h"
|
||||
|
||||
#define HAL_NETC_PHY0_RESET PIN('1', 15)
|
||||
|
||||
static inline void hal_netc_trdc_region(uint8_t mrc, uint8_t domain,
|
||||
@@ -605,6 +607,11 @@ static inline void hal_netc_pins_init(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// RT1180's SoC-specific topology fixes link 0 to switch port 0, link 4 to
|
||||
// ENETC0, and link 5 between switch port 4 and ENETC1.
|
||||
// Hardcoded to use link 0; Mongoose defaults to MG_TCPIP_NETC_LINK = 0
|
||||
// Any use of other switch port x would need to access NETC_LINK_CFG[x] and
|
||||
// NETC_IERB->LxBCR instead, and Mongoose needs MG_TCPIP_NETC_LINK = x
|
||||
static inline bool hal_netc_ierb_init(void) {
|
||||
uint32_t timeout = 1000000UL;
|
||||
|
||||
@@ -624,10 +631,7 @@ static inline bool hal_netc_ierb_init(void) {
|
||||
// Attribute 1 permits MSI-X writes through the root-complex window.
|
||||
NETC_IERB->ARRAY_NUM_RC[0].RCMSIAMQR =
|
||||
(NETC_IERB->ARRAY_NUM_RC[0].RCMSIAMQR & ~(7UL << 27)) | (1UL << 27);
|
||||
// RT1180's SoC-specific topology fixes link 0 to switch port 0, link 4 to
|
||||
// ENETC0, and link 5 between switch port 4 and ENETC1.
|
||||
NETC_IERB->L0BCR =
|
||||
NETC_IERB_L0BCR_MDIO_PHYAD_PRTAD(HAL_NETC_PHY0_ADDR);
|
||||
NETC_IERB->L0BCR = NETC_IERB_L0BCR_MDIO_PHYAD_PRTAD(BOARD_ETH_PHY_ADDR);
|
||||
__DSB();
|
||||
|
||||
if ((NETC_PRIV->NETCSR & NETC_PRIV_NETCSR_ERROR_MASK) != 0U) return false;
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
#define MG_ENABLE_TCPIP 1
|
||||
#define MG_ENABLE_DRIVER_NETC 1
|
||||
#define MG_OTA MG_OTA_RT1180
|
||||
// Keep the Mongoose PHY address aligned with NETC switch link binding
|
||||
#include "board_config.h"
|
||||
#define MG_TCPIP_PHY_ADDR BOARD_ETH_PHY_ADDR
|
||||
|
||||
#define MG_IO_SIZE 256
|
||||
#define MG_ENABLE_CUSTOM_MILLIS 1
|
||||
|
||||
Reference in new issue
Block a user