ethernet.c File Reference


Detailed Description

lwIP on ethernet entry point.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file ethernet.c.

#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 "BasicWEB.h"
#include "BasicSMTP.h"
#include "lwip/sys.h"
#include "lwip/api.h"
#include "lwip/tcpip.h"
#include "lwip/memp.h"
#include "lwip/stats.h"
#include "netif/loopif.h"
#include "supervisor.h"
#include "shell.h"
#include "MMI.h"

Go to the source code of this file.

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.
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.
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.
 portTASK_FUNCTION (vStartEthernetTask, pvParameters)
 configure lwIP and MACB, start lwIP layer, start servers tasks through lwIP services.
static void prv_v_set_default_macaddr (unsigned portCHAR aMacAddress[])
 Set the default mac addr.
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.
static void prvEthernetConfigureInterface (void *param)
 set ethernet config, by parsing ETHERNET_CONFIG_FILE file.
static void prvlwIPInit (void)
 start lwIP layer.
static void tcpip_init_done (void *arg)
 Callback executed when the TCP/IP init is done.
void v_ethernet_stopResources (void)
 Stop the ethernet module resources.
void vEthernetGetGWAddr (portCHAR *pcConfig)
 get the current GW address : formatted as follow : XXX.XXX.XXX.XXX
void vEthernetGetIPAddr (portCHAR *pcConfig)
 get the current IP address : formatted as follow : XXX.XXX.XXX.XXX
void vEthernetGetMACAddr (portCHAR *pcConfig)
 get the current MAC address : formatted as follow : XX:XX:XX:XX:XX:XX
void vEthernetGetSubnetMask (portCHAR *pcConfig)
 get the current Subnet mask : formatted as follow : XXX.XXX.XXX.XXX
void vStartEthernetTaskLauncher (unsigned portBASE_TYPE uxPriority)
 Create the vStartEthernetTask task.

Variables

struct netif MACB_if
xSemaphoreHandle xCFGMutex


Function Documentation

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.

Note:
This function must be of the type pfShellCmd defined by the shell module.
Parameters:
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.
Returns:
the status of the command execution.

Definition at line 343 of file ethernet.c.

References SHELL_ERRMSG_MEMALLOC, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, vEthernetGetGWAddr(), vEthernetGetIPAddr(), vEthernetGetMACAddr(), and vEthernetGetSubnetMask().

Referenced by e_syscmds_cmd_get_config().

00346 {
00347 portCHAR buf[18];
00348 
00349   if(ppcStringReply != NULL)
00350   {
00351     /* allocate a buffer for answer */
00352     *ppcStringReply = (signed portCHAR *)pvPortMalloc(130);
00353     if( NULL == *ppcStringReply )
00354     {
00355        *ppcStringReply = (signed portCHAR *)SHELL_ERRMSG_MEMALLOC;
00356        return( SHELL_EXECSTATUS_KO );
00357     }
00358     /* add some static data */
00359     strcpy((char *)*ppcStringReply, "macaddr=");
00360     /* get MAC addr and add it to the buffer */
00361     vEthernetGetMACAddr(buf);
00362     strcat((char *)*ppcStringReply,buf);
00363     /* add some static data */
00364     strcat((char *)*ppcStringReply,"\r\nipaddr=");
00365     /* get IP addr and add it to the buffer */
00366     vEthernetGetIPAddr(buf);
00367     strcat((char *)*ppcStringReply,buf);
00368     /* add some static data */
00369     strcat((char *)*ppcStringReply,"\r\nsubmask=");
00370     /* get Subnet Mask and add it to the buffer */
00371     vEthernetGetSubnetMask(buf);
00372     strcat((char *)*ppcStringReply,buf);
00373     /* add some static data */
00374     strcat((char *)*ppcStringReply,"\r\ngwaddr=");
00375     /* get GW addr and add it to the buffer */
00376     vEthernetGetGWAddr(buf);
00377     strcat((char *)*ppcStringReply,buf);
00378     /* add some static data */
00379     strcat((char *)*ppcStringReply,"\r\n");
00380     /* no error, return */
00381     return( SHELL_EXECSTATUS_OK );
00382   }
00383   return( SHELL_EXECSTATUS_KO );
00384 }

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.

Note:
This function must be of the type pfShellCmd defined by the shell module.
Parameters:
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.
Returns:
the status of the command execution.

Definition at line 298 of file ethernet.c.

References config_file_set_value(), ETHERNET_CONFIG_FILE, SHELL_ERRMSG_CONFIGERROR, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, and SHELL_MSG_REBOOT.

Referenced by e_syscmds_cmd_set_config().

00301 {
00302 
00303     if (config_file_set_value(ETHERNET_CONFIG_FILE, ac, av) != 0)
00304     {
00305       if(ppcStringReply != NULL)
00306       {
00307         *ppcStringReply = (signed portCHAR *)SHELL_ERRMSG_CONFIGERROR;
00308       }
00309       return( SHELL_EXECSTATUS_KO );
00310     }
00311     if(ppcStringReply != NULL)
00312     {
00313       /* allocate a buffer for answer */
00314       *ppcStringReply = (signed portCHAR *)pvPortMalloc( strlen( SHELL_MSG_REBOOT ) +1 ); // Alloc
00315       if( NULL != *ppcStringReply )
00316       {
00317          strcpy( (char *)*ppcStringReply, SHELL_MSG_REBOOT );
00318       }
00319     }
00320     return( SHELL_EXECSTATUS_OK );
00321 }

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.

Note:
This function must be of the type pfShellCmd defined by the shell module.
Parameters:
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.
Returns:
the status of the command execution.

Definition at line 526 of file ethernet.c.

References SHELL_EXECSTATUS_OK.

00529 {
00530    if( NULL != ppcStringReply )
00531       *ppcStringReply = NULL;
00532    stats_display();
00533    return( SHELL_EXECSTATUS_OK );
00534 }

portTASK_FUNCTION ( vStartEthernetTask  ,
pvParameters   
)

configure lwIP and MACB, start lwIP layer, start servers tasks through lwIP services.

Definition at line 135 of file ethernet.c.

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, and prvlwIPInit().

00136 {
00137 static const gpio_map_t MACB_GPIO_MAP =
00138 {
00139   {AVR32_MACB_MDC_0_PIN,    AVR32_MACB_MDC_0_FUNCTION   },
00140   {AVR32_MACB_MDIO_0_PIN,   AVR32_MACB_MDIO_0_FUNCTION  },
00141   {AVR32_MACB_RXD_0_PIN,    AVR32_MACB_RXD_0_FUNCTION   },
00142   {AVR32_MACB_TXD_0_PIN,    AVR32_MACB_TXD_0_FUNCTION   },
00143   {AVR32_MACB_RXD_1_PIN,    AVR32_MACB_RXD_1_FUNCTION   },
00144   {AVR32_MACB_TXD_1_PIN,    AVR32_MACB_TXD_1_FUNCTION   },
00145   {AVR32_MACB_TX_EN_0_PIN,  AVR32_MACB_TX_EN_0_FUNCTION },
00146   {AVR32_MACB_RX_ER_0_PIN,  AVR32_MACB_RX_ER_0_FUNCTION },
00147   {AVR32_MACB_RX_DV_0_PIN,  AVR32_MACB_RX_DV_0_FUNCTION },
00148   {AVR32_MACB_TX_CLK_0_PIN, AVR32_MACB_TX_CLK_0_FUNCTION}
00149 };
00150 
00151   // Assign GPIO to MACB
00152   gpio_enable_module(MACB_GPIO_MAP, sizeof(MACB_GPIO_MAP) / sizeof(MACB_GPIO_MAP[0]));
00153 
00154 
00155   /* Setup lwIP. */
00156   prvlwIPInit();
00157 
00158 #if (HTTP_USED == 1)
00159   /* Create the WEB server task.  This uses the lwIP RTOS abstraction layer.*/
00160   sys_thread_new( "WEB", vBasicWEBServer, ( void * ) NULL,
00161                    CTRLPANEL_WEB_SERVER_STACK_SIZE,
00162                    CTRLPANEL_WEB_SERVER_PRIORITY );
00163 #endif
00164 
00165 #if (TFTP_USED == 1)
00166   /* Create the TFTP server task.  This uses the lwIP RTOS abstraction layer.*/
00167   sys_thread_new( "TFTP", vBasicTFTPServer, ( void * ) NULL,
00168                    CTRLPANEL_TFTP_SERVER_STACK_SIZE,
00169                    CTRLPANEL_TFTP_SERVER_PRIORITY );
00170 #endif
00171 
00172 #if (SMTP_USED == 1)
00173   /* Create the SMTP Client task.  This uses the lwIP RTOS abstraction layer.*/
00174   sys_thread_new( "SMTP", vBasicSMTPClient, ( void * ) NULL,
00175                    CTRLPANEL_SMTP_CLIENT_STACK_SIZE,
00176                    CTRLPANEL_SMTP_CLIENT_PRIORITY );
00177 #endif
00178   // Kill this task.
00179   vTaskDelete(NULL);
00180 }

