![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
forkd
Fork of LGstaandart by
Diff: main.c
- Revision:
- 132:2c7bec5cf6fe
- Parent:
- 130:1421dda4d7e7
- Child:
- 133:90d0bf0e2996
diff -r ef5973569c02 -r 2c7bec5cf6fe main.c --- a/main.c Tue Apr 12 14:16:03 2016 +0000 +++ b/main.c Wed Apr 13 15:01:16 2016 +0000 @@ -28,6 +28,11 @@ ** Main Function main() ******************************************************************************/ Device device; //Single global for all device hardware-independent algorithm +#define IMG_START_SECTOR 0x00010000 /* Sector 16 */ +#define IMG_END_SECTOR 0x00037FFF /* Sector 20 */ +/* +#define IMG_START_SECTOR 0x00030000//0x00010000 /* Sector 16 +#define IMG_END_SECTOR 0x00037FFF */ extern uint32_t CMD_Mode; unsigned int secPuls; @@ -94,6 +99,21 @@ if (OutBufCon1Count) OutBufCon1Count--; if (ReadCon (Time)) { +///////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +//////////////////////Выбор FlashMod/////////////////////////// +//////////////////////////////////////////////////////////////// + + if (Time[0] == 'W') { + Gyro.FlashMod=1; + } + if (Time[0] == 'R') { + Gyro.FlashMod=2; + } + +/////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// if (Time[0] == 'h') { // если ввели буквц h то выдать подсказку. сделанно через принф ОЧЕНЬ плохо в работе не использовать sprintf(Time,"\r\nCompiled: %s %s.",__DATE__, __TIME__ ); //Подготовка даты и времени компиляции @@ -359,10 +379,47 @@ Gyro.VibroOutF = 0; VibroOut(); //Чтение ADS_SPI } +//&Gyro.Firmware_Version +///////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////Работа с Flash////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////////////////////// + if(Gyro.FlashMod == 1) + { + + + /* Prepare Sectors to be flashed */ + if(u32IAP_PrepareSectors(19, 21) == IAP_STA_CMD_SUCCESS) + { + WriteCon("\r\nPrepare Sector OK"); + + /* Copy data (already) located in RAM to flash */ + if(u32IAP_CopyRAMToFlash(IMG_START_SECTOR, &TempA, 256) == IAP_STA_CMD_SUCCESS) + {WriteCon("\r\nWrite"); + + /* Verify the flash contents with the contents in RAM */ + if(u32IAP_Compare(IMG_START_SECTOR, &TempA, 256, 0) == IAP_STA_CMD_SUCCESS){WriteCon("\r\nCompare"); + + }else{WriteCon("\r\n error Compare");} + + }else{WriteCon("\r\n error Write");} + + }else{WriteCon("\r\n error prepare");} + Gyro.FlashMod = 0; + } + + if(Gyro.FlashMod == 2) // установка ног в регисторе тоже подумать , зачем отделный флаг? наверно + { + Gyro.FlashMod = 0; + WriteCon("\r\Rnead from Flash"); + } + + + }//while -} //main +}//main /****************************************************************************** ** End Of File