Initializing+Shell+commands

Initializing+Shell+commands

The command line interface is a traditional method for accessing the network functionality on a remote system (telnet), or in a device with a serial port (be that RS-232 or USB). A group of shell commands are available for µC/TCPIP. These may simply expedite evaluation of the network suite, or become part a primary method of access (or gathering debug information) in your final product.

Using the Shell Commands

To use shell commands some file, in addition to the generic µC/TCPIP files, must be included in the build:

See Directories and Files - Shell Commands

Using Network Interface Programming API

The following files must be included in any application or header files initialize µC/Shell or handle shell commands.

Include file

Description

Include file

Description

Cmd/net_cmd.h

Contains the initialization function API

API Reference

All Interface APIs are presented in the section 

Function Name

Description

Function Name

Description

NetCmd_Init()

Add Network Shell commands to µC/Shell

Initialization order

Modules must be initialized in the following order:

  1. µC/Shell

  2. Network suite (see Initializing Tasks and objects)

  3. Network Shell Command

#include <Source/net.h> #include <net_dev_rs9110n2x.h> #include <net_bsp.h> #include <net_phy.h> #include <Cmd/net_cmd.h> CPU_BOOLEAN App_InitTCPIP (void) { NET_IF_NBR if_nbr; NET_ERR err; NET_CMD_ERR err_cmd; err = Net_Init(); if (err != NET_ERR_NONE) { return (DEF_FAIL); } if_nbr = NetIF_Add((void *)&NetIF_API_WiFi (void *)&NetDev_API_RS9110N2x, (void *)&NetDev_BSP_SPI_API, (void *)&NetDev_Cfg_WiFi_0, (void *)&NetWiFiMgr_API_Generic, (void *) 0, (NET_ERR *)&err); if (err != NET_IF_ERR_NONE) { return (DEF_FAIL); } NetIF_Start(if_nbr, &err); if (err != NET_IF_ERR_NONE) { return (DEF_FAIL); }   /*uC-Shell must has been initialized before initializing Network Shell Command */ NetCmd_Init(&err_cmd); if (err != NET_CMD_ERR_NONE) { return (DEF_FAIL); } return (DEF_OK); }