The module therefore loads the persistent stored EEPROM data for the network stack. After configuring the network it starts the network stack and checks for occuring errors. If the start fails, the user and the application are informed. If no error occurs, the application can start with the usage of a configured network.
Files | |
| file | bootup.c |
| Implementation of the boot process of the eWicht application. | |
| file | bootup.h |
| Prototypes for calling the eWicht application boot up and network routines. | |
Data Structures | |
| struct | _IP_CONFIG |
| This typedef defines the local structure for TCP/IP stack parameters. More... | |
| struct | sIPFlags |
| This structure is used in the PCOMMON_CONFIG structure to define some IP related flags. More... | |
| struct | PCOMMON_CONFIG |
| This typedef defines the peristent structure for common settings and TCP/IP stack parameters. More... | |
Defines | |
| #define | HOSTNAME ((ROM BYTE *) 0x01fbf0) |
| The hostname of this device located in flash memory. | |
Enumerations | |
| enum | eWichtProjects |
| Enumerates the different projects an eWicht can be used for. More... | |
Functions | |
| void | BootupInit (void) |
| This function initializes the application network module. | |
| BOOL | bBootupMain (void) |
| This function must be called periodically by the application. | |
| void | BootupSetIP (void) |
| By calling this function the eWicht enters the IP Menu. | |
| void | BootupResetToFactory (void) |
| Sometimes the reset of the persistent data in the EEPROM to a well known state is needed. | |
| void | BootupEnterBootloader (void) |
| Calling this function prepares the bootloader entry. | |
| void | BootupRestoreState (void) |
| Writes back the current bootup state (located in RAM) to persistent storage (EEPROM). | |
Variables | |
| static SM_BOOTUP | _eBootUpSM |
| The local state machine. | |
| static BOOL | _bFirstTime |
| Indicator for being here the first time (After bootup). | |
| static BYTE | _au8NetworkDataForBootloader [12] |
| Stores the network related data like MAC address and IP address for reboot. | |
| IP_CONFIG | sIPConfig |
| This field stores the local TCP/IP parameters. | |
| PCOMMON_CONFIG | sPCommonConfig |
| The persistent data field. | |
| #define HOSTNAME ((ROM BYTE *) 0x01fbf0) |
| enum eWichtProjects |
| BOOL bBootupMain | ( | void | ) |
This function must be called periodically by the application.
First of all the function displays the current installed firmware version and does a LED blinking check. After it the function tries to configure and to start the network due directly accessing the TCP/IP stack and its parameters. Several reasons in the network or on the local device can lead to a non working network. The function is able to detect this and report it to the calling application and displaying it to the user as well.
Possible reasons for network failures:
As long the eWicht has no valid IP address, it is possible to enter the IP menu. The function checks for a pressed encoder button by itself. After a valid IP is obtained, the application can start the IP Menu due calling the function BootupSetIP.
| TRUE | The network module is ready, the application can start using the network. | |
| FALSE | The network is not ready due several reasons (see above). |
| void BootupEnterBootloader | ( | void | ) |
| void BootupInit | ( | void | ) |
This function initializes the application network module.
The network data persitant stored in EEPROM is loaded and the TCP/IP Stack is configured with this settings. If the function detects an empty EEPROM it loads the factory settings to ensure proper operation of the eWicht device.
| void BootupResetToFactory | ( | void | ) |
Sometimes the reset of the persistent data in the EEPROM to a well known state is needed.
The call of this function resets eWicht to the following parameters:
Manual settings: IP: 192.168.0.10 Subnet: 255.255.255.0 (/24) Gateway: 192.168.0.1
The network address is accquired automatically (by DHCP or AutoIP), the first AutoIP address is generated and saved in EEPROM.
| void BootupSetIP | ( | void | ) |
By calling this function the eWicht enters the IP Menu.
The call only configures the internal application network module state machine. Due calling periodically the main routine bBootupMain, the Menu will be handled. After the menu has been finished, the main routine configures the network stack with the new data and tries to restart the stack. If succeeded, the application can use the new configured network stack.
BYTE _au8NetworkDataForBootloader[12] [static] |
BOOL _bFirstTime [static] |
SM_BOOTUP _eBootUpSM [static] |
The persistent data field.
The field stores common settings of the eWicht and for the network. At the beginning the application must call BootupInit. This function loads the data which is stored in the data EEPROM into this SRAM field. The IP Menu or the function BootupResetToFactory can change these fields and store it back to the EEPROM.
1.5.5