forked from xuos/xiuos
1. fixed IRQ interrupt
2. changed lwip test command 3. merge dns and ping command 4. change test to cmd_lwip
This commit is contained in:
parent
ddb889623d
commit
877ef9e221
|
@ -121,7 +121,7 @@ static void UdpSocketThreadServer(void *arg)
|
||||||
|
|
||||||
lw_print("Receive from : %s\n",inet_ntoa(seraddr.sin_addr));
|
lw_print("Receive from : %s\n",inet_ntoa(seraddr.sin_addr));
|
||||||
|
|
||||||
lw_print("Recevce data : %s\n\n",recv_data);
|
lw_print("Receive data : %s\n\n",recv_data);
|
||||||
|
|
||||||
sendto(sock,recv_data,
|
sendto(sock,recv_data,
|
||||||
recv_data_len,0,
|
recv_data_len,0,
|
||||||
|
|
|
@ -71,14 +71,15 @@ static void test_ua_connect(void *arg)
|
||||||
UA_ClientConfig *config = UA_Client_getConfig(client);
|
UA_ClientConfig *config = UA_Client_getConfig(client);
|
||||||
UA_ClientConfig_setDefault(config);
|
UA_ClientConfig_setDefault(config);
|
||||||
|
|
||||||
|
|
||||||
retval = UA_Client_connect(client, test_uri);
|
retval = UA_Client_connect(client, test_uri);
|
||||||
if (retval != UA_STATUSCODE_GOOD)
|
if (retval != UA_STATUSCODE_GOOD)
|
||||||
{
|
{
|
||||||
ua_print("ua: [%s] connect failed\n", __func__);
|
ua_print("ua: [%s] ret %x\n", __func__, retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
ua_print("ua: [%s] start Ua Test!\n", __func__);
|
||||||
|
UA_Client_disconnect(client);
|
||||||
|
UA_Client_delete(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_ua_connect_thr(void *arg)
|
void test_ua_connect_thr(void *arg)
|
||||||
|
@ -93,7 +94,6 @@ void test_sh_ua_connect(void)
|
||||||
int result = 0;
|
int result = 0;
|
||||||
pthread_t th_id;
|
pthread_t th_id;
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
|
|
||||||
sys_thread_new("ua test", test_ua_connect_thr, NULL, 4096, 15);
|
sys_thread_new("ua test", test_ua_connect_thr, NULL, 4096, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,21 +117,19 @@ void *test_ua_get_server_info(void *param)
|
||||||
|
|
||||||
UA_StatusCode retval = UA_Client_connect(client, OPC_SERVER);
|
UA_StatusCode retval = UA_Client_connect(client, OPC_SERVER);
|
||||||
if(retval != UA_STATUSCODE_GOOD) {
|
if(retval != UA_STATUSCODE_GOOD) {
|
||||||
ua_print("ua: [%s] connect failed %d\n", __func__, retval);
|
ua_print("ua: [%s] connect failed %#x\n", __func__, retval);
|
||||||
UA_Client_delete(client);
|
UA_Client_delete(client);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ua_print("ua: [%s] connect ok!\n", __func__);
|
ua_print("ua: [%s] connect ok!\n", __func__);
|
||||||
|
|
||||||
while(1)
|
|
||||||
{
|
|
||||||
ua_read_time(client);
|
ua_read_time(client);
|
||||||
ua_get_server_info(client);
|
ua_get_server_info(client);
|
||||||
}
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
// UA_Client_disconnect(client);
|
UA_Client_disconnect(client);
|
||||||
// UA_Client_delete(client); /* Disconnects the client internally */
|
UA_Client_delete(client); /* Disconnects the client internally */
|
||||||
}
|
}
|
||||||
|
|
||||||
void *test_ua_get_server_info_thr(void *arg)
|
void *test_ua_get_server_info_thr(void *arg)
|
||||||
|
|
|
@ -17,11 +17,17 @@
|
||||||
|
|
||||||
#define ARCH_MAX_IRQ_NUM (256)
|
#define ARCH_MAX_IRQ_NUM (256)
|
||||||
|
|
||||||
#define ARCH_IRQ_NUM_OFFSET 0
|
//#define ARCH_IRQ_NUM_OFFSET 0
|
||||||
|
|
||||||
#define SYSTICK_IRQN 15
|
//#define SYSTICK_IRQN 15
|
||||||
#define UART1_IRQn 36
|
//#define UART1_IRQn 36
|
||||||
#define UART2_IRQn 37
|
//#define UART2_IRQn 37
|
||||||
|
|
||||||
|
#define ARCH_IRQ_NUM_OFFSET 16
|
||||||
|
|
||||||
|
#define SYSTICK_IRQN -1
|
||||||
|
#define UART1_IRQn 20
|
||||||
|
#define UART2_IRQn 21
|
||||||
|
|
||||||
int32 ArchEnableHwIrq(uint32 irq_num);
|
int32 ArchEnableHwIrq(uint32 irq_num);
|
||||||
int32 ArchDisableHwIrq(uint32 irq_num);
|
int32 ArchDisableHwIrq(uint32 irq_num);
|
||||||
|
|
|
@ -70,7 +70,6 @@
|
||||||
#include "lwip/igmp.h"
|
#include "lwip/igmp.h"
|
||||||
#include "lwip/mld6.h"
|
#include "lwip/mld6.h"
|
||||||
|
|
||||||
//
|
|
||||||
//#define USE_RTOS 1
|
//#define USE_RTOS 1
|
||||||
//#define FSL_RTOS_FREE_RTOS
|
//#define FSL_RTOS_FREE_RTOS
|
||||||
//#define FSL_RTOS_XIUOS
|
//#define FSL_RTOS_XIUOS
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#endif /* FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL */
|
#endif /* FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL */
|
||||||
|
|
||||||
#include "lwipopts.h"
|
#include "lwipopts.h"
|
||||||
|
#include <xs_isr.h>
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
|
@ -3384,7 +3385,8 @@ void ENET_1588_Timer_IRQHandler(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ENET_DriverIRQHandler(void)
|
//void ENET_DriverIRQHandler(void)
|
||||||
|
void ENET_DriverIRQHandler(int vector, void *param)
|
||||||
{
|
{
|
||||||
ENET_CommonFrame0IRQHandler(ENET);
|
ENET_CommonFrame0IRQHandler(ENET);
|
||||||
/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
|
/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
|
||||||
|
@ -3399,6 +3401,8 @@ void ENET_DriverIRQHandler(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECLARE_HW_IRQ(ENET_IRQn, ENET_DriverIRQHandler, NONE);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ENET1)
|
#if defined(ENET1)
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
SRC_DIR += LwIP test
|
SRC_DIR += LwIP cmd_lwip
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
* Definitions
|
* Definitions
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
#define LWIP_DHCP_TIME 10000 // 10s
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Prototypes
|
* Prototypes
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
@ -124,6 +126,7 @@ int print_dhcp_state(struct netif *netif)
|
||||||
*/
|
*/
|
||||||
void lwip_dhcp_test(void)
|
void lwip_dhcp_test(void)
|
||||||
{
|
{
|
||||||
|
u32_t dhcp_time;
|
||||||
static int flag = 0;
|
static int flag = 0;
|
||||||
char ip_addr[4] = {0, 0, 0, 0};
|
char ip_addr[4] = {0, 0, 0, 0};
|
||||||
|
|
||||||
|
@ -134,11 +137,13 @@ void lwip_dhcp_test(void)
|
||||||
|
|
||||||
dhcp_start(&gnetif);
|
dhcp_start(&gnetif);
|
||||||
|
|
||||||
lw_pr_info("\r\n************************************************\r\n");
|
lw_print("\r\n************************************************\r\n");
|
||||||
lw_pr_info(" DHCP example\r\n");
|
lw_print(" DHCP example\r\n");
|
||||||
lw_pr_info("************************************************\r\n");
|
lw_print("************************************************\r\n");
|
||||||
|
|
||||||
while (1)
|
dhcp_time = sys_now();
|
||||||
|
|
||||||
|
while ((sys_now() - dhcp_time) < LWIP_DHCP_TIME)
|
||||||
{
|
{
|
||||||
/* Poll the driver, get any outstanding frames */
|
/* Poll the driver, get any outstanding frames */
|
||||||
ethernetif_input(&gnetif);
|
ethernetif_input(&gnetif);
|
||||||
|
@ -167,6 +172,6 @@ void lwip_dhcp_test(void)
|
||||||
|
|
||||||
|
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) | SHELL_CMD_PARAM_NUM(0),
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) | SHELL_CMD_PARAM_NUM(0),
|
||||||
getip, lwip_dhcp_test, DHCP_Test);
|
getdynip, lwip_dhcp_test, DHCP_Test);
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -93,7 +93,19 @@ void lwip_ping_thread(int argc, char *argv[])
|
||||||
else if(argc == 2)
|
else if(argc == 2)
|
||||||
{
|
{
|
||||||
lw_print("lw: [%s] gw %s\n", __func__, argv[1]);
|
lw_print("lw: [%s] gw %s\n", __func__, argv[1]);
|
||||||
sscanf(argv[1], "%d.%d.%d.%d", &lwip_gwaddr[0], &lwip_gwaddr[1], &lwip_gwaddr[2], &lwip_gwaddr[3]);
|
if(isdigit(argv[1][0]))
|
||||||
|
{
|
||||||
|
if(sscanf(argv[1], "%d.%d.%d.%d", &lwip_gwaddr[0], &lwip_gwaddr[1], &lwip_gwaddr[2], &lwip_gwaddr[3]) == EOF)
|
||||||
|
{
|
||||||
|
lw_pr_info("input wrong ip\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
get_url_ip(argv[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lw_print("lw: [%s] argc %d\n", __func__, argc);
|
lw_print("lw: [%s] argc %d\n", __func__, argc);
|
||||||
|
@ -107,18 +119,4 @@ void lwip_ping_thread(int argc, char *argv[])
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) | SHELL_CMD_PARAM_NUM(3),
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) | SHELL_CMD_PARAM_NUM(3),
|
||||||
ping, lwip_ping_thread, ping [IP] 3 times);
|
ping, lwip_ping_thread, ping [IP] 3 times);
|
||||||
|
|
||||||
int lwip_dns_test(int argc, char **argv)
|
|
||||||
{
|
|
||||||
if (argc <= 1)
|
|
||||||
{
|
|
||||||
lw_pr_info("Please input: ping <host address>\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
get_url_ip(argv[1]);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) | SHELL_CMD_PARAM_NUM(2),
|
|
||||||
dns, lwip_dns_test, dns [url]);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue