Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NetDev_Start()

...

The second function is the device driver Start() function. This function is called once each time an interface is started.anchor11101351110135

Files

...

11097101109710Every device driver’s net_dev.c Anchor11097171109717

Prototype

...

rowspan2

...

Anchor11097181109718 

 

Note that since every device driver’s Start() function is accessed only by function pointer via the device driver’s API structure, it doesn’t need to be globally available and should therefore be declared as ‘static’static.anchor11097191109719

Arguments

Anchor11097201109720 p_if Anchor11318271131827pif

Pointer to the interface to start a network device.

Anchor11097211109721 p_err Anchor11318291131829perr

Pointer to variable that will receive the return error code from this function.

...

Returned Value

...

None. Anchor11101021110102

Required Configuration

...

1110103None. Anchor11101041110104

Notes / Warnings

...

1090967The Start() function performs the following items:

...

a. Configure the MAC address using the string found within the device configuration structure. This is a form of static MAC address configuration and may be performed by calling NetASCII_Str_to_MAC() and NetIF_AddrHW_SetHandler(). If the device configuration string has been left empty, or is specified as all 0’s, an error will be returned and the next method should be attempted.

...

...

b. Check if the application developer has called NetIF_AddrHW_Set() by making a call to NetIF_AddrHW_GetHandler() and NetIF_AddrHW_IsValidHandler() in order to check if the specified MAC address is valid. This method may be used as a static method for configuring the MAC address during run-time, or a dynamic method should a pre-programmed external memory device exist. If the acquired MAC address does not pass the check function, then:

...

c. Call NetIF_AddrHW_SetHandler() using the data found within the MAC individual address registers. If an auto-loading EEPROM is attached to the MAC, the registers will contain valid data. If not, then a configuration error has occurred. This method is often used with a production process where the MAC supports the automatic loading of individual address registers from a serial EEPROM. When using this method, the developer should specify an empty string for the MAC address within the device configuration and refrain from calling NetIF_AddrHW_Set() from within the application.

...