mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-11 16:40:17 +00:00
5 files changed
+9
-12
No files matched your search
@@ -256,7 +256,6 @@ static bool mg_tcpip_driver_rp2040_rmii_init(struct mg_tcpip_if *ifp) {
|
|||||||
(struct mg_tcpip_driver_rp2040_rmii_data *) ifp->driver_data;
|
(struct mg_tcpip_driver_rp2040_rmii_data *) ifp->driver_data;
|
||||||
uint rx_sm_addr, tx_sm_addr;
|
uint rx_sm_addr, tx_sm_addr;
|
||||||
s_ifp = ifp;
|
s_ifp = ifp;
|
||||||
if (ifp->queue.len == 0) ifp->queue.len = 8192;
|
|
||||||
rx_sm_addr = pio_add_program(pio0, &rmii_rx_program);
|
rx_sm_addr = pio_add_program(pio0, &rmii_rx_program);
|
||||||
tx_sm_addr = pio_add_program(pio0, &rmii_tx_program);
|
tx_sm_addr = pio_add_program(pio0, &rmii_tx_program);
|
||||||
smi_wr_addr = pio_add_program(pio0, &smi_wr_program);
|
smi_wr_addr = pio_add_program(pio0, &smi_wr_program);
|
||||||
@@ -338,7 +337,7 @@ static void rx_irq(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static size_t mg_tcpip_driver_rp2040_rmii_rx(void *buf, size_t buflen, struct mg_tcpip_if *ifp) {
|
static size_t mg_tcpip_driver_rp2040_rmii_rx(void *buf, size_t buflen, struct mg_tcpip_if *ifp) {
|
||||||
size_t len = mg_tcpip_qread(buf, ifp);
|
size_t len = 0; // mg_tcpip_qread(buf, ifp);
|
||||||
if (len == 0) return 0;
|
if (len == 0) return 0;
|
||||||
len -= 4; // exclude CRC from frame length
|
len -= 4; // exclude CRC from frame length
|
||||||
uint32_t crc = crc_calc(buf, len); // calculate CRC and compare
|
uint32_t crc = crc_calc(buf, len); // calculate CRC and compare
|
||||||
|
|||||||
@@ -56,13 +56,13 @@ int main(void) {
|
|||||||
mg_mgr_init(&mgr); // and attach it to the MIP interface
|
mg_mgr_init(&mgr); // and attach it to the MIP interface
|
||||||
mg_timer_add(&mgr, 500, MG_TIMER_REPEAT, blink_cb, &mgr);
|
mg_timer_add(&mgr, 500, MG_TIMER_REPEAT, blink_cb, &mgr);
|
||||||
|
|
||||||
struct mg_tcpip_driver driver = {.tx = usb_tx, .rx = mg_tcpip_driver_rx, .up = usb_up};
|
struct mg_tcpip_driver driver = {.tx = usb_tx, .up = usb_up};
|
||||||
struct mg_tcpip_if mif = {.mac = {2, 0, 1, 2, 3, 0x77},
|
struct mg_tcpip_if mif = {.mac = {2, 0, 1, 2, 3, 0x77},
|
||||||
.ip = mg_htonl(MG_U32(192, 168, 3, 1)),
|
.ip = mg_htonl(MG_U32(192, 168, 3, 1)),
|
||||||
.mask = mg_htonl(MG_U32(255, 255, 255, 0)),
|
.mask = mg_htonl(MG_U32(255, 255, 255, 0)),
|
||||||
.enable_dhcp_server = true,
|
.enable_dhcp_server = true,
|
||||||
.driver = &driver,
|
.driver = &driver,
|
||||||
.queue.len = 4096};
|
.recv_queue.size = 4096};
|
||||||
s_ifp = &mif;
|
s_ifp = &mif;
|
||||||
mg_tcpip_init(&mgr, &mif);
|
mg_tcpip_init(&mgr, &mif);
|
||||||
tusb_init();
|
tusb_init();
|
||||||
|
|||||||
@@ -88,14 +88,13 @@ int main(void) {
|
|||||||
|
|
||||||
|
|
||||||
MG_INFO(("Init TCP/IP stack ..."));
|
MG_INFO(("Init TCP/IP stack ..."));
|
||||||
struct mg_tcpip_driver driver = {
|
struct mg_tcpip_driver driver = {.tx = usb_tx, .up = usb_up};
|
||||||
.tx = usb_tx, .rx = mg_tcpip_driver_rx, .up = usb_up};
|
|
||||||
struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(),
|
struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(),
|
||||||
.ip = mg_htonl(MG_U32(192, 168, 3, 1)),
|
.ip = mg_htonl(MG_U32(192, 168, 3, 1)),
|
||||||
.mask = mg_htonl(MG_U32(255, 255, 255, 0)),
|
.mask = mg_htonl(MG_U32(255, 255, 255, 0)),
|
||||||
.enable_dhcp_server = true,
|
.enable_dhcp_server = true,
|
||||||
.driver = &driver,
|
.driver = &driver,
|
||||||
.queue.len = 4096};
|
.recv_queue.size = 4096};
|
||||||
s_ifp = &mif;
|
s_ifp = &mif;
|
||||||
mg_tcpip_init(&mgr, &mif);
|
mg_tcpip_init(&mgr, &mif);
|
||||||
mg_timer_add(&mgr, 500, MG_TIMER_REPEAT, blink_cb, &mgr);
|
mg_timer_add(&mgr, 500, MG_TIMER_REPEAT, blink_cb, &mgr);
|
||||||
|
|||||||
@@ -88,14 +88,13 @@ int main(void) {
|
|||||||
|
|
||||||
|
|
||||||
MG_INFO(("Init TCP/IP stack ..."));
|
MG_INFO(("Init TCP/IP stack ..."));
|
||||||
struct mg_tcpip_driver driver = {
|
struct mg_tcpip_driver driver = {.tx = usb_tx, .up = usb_up};
|
||||||
.tx = usb_tx, .rx = mg_tcpip_driver_rx, .up = usb_up};
|
|
||||||
struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(),
|
struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(),
|
||||||
.ip = mg_htonl(MG_U32(192, 168, 3, 1)),
|
.ip = mg_htonl(MG_U32(192, 168, 3, 1)),
|
||||||
.mask = mg_htonl(MG_U32(255, 255, 255, 0)),
|
.mask = mg_htonl(MG_U32(255, 255, 255, 0)),
|
||||||
.enable_dhcp_server = true,
|
.enable_dhcp_server = true,
|
||||||
.driver = &driver,
|
.driver = &driver,
|
||||||
.queue.len = 4096};
|
.recv_queue.size = 4096};
|
||||||
s_ifp = &mif;
|
s_ifp = &mif;
|
||||||
mg_tcpip_init(&mgr, &mif);
|
mg_tcpip_init(&mgr, &mif);
|
||||||
mg_timer_add(&mgr, 500, MG_TIMER_REPEAT, blink_cb, &mgr);
|
mg_timer_add(&mgr, 500, MG_TIMER_REPEAT, blink_cb, &mgr);
|
||||||
|
|||||||
+2
-2
@@ -64,8 +64,8 @@ struct mg_tcpip_spi {
|
|||||||
|
|
||||||
#if MG_ENABLE_TCPIP
|
#if MG_ENABLE_TCPIP
|
||||||
#if !defined(MG_ENABLE_DRIVER_STM32H) && !defined(MG_ENABLE_DRIVER_TM4C)
|
#if !defined(MG_ENABLE_DRIVER_STM32H) && !defined(MG_ENABLE_DRIVER_TM4C)
|
||||||
#define MG_ENABLE_DRIVER_STM32 1
|
#define MG_ENABLE_DRIVER_STM32 1
|
||||||
#else
|
#else
|
||||||
#define MG_ENABLE_DRIVER_STM32 0
|
#define MG_ENABLE_DRIVER_STM32 0
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
Reference in new issue
Block a user