change demo command and support DHCP demo

This commit is contained in:
wlyu
2022-01-06 15:44:24 +08:00
parent d1d4632292
commit a0337a42e3
12 changed files with 243 additions and 18 deletions
@@ -76,19 +76,19 @@ static void ZombieKTaskEntry(void *parameter)
SuspendKTask(zombie_recycle);
CriticalAreaUnLock(lock);
DO_KTASK_ASSIGN;
}
}
}
}
void ZombieTaskRecycleInit(void)
{
InitDoubleLinkList(&KTaskZombie);
zombie_recycle = KTaskCreate("ZombieRecycleKTask",
ZombieKTaskEntry,
NONE,
ZOMBIE_KTASK_STACKSIZE,
KTASK_LOWEST_PRIORITY + 1);
KTASK_PRIORITY_MAX - 1);
StartupKTask(zombie_recycle);
}
@@ -118,7 +118,7 @@ a lot of data that needs to be copied, this should be set high. */
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
turning this on does currently not work. */
#define LWIP_DHCP 0
#define LWIP_DHCP 1
/* ---------- UDP options ---------- */
@@ -89,6 +89,7 @@ char lwip_netmask[] = {255, 255, 255, 0};
char lwip_gwaddr[] = {192, 168, 250, 252};
int errno;
int is_lwip_test = 0; //for lwip input thread
x_ticks_t lwip_sys_now;
@@ -442,7 +443,7 @@ void TcpIpInit(void)
KPrintf("lwip dhcp init fail...\n\n");
while(ip_addr_cmp(&(gnetif.ip_addr),&ipaddr))
{
vTaskDelay(1);
DelayKTask(1);
}
#endif
KPrintf("\n\nIP:%d.%d.%d.%d\n\n", \
@@ -470,6 +471,10 @@ void lwip_config_input(struct netif *net)
{
pthread_t th_id = 0;
//neglect create input thread for test
if(is_lwip_test)
return;
th_id = sys_thread_new("eth_input", lwip_input_thread, net, 4096, 15);
if (th_id >= 0) {
@@ -66,6 +66,8 @@
#define LOCAL_PORT_SERVER 4840
#define TARGET_PORT_CLIENT LOCAL_PORT_SERVER
#define TEST_LWIP_TIMES 3
/*Static IP ADDRESS: IP_ADDR0.IP_ADDR1.IP_ADDR2.IP_ADDR3 */
#define IP_ADDR0_SERVER 192
#define IP_ADDR1_SERVER 168
@@ -106,6 +108,8 @@ typedef x_base sys_prot_t;
extern char lwip_ipaddr[];
extern char lwip_netmask[];
extern char lwip_gwaddr[];
extern int is_lwip_test;
extern struct netif gnetif;
void TcpIpInit(void);
void lwip_config_net(char *ip, char *mask, char *gw);