mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-31 13:00:49 +00:00
Add driver init to mg_mgr_init()
This commit is contained in:
1 parent
9f498d2eea
commit
c8fd3d6d25
29 files changed
+455
-12
No files matched your search
@@ -5,4 +5,13 @@
|
||||
#include "Driver_ETH_MAC.h" // keep this include
|
||||
#include "Driver_ETH_PHY.h" // keep this include
|
||||
|
||||
#ifndef MG_MAC_ADDRESS
|
||||
#define MG_MAC_ADDRESS MG_MAC_ADDRESS_RANDOM
|
||||
#endif
|
||||
|
||||
#define MG_TCPIP_DRIVER_DATA int driver_data;
|
||||
|
||||
#define MG_TCPIP_DRIVER_CODE &mg_tcpip_driver_cmsis
|
||||
#define MG_TCPIP_DRIVER_NAME "cmsis"
|
||||
|
||||
#endif
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "tcpip.h"
|
||||
#include "net_builtin.h"
|
||||
|
||||
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_IMXRT) && MG_ENABLE_DRIVER_IMXRT
|
||||
struct imxrt_enet {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_IMXRT) && MG_ENABLE_DRIVER_IMXRT
|
||||
|
||||
struct mg_tcpip_driver_imxrt_data {
|
||||
// MDC clock divider. MDC clock is derived from IPS Bus clock (ipg_clk),
|
||||
// must not exceed 2.5MHz. Configuration for clock range 2.36~2.50 MHz
|
||||
@@ -16,3 +18,26 @@ struct mg_tcpip_driver_imxrt_data {
|
||||
|
||||
uint8_t phy_addr; // PHY address
|
||||
};
|
||||
|
||||
#ifndef MG_MAC_ADDRESS
|
||||
#define MG_MAC_ADDRESS MG_MAC_ADDRESS_RANDOM
|
||||
#endif
|
||||
|
||||
#ifndef MG_TCPIP_PHY_ADDR
|
||||
#define MG_TCPIP_PHY_ADDR 2
|
||||
#endif
|
||||
|
||||
#ifndef MG_DRIVER_MDC_CR
|
||||
#define MG_DRIVER_MDC_CR 24
|
||||
#endif
|
||||
|
||||
#define MG_TCPIP_DRIVER_DATA \
|
||||
static struct mg_tcpip_driver_imxrt_data driver_data = { \
|
||||
.mdc_cr = MG_DRIVER_MDC_CR, \
|
||||
.phy_addr = MG_TCPIP_PHY_ADDR, \
|
||||
};
|
||||
|
||||
#define MG_TCPIP_DRIVER_CODE &mg_tcpip_driver_imxrt
|
||||
#define MG_TCPIP_DRIVER_NAME "imxrt"
|
||||
|
||||
#endif
|
||||
@@ -1,8 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_RA) && MG_ENABLE_DRIVER_RA
|
||||
|
||||
struct mg_tcpip_driver_ra_data {
|
||||
// MDC clock "divider". MDC clock is software generated,
|
||||
uint32_t clock; // core clock frequency in Hz
|
||||
uint16_t irqno; // IRQn, R_ICU->IELSR[irqno]
|
||||
uint8_t phy_addr; // PHY address
|
||||
};
|
||||
|
||||
#undef MG_ENABLE_TCPIP_DRIVER_INIT
|
||||
#define MG_ENABLE_TCPIP_DRIVER_INIT 0 // TODO(): needs SystemCoreClock
|
||||
#if 0
|
||||
#ifndef MG_MAC_ADDRESS
|
||||
#define MG_MAC_ADDRESS MG_MAC_ADDRESS_RANDOM
|
||||
#endif
|
||||
|
||||
#ifndef MG_TCPIP_PHY_ADDR
|
||||
#define MG_TCPIP_PHY_ADDR 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_DRIVER_RA_CLOCK
|
||||
#define MG_DRIVER_RA_CLOCK
|
||||
#endif
|
||||
|
||||
#ifndef MG_DRIVER_RA_IRQNO
|
||||
#define MG_DRIVER_RA_IRQNO 0
|
||||
#endif
|
||||
|
||||
#define MG_TCPIP_DRIVER_DATA \
|
||||
static struct mg_tcpip_driver_ra_data driver_data = { \
|
||||
.clock = MG_DRIVER_RA_CLOCK, \
|
||||
.irqno = MG_DRIVER_RA_CLOCK, \
|
||||
.phy_addr = MG_TCPIP_PHY_ADDR, \
|
||||
};
|
||||
|
||||
#define MG_TCPIP_DRIVER_CODE &mg_tcpip_driver_ra
|
||||
#define MG_TCPIP_DRIVER_NAME "ra"
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "tcpip.h"
|
||||
#include "net_builtin.h"
|
||||
|
||||
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_SAME54) && MG_ENABLE_DRIVER_SAME54
|
||||
|
||||
#if defined(MG_ENABLE_DRIVER_SAME54) && MG_ENABLE_DRIVER_SAME54
|
||||
#include <sam.h>
|
||||
|
||||
#define ETH_PKT_SIZE 1536 // Max frame size
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_SAME54) && MG_ENABLE_DRIVER_SAME54
|
||||
|
||||
struct mg_tcpip_driver_same54_data {
|
||||
int mdc_cr;
|
||||
};
|
||||
|
||||
#ifndef MG_MAC_ADDRESS
|
||||
#define MG_MAC_ADDRESS MG_MAC_ADDRESS_RANDOM
|
||||
#endif
|
||||
|
||||
#ifndef MG_DRIVER_MDC_CR
|
||||
#define MG_DRIVER_MDC_CR 5
|
||||
#endif
|
||||
|
||||
#define MG_TCPIP_DRIVER_DATA \
|
||||
static struct mg_tcpip_driver_same54_data driver_data = { \
|
||||
.mdc_cr = MG_DRIVER_MDC_CR, \
|
||||
};
|
||||
|
||||
#define MG_TCPIP_DRIVER_CODE &mg_tcpip_driver_same54
|
||||
#define MG_TCPIP_DRIVER_NAME "same54"
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_STM32F) && \
|
||||
MG_ENABLE_DRIVER_STM32F
|
||||
|
||||
struct mg_tcpip_driver_stm32f_data {
|
||||
// MDC clock divider. MDC clock is derived from HCLK, must not exceed 2.5MHz
|
||||
// HCLK range DIVIDER mdc_cr VALUE
|
||||
@@ -16,3 +19,26 @@ struct mg_tcpip_driver_stm32f_data {
|
||||
|
||||
uint8_t phy_addr; // PHY address
|
||||
};
|
||||
|
||||
#ifndef MG_MAC_ADDRESS
|
||||
#define MG_MAC_ADDRESS MG_MAC_ADDRESS_RANDOM
|
||||
#endif
|
||||
|
||||
#ifndef MG_TCPIP_PHY_ADDR
|
||||
#define MG_TCPIP_PHY_ADDR 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_DRIVER_MDC_CR
|
||||
#define MG_DRIVER_MDC_CR 4
|
||||
#endif
|
||||
|
||||
#define MG_TCPIP_DRIVER_DATA \
|
||||
static struct mg_tcpip_driver_stm32f_data driver_data = { \
|
||||
.mdc_cr = MG_DRIVER_MDC_CR, \
|
||||
.phy_addr = MG_TCPIP_PHY_ADDR, \
|
||||
};
|
||||
|
||||
#define MG_TCPIP_DRIVER_CODE &mg_tcpip_driver_stm32f
|
||||
#define MG_TCPIP_DRIVER_NAME "stm32f"
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_STM32H) && \
|
||||
MG_ENABLE_DRIVER_STM32H
|
||||
|
||||
struct mg_tcpip_driver_stm32h_data {
|
||||
// MDC clock divider. MDC clock is derived from HCLK, must not exceed 2.5MHz
|
||||
// HCLK range DIVIDER mdc_cr VALUE
|
||||
@@ -14,3 +17,21 @@ struct mg_tcpip_driver_stm32h_data {
|
||||
// 110, 111 Reserved
|
||||
int mdc_cr; // Valid values: -1, 0, 1, 2, 3, 4, 5
|
||||
};
|
||||
|
||||
#ifndef MG_MAC_ADDRESS
|
||||
#define MG_MAC_ADDRESS MG_MAC_ADDRESS_RANDOM
|
||||
#endif
|
||||
|
||||
#ifndef MG_DRIVER_MDC_CR
|
||||
#define MG_DRIVER_MDC_CR 4
|
||||
#endif
|
||||
|
||||
#define MG_TCPIP_DRIVER_DATA \
|
||||
static struct mg_tcpip_driver_stm32h_data driver_data = { \
|
||||
.mdc_cr = MG_DRIVER_MDC_CR, \
|
||||
};
|
||||
|
||||
#define MG_TCPIP_DRIVER_CODE &mg_tcpip_driver_stm32h
|
||||
#define MG_TCPIP_DRIVER_NAME "stm32h"
|
||||
|
||||
#endif
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#include "tcpip.h"
|
||||
#include "net_builtin.h"
|
||||
|
||||
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_TM4C) && MG_ENABLE_DRIVER_TM4C
|
||||
struct tm4c_emac {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_TM4C) && MG_ENABLE_DRIVER_TM4C
|
||||
|
||||
struct mg_tcpip_driver_tm4c_data {
|
||||
// MDC clock divider. MDC clock is derived from SYSCLK, must not exceed 2.5MHz
|
||||
// SYSCLK range DIVIDER mdc_cr VALUE
|
||||
@@ -12,3 +14,22 @@ struct mg_tcpip_driver_tm4c_data {
|
||||
// 0x4-0xF Reserved
|
||||
int mdc_cr; // Valid values: -1, 0, 1, 2, 3
|
||||
};
|
||||
|
||||
#ifndef MG_MAC_ADDRESS
|
||||
#define MG_MAC_ADDRESS MG_MAC_ADDRESS_RANDOM
|
||||
#endif
|
||||
|
||||
#ifndef MG_DRIVER_MDC_CR
|
||||
#define MG_DRIVER_MDC_CR 1
|
||||
#endif
|
||||
|
||||
#define MG_TCPIP_DRIVER_DATA \
|
||||
static struct mg_tcpip_driver_tm4c_data driver_data = { \
|
||||
.mdc_cr = MG_DRIVER_MDC_CR, \
|
||||
};
|
||||
|
||||
#define MG_TCPIP_DRIVER_CODE &mg_tcpip_driver_tm4c
|
||||
#define MG_TCPIP_DRIVER_NAME "tm4c"
|
||||
|
||||
|
||||
#endif
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
#include "tcpip.h"
|
||||
#include "net_builtin.h"
|
||||
|
||||
#if MG_ENABLE_TCPIP
|
||||
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_W5500) && MG_ENABLE_DRIVER_W5500
|
||||
|
||||
enum { W5500_CR = 0, W5500_S0 = 1, W5500_TX0 = 2, W5500_RX0 = 3 };
|
||||
|
||||
|
||||
Reference in new issue
Block a user