static void prv_v_set_default_macaddr ( unsigned portCHAR  aMacAddress[]  )  [static]

Set the default mac addr.

Parameters:
aMacAddress[] Mac address array of len 6.

Definition at line 544 of file ethernet.c.

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().

00545 {
00546    aMacAddress[0] = ETHERNET_CONF_ETHADDR0;
00547    aMacAddress[1] = ETHERNET_CONF_ETHADDR1;
00548    aMacAddress[2] = ETHERNET_CONF_ETHADDR2;
00549    aMacAddress[3] = ETHERNET_CONF_ETHADDR3;
00550    aMacAddress[4] = ETHERNET_CONF_ETHADDR4;
00551    aMacAddress[5] = ETHERNET_CONF_ETHADDR5;
00552 }

static void prv_v_set_default_netconfig ( unsigned portCHAR  aMacAddress[],
struct ip_addr *  pxIpAddr,
struct ip_addr *  pxNetMask,
struct ip_addr *  pxGateway 
) [static]

Set the default network configuration.

Parameters:
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

Definition at line 562 of file ethernet.c.

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, and prv_v_set_default_macaddr().

Referenced by prvEthernetConfigureInterface().

00566 {
00567    // Default MAC addr.
00568    prv_v_set_default_macaddr( aMacAddress );
00569    // pass the MACB address to AVR32_EMAC module
00570    vMACBSetMACAddress( aMacAddress );
00571    // set MAC hardware address length to be used by lwIP
00572    // MACB_if.hwaddr_len = 6;
00573    // set MAC hardware address to be used by lwIP
00574    // memcpy(MACB_if.hwaddr, aMacAddress, MACB_if.hwaddr_len);
00575 
00576    // Default ip addr.
00577    IP4_ADDR(pxIpAddr,ETHERNET_CONF_IPADDR0,ETHERNET_CONF_IPADDR1,ETHERNET_CONF_IPADDR2,ETHERNET_CONF_IPADDR3);
00578 
00579    // Default Subnet mask.
00580    IP4_ADDR(pxNetMask,ETHERNET_CONF_NET_MASK0,ETHERNET_CONF_NET_MASK1,ETHERNET_CONF_NET_MASK2,ETHERNET_CONF_NET_MASK3);
00581 
00582    // Default Gw addr.
00583    IP4_ADDR(pxGateway,ETHERNET_CONF_GATEWAY_ADDR0,ETHERNET_CONF_GATEWAY_ADDR1,ETHERNET_CONF_GATEWAY_ADDR2,ETHERNET_CONF_GATEWAY_ADDR3);
00584 }

static void prvEthernetConfigureInterface ( void *  param  )  [static]

set ethernet config, by parsing ETHERNET_CONFIG_FILE file.

Definition at line 405 of file ethernet.c.

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, MACB_if, prv_v_set_default_macaddr(), prv_v_set_default_netconfig(), vEthernetGetIPAddr(), vMMI_DisplayIP(), x_supervisor_SemaphoreGive(), x_supervisor_SemaphoreTake(), and xCFGMutex.

Referenced by tcpip_init_done().

