00001 /* 00002 * "Copyright (c) 2008 Robert B. Reese, Bryan A. Jones, J. W. Bruce ("AUTHORS")" 00003 * All rights reserved. 00004 * (R. Reese, reese_AT_ece.msstate.edu, Mississippi State University) 00005 * (B. A. Jones, bjones_AT_ece.msstate.edu, Mississippi State University) 00006 * (J. W. Bruce, jwbruce_AT_ece.msstate.edu, Mississippi State University) 00007 * 00008 * Permission to use, copy, modify, and distribute this software and its 00009 * documentation for any purpose, without fee, and without written agreement is 00010 * hereby granted, provided that the above copyright notice, the following 00011 * two paragraphs and the authors appear in all copies of this software. 00012 * 00013 * IN NO EVENT SHALL THE "AUTHORS" BE LIABLE TO ANY PARTY FOR 00014 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT 00015 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE "AUTHORS" 00016 * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00017 * 00018 * THE "AUTHORS" SPECIFICALLY DISCLAIMS ANY WARRANTIES, 00019 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 00020 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 00021 * ON AN "AS IS" BASIS, AND THE "AUTHORS" HAS NO OBLIGATION TO 00022 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." 00023 * 00024 * Please maintain this header in its entirety when copying/modifying 00025 * these files. 00026 * 00027 * 00028 */ 00029 00030 // Documentation for this file. If the \file tag isn't present, 00031 // this file won't be documented. 00036 #ifndef _PIC24_FLASH_H_ 00037 #define _PIC24_FLASH_H_ 00038 00039 #define FLASH_ROWSIZE 64 //in number of instructions 00040 #define FLASH_ROWS_PER_PAGE 8 00041 #define FLASH_PAGEINSTR (FLASH_ROWSIZE * FLASH_ROWS_PER_PAGE) //8 rows of 64 instructions 00042 #define FLASH_PAGESIZE (FLASH_PAGEINSTR*2) //each instruction appears to occupy 2 program memory addresses 00043 #define FLASH_PAGEBYTES (FLASH_PAGEINSTR*3) //total bytes is FLASH_PAGEINSTR *3 = 1536 00044 #define FLASH_ROWBYTES (FLASH_ROWSIZE*3) //bytes in one row 00045 00046 void doWriteLatchFlash(uint16 u16_addrhi, uint16 u16_addrlo, uint16 u16_wordhi, uint16 u16_wordlo); 00047 uint32 doReadLatchFlash(uint16 u16_addrhi, uint16 u16_addrlo); 00048 void doEraseFlash (uint16 u16_addrhi, uint16 u16_addrlo); 00049 void doWriteFlash(); 00050 void doWritePageFlash(union32 u32_pmemAddress, uint8* pu8_data, uint16 u16_len); 00051 void doReadPageFlash(union32 u32_pmemAddress, uint8* pu8_data, uint16 u16_len); 00052 00053 00054 #endif