/** * Copyright (c) 2007, Freescale Semiconductor * Freescale Confidential Proprietary * * File name : Flash.h * Project name: VKSP Software Library * * Author : Ioseph Martinez * Department : Go to Market AUTO - RTAC Americas * * Description : VKSP Transmitter Flash Driver, header file * * History : * 14/Jan/2008 : Version 0.1 - */ #include /* for EnableInterrupts macro */ #include "derivative.h" /* include peripheral declarations */ /* Set the correct bus frequency */ #define FLASH_FBUS_FREQ 4000000 /* Do not change the following code */ #if (FLASH_FBUS_FREQ > 10000000) #define FLASH_PRDIV8 1 #define FLASH_DIV (unsigned char ( (FLASH_FBUS_FREQ/1400000) -1 ) ) #else #define FLASH_PRDIV8 0 #define FLASH_DIV ((unsigned char)((FLASH_FBUS_FREQ/175000)-1)) #endif #define FLASH_ERASE_CMD 0x40 #define FLASH_PROGRAM_CMD 0x20 typedef void(*pt2Func)(void); void FlashInit(void); void Flash_Cmd(unsigned int Address, unsigned char bData, unsigned char cmd); /* Macros to call the function using the different features */ #define Flash_Erase(Address) \ Flash_Cmd((unsigned int)Address, (unsigned int)1, FLASH_ERASE_CMD) #define Flash_Program(Address, Data) \ Flash_Cmd((unsigned int)Address, (unsigned char)Data, FLASH_PROGRAM_CMD)