support PLC bus and clean codes

This commit is contained in:
wlyu
2022-02-15 17:40:40 +08:00
parent a101e994ff
commit 5185501d72
16 changed files with 200 additions and 680 deletions
@@ -18,11 +18,6 @@
* @date 2021.12.15
*/
/*******************************************************************************
* Includes
******************************************************************************/
#include "lwip/opt.h"
#if LWIP_IPV4 && LWIP_RAW
@@ -41,21 +36,7 @@
#include <sys_arch.h>
#include "connect_ethernet.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/*******************************************************************************
* Prototypes
******************************************************************************/
/*******************************************************************************
* Variables
******************************************************************************/
/*******************************************************************************
* Code
******************************************************************************/
/******************************************************************************/
static void *LwipSetIPTask(void *param)
{
@@ -39,23 +39,9 @@
#include "fsl_iomuxc.h"
#include "sys_arch.h"
/*******************************************************************************
* Definitions
******************************************************************************/
#define LWIP_DHCP_TIME 10000 // 10s
/*******************************************************************************
* Prototypes
******************************************************************************/
/*******************************************************************************
* Variables
******************************************************************************/
/*******************************************************************************
* Code
******************************************************************************/
/******************************************************************************/
/*!
* @brief Prints DHCP status of the interface when it has changed from last status.
@@ -18,10 +18,6 @@
* @date 2021.12.15
*/
/*******************************************************************************
* Includes
******************************************************************************/
#include "lwip/opt.h"
#if LWIP_IPV4 && LWIP_RAW
@@ -39,26 +35,12 @@
#include <sys_arch.h>
#include "connect_ethernet.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/*******************************************************************************
* Prototypes
******************************************************************************/
/*******************************************************************************
* Variables
******************************************************************************/
char test_ip_addr[] = {192, 168, 250, 253};
char test_net_mask[] = {255, 255, 255, 0};
char test_gw_addr[] = {192, 168, 250, 252};
ip4_addr_t ping_addr;
/*******************************************************************************
* Code
******************************************************************************/
/******************************************************************************/
void LwipPingTest(int argc, char *argv[])
{
@@ -24,27 +24,13 @@
#include "lwip/sys.h"
#include "tcpecho_raw.h"
/*******************************************************************************
* Definitions
******************************************************************************/
#define MSG_SIZE 128
/*******************************************************************************
* Prototypes
******************************************************************************/
/*******************************************************************************
* Variables
******************************************************************************/
// this is for test in shell, in fact, shell restrict the length of input string, which is less then 128
char tcp_send_msg[MSG_SIZE] = {0};
char tcp_target[] = {192, 168, 250, 252};
/*******************************************************************************
* Code
******************************************************************************/
/******************************************************************************/
static void LwipTcpSendTask(void *arg)
{
@@ -24,31 +24,16 @@
#include <lwip/sockets.h>
#include "lwip/sys.h"
/*******************************************************************************
* Definitions
******************************************************************************/
#define UDP_TASK_STACK_SIZE 4096
#define UDP_TASK_PRIO 15
#define PBUF_SIZE 27
/*******************************************************************************
* Prototypes
******************************************************************************/
/*******************************************************************************
* Variables
******************************************************************************/
static struct udp_pcb *udpecho_raw_pcb;
char udp_target[] = {192, 168, 250, 252};
char hello_str[] = {"hello world\r\n"};
char udp_send_msg[] = "\n\nThis one is UDP pkg. Congratulations on you.\n\n";
/*******************************************************************************
* Code
******************************************************************************/
/******************************************************************************/
static void LwipUDPSendTask(void *arg)
{
@@ -384,6 +384,7 @@ static char *const bus_type_str[] =
"SERIAL_BUS",
"ADC_BUS",
"DAC_BUS",
"PLC_BUS",
"Unknown"
};