The last step in making your network interface active on the network is to start it. Similar to the Add function, each type of network interface has its own Start function.
Each Start function has an optional argument for a setup structure that includes parameters for IPv4, IPv6, DHCP and other interface-specific parameters. This allows your application to define and populate a setup structure with parameters that match your network's characteristics and your application's needs. Including the argument causes the Network Core Stack to perform the minimal setup required for the interface to be visible on the network. For more details on the network interface setup structure, see Network Interface Start Setup.
The sections below show how to start a network interface according to its type; either Ethernet of Wi-Fi.
Starting the Network Interface
For a complete example on how to start an Ethernet interface, please refer to the example files.
For a complete example on how to start a Wi-Fi Interface, please refer to the example files.
Network Interface Ready
Because the network interface start function doesn't block, other mechanisms exist to let your application know when the setup of the interface is complete. You can use the different callback functions (DHCP, IPv6, IPv4. Link-Local) inside the
NET_IF_xxx_CFG structure you are passing to the interface start function. You can use those callbacks to notify your application when a specific setup process has finished. They will also give you information on the process that just completed: for example, the status of the process, the IP address that was just configured, etc.
Micrium OS also includes a module to that allows your application to wait for the network interface setup to be complete. To enable this module, you must enable the
NET_IF_CFG_WAIT_SETUP_READY_EN configuration in your
net_cfg.h file (see section Network Core Compile-Time Configurations). So once the network interface is started, your application can begin waiting for the setup to be complete by using the API function
NetIF_WaitSetupReady(). This function will wait for the various processes that you enabled in the
NET_IF_xxx_CFG argument (DHCP, IPv6, etc.), and it will exit when every process has finished, if no error occurred. You can also pass a reference to a
NET_IF_APP_INFO type variable. The function will populate structure with the information collected during the setup.
Starting the Network Interface Without a Configuration
Alternatively, the network interface can be started immediately without a configuration.
|Function||Description||Section in the Network Core Programming Guide|
|Set a static IPv4 address on the network interface.||IPv4 - Assign an Address to a Network Interface|
|Enable the DHCP client (IPv4) on the network interface.||DHCP Client Programming|
|Enable the IPv4 Link-Local address setup on the network interface.||IPv4 - Link-Local Address Setup|
|Enable the IPv6 SLAAC setup on the network interface.||IPv6 - Stateless Address Autoconfiguration (SLAAC)|
|Set a static IPv6 address on the network interface.||IPv6 - Assign an Address to a Network Interface|