#include <arch/DspNetIFConfigUtil.h>
Classes | |
struct | tsDspNetConfig |
union | tuDspNetConfigBlock |
Public Member Functions | |
tcDspNetIFConfigUtil (MityDSP::tcDspFlash *apFlash, MityDSP::tcDspConfig *apConfig, unsigned int anFlashOffset) | |
tcDspNetIFConfigUtil (MityDSP::tcDspConfig *apConfig, tsDspNetConfig *apNetConfig) | |
~tcDspNetIFConfigUtil (void) | |
int | UpdateConfig (tsDspNetConfig *apConfig) |
Update the config block. | |
int | RunQueryServer (struct netif *apIF, unsigned int anTaskPri=3, unsigned short anPortNo=NETIFCFG_POLL_PORT) |
Start the MityDSP discovery server. | |
int | GetConfig (tsDspNetConfig *apConfig) |
Get a copy of the config block for this interface. | |
struct netif * | GetNetIf () |
Get a pointer to the lwip netif structure for this interface. | |
bool | IsUp () |
is interface up? |
Protected Member Functions | |
int | QueryServer (struct netif *apIF, unsigned short anPortNo) |
void | WaitForDHCP (struct netif *apIF) |
Static Protected Member Functions | |
static int | DispatchQueryServer (struct netif *apIF, unsigned short anPortNo, void *apThis) |
Protected Attributes | |
volatile tuDspNetConfigBlock * | mpData |
MityDSP::tcDspFlash * | mpFlash |
MityDSP::tcDspConfig * | mpConfig |
bool | mbStoredInFlash |
volatile bool | mbStopQuery |
volatile bool | mbQueryRunning |
unsigned int | mnFlashOffset |
struct netif | msNetif |
Utility class to provide access/storage of Network Interface configuration data. This class will manage FLASH storage and updates to network interface configuration data. The class is designed to support (through multiple instances) more than one network interface structure.
The class also provides a mechanism to launch a NetWork Query Server to respond to MityDSP network configuration requests from the MityDSPLocator PC application.
The code below shows a simple example of usage. Check the lwip stack initialization page for a full example that includes use of this class.
tcDspNetIFConfigUtil::tcDspNetIFConfigUtil | ( | MityDSP::tcDspFlash * | apFlash, |
MityDSP::tcDspConfig * | apConfig, | ||
unsigned int | anFlashOffset | ||
) |
Constructor.
Call this constructor if Network Interface data is to be read/stored in FLASH memory. This constructor will populate the necessary configuration data from the location offset specified in the constructor arguements. If invalid data is found in the FLASH (e.g., the FLASH was previously unconfigured) then the information will be iniatialized from the apConfig structure.
[in] | apFlash | Valid pointer to the MityDSP FLASH object |
[in] | apConfig | Valid pointer to the MityDSP Configuration Object |
[in] | anFlashOffset | Offset from base of FLASH where configuration data is stored. |
tcDspNetIFConfigUtil::tcDspNetIFConfigUtil | ( | MityDSP::tcDspConfig * | apConfig, |
tsDspNetConfig * | apNetConfig | ||
) |
Constructor.
Call this constructor if Network IF data is simply managed in RAM and not stored in FLASH.
[in] | apConfig | Pointer to a valid tcDspConfig block |
[in] | apNetConfig | Pointer to Configuration block data to copy as reference |
tcDspNetIFConfigUtil::~tcDspNetIFConfigUtil | ( | void | ) |
Destructor.
This destructor will terminate an associated MityDSPLocator Query response thread if it is running.
int tcDspNetIFConfigUtil::UpdateConfig | ( | tsDspNetConfig * | apConfig | ) |
Update the config block.
Update Configuration
This routine will copy the configuration in apConfig to the local copy. If this instance is associated to FLASH memory, then the FLASH memory will be updated.
[in] | apConfig | Pointer to configuration data. |
int tcDspNetIFConfigUtil::RunQueryServer | ( | struct netif * | apIF, |
unsigned int | anTaskPri = 3 , |
||
unsigned short | anPortNo = NETIFCFG_POLL_PORT |
||
) |
Start the MityDSP discovery server.
Run MityDSPLocator Query Server thread.
This method will spawn a thread that will monitor broadcast Poll Requests and repond appropriately. Threads started are destroyed by the destructor of the class.
[in] | apIF | Pointer to LWIP network interface structure to respond on. |
[in] | anTaskPri | Task priority of monitor thread, default 4 |
[in] | anPortNo | Port number of monitor thread, default NETIFCFG_POLL_PORT |
int tcDspNetIFConfigUtil::GetConfig | ( | tsDspNetConfig * | apConfig | ) |
Get a copy of the config block for this interface.
Get Configuration
This routine will copy the current configuration to apConfig.
[out] | apConfig | Pointer to configuration data to be filled. |
|
inlineread |
Get a pointer to the lwip netif structure for this interface.
bool tcDspNetIFConfigUtil::IsUp | ( | ) |
is interface up?
|
staticprotected |
Utility Method to launch class scoped Query Server
[in] | apIF | Pointer to LWIP network interface structure to respond on. |
[in] | anPortNo | Port number of monitor thread |
[in] | apThis | Pointer to valid tcDspNetIFConfigUtil class |
|
protected |
|
protected |
Utility Method to ensure LWIP network interface is bound to an address
[in] | apIF | Pointer to the network interface to check. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |