/* ** ################################################################### ** ** Filename : IntFlash.C ** ** Project : IntFlash ** ** Processor : MC9S08GB60 ** ** Version : Driver 01.01 ** ** Compiler : Metrowerks HCS08 C Compiler ** ** Date/Time : 30.4.2003, 15:56 ** ** Abstract : ** ** Main module. ** Here is to be placed user's code. ** ** Settings : ** ** ** Contents : ** ** No public methods ** ** ** Copyright: 1997 - 2009 Freescale Semiconductor, Inc. All Rights Reserved. ** ** ** ** http : www.freescale.com ** mail : support@freescale.com ** ** ################################################################### */ /* MODULE IntFlash */ /* Including used modules for compilling procedure */ #include "Cpu.h" #include "Events.h" #include "IFsh1.h" /* Include shared modules, which are used for whole project */ #include "PE_Types.h" #include "PE_Error.h" #include "PE_Const.h" #include "IO_Map.h" void main(void) { byte err[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; byte VP[128]; dword dwData; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ #ifndef PE_OS_OSEK_SUPPORT for(;;){ /* a) Write byte to the last address of the page and to the first address of the next page */ err[0]=IFsh1_SetByteFlash(0xdfff,0); err[1]=IFsh1_SetByteFlash(0xe000,0); /* Write words before/after byte written in step a) */ err[2]=IFsh1_SetWordFlash(0xdffd,0x1234); err[3]=IFsh1_SetWordFlash(0xe001,0x1234); /* Rewrite bytes written in step a) */ err[4]=IFsh1_SetWordFlash(0xdfff,0xfefe); /* Write long */ err[5]=IFsh1_SetLongFlash(0xe002,0xfefefefe); /* Erase first page */ err[6]=IFsh1_EraseSector(0xdfff); /* Erase second page */ err[7]=IFsh1_EraseSector(0xe000); /* Set Virtual Page address */ IFsh1_SetVirtualPageAddress((word)VP); /* Read data from FLASH into the virtual page */ err[13]=IFsh1_GetPage(0xe000); /* Write long to the virtual page */ err[14]=IFsh1_GetLongPage(3,&dwData); err[15]=IFsh1_SetWordPage(3,0); /* Write virtual page to the FLASH */ err[16]=IFsh1_SetPage(0xe000); } #else StartOS(Mode); /* Jump to OSEKturbo OS startup */ /*DO NOT WRITE CODE BELOW THIS LINE*/ #endif PE_OS_OSEK_SUPPORT /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/ /* END IntFlash */ /* ** ################################################################### ** ** This file was created by Processor Expert 03.23 for ** the Freescale HCS08 series of microcontrollers. ** ** ################################################################### */