初始版本
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* MDK Middleware - Component ::Network
|
||||
* Copyright (c) 2004-2019 Arm Limited (or its affiliates). All rights reserved.
|
||||
*------------------------------------------------------------------------------
|
||||
* Name: Net_Config.c
|
||||
* Purpose: Network Configuration
|
||||
* Rev.: V7.1.0
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
|
||||
|
||||
// <h>Network System Settings
|
||||
// <i>Global Network System definitions
|
||||
// <s.15>Local Host Name
|
||||
// <i>This is the name under which embedded host can be
|
||||
// <i>accessed on a local area network.
|
||||
// <i>Default: "my_host"
|
||||
#define NET_HOST_NAME "my_host"
|
||||
|
||||
// <o>Memory Pool Size <1536-262144:4>
|
||||
// <i>This is the size of a memory pool in bytes. Buffers for
|
||||
// <i>network packets are allocated from this memory pool.
|
||||
// <i>Default: 12000 bytes
|
||||
#define NET_MEM_POOL_SIZE 12000
|
||||
|
||||
// <q>Start System Services
|
||||
// <i>If enabled, the system will automatically start server services
|
||||
// <i>(HTTP, FTP, TFTP server, ...) when initializing the network system.
|
||||
// <i>Default: Enabled
|
||||
#define NET_START_SERVICE 1
|
||||
|
||||
// <h>OS Resource Settings
|
||||
// <i>These settings are used to optimize usage of OS resources.
|
||||
// <o>Core Thread Stack Size <512-65535:4>
|
||||
// <i>Default: 1024 bytes
|
||||
#define NET_THREAD_STACK_SIZE 1024
|
||||
|
||||
// Core Thread Priority
|
||||
#define NET_THREAD_PRIORITY osPriorityNormal
|
||||
|
||||
// </h>
|
||||
// </h>
|
||||
|
||||
//------------- <<< end of configuration section >>> ---------------------------
|
||||
|
||||
#include "RTE_Components.h"
|
||||
|
||||
#ifdef RTE_Network_Interface_ETH_0
|
||||
#include "Net_Config_ETH_0.h"
|
||||
#endif
|
||||
#ifdef RTE_Network_Interface_ETH_1
|
||||
#include "Net_Config_ETH_1.h"
|
||||
#endif
|
||||
|
||||
#ifdef RTE_Network_Interface_WiFi_0
|
||||
#include "Net_Config_WiFi_0.h"
|
||||
#endif
|
||||
|
||||
#ifdef RTE_Network_Interface_WiFi_1
|
||||
#include "Net_Config_WiFi_1.h"
|
||||
#endif
|
||||
|
||||
#ifdef RTE_Network_Interface_PPP
|
||||
#include "Net_Config_PPP.h"
|
||||
#endif
|
||||
|
||||
#ifdef RTE_Network_Interface_SLIP
|
||||
#include "Net_Config_SLIP.h"
|
||||
#endif
|
||||
|
||||
#ifdef RTE_Network_Socket_UDP
|
||||
#include "Net_Config_UDP.h"
|
||||
#endif
|
||||
#ifdef RTE_Network_Socket_TCP
|
||||
#include "Net_Config_TCP.h"
|
||||
#endif
|
||||
#ifdef RTE_Network_Socket_BSD
|
||||
#include "Net_Config_BSD.h"
|
||||
#endif
|
||||
|
||||
#ifdef RTE_Network_Web_Server_RO
|
||||
#include "Net_Config_HTTP_Server.h"
|
||||
#endif
|
||||
#ifdef RTE_Network_Web_Server_FS
|
||||
#include "Net_Config_HTTP_Server.h"
|
||||
#endif
|
||||
|
||||
#ifdef RTE_Network_Telnet_Server
|
||||
#include "Net_Config_Telnet_Server.h"
|
||||
#endif
|
||||
|
||||
#ifdef RTE_Network_TFTP_Server
|
||||
#include "Net_Config_TFTP_Server.h"
|
||||
#endif
|
||||
#ifdef RTE_Network_TFTP_Client
|
||||
#include "Net_Config_TFTP_Client.h"
|
||||
#endif
|
||||
|
||||
#ifdef RTE_Network_FTP_Server
|
||||
#include "Net_Config_FTP_Server.h"
|
||||
#endif
|
||||
#ifdef RTE_Network_FTP_Client
|
||||
#include "Net_Config_FTP_Client.h"
|
||||
#endif
|
||||
|
||||
#ifdef RTE_Network_DNS_Client
|
||||
#include "Net_Config_DNS_Client.h"
|
||||
#endif
|
||||
|
||||
#ifdef RTE_Network_SMTP_Client
|
||||
#include "Net_Config_SMTP_Client.h"
|
||||
#endif
|
||||
|
||||
#ifdef RTE_Network_SNMP_Agent
|
||||
#include "Net_Config_SNMP_Agent.h"
|
||||
#endif
|
||||
|
||||
#ifdef RTE_Network_SNTP_Client
|
||||
#include "Net_Config_SNTP_Client.h"
|
||||
#endif
|
||||
|
||||
#include "net_config.h"
|
||||
|
||||
/**
|
||||
\addtogroup net_genFunc
|
||||
@{
|
||||
*/
|
||||
/**
|
||||
\fn void net_sys_error (NET_ERROR error)
|
||||
\ingroup net_cores
|
||||
\brief Network system error handler.
|
||||
*/
|
||||
void net_sys_error (NET_ERROR error) {
|
||||
/* This function is called when a fatal error is encountered. */
|
||||
/* The normal program execution is not possible anymore. */
|
||||
|
||||
switch (error) {
|
||||
case NET_ERROR_MEM_ALLOC:
|
||||
/* Out of memory */
|
||||
break;
|
||||
|
||||
case NET_ERROR_MEM_FREE:
|
||||
/* Trying to release non existing memory block */
|
||||
break;
|
||||
|
||||
case NET_ERROR_MEM_CORRUPT:
|
||||
/* Memory Link pointer corrupted */
|
||||
/* More data written than the size of allocated memory block */
|
||||
break;
|
||||
|
||||
case NET_ERROR_CONFIG:
|
||||
/* Network configuration error detected */
|
||||
break;
|
||||
|
||||
case NET_ERROR_UDP_ALLOC:
|
||||
/* Out of UDP Sockets */
|
||||
break;
|
||||
|
||||
case NET_ERROR_TCP_ALLOC:
|
||||
/* Out of TCP Sockets */
|
||||
break;
|
||||
|
||||
case NET_ERROR_TCP_STATE:
|
||||
/* TCP State machine in undefined state */
|
||||
break;
|
||||
}
|
||||
|
||||
/* End-less loop */
|
||||
while (1);
|
||||
}
|
||||
/**
|
||||
@}
|
||||
*/
|
||||
@@ -0,0 +1,253 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* MDK Middleware - Component ::Network:Interface
|
||||
* Copyright (c) 2004-2020 Arm Limited (or its affiliates). All rights reserved.
|
||||
*------------------------------------------------------------------------------
|
||||
* Name: Net_Config_ETH_0.h
|
||||
* Purpose: Network Configuration for ETH Interface
|
||||
* Rev.: V7.3.0
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
|
||||
|
||||
// <h>Ethernet Network Interface 0
|
||||
#define ETH0_ENABLE 1
|
||||
|
||||
// <o>Connect to hardware via Driver_ETH# <0-255>
|
||||
// <i>Select driver control block for MAC and PHY interface
|
||||
#define ETH0_DRIVER 0
|
||||
|
||||
// <s.17>MAC Address
|
||||
// <i>Ethernet MAC Address in text representation
|
||||
// <i>Value FF-FF-FF-FF-FF-FF is not allowed,
|
||||
// <i>LSB of first byte must be 0 (an ethernet Multicast bit).
|
||||
// <i>Default: "1E-30-6C-A2-45-5E"
|
||||
#define ETH0_MAC_ADDR "1E-30-6C-A2-45-5E"
|
||||
|
||||
// <e>VLAN
|
||||
// <i>Enable or disable Virtual LAN
|
||||
#define ETH0_VLAN_ENABLE 0
|
||||
|
||||
// <o>VLAN Identifier <1-4093>
|
||||
// <i>A unique 12-bit numeric value
|
||||
// <i>Default: 1
|
||||
#define ETH0_VLAN_ID 1
|
||||
// </e>
|
||||
|
||||
// <e>IPv4
|
||||
// <i>Enable IPv4 Protocol for Network Interface
|
||||
#define ETH0_IP4_ENABLE 1
|
||||
|
||||
// <s.15>IP Address
|
||||
// <i>Static IPv4 Address in text representation
|
||||
// <i>Default: "192.168.0.100"
|
||||
#define ETH0_IP4_ADDR "192.168.0.100"
|
||||
|
||||
// <s.15>Subnet mask
|
||||
// <i>Local Subnet mask in text representation
|
||||
// <i>Default: "255.255.255.0"
|
||||
#define ETH0_IP4_MASK "255.255.255.0"
|
||||
|
||||
// <s.15>Default Gateway
|
||||
// <i>IP Address of Default Gateway in text representation
|
||||
// <i>Default: "192.168.0.254"
|
||||
#define ETH0_IP4_GATEWAY "192.168.0.254"
|
||||
|
||||
// <s.15>Primary DNS Server
|
||||
// <i>IP Address of Primary DNS Server in text representation
|
||||
// <i>Default: "8.8.8.8"
|
||||
#define ETH0_IP4_PRIMARY_DNS "8.8.8.8"
|
||||
|
||||
// <s.15>Secondary DNS Server
|
||||
// <i>IP Address of Secondary DNS Server in text representation
|
||||
// <i>Default: "8.8.4.4"
|
||||
#define ETH0_IP4_SECONDARY_DNS "8.8.4.4"
|
||||
|
||||
// <e>IP Fragmentation
|
||||
// <i>This option enables fragmentation of outgoing IP datagrams,
|
||||
// <i>and reassembling the fragments of incoming IP datagrams.
|
||||
// <i>Default: enabled
|
||||
#define ETH0_IP4_FRAG_ENABLE 1
|
||||
|
||||
// <o>MTU size <576-1500>
|
||||
// <i>Maximum Transmission Unit in bytes
|
||||
// <i>Default: 1500
|
||||
#define ETH0_IP4_MTU 1500
|
||||
// </e>
|
||||
|
||||
// <h>ARP Address Resolution
|
||||
// <i>ARP cache and node address resolver settings
|
||||
// <o>Cache Table size <5-100>
|
||||
// <i>Number of cached MAC/IP addresses
|
||||
// <i>Default: 10
|
||||
#define ETH0_ARP_TAB_SIZE 10
|
||||
|
||||
// <o>Cache Timeout in seconds <5-255>
|
||||
// <i>A timeout for cached hardware/IP addresses
|
||||
// <i>Default: 150
|
||||
#define ETH0_ARP_CACHE_TOUT 150
|
||||
|
||||
// <o>Number of Retries <0-20>
|
||||
// <i>Number of Retries to resolve an IP address
|
||||
// <i>before ARP module gives up
|
||||
// <i>Default: 4
|
||||
#define ETH0_ARP_MAX_RETRY 4
|
||||
|
||||
// <o>Resend Timeout in seconds <1-10>
|
||||
// <i>A timeout to resend the ARP Request
|
||||
// <i>Default: 2
|
||||
#define ETH0_ARP_RESEND_TOUT 2
|
||||
|
||||
// <q>Send Notification on Address changes
|
||||
// <i>When this option is enabled, the embedded host
|
||||
// <i>will send a Gratuitous ARP notification at startup,
|
||||
// <i>or when the device IP address has changed.
|
||||
// <i>Default: Disabled
|
||||
#define ETH0_ARP_NOTIFY 0
|
||||
// </h>
|
||||
|
||||
// <e>IGMP Group Management
|
||||
// <i>Enable or disable Internet Group Management Protocol
|
||||
#define ETH0_IGMP_ENABLE 0
|
||||
|
||||
// <o>Membership Table size <2-50>
|
||||
// <i>Number of Groups this host can join
|
||||
// <i>Default: 5
|
||||
#define ETH0_IGMP_TAB_SIZE 5
|
||||
// </e>
|
||||
|
||||
// <q>NetBIOS Name Service
|
||||
// <i>When this option is enabled, the embedded host can be
|
||||
// <i>accessed by its name on local LAN using NBNS protocol.
|
||||
#define ETH0_NBNS_ENABLE 1
|
||||
|
||||
// <e>Dynamic Host Configuration
|
||||
// <i>When this option is enabled, local IP address, Net Mask
|
||||
// <i>and Default Gateway are obtained automatically from
|
||||
// <i>the DHCP Server on local LAN.
|
||||
#define ETH0_DHCP_ENABLE 1
|
||||
|
||||
// <s.40>Vendor Class Identifier
|
||||
// <i>This value is optional. If specified, it is added
|
||||
// <i>to DHCP request message, identifying vendor type.
|
||||
// <i>Default: ""
|
||||
#define ETH0_DHCP_VCID ""
|
||||
|
||||
// <q>Bootfile Name
|
||||
// <i>This value is optional. If enabled, the Bootfile Name
|
||||
// <i>(option 67) is also requested from DHCP server.
|
||||
// <i>Default: disabled
|
||||
#define ETH0_DHCP_BOOTFILE 0
|
||||
|
||||
// <q>NTP Servers
|
||||
// <i>This value is optional. If enabled, a list of NTP Servers
|
||||
// <i>(option 42) is also requested from DHCP server.
|
||||
// <i>Default: disabled
|
||||
#define ETH0_DHCP_NTP_SERVERS 0
|
||||
// </e>
|
||||
|
||||
// Disable ICMP Echo response
|
||||
#define ETH0_ICMP_NO_ECHO 0
|
||||
// </e>
|
||||
|
||||
// <e>IPv6
|
||||
// <i>Enable IPv6 Protocol for Network Interface
|
||||
#define ETH0_IP6_ENABLE 1
|
||||
|
||||
// <s.40>IPv6 Address
|
||||
// <i>Static IPv6 Address in text representation
|
||||
// <i>Use unspecified address "::" when static
|
||||
// <i>IPv6 address is not used.
|
||||
// <i>Default: "fec0::2"
|
||||
#define ETH0_IP6_ADDR "fec0::2"
|
||||
|
||||
// <o>Subnet prefix-length <1-128>
|
||||
// <i>Number of bits that define network address
|
||||
// <i>Default: 64
|
||||
#define ETH0_IP6_PREFIX_LEN 64
|
||||
|
||||
// <s.40>Default Gateway
|
||||
// <i>Default Gateway IPv6 Address in text representation
|
||||
// <i>Default: "fec0::1"
|
||||
#define ETH0_IP6_GATEWAY "fec0::1"
|
||||
|
||||
// <s.40>Primary DNS Server
|
||||
// <i>Primary DNS Server IPv6 Address in text representation
|
||||
// <i>Default: "2001:4860:4860::8888"
|
||||
#define ETH0_IP6_PRIMARY_DNS "2001:4860:4860::8888"
|
||||
|
||||
// <s.40>Secondary DNS Server
|
||||
// <i>Secondary DNS Server IPv6 Address in text representation
|
||||
// <i>Default: "2001:4860:4860::8844"
|
||||
#define ETH0_IP6_SECONDARY_DNS "2001:4860:4860::8844"
|
||||
|
||||
// <h>Neighbor Discovery
|
||||
// <i>Neighbor cache and node address resolver settings
|
||||
// <o>Cache Table size <5-100>
|
||||
// <i>Number of cached node addresses
|
||||
// <i>Default: 5
|
||||
#define ETH0_NDP_TAB_SIZE 5
|
||||
|
||||
// <o>Cache Timeout in seconds <5-255>
|
||||
// <i>Timeout for cached node addresses
|
||||
// <i>Default: 150
|
||||
#define ETH0_NDP_CACHE_TOUT 150
|
||||
|
||||
// <o>Number of Retries <0-20>
|
||||
// <i>Number of retries to resolve an IP address
|
||||
// <i>before NDP module gives up
|
||||
// <i>Default: 4
|
||||
#define ETH0_NDP_MAX_RETRY 4
|
||||
|
||||
// <o>Resend Timeout in seconds <1-10>
|
||||
// <i>A timeout to resend Neighbor Solicitation
|
||||
// <i>Default: 2
|
||||
#define ETH0_NDP_RESEND_TOUT 2
|
||||
// </h>
|
||||
|
||||
// <e>Dynamic Host Configuration
|
||||
// <i>When this option is enabled, local IPv6 address is
|
||||
// <i>automatically configured.
|
||||
#define ETH0_DHCP6_ENABLE 1
|
||||
|
||||
// <o>DHCPv6 Client Mode <0=>Stateless Mode <1=>Statefull Mode
|
||||
// <i>Stateless DHCPv6 Client uses router advertisements
|
||||
// <i>for IPv6 address autoconfiguration (SLAAC).
|
||||
// <i>Statefull DHCPv6 Client connects to DHCPv6 server for a
|
||||
// <i>leased IPv6 address and DNS server IPv6 addresses.
|
||||
#define ETH0_DHCP6_MODE 1
|
||||
|
||||
// <e>Vendor Class Option
|
||||
// <i>If enabled, Vendor Class option is added to DHCPv6
|
||||
// <i>request message, identifying vendor type.
|
||||
// <i>Default: disabled
|
||||
#define ETH0_DHCP6_VCLASS_ENABLE 0
|
||||
|
||||
// <o>Enterprise ID
|
||||
// <i>Enterprise-number as registered with IANA.
|
||||
// <i>Default: 0 (Reserved)
|
||||
#define ETH0_DHCP6_VCLASS_EID 0
|
||||
|
||||
// <s.40>Vendor Class Data
|
||||
// <i>This string identifies vendor type.
|
||||
// <i>Default: ""
|
||||
#define ETH0_DHCP6_VCLASS_DATA ""
|
||||
// </e>
|
||||
// </e>
|
||||
|
||||
// Disable ICMP6 Echo response
|
||||
#define ETH0_ICMP6_NO_ECHO 0
|
||||
// </e>
|
||||
|
||||
// <h>OS Resource Settings
|
||||
// <i>These settings are used to optimize usage of OS resources.
|
||||
// <o>Interface Thread Stack Size <512-65535:4>
|
||||
// <i>Default: 512 bytes
|
||||
#define ETH0_THREAD_STACK_SIZE 512
|
||||
|
||||
// Interface Thread Priority
|
||||
#define ETH0_THREAD_PRIORITY osPriorityAboveNormal
|
||||
|
||||
// </h>
|
||||
// </h>
|
||||
|
||||
//------------- <<< end of configuration section >>> ---------------------------
|
||||
@@ -0,0 +1,69 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* MDK Middleware - Component ::Network:Socket
|
||||
* Copyright (c) 2004-2019 Arm Limited (or its affiliates). All rights reserved.
|
||||
*------------------------------------------------------------------------------
|
||||
* Name: Net_Config_TCP.h
|
||||
* Purpose: Network Configuration for TCP Sockets
|
||||
* Rev.: V7.1.1
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
|
||||
|
||||
// <h>TCP Sockets
|
||||
#define TCP_ENABLE 1
|
||||
|
||||
// <o>Number of TCP Sockets <1-20>
|
||||
// <i>Number of available TCP sockets
|
||||
// <i>Default: 6
|
||||
#define TCP_NUM_SOCKS 6
|
||||
|
||||
// <o>Number of Retries <0-20>
|
||||
// <i>How many times TCP module will try to retransmit data
|
||||
// <i>before giving up. Increase this value for high-latency
|
||||
// <i>and low throughput networks.
|
||||
// <i>Default: 5
|
||||
#define TCP_MAX_RETRY 5
|
||||
|
||||
// <o>Retry Timeout in seconds <1-10>
|
||||
// <i>If data frame not acknowledged within this time frame,
|
||||
// <i>TCP module will try to resend the data again.
|
||||
// <i>Default: 4
|
||||
#define TCP_RETRY_TOUT 4
|
||||
|
||||
// <o>Default Connect Timeout in seconds <1-65535>
|
||||
// <i>If no TCP data frame has been exchanged during this time,
|
||||
// <i>the TCP connection is either closed or a keep-alive frame
|
||||
// <i>is sent to verify that the connection still exists.
|
||||
// <i>Default: 120
|
||||
#define TCP_DEFAULT_TOUT 120
|
||||
|
||||
// <o>Maximum Segment Size <536-1440>
|
||||
// <i>The Maximum Segment Size specifies the maximum
|
||||
// <i>number of bytes in the TCP segment's Data field.
|
||||
// <i>Default: 1440
|
||||
#define TCP_MAX_SEG_SIZE 1440
|
||||
|
||||
// <o>Receive Window Size <536-65535>
|
||||
// <i>Receive Window Size specifies the size of data,
|
||||
// <i>that the socket is able to buffer in flow-control mode.
|
||||
// <i>Default: 4320
|
||||
#define TCP_RECEIVE_WIN_SIZE 4320
|
||||
|
||||
// </h>
|
||||
|
||||
// TCP Initial Retransmit period in seconds
|
||||
#define TCP_INITIAL_RETRY_TOUT 1
|
||||
|
||||
// TCP SYN frame retransmit period in seconds
|
||||
#define TCP_SYN_RETRY_TOUT 2
|
||||
|
||||
// Number of retries to establish a connection
|
||||
#define TCP_CONNECT_RETRY 7
|
||||
|
||||
// Dynamic port start (default 49152)
|
||||
#define TCP_DYN_PORT_START 49152
|
||||
|
||||
// Dynamic port end (default 65535)
|
||||
#define TCP_DYN_PORT_END 65535
|
||||
|
||||
//------------- <<< end of configuration section >>> ---------------------------
|
||||
Reference in New Issue
Block a user