00406 {
00407 struct ip_addr xIpAddr, xNetMask, xGateway;
00408 extern err_t ethernetif_init( struct netif *netif );
00409 portCHAR token[18];
00410 portCHAR IPAddress[16];
00411 portCHAR * current;
00412 unsigned portCHAR MacAddress[6];
00413 portSHORT NbDigits = 0;
00414 unsigned int AddrByte;
00415 
00416 
00417   // We're going to access the file system to do configuration
00418   // => get the CFG mutex.
00419   if( pdFALSE == x_supervisor_SemaphoreTake( xCFGMutex, 0 ) )
00420   { // Failed to get the CFG mutex.
00421     /* Use default parameters. */
00422     prv_v_set_default_netconfig( MacAddress, &xIpAddr, &xNetMask, &xGateway );
00423   }
00424   /* open the config file */
00425   else
00426   {
00427     if (config_file_get_value(ETHERNET_CONFIG_FILE, "macaddr" , token) >= 0)
00428     {
00429       current = token;
00430       while (NbDigits < 6)
00431       {
00432         /* get two next bytes and convert as integer */
00433         sscanf(current, "%02x", &AddrByte);
00434         MacAddress[NbDigits++] = (portCHAR)AddrByte;
00435         current = strpbrk(current, ":");
00436 
00437         if ((current == NULL) && (NbDigits != 6))
00438         {
00439           prv_v_set_default_macaddr( MacAddress );
00440           break;
00441         }
00442         current++;
00443       }
00444     }
00445     else
00446     {
00447       /* can't find field in config file, use default parameters */
00448       prv_v_set_default_macaddr( MacAddress );
00449     }
00450     /* pass the MACB address to AVR32_EMAC module */
00451     vMACBSetMACAddress(MacAddress);
00452     /* set MAC hardware address length to be used by lwIP */
00453     // MACB_if.hwaddr_len = 6;
00454     /* set MAC hardware address to be used by lwIP */
00455     // memcpy((char *)MACB_if.hwaddr, MacAddress, MACB_if.hwaddr_len);
00456 
00457     if (config_file_get_value(ETHERNET_CONFIG_FILE, "ipaddr" , token) >= 0)
00458     {
00459       /* get IP address */
00460       xIpAddr.addr = inet_addr(token);
00461     }
00462     else
00463     {
00464       /* can't find field in config file, use default parameters */
00465       IP4_ADDR(&xIpAddr,ETHERNET_CONF_IPADDR0,ETHERNET_CONF_IPADDR1,ETHERNET_CONF_IPADDR2,ETHERNET_CONF_IPADDR3);
00466     }
00467 
00468     if (config_file_get_value(ETHERNET_CONFIG_FILE, "submask", token) >= 0)
00469     {
00470       /* get subnet mask */
00471       xNetMask.addr = inet_addr(token);
00472     }
00473     else
00474     {
00475       /* can't find field in config file, use default parameters */
00476       IP4_ADDR(&xNetMask,ETHERNET_CONF_NET_MASK0,ETHERNET_CONF_NET_MASK1,ETHERNET_CONF_NET_MASK2,ETHERNET_CONF_NET_MASK3);
00477     }
00478 
00479     if (config_file_get_value(ETHERNET_CONFIG_FILE, "gwaddr" , token) >= 0)
00480     {
00481       /* get GW address */
00482       xGateway.addr = inet_addr(token);
00483     }
00484     else
00485     {
00486       /* can't find field in config file, use default parameters */
00487       IP4_ADDR(&xGateway,ETHERNET_CONF_GATEWAY_ADDR0,ETHERNET_CONF_GATEWAY_ADDR1,ETHERNET_CONF_GATEWAY_ADDR2,ETHERNET_CONF_GATEWAY_ADDR3);
00488     }
00489     // Release the CFG mutex.
00490     x_supervisor_SemaphoreGive( xCFGMutex );
00491   }
00492 
00493   /* add data to netif */
00494   netif_add(&MACB_if, &xIpAddr, &xNetMask, &xGateway, NULL, ethernetif_init, tcpip_input);
00495   /* make it the default interface */
00496   netif_set_default(&MACB_if);
00497   /* bring it up */
00498   netif_set_up(&MACB_if);
00499   /* get new IP Address */
00500   vEthernetGetIPAddr(IPAddress);
00501   /* set IP Address to Display */
00502 #ifdef MMILCD_ENABLE
00503   vMMI_DisplayIP(IPAddress);
00504 #endif
00505 }

static void prvlwIPInit ( void   )  [static]

start lwIP layer.

Definition at line 390 of file ethernet.c.

References tcpip_init_done().

Referenced by portTASK_FUNCTION().

00391 {
00392   sys_sem_t sem;
00393 
00394 
00395   sem = sys_sem_new(0); // Create a new semaphore.
00396   tcpip_init(tcpip_init_done, &sem);
00397   sys_sem_wait(sem);    // Block until the lwIP stack is initialized.
00398   sys_sem_free(sem);    // Free the semaphore.
00399 
00400 }

static void tcpip_init_done ( void *  arg  )  [static]

Callback executed when the TCP/IP init is done.

Definition at line 184 of file ethernet.c.

References prvEthernetConfigureInterface().

Referenced by prvlwIPInit().

00185 {
00186   sys_sem_t *sem;
00187   sem = (sys_sem_t *)arg;
00188   prvEthernetConfigureInterface(NULL);
00189   sys_sem_signal(*sem); // Signal the waiting thread that the TCP/IP init is done.
00190 }

void v_ethernet_stopResources ( void   ) 

Stop the ethernet module resources.

Definition at line 195 of file ethernet.c.

Referenced by e_syscmds_reboot().

00196 {
00197   // Disable the MACB.
00198   vDisableMACBOperations( &AVR32_MACB );
00199 }

void vEthernetGetGWAddr ( portCHAR *  pcConfig  ) 

get the current GW address : formatted as follow : XXX.XXX.XXX.XXX

Parameters:
pcConfig Input/Output. The response string. If Input is NULL, no response string will be output. The caller has to allocate this buffer

Definition at line 269 of file ethernet.c.

References MACB_if, and sprintf().

Referenced by e_ethernet_cmd_get_config().

00270 {
00271   if (pcConfig != NULL)
00272   {
00273     sprintf(pcConfig,"%d.%d.%d.%d", (u16_t)(ntohl((MACB_if.gw.addr) >> 24) & 0xff),
00274                                 (u16_t)(ntohl((MACB_if.gw.addr) >> 16) & 0xff),
00275                                 (u16_t)(ntohl((MACB_if.gw.addr) >> 8) & 0xff),
00276                                 (u16_t) ntohl((MACB_if.gw.addr) & 0xff ));
00277   }
00278 }

void vEthernetGetIPAddr ( portCHAR *  pcConfig  ) 

get the current IP address : formatted as follow : XXX.XXX.XXX.XXX

Parameters:
pcConfig Input/Output. The response string. If Input is NULL, no response string will be output. The caller has to allocate this buffer

Definition at line 229 of file ethernet.c.

References MACB_if, and sprintf().

Referenced by e_ethernet_cmd_get_config(), prulweb_BuildErrorTail(), and prvEthernetConfigureInterface().

00230 {
00231   if (pcConfig != NULL)
00232   {
00233     sprintf(pcConfig,"%d.%d.%d.%d", (u16_t)(ntohl((MACB_if.ip_addr.addr) >> 24) & 0xff),
00234                                 (u16_t)(ntohl((MACB_if.ip_addr.addr) >> 16) & 0xff),
00235                                 (u16_t)(ntohl((MACB_if.ip_addr.addr) >> 8) & 0xff),
00236                                 (u16_t) ntohl((MACB_if.ip_addr.addr) & 0xff ));
00237   }
00238 }

void vEthernetGetMACAddr ( portCHAR *  pcConfig  ) 

get the current MAC address : formatted as follow : XX:XX:XX:XX:XX:XX

Parameters:
pcConfig Input/Output. The response string. If Input is NULL, no response string will be output. The caller has to allocate this buffer

Definition at line 210 of file ethernet.c.

References MACB_if, and sprintf().

Referenced by e_ethernet_cmd_get_config().

00211 {
00212   if (pcConfig != NULL)
00213   {
00214     sprintf(pcConfig, "%02x:%02x:%02x:%02x:%02x:%02x", MACB_if.hwaddr[0], MACB_if.hwaddr[1],
00215                                                        MACB_if.hwaddr[2], MACB_if.hwaddr[3],
00216                                                        MACB_if.hwaddr[4], MACB_if.hwaddr[5]);
00217   }
00218 }

void vEthernetGetSubnetMask ( portCHAR *  pcConfig  ) 

get the current Subnet mask : formatted as follow : XXX.XXX.XXX.XXX

Parameters:
pcConfig Input/Output. The response string. If Input is NULL, no response string will be output. The caller has to allocate this buffer

Definition at line 249 of file ethernet.c.

References MACB_if, and sprintf().

Referenced by e_ethernet_cmd_get_config().

00250 {
00251   if (pcConfig != NULL)
00252   {
00253     sprintf(pcConfig,"%d.%d.%d.%d", (u16_t)(ntohl((MACB_if.netmask.addr) >> 24) & 0xff),
00254                                 (u16_t)(ntohl((MACB_if.netmask.addr) >> 16) & 0xff),
00255                                 (u16_t)(ntohl((MACB_if.netmask.addr) >> 8) & 0xff),
00256                                 (u16_t) ntohl((MACB_if.netmask.addr) & 0xff ));
00257   }
00258 }

void vStartEthernetTaskLauncher ( unsigned portBASE_TYPE  uxPriority  ) 

Create the vStartEthernetTask task.

Definition at line 125 of file ethernet.c.

References configMINIMAL_STACK_SIZE.

Referenced by portTASK_FUNCTION().

00126 {
00127   /* Spawn the Sentinel task. */
00128   xTaskCreate( vStartEthernetTask, ( const signed portCHAR * )"ETHLAUNCH",
00129                configMINIMAL_STACK_SIZE + 192, NULL, uxPriority, ( xTaskHandle * )NULL );
00130 }


Variable Documentation

struct netif MACB_if

xSemaphoreHandle xCFGMutex

The CFG system mutex.

Definition at line 203 of file supervisor.c.


Generated on Fri Feb 19 02:22:44 2010 for AVR32 - Control Panel demonstration. by  doxygen 1.5.5