fixed menu and complilation error

This commit is contained in:
wlyu 2021-12-20 16:44:44 +08:00
commit 8992dce241
14 changed files with 718 additions and 752 deletions

View File

@ -3,6 +3,7 @@ menu "control app"
menuconfig APPLICATION_CONTROL
bool "Using control apps"
default n
depends on SUPPORT_CONTROL_FRAMEWORK
endmenu

View File

@ -2,9 +2,11 @@ SRC_DIR :=
ifeq ($(CONFIG_RESOURCES_LWIP),y)
SRC_DIR += lwip_demo
endif
ifeq ($(CONFIG_USING_CONTROL_PLC_OPCUA), y)
SRC_DIR += opcua_demo
endif
endif
include $(KERNEL_ROOT)/compiler.mk

View File

@ -1,3 +1,3 @@
SRC_FILES := ping.c lwip_ping_demo.c
SRC_FILES := ping.c lwip_ping_demo.c udp_echo.c lwip_udp_demo.c
include $(KERNEL_ROOT)/compiler.mk

View File

@ -46,8 +46,6 @@
#include "pin_mux.h"
#include "clock_config.h"
#include "fsl_gpio.h"
#include "fsl_iomuxc.h"
#include <transform.h>
#include <sys_arch.h>

View File

@ -19,6 +19,7 @@
*/
#include <xiuos.h>
#include "board.h"
#include "udp_echo.h"
#include <connect_ethernet.h>

View File

@ -25,12 +25,9 @@
#include <stdint.h>
#include <sys/types.h>
#include <lwip/altcp.h>
#include <fsl_gpio.h>
#include <fsl_iomuxc.h>
#include "netif/ethernet.h"
#include "enet_ethernetif.h"
#include "connect_ethernet.h"
#include "board.h"
typedef unsigned int nfds_t;
#include "../../../../APP_Framework/Framework/control/plc/interoperability/opcua/open62541.h"
@ -70,14 +67,13 @@ typedef unsigned int nfds_t;
/* System clock name. */
#define EXAMPLE_CLOCK_NAME kCLOCK_CoreSysClk
//#define sourceClock CLOCK_GetFreq(kCLOCK_CoreSysClk)
const char *test_uri = "opc.tcp://192.168.250.5:4840";
const char *test_cb_str = "tcp client connected\r\n";
void ua_ip_init(void)
{
#ifdef BOARD_CORTEX_M7_EVB
struct netif fsl_netif0;
#if defined(FSL_FEATURE_SOC_LPC_ENET_COUNT) && (FSL_FEATURE_SOC_LPC_ENET_COUNT > 0)
mem_range_t non_dma_memory[] = NON_DMA_MEMORY_ARRAY;
@ -92,8 +88,6 @@ void ua_ip_init(void)
#endif /* FSL_FEATURE_SOC_LPC_ENET_COUNT */
};
gpio_pin_config_t gpio_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};
ua_print("lw: [%s] start ...\n", __func__);
IP4_ADDR(&fsl_netif0_ipaddr, configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3);
@ -107,8 +101,6 @@ void ua_ip_init(void)
netif_set_default(&fsl_netif0);
netif_set_up(&fsl_netif0);
// ping_init(&fsl_netif0_gw);
ua_print("\r\n************************************************\r\n");
ua_print(" PING example\r\n");
ua_print("************************************************\r\n");
@ -119,7 +111,7 @@ void ua_ip_init(void)
ua_print(" IPv4 Gateway : %u.%u.%u.%u\r\n", ((u8_t *)&fsl_netif0_gw)[0], ((u8_t *)&fsl_netif0_gw)[1],
((u8_t *)&fsl_netif0_gw)[2], ((u8_t *)&fsl_netif0_gw)[3]);
ua_print("************************************************\r\n");
#endif
}
// tcp client callback
@ -243,4 +235,3 @@ void TestUaConnect(int argc, char *argv[])
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) | SHELL_CMD_PARAM_NUM(0),
UaConnect, TestUaConnect, TestUaConnect);

View File

@ -2,4 +2,5 @@
menuconfig USING_CONTROL_PLC_OPCUA
bool "PLC support OPCUA"
default y
depends on RESOURCES_LWIP

View File

@ -1,9 +1,13 @@
SRC_DIR :=
ifeq ($(CONFIG_RESOURCES_LWIP),y)
ifeq ($(CONFIG_USING_CONTROL_PLC_OPCUA), y)
SRC_DIR += opcua
endif
endif
SRC_FILES += interoperability.c
include $(KERNEL_ROOT)/compiler.mk

View File

@ -426,8 +426,6 @@ void ENET_Init(ENET_Type *base,
/* Reset ENET module. */
ENET_Reset(base);
lw_print("lw: [%s] config %p %x\n", __func__, config, config->interrupt);
/* Initializes the ENET transmit buffer descriptors. */
ENET_SetTxBufferDescriptors(handle, config, bufferConfig);
@ -504,9 +502,6 @@ static void ENET_SetHandler(ENET_Type *base,
handle->txBdCurrent[count] = buffCfg->txBdStartAddrAlign;
handle->txBuffSizeAlign[count] = buffCfg->txBuffSizeAlign;
lw_print("lw: [%s] %d instance %d ring %d %p IRQ %p %#x\n", __func__,
count, instance, handle->ringNum, buffCfg->rxBdStartAddrAlign, config, config->interrupt);
buffCfg++;
}
@ -516,19 +511,16 @@ static void ENET_SetHandler(ENET_Type *base,
/* Set the IRQ handler when the interrupt is enabled. */
if (config->interrupt & ENET_TX_INTERRUPT)
{
lw_trace();
s_enetTxIsr = ENET_TransmitIRQHandler;
EnableIRQ(s_enetTxIrqId[instance]);
}
if (config->interrupt & ENET_RX_INTERRUPT)
{
lw_trace();
s_enetRxIsr = ENET_ReceiveIRQHandler;
EnableIRQ(s_enetRxIrqId[instance]);
}
if (config->interrupt & ENET_ERR_INTERRUPT)
{
lw_trace();
s_enetErrIsr = ENET_ErrorIRQHandler;
EnableIRQ(s_enetErrIrqId[instance]);
}
@ -921,10 +913,6 @@ static void ENET_ActiveSend(ENET_Type *base, uint32_t ringId)
/* Ensure previous data update is completed with Data Synchronization Barrier before activing Tx BD. */
__DSB();
//tst by wly
// lw_print("lw: [%s] ring %d\n", __func__, ringId);
switch (ringId)
{
case kENET_Ring0:
@ -1322,12 +1310,9 @@ status_t ENET_GetRxFrameSize(enet_handle_t *handle, uint32_t *length)
}
/* FCS is removed by MAC. */
*length = curBuffDescrip->length;
// lw_print("lw: [%s] %p %p ctrl %#x ok\n", __func__, curBuffDescrip, handle->rxBdCurrent[0], curBuffDescrip->control);
return kStatus_Success;
}
// lw_print("lw: [%s] %p %p ctrl %#x\n", __func__, curBuffDescrip, handle->rxBdCurrent[0], curBuffDescrip->control);
/* Increase the buffer descriptor, if it is the last one, increase to first one of the ring buffer. */
if (curBuffDescrip->control & ENET_BUFFDESCRIPTOR_RX_WRAP_MASK)
{
@ -1396,8 +1381,6 @@ status_t ENET_ReadFrame(ENET_Type *base, enet_handle_t *handle, uint8_t *data, u
/* For data-NULL input, only update the buffer descriptor. */
if (!data)
{
// lw_print("lw: [%s] data %d ctrl %#x\n", __func__, length, handle->rxBdCurrent[0]->control);
do
{
/* Update the control flag. */
@ -1418,8 +1401,6 @@ status_t ENET_ReadFrame(ENET_Type *base, enet_handle_t *handle, uint8_t *data, u
else
{
// lw_print("lw: [%s] data len %d ctrl %#x\n", __func__, length, handle->rxBdCurrent[0]->control);
/* A frame on one buffer or several receive buffers are both considered. */
#if defined(FSL_FEATURE_MEMORY_HAS_ADDRESS_OFFSET) && FSL_FEATURE_MEMORY_HAS_ADDRESS_OFFSET
address = MEMORY_ConvertMemoryMapAddress((uint32_t)curBuffDescrip->buffer, kMEMORY_DMA2Local);
@ -1489,9 +1470,6 @@ status_t ENET_ReadFrame(ENET_Type *base, enet_handle_t *handle, uint8_t *data, u
/* Get the current buffer descriptor. */
curBuffDescrip = handle->rxBdCurrent[0];
// lw_print("lw: [%s] ctrl %#x\n", __func__, handle->rxBdCurrent[0]->control);
/* Add the cache invalidate maintain. */
#if defined(FSL_FEATURE_MEMORY_HAS_ADDRESS_OFFSET) && FSL_FEATURE_MEMORY_HAS_ADDRESS_OFFSET
address = MEMORY_ConvertMemoryMapAddress((uint32_t)curBuffDescrip->buffer, kMEMORY_DMA2Local);
@ -1517,8 +1495,6 @@ static void ENET_UpdateReadBuffers(ENET_Type *base, enet_handle_t *handle, uint3
/* Sets the receive buffer descriptor with the empty flag. */
handle->rxBdCurrent[ringId]->control |= ENET_BUFFDESCRIPTOR_RX_EMPTY_MASK;
// lw_print("lw: [%s] ring %d ctrl %#x\n", __func__, ringId, handle->rxBdCurrent[ringId]->control);
/* Increase current buffer descriptor to the next one. */
if (handle->rxBdCurrent[ringId]->control & ENET_BUFFDESCRIPTOR_RX_WRAP_MASK)
{
@ -1529,8 +1505,6 @@ static void ENET_UpdateReadBuffers(ENET_Type *base, enet_handle_t *handle, uint3
handle->rxBdCurrent[ringId]++;
}
// lw_print("lw: [%s] ring %d changed ctrl %#x\n", __func__, ringId, handle->rxBdCurrent[ringId]->control);
/* Ensure previous data update is completed with Data Synchronization Barrier before activing Rx BD. */
__DSB();
@ -1636,8 +1610,6 @@ status_t ENET_SendFrame(ENET_Type *base, enet_handle_t *handle, const uint8_t *d
handle->txBdCurrent[0]++;
}
// lw_print("lw: [%s] ctrl %#x\n", __func__, curBuffDescrip->control);
/* Active the transmit buffer descriptor. */
ENET_ActiveSend(base, 0);
@ -3130,8 +3102,6 @@ void ENET_ReceiveIRQHandler(ENET_Type *base, enet_handle_t *handle)
assert(handle);
uint32_t mask = kENET_RxFrameInterrupt | kENET_RxBufferInterrupt;
lw_print("lw: [%s] input\n", __func__);
/* Check if the receive interrupt happen. */
#if FSL_FEATURE_ENET_QUEUE > 1
switch (ringId)

View File

@ -1,5 +1,3 @@
SRC_FILES += sys_arch.c \
tcp_echo_socket_demo.c \
udp_echo.c
SRC_FILES += sys_arch.c
include $(KERNEL_ROOT)/compiler.mk