#include <stdlib.h>
#include <string.h>
#include "conf_eth.h"
#include "conf_explorer.h"
#include "gpio.h"
#include "FreeRTOS.h"
#include "task.h"
#include "serial.h"
#include "fsaccess.h"
#include "config_file.h"
#include "conf_lwip_threads.h"
#include "ethernet.h"
#include "macb.h"
#include "lwip/sys.h"
#include "lwip/api.h"
#include "lwip/tcpip.h"
#include "lwip/memp.h"
#include "lwip/stats.h"
#include "lwip/init.h"
#include "supervisor.h"
#include "shell.h"
#include "mmi.h"
Functions | |
eExecStatus | e_ethernet_cmd_get_config (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply) |
The set sensor config command: set the value of a config field of a sensor. Takes three parameters. The first parameter is the sensor's name, the second parameter is the config field name, the third parameter is the value. Format: set_sensor_config sensorname field=value. More... | |
eExecStatus | e_ethernet_cmd_set_config (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply) |
The get sensor config command: get the config fields value of a sensor. Takes one parameter, that is the sensor's name. Format: get_sensor_config sensorname. More... | |
eExecStatus | e_ip_stat (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply) |
The development only ip statck stats: display the TCP/IP stack stats on COM2. No parameters. Format: ipstat. More... | |
portTASK_FUNCTION (vStartEthernetTask, pvParameters) | |
create ethernet task, for ethernet management. More... | |
static void | prv_v_set_default_macaddr (unsigned portCHAR aMacAddress[]) |
Set the default mac addr. More... | |
static void | prv_v_set_default_netconfig (unsigned portCHAR aMacAddress[], struct ip_addr *pxIpAddr, struct ip_addr *pxNetMask, struct ip_addr *pxGateway) |
Set the default network configuration. More... | |
static void | prvEthernetConfigureInterface (void *param) |
set Ethernet config, by parsing ETHERNET_CONFIG_FILE file. More... | |
static void | prvlwIPInit (void) |
start lwIP layer. More... | |
static void | tcpip_init_done (void *arg) |
Callback executed when the TCP/IP init is done. More... | |
void | v_ethernet_stopResources (void) |
Stop the Ethernet module resources. More... | |
void | vEthernetGetGWAddr (portCHAR *pcConfig) |
get the current GW address : formatted as follow : XXX.XXX.XXX.XXX More... | |
void | vEthernetGetIPAddr (portCHAR *pcConfig) |
get the current IP address : formatted as follow : XXX.XXX.XXX.XXX More... | |
void | vEthernetGetMACAddr (portCHAR *pcConfig) |
get the current MAC address : formatted as follow : XX:XX:XX:XX:XX:XX More... | |
void | vEthernetGetSubnetMask (portCHAR *pcConfig) |
get the current Subnet mask : formatted as follow : XXX.XXX.XXX.XXX More... | |
void | vStartEthernetTaskLauncher (unsigned portBASE_TYPE uxPriority) |
Create the vStartEthernetTask task. More... | |
Variables | |
struct netif | MACB_if |
xSemaphoreHandle | xCFGMutex |
eExecStatus e_ethernet_cmd_get_config | ( | eModId | xModId, |
signed short | FsNavId, | ||
int | ac, | ||
signed portCHAR * | av[], | ||
signed portCHAR ** | ppcStringReply | ||
) |
The set sensor config command: set the value of a config field of a sensor. Takes three parameters. The first parameter is the sensor's name, the second parameter is the config field name, the third parameter is the value. Format: set_sensor_config sensorname field=value.
xModId | Input. The module that is calling this function. |
FsNavId | Ignored. |
ac | Input. The argument counter. For this command, should be 3. |
av | Input. The argument vector. |
ppcStringReply | Input/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string. |
References buf, NULL, pvPortMalloc(), SHELL_ERRMSG_MEMALLOC, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, vEthernetGetGWAddr(), vEthernetGetIPAddr(), vEthernetGetMACAddr(), and vEthernetGetSubnetMask().
Referenced by e_syscmds_cmd_get_config().
eExecStatus e_ethernet_cmd_set_config | ( | eModId | xModId, |
signed short | FsNavId, | ||
int | ac, | ||
signed portCHAR * | av[], | ||
signed portCHAR ** | ppcStringReply | ||
) |
The get sensor config command: get the config fields value of a sensor. Takes one parameter, that is the sensor's name. Format: get_sensor_config sensorname.
xModId | Input. The module that is calling this function. |
FsNavId | Ignored. |
ac | Input. The argument counter. For this command, should be 1. |
av | Input. The argument vector. |
ppcStringReply | Input/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string. |
References config_file_set_value(), ETHERNET_CONFIG_FILE, NULL, pvPortMalloc(), SHELL_ERRMSG_CONFIGERROR, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, and SHELL_MSG_REBOOT.
Referenced by e_syscmds_cmd_set_config().
eExecStatus e_ip_stat | ( | eModId | xModId, |
signed short | FsNavId, | ||
int | ac, | ||
signed portCHAR * | av[], | ||
signed portCHAR ** | ppcStringReply | ||
) |
The development only ip statck stats: display the TCP/IP stack stats on COM2. No parameters. Format: ipstat.
xModId | Input. The module that is calling this function. |
FsNavId | Ignored. |
ac | Input. The argument counter. Ignored. |
av | Input. The argument vector. Ignored |
ppcStringReply | Input/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string. |
References NULL, SHELL_EXECSTATUS_OK, and stats_display.
portTASK_FUNCTION | ( | vStartEthernetTask | , |
pvParameters | |||
) |
create ethernet task, for ethernet management.
configure lwIP and MACB, start lwIP layer, start servers tasks through lwIP services.
pvParameters | Input; not used. |
uxPriority | Input. priority for the task, it should be low |
References CTRLPANEL_SMTP_CLIENT_PRIORITY, CTRLPANEL_SMTP_CLIENT_STACK_SIZE, CTRLPANEL_TFTP_SERVER_PRIORITY, CTRLPANEL_TFTP_SERVER_STACK_SIZE, CTRLPANEL_WEB_SERVER_PRIORITY, CTRLPANEL_WEB_SERVER_STACK_SIZE, gpio_enable_module(), lwipBASIC_SMTP_CLIENT_PRIORITY, lwipBASIC_SMTP_CLIENT_STACK_SIZE, lwipBASIC_TFTP_SERVER_PRIORITY, lwipBASIC_TFTP_SERVER_STACK_SIZE, lwipBASIC_WEB_SERVER_PRIORITY, lwipBASIC_WEB_SERVER_STACK_SIZE, NULL, prvlwIPInit(), sys_thread_new(), and vTaskDelete().
|
static |
Set the default mac addr.
aMacAddress[] | Mac address array of len 6. |
References ETHERNET_CONF_ETHADDR0, ETHERNET_CONF_ETHADDR1, ETHERNET_CONF_ETHADDR2, ETHERNET_CONF_ETHADDR3, ETHERNET_CONF_ETHADDR4, and ETHERNET_CONF_ETHADDR5.
Referenced by prv_v_set_default_netconfig(), and prvEthernetConfigureInterface().
|
static |
Set the default network configuration.
aMacAddress[] | Mac address array of len 6 |
pxIpAddr | pointer on Ip address struct |
pxNetMask | pointer on network mask address struct |
pxGateway | pointer on gateway Ip address struct |
References ETHERNET_CONF_GATEWAY_ADDR0, ETHERNET_CONF_GATEWAY_ADDR1, ETHERNET_CONF_GATEWAY_ADDR2, ETHERNET_CONF_GATEWAY_ADDR3, ETHERNET_CONF_IPADDR0, ETHERNET_CONF_IPADDR1, ETHERNET_CONF_IPADDR2, ETHERNET_CONF_IPADDR3, ETHERNET_CONF_NET_MASK0, ETHERNET_CONF_NET_MASK1, ETHERNET_CONF_NET_MASK2, ETHERNET_CONF_NET_MASK3, prv_v_set_default_macaddr(), and vMACBSetMACAddress().
Referenced by prvEthernetConfigureInterface().
|
static |
set Ethernet config, by parsing ETHERNET_CONFIG_FILE file.
References config_file_get_value(), ETHERNET_CONF_GATEWAY_ADDR0, ETHERNET_CONF_GATEWAY_ADDR1, ETHERNET_CONF_GATEWAY_ADDR2, ETHERNET_CONF_GATEWAY_ADDR3, ETHERNET_CONF_IPADDR0, ETHERNET_CONF_IPADDR1, ETHERNET_CONF_IPADDR2, ETHERNET_CONF_IPADDR3, ETHERNET_CONF_NET_MASK0, ETHERNET_CONF_NET_MASK1, ETHERNET_CONF_NET_MASK2, ETHERNET_CONF_NET_MASK3, ETHERNET_CONFIG_FILE, ethernetif_init(), MACB_if, netif_add(), netif_set_default(), netif_set_up(), NULL, pdFALSE, prv_v_set_default_macaddr(), prv_v_set_default_netconfig(), tcpip_input(), vEthernetGetIPAddr(), vMACBSetMACAddress(), vMMI_DisplayIP(), x_supervisor_SemaphoreGive(), x_supervisor_SemaphoreTake(), and xCFGMutex.
Referenced by tcpip_init_done().
|
static |
start lwIP layer.
References ERR_OK, sys_sem_free(), sys_sem_new(), sys_sem_wait, tcpip_init(), and tcpip_init_done().
Referenced by portTASK_FUNCTION().
|
static |
Callback executed when the TCP/IP init is done.
References NULL, prvEthernetConfigureInterface(), and sys_sem_signal().
Referenced by prvlwIPInit().
void v_ethernet_stopResources | ( | void | ) |
Stop the Ethernet module resources.
References vDisableMACBOperations().
Referenced by e_syscmds_reboot().
void vEthernetGetGWAddr | ( | portCHAR * | pcConfig | ) |
get the current GW address : formatted as follow : XXX.XXX.XXX.XXX
pcConfig | Input/Output. The response string. If Input is NULL, no response string will be output. The caller has to allocate this buffer |
References netif::gw, MACB_if, ntohl, NULL, and sprintf().
Referenced by e_ethernet_cmd_get_config().
void vEthernetGetIPAddr | ( | portCHAR * | pcConfig | ) |
get the current IP address : formatted as follow : XXX.XXX.XXX.XXX
pcConfig | Input/Output. The response string. If Input is NULL, no response string will be output. The caller has to allocate this buffer |
References netif::ip_addr, MACB_if, ntohl, NULL, and sprintf().
Referenced by e_ethernet_cmd_get_config(), and prvEthernetConfigureInterface().
void vEthernetGetMACAddr | ( | portCHAR * | pcConfig | ) |
get the current MAC address : formatted as follow : XX:XX:XX:XX:XX:XX
pcConfig | Input/Output. The response string. If Input is NULL, no response string will be output. The caller has to allocate this buffer |
References netif::hwaddr, MACB_if, NULL, and sprintf().
Referenced by e_ethernet_cmd_get_config().
void vEthernetGetSubnetMask | ( | portCHAR * | pcConfig | ) |
get the current Subnet mask : formatted as follow : XXX.XXX.XXX.XXX
pcConfig | Input/Output. The response string. If Input is NULL, no response string will be output. The caller has to allocate this buffer |
References MACB_if, netif::netmask, ntohl, NULL, and sprintf().
Referenced by e_ethernet_cmd_get_config().
void vStartEthernetTaskLauncher | ( | unsigned portBASE_TYPE | uxPriority | ) |
Create the vStartEthernetTask task.
uxPriority | Input; priority of the task to create. |
References configMINIMAL_STACK_SIZE, NULL, and xTaskCreate.
struct netif MACB_if |
xSemaphoreHandle xCFGMutex |
The CFG system mutex.