Disona

F28M35 Flash C28: API and flash Init

Jun 9th, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.92 KB | None | 0 0
  1. #pragma CODE_SECTION(C28flash_InitFlash,ramFuncSection);
  2. void C28flash_InitFlash (void){
  3.     Uint32 i;
  4.  
  5.     InitFlash();                // Tune waitstates
  6.     CsmUnlock();                // Unlock CSM (not necessary right now)
  7.     FlashGainPump();            // Gain Pump from M3
  8.  
  9.     for (i=0;i<1024;i++){
  10.         flashData.dataBuffer[i] = i;
  11.     }
  12.     flashData.numOfWords = 1024;
  13.     flashData.flashAddress = 0x128000;
  14.     // Запрет ECC
  15.     EALLOW;
  16.     FlashEccRegs.ECC_ENABLE.bit.ENABLE = 0x0;
  17.     EDIS;
  18.  
  19.     Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 150);        // Init API
  20.     Fapi_setActiveFlashBank(Fapi_FlashBank0);               // Chose flash bank (we only have "bank 0" on C28)
  21.     Fapi_getBankSectors(Fapi_FlashBank0, &F28M35flash);     // Get info about sector structure on C28
  22.  
  23.     // Fill test buffer to be flashed
  24.     /* for (i=0;i<1024;i++){
  25.         flashData1.dataBuffer[i] = i;
  26.     }*/
  27. }
Advertisement
Add Comment
Please, Sign In to add comment