bootup.c

Go to the documentation of this file.
00001 // ////////////////////////////////////////////////////////////////////////////
00002 // ////////////////////////////////////////////////////////////////////////////
00014 // ////////////////////////////////////////////////////////////////////////////
00015 // ////////////////////////////////////////////////////////////////////////////
00016 
00017 
00018 // ////////////////////////////////////////////////////////////////////////////
00019 // Local Includes
00020 // ////////////////////////////////////////////////////////////////////////////
00021 
00022     #define     BOOTUP_C
00023     #include    "bootup.h"
00024     #include    "mdns.h"
00025     #include    "TCPIP.h"
00026     #include    "stringtable.h"
00027     #include    "sralloc.h"
00028 
00029     #include    "projectdefs.h"
00030 
00031 
00032 // ////////////////////////////////////////////////////////////////////////////
00033 // Local Typedefs
00034 // ////////////////////////////////////////////////////////////////////////////
00035 
00036 // States of bootup
00037 typedef enum
00038 {
00039     BOOTUP_SM_STARTUP = 0,
00040     BOOTUP_SM_STARTUP_WAIT,
00041     BOOTUP_SM_STARTUP_LANGUAGE,
00042     BOOTUP_SM_STARTUP_FINI,
00043     BOOTUP_SM_IPSET,
00044     BOOTUP_SM_NOLINK,
00045     BOOTUP_SM_NOLINK_WAIT,
00046     BOOTUP_SM_WAIT_FOR_IP,
00047     BOOTUP_SM_START_CHECK_IP,
00048     BOOTUP_SM_CHECK_IP,
00049     BOOTUP_SM_IP_ERROR,
00050     BOOTUP_SM_SHOW_IP_ERROR,
00051     BOOTUP_SM_DISPLAY_IPDATA,
00052     BOOTUP_SM_WAIT_FOR_USER,
00053     BOOTUP_SM_WAIT_FOR_NAMESERVICE,
00054     BOOTUP_SM_WAIT_FOR_USER2,
00055     BOOTUP_SM_READY
00056 } SM_BOOTUP;
00057 
00058 
00059 // ////////////////////////////////////////////////////////////////////////////
00060 // Local Defines
00061 // ////////////////////////////////////////////////////////////////////////////
00062 
00063 // ////////////////////////////////////////////////////////////////////////////
00064 // Local Variables
00065 // ////////////////////////////////////////////////////////////////////////////
00066 
00070 static SM_BOOTUP _eBootUpSM;
00071 
00075 static BOOL _bFirstTime;    
00076 
00077 
00081 static BYTE _au8NetworkDataForBootloader[12];
00082 
00083 
00084 // ////////////////////////////////////////////////////////////////////////////
00085 // Local function prototypes
00086 // ////////////////////////////////////////////////////////////////////////////
00087 
00088 static void BootupCheckVersionTag(void);
00089 
00090 
00091 // ////////////////////////////////////////////////////////////////////////////
00092 // ////////////////////////////////////////////////////////////////////////////
00093 
00094 void BootupInit(void)
00095 {
00096     _bFirstTime = TRUE;
00097     _eBootUpSM = BOOTUP_SM_STARTUP;
00098 
00099 
00100     // ////////////////////////////////////////////////////////////////////////
00101     // IP level
00102 
00103     // Get the common and network related data from external EEPROM:
00104     {
00105         XEEReadArray(BOOTUP_EEPROM_ADD, (BYTE *)(&sPCommonConfig), sizeof(PCOMMON_CONFIG));
00106     }
00107 
00108 
00109     // Check, if any updates have been done and the EEPROM data must be 
00110     // updated somehow.
00111     BootupCheckVersionTag();
00112 
00113 
00114     // ////////////////////////////////////////////////////////////////////////
00115     // DHCP level
00116 
00117     if (sPCommonConfig.Flags.bIsDHCPEnabled == TRUE)
00118     {
00119         // Starting automatic IP discovery (including AutoIP if DHCP fails).
00120         DHCPEnable();
00121         DHCPReset(FALSE);
00122     }
00123     else
00124     {
00125         // Starting manual IP discovery...
00126         DHCPDisable();
00127         sIPConfig.MyIPAddr.Val = sPCommonConfig.ManIPAddr.Val;
00128         sIPConfig.MyMask.Val = IPConvertSubnetToMask(sPCommonConfig.ManMask);
00129         sIPConfig.MyGateway.Val = sPCommonConfig.ManGateway.Val;
00130         sIPConfig.Flags.bIPunique = FALSE;
00131     }
00132 }
00133 
00134 
00135 // ////////////////////////////////////////////////////////////////////////////
00136 // ////////////////////////////////////////////////////////////////////////////
00137 
00138 void BootupSetIP(void)
00139 {
00140     // Entering the IP set menu.
00141     _eBootUpSM = BOOTUP_SM_IPSET;
00142 }
00143 
00144 // ////////////////////////////////////////////////////////////////////////////
00145 // ////////////////////////////////////////////////////////////////////////////
00146 
00147 BOOL bBootupMain(void)
00148 {
00149     // Reset the application if the network connection is lost.
00150     if ((_eBootUpSM > BOOTUP_SM_NOLINK_WAIT) && (MACIsLinked()) == 0) 
00151     {
00152         OutSwitchOffAllLEDs();
00153         u16GlobalFlags &= ~(LINKISUP_MASK); // Stop executing TCP/IP stack.
00154         _eBootUpSM = BOOTUP_SM_NOLINK;
00155         // Reset the heap!
00156         SRAMInitHeap();
00157     }
00158 
00159 
00160     // ////////////////////////////////////////////////////////////////////////
00161     // The State Machine implementation.
00162 
00163     switch(_eBootUpSM)
00164     {
00165     case BOOTUP_SM_STARTUP:
00166         // Display the startup string and waiting for some time. In this time
00167         // also the physical network layer comes up.
00168 
00169         strcpypgm2ram(lcdram_row1, (ROM char *) "eWicht " PROJECT_NAME);
00170 
00171         strcpypgm2ram(lcdram_row2, (ROM char *) FIRMWARE_VERSION_STRING);
00172         lcd_status = LCD_CLR_MASK | LCD_ROW1_MASK | LCD_CENTER1_MASK |
00173                      LCD_ROW2_MASK | LCD_CENTER2_MASK;
00174 
00175         if (_bFirstTime == TRUE)
00176         {
00177             u8ApplTimer = 250;  // Wait 2.5 seconds.
00178         }
00179         else
00180         {
00181             u8ApplTimer = 50;   // Wait 0.5 seconds.
00182         }
00183         
00184         InputButtonReset(ENC_BTN);
00185         _eBootUpSM = BOOTUP_SM_STARTUP_WAIT;
00186         // Intented fall through.
00187 
00188     case BOOTUP_SM_STARTUP_WAIT:
00189         // Switch on all the LEDs in a serial fashion for testing purposes.
00190         // Go to the next state if the intitial wait time is over.
00191 
00192 #ifndef DEBEXT_MODE
00193         if (_bFirstTime == TRUE)
00194         { 
00195             switch (u8ApplTimer)
00196             {
00197             case 250:
00198                 OutSetLED(LED_ACC, LED_ON);
00199                 break;
00200 
00201             case 240:
00202                 OutSetLED(LED_FL, LED_ON);
00203                 break;
00204 
00205             case 230:
00206                 OutSetLED(LED_F1, LED_ON);
00207                 break;
00208 
00209             case 220:
00210                 OutSetLED(LED_F2, LED_ON);
00211                 break;
00212 
00213             case 210:
00214                 OutSetLED(LED_F3, LED_ON);
00215                 break;
00216 
00217             case 200:
00218                 OutSetLED(LED_F4, LED_ON);
00219                 break;
00220 
00221             case 190:
00222                 OutSetLED(LED_PWR, LED_ON);
00223                 break;
00224 
00225             case 180:
00226                 OutSetLED(LED_SEL, LED_ON);
00227                 break;
00228 
00229             case 170:
00230                 OutSetLED(LED_ACC, LED_OFF);
00231                 break;
00232 
00233             case 160:
00234                 OutSetLED(LED_FL, LED_OFF);
00235                 break;
00236 
00237             case 150:
00238                 OutSetLED(LED_F1, LED_OFF);
00239                 break;
00240 
00241             case 140:
00242                 OutSetLED(LED_F2, LED_OFF);
00243                 break;
00244 
00245             case 130:
00246                 OutSetLED(LED_F3, LED_OFF);
00247                 break;
00248 
00249             case 120:
00250                 OutSetLED(LED_F4, LED_OFF);
00251                 break;
00252 
00253             case 110:
00254                 OutSetLED(LED_PWR, LED_OFF);
00255                 break;
00256 
00257             case 100:
00258                 OutSetLED(LED_SEL, LED_OFF);
00259                 break;
00260             }
00261         }
00262 #endif
00263         
00264         if (u8ApplTimer == 0)
00265         {
00266             if (sPCommonConfig.u8LanguageID != LANGID_NOTSPECIFIED)
00267             {
00268                 // Valid language configured, go ahead.
00269                 StrTbl_SetLanguage(sPCommonConfig.u8LanguageID);
00270                 _eBootUpSM = BOOTUP_SM_STARTUP_FINI;
00271                 break;
00272             }
00273     
00274             InputEncoderInit(0, 0, LANGID_MAX, 0);
00275             _eBootUpSM = BOOTUP_SM_STARTUP_LANGUAGE;
00276         }
00277         break;
00278 
00279     case BOOTUP_SM_STARTUP_LANGUAGE:
00280         if (bInputButtonPushed(ENC_BTN)||bInputButtonPushed(F4_BTN))
00281         {
00282             // Language dialog was finished!
00283             sPCommonConfig.u8LanguageID = (BYTE)s16InputEncoderGetValue();
00284             // Write the new language ID to the EEPROM:
00285             XEEWriteArray(BOOTUP_EEPROM_ADD, (BYTE *)&sPCommonConfig, sizeof(PCOMMON_CONFIG));
00286             InputButtonReset(ENC_BTN);
00287             _eBootUpSM = BOOTUP_SM_STARTUP_FINI;
00288         }
00289         else if (bInputEncoderValueChanged() == TRUE)
00290         {
00291             strcpypgm2ram(lcdram_row1, (ROM char *) "eWicht");
00292             StrTbl_SetLanguage((BYTE)s16InputEncoderGetValue());
00293             StrTbl_GetString(lcdram_row2, STRTBLID_LANGUAGE_NAME);
00294             lcd_status = LCD_CLR_MASK | LCD_ROW1_MASK | LCD_CENTER1_MASK | LCD_ROW2_MASK | LCD_CENTER2_MASK;
00295         }
00296         break;
00297 
00298     case BOOTUP_SM_STARTUP_FINI:
00299         // Mark this session as booted:
00300         _bFirstTime = FALSE;
00301         StackInit();
00302         bInitMDNSResponder();   // Initialize the MDNS Responder.
00303         u16GlobalFlags |= LINKISUP_MASK;    // Start executing TCP/IP stack.
00304 
00305         if (bInputButtonPushed(ENC_BTN) == TRUE)
00306         {
00307             // User pushed the encoder button -> Entering the IP menu.
00308             IPSetInit(FALSE);
00309             _eBootUpSM = BOOTUP_SM_IPSET;
00310         }
00311         else if (sPCommonConfig.Flags.bIsDHCPEnabled == TRUE)
00312         {
00313             // Inform the user about the enabled DHCP and the starting
00314             // discovery.
00315             StrTbl_GetString(lcdram_row1, STRTBLID_ALLOCATE);
00316             StrTbl_GetString(lcdram_row2, STRTBLID_IP_ADDRESS);
00317 
00318             lcd_status = LCD_CLR_MASK | LCD_ROW1_MASK | LCD_CENTER1_MASK |
00319                     LCD_ROW2_MASK | LCD_CENTER2_MASK | LCD_PROGRESS_MASK;
00320             _eBootUpSM = BOOTUP_SM_WAIT_FOR_IP;
00321             InputButtonReset(ENC_BTN);
00322         }
00323         else
00324         {
00325             // IP Address was manual set by user...
00326             _eBootUpSM = BOOTUP_SM_START_CHECK_IP;
00327         }
00328         break;
00329 
00330     case BOOTUP_SM_WAIT_FOR_IP:
00331         if (bInputButtonPushed(ENC_BTN) == TRUE)
00332         {
00333             // During the discovery phase the user has the possibility to enter
00334             // the IP menu.
00335             IPSetInit(FALSE);
00336             _eBootUpSM = BOOTUP_SM_IPSET;
00337             break;
00338         }
00339 
00340         if (DHCPIsBound())
00341         {
00342             // The DHCP discovery phase was successful. No IP check is needed
00343             // here.
00344     
00345             // Starting the MDNS service.
00346             StartMDNSResponder();
00347             _eBootUpSM = BOOTUP_SM_DISPLAY_IPDATA;
00348         }
00349         else if (sIPConfig.MyIPAddr.Val)
00350         {
00351             // AUTO-IP (DHCP discovery not successful). Check the choosen IP 
00352             // for uniqueness.
00353             _eBootUpSM = BOOTUP_SM_START_CHECK_IP;
00354         }
00355         break;
00356 
00357     case BOOTUP_SM_START_CHECK_IP:
00358         // Gracious ARP phase. Checking for the uniqueness of the choosen IP
00359         // address (only needed if the IP address was choosen manually or by
00360         // AutoIP). 
00361         // Sending three ARP requests to the choosen IP and waiting for 
00362         // answers. If receiving an answer the gracious ARP phase fails.
00363         if (sIPConfig.Flags.bIPunique == TRUE)
00364         {
00365             _eBootUpSM = BOOTUP_SM_DISPLAY_IPDATA;
00366             break;
00367         }
00368         else
00369         {
00370             u8ApplTimer = 255;
00371             _eBootUpSM = BOOTUP_SM_CHECK_IP;
00372         }
00373         // Intented fall through.
00374 
00375     case BOOTUP_SM_CHECK_IP:
00376         // Do three gracious ARP for ensuring that IP is unique.
00377         {
00378             MAC_ADDR dummy;
00379             if (u8ApplTimer == 0)
00380             {
00381                 // Gracious ARP time is over.
00382 
00383                 // The uniqness of IP is ensured!
00384                 sIPConfig.Flags.bIPunique = TRUE;
00385 
00386                 // Starting the MDNS service.
00387                 StartMDNSResponder();
00388 
00389                 // Displaying the choosen IP Address to the user. 
00390                 _eBootUpSM = BOOTUP_SM_DISPLAY_IPDATA;
00391                 break;
00392             }
00393 
00394             if (ARPIsResolved(&sIPConfig.MyIPAddr, &dummy) == FALSE)
00395             {
00396                 // ARP is still not resolved! That is good. 
00397                 switch(u8ApplTimer)
00398                 {
00399                 case 255:   // 2.55 seconds to go
00400                 case 192:   // 1.92 seconds to go
00401                 case 129:   // 1.29 seconds to go
00402                     ARPResolve(&sIPConfig.MyIPAddr);
00403                 }
00404             }
00405             else
00406                 // Got an answer! Gracious ARP failed.
00407                 _eBootUpSM = BOOTUP_SM_SHOW_IP_ERROR;
00408 
00409             break;
00410         }
00411 
00412     case BOOTUP_SM_SHOW_IP_ERROR:
00413         // An IP related error has occured. 
00414 
00415         // Disable the IP address!!!
00416         sIPConfig.MyIPAddr.Val = 0;
00417         sIPConfig.MyMask.Val = 0;
00418         sIPConfig.MyGateway.Val = 0;
00419 
00420         // Show the error to the user.
00421         StrTbl_GetString(lcdram_row1, STRTBLID_ADDRESS_CONFLICT1);
00422         StrTbl_GetString(lcdram_row2, STRTBLID_ADDRESS_CONFLICT2);
00423         lcd_status = LCD_CLR_MASK | LCD_ROW1_MASK | LCD_CENTER1_MASK |
00424                     LCD_ROW2_MASK | LCD_CENTER2_MASK;
00425 
00426         InputButtonReset(ENC_BTN);
00427         _eBootUpSM = BOOTUP_SM_IP_ERROR;        
00428         break;
00429 
00430     case BOOTUP_SM_IP_ERROR:
00431         // Waiting for user acknowledgement of the error. After the push of the
00432         // rotary encoder the IP menu is entered.
00433         if (bInputButtonPushed(ENC_BTN) == TRUE)
00434         {
00435             IPSetInit(FALSE);
00436             _eBootUpSM = BOOTUP_SM_IPSET;
00437         }
00438         break;
00439 
00440     case BOOTUP_SM_IPSET:
00441         // Call the IP menu periodically:
00442         if (IPSetMain() == TRUE)
00443         {
00444             // Restart the application...
00445             _eBootUpSM = BOOTUP_SM_STARTUP;
00446         }
00447         break;
00448 
00449     case BOOTUP_SM_NOLINK:
00450         // A network connection is lost (PHY layer). Show this to the user.
00451         StrTbl_GetString(lcdram_row1, STRTBLID_CABEL_UNPLUGGED1);
00452         StrTbl_GetString(lcdram_row2, STRTBLID_CABEL_UNPLUGGED2);
00453         lcd_status = LCD_CLR_MASK | LCD_ROW1_MASK | LCD_CENTER1_MASK |
00454                      LCD_ROW2_MASK | LCD_CENTER2_MASK;
00455         _eBootUpSM = BOOTUP_SM_NOLINK_WAIT;
00456         break;
00457 
00458     case BOOTUP_SM_NOLINK_WAIT:
00459         // The eWicht is in a state without a network connection (PHY layer).
00460         // With a push of the rotary encoder the IP menu is entered. A detected
00461         // network connection leads to the normal bootup state.
00462         if (bInputButtonPushed(ENC_BTN) == TRUE)
00463         {
00464             IPSetInit(FALSE);
00465             _eBootUpSM = BOOTUP_SM_IPSET;
00466         }
00467         else if (MACIsLinked())
00468         {
00469             if (sPCommonConfig.Flags.bIsDHCPEnabled)
00470             {
00471                 DHCPReset(FALSE);
00472             }
00473             else
00474             {
00475                 sIPConfig.Flags.bIPunique = FALSE;
00476             }
00477     
00478             _eBootUpSM = BOOTUP_SM_STARTUP;
00479         }
00480         break;
00481 
00482     case BOOTUP_SM_DISPLAY_IPDATA:
00483         // In case the IP was obtained automatically (via DHCP or AutoIP), the
00484         // IP is shown to the user.
00485         if (sPCommonConfig.Flags.bIsDHCPEnabled == TRUE)
00486         {
00487             StrTbl_GetString(lcdram_row1, STRTBLID_OBTAINED_IP);
00488         }
00489         else
00490         {
00491             StrTbl_GetString(lcdram_row1, STRTBLID_MANUAL_IP);  
00492         }
00493 
00494         sprintf(lcdram_row2, (ROM char *) "%hhu.%hhu.%hhu.%hhu", 
00495                         sIPConfig.MyIPAddr.v[0], sIPConfig.MyIPAddr.v[1], 
00496                         sIPConfig.MyIPAddr.v[2], sIPConfig.MyIPAddr.v[3]);
00497         lcd_addr2 = 0;
00498         lcd_status = LCD_CLR_MASK | LCD_ROW1_MASK | LCD_CENTER1_MASK | 
00499                      LCD_CENTER2_MASK | LCD_ROW2_MASK;
00500 
00501         InputButtonReset(ENC_BTN);
00502         u8ApplTimer = 250;
00503         _eBootUpSM = BOOTUP_SM_WAIT_FOR_USER;
00504         break;
00505 
00506     case BOOTUP_SM_WAIT_FOR_USER:
00507         if ((u8ApplTimer == 0) || (bInputButtonPushed(ENC_BTN) == TRUE))
00508         {
00509             _eBootUpSM = BOOTUP_SM_WAIT_FOR_NAMESERVICE;
00510         }
00511         break;
00512 
00513     case BOOTUP_SM_WAIT_FOR_NAMESERVICE:
00514         if(eGetMDNSState() == MDNS_HAS_STOPPED)
00515         {
00516             // Nameserver has stopped! Thats bad but the eWicht will work
00517             // anyway. Display to user, that nameserver could not be 
00518             // started. Connection to the eWicht via its name is not 
00519             // possible than.
00520             // A reason for this can be that another device in the network
00521             // has the same name.
00522 
00523             StrTbl_GetString(lcdram_row1, STRTBLID_NAMESERVICE);
00524             StrTbl_GetString(lcdram_row2, STRTBLID_STOPPED);
00525             lcd_status = LCD_CLR_MASK | LCD_ROW1_MASK | LCD_CENTER1_MASK |
00526                          LCD_ROW2_MASK | LCD_CENTER2_MASK;
00527 
00528             InputButtonReset(ENC_BTN);
00529             u8ApplTimer = 250;
00530             _eBootUpSM = BOOTUP_SM_WAIT_FOR_USER2;
00531         }
00532         else if(eGetMDNSState() == MDNS_IS_RUNNING)
00533         {
00534             _eBootUpSM = BOOTUP_SM_READY;
00535         }
00536 
00537         break;
00538 
00539     case BOOTUP_SM_WAIT_FOR_USER2:
00540         if ((u8ApplTimer == 0) || (bInputButtonPushed(ENC_BTN) == TRUE))
00541         {
00542             _eBootUpSM = BOOTUP_SM_READY;
00543         }
00544         break;
00545 
00546     case BOOTUP_SM_READY:
00547         // The boot up is finished. Indicate this to the calling application.
00548         return TRUE;
00549     }
00550 
00551     return FALSE;
00552 }
00553 
00554 // ////////////////////////////////////////////////////////////////////////////
00555 // ////////////////////////////////////////////////////////////////////////////
00556 
00557 void BootupEnterBootloader(void)
00558 {
00559     // Fetch the MAC address from MAC module.
00560     memcpypgm2ram(_au8NetworkDataForBootloader, pu8MAC, 6);
00561     memcpy((void *)&_au8NetworkDataForBootloader[6], (void *)&sIPConfig.MyIPAddr, 4);
00562     *(WORD *)(&_au8NetworkDataForBootloader[10]) = CalcIPChecksum(_au8NetworkDataForBootloader, 6+4);
00563 
00564     PROD = (WORD) _au8NetworkDataForBootloader;
00565 }
00566 
00567 // ////////////////////////////////////////////////////////////////////////////
00568 // ////////////////////////////////////////////////////////////////////////////
00569 
00570 void BootupRestoreState(void)
00571 {
00572     // Write the bulk of new data to the web EEPROM:
00573     XEEWriteArray(BOOTUP_EEPROM_ADD, (BYTE *)(&sPCommonConfig), sizeof(PCOMMON_CONFIG));
00574 }
00575 
00576 // ////////////////////////////////////////////////////////////////////////////
00577 // ////////////////////////////////////////////////////////////////////////////
00578 
00579 void BootupResetToFactory(void)
00580 {
00581     int i = 0;
00582 
00583     // Restoring IP specific data:
00584 
00585     // The DHCP Flag automatically resets MyIPAddr, MyMask and MyGateway to 0
00586     // in the application.
00587     sPCommonConfig.Flags.bIsDHCPEnabled = TRUE;
00588     
00589     sPCommonConfig.ManIPAddr.v[0] = 192;
00590     sPCommonConfig.ManIPAddr.v[1] = 168;
00591     sPCommonConfig.ManIPAddr.v[2] = 0;
00592     sPCommonConfig.ManIPAddr.v[3] = 10;
00593     sPCommonConfig.ManMask = 24;
00594     sPCommonConfig.ManGateway.v[0] = 192;
00595     sPCommonConfig.ManGateway.v[1] = 168;
00596     sPCommonConfig.ManGateway.v[2] = 0;
00597     sPCommonConfig.ManGateway.v[3] = 1;
00598 
00599     sPCommonConfig.LastAutoIP = GenerateAutoIP(0);
00600 
00601     sPCommonConfig.u8LCDLight = 20;
00602 
00603     sPCommonConfig.u32VersionTag = FIRMWARE_VERSION;
00604 
00605     sPCommonConfig.TargetProject = PROJECT_ID;
00606 
00607     // The user selects the language at eWicht after a restart:
00608     sPCommonConfig.u8LanguageID = 0xFF; 
00609 
00610     BootupRestoreState();
00611 }
00612 
00613 // ////////////////////////////////////////////////////////////////////////////
00614 // ////////////////////////////////////////////////////////////////////////////
00615 
00616 static void BootupCheckVersionTag(void)
00617 {
00618     if (sPCommonConfig.u32VersionTag == 0xFFFFFFFF)
00619     {
00620         // Indicator for first time being here (first switch on with an empty
00621         // EEPROM)! Filling the EEPROM with typical application data:
00622         ApplResetToFactory(FALSE);
00623     }
00624     else if (sPCommonConfig.u32VersionTag < FIRMWARE_VERSION)
00625     {
00626         // This EEPROM is from an old version (older than this).
00627 
00628         // Migrate!
00629         sPCommonConfig.u32VersionTag = FIRMWARE_VERSION;
00630         XEEWriteArray(BOOTUP_EEPROM_ADD+offsetof(PCOMMON_CONFIG, u32VersionTag), (BYTE *)&sPCommonConfig.u32VersionTag, 4);
00631     }
00632     
00633     if (sPCommonConfig.TargetProject != PROJECT_ID)
00634     {
00635         // Trying to preserve the boot data:
00636         sPCommonConfig.TargetProject = PROJECT_ID;
00637 
00638         // This EEPROM content is from another target.
00639         ApplResetToFactory(TRUE);
00640     }
00641 }
00642 
00643 // ////////////////////////////////////////////////////////////////////////////
00644 // ////////////////////////////////////////////////////////////////////////////

Generated on Sun Nov 27 20:02:38 2011 for eWicht by  doxygen 1.5.5