Go to the documentation of this file.00001
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef FLASH_LIB_H
00044 #define FLASH_LIB_H
00045
00046
00047
00048
00049 #include "config.h"
00050
00051
00052
00053
00054
00055
00056 #define FLASH_BLANK_VALUE 0xFF
00057
00058 #ifndef FLASH_PAGE_SIZE
00059 #error You must define FLASH_PAGE_SIZE in bytes in config.h
00060 #endif
00061
00062 #if (FLASH_END==0x1FFFF)
00063 #define LAST_BOOT_ENTRY 0xFFFE
00064 #elif (FLASH_END==0xFFFF)
00065 #define LAST_BOOT_ENTRY 0x7FFE
00066 #elif (FLASH_END==0x3FFF)
00067 #define LAST_BOOT_ENTRY 0x1FFE
00068 #else
00069 #error You must define FLASH_END in bytes in config.h
00070 #endif
00071
00078 #define Flash_read_id1() ( (*boot_flash_read_sig)(0x0000))
00079
00086 #define Flash_read_id2() ( (*boot_flash_read_sig)(0x0002))
00087
00094 #define Flash_read_id3() ( (*boot_flash_read_sig)(0x0004))
00095
00102 #define Flash_read_osccal() ( (*boot_flash_read_sig)(0x0001))
00103
00110 #define Flash_read_fuse_low() ( (*boot_flash_read_fuse)(0x0000))
00111
00118 #define Flash_read_fuse_high() ( (*boot_flash_read_fuse)(0x0003))
00119
00126 #define Flash_read_fuse_extended() ( (*boot_flash_read_fuse)(0x0002))
00127
00134 #define Flash_read_lock() ( (*boot_flash_read_fuse)(0x0001))
00135
00136
00137 #define Flash_write_lb(b) ((*boot_lock_wr_bits)(b))
00138
00139
00140
00141
00142
00143
00144 extern U8 (*boot_flash_read_sig) (unsigned long adr);
00145 extern U8 (*boot_flash_read_fuse) (unsigned long adr);
00146 extern void (*boot_lock_wr_bits) (unsigned char val);
00154 extern void flash_wr_byte(Uint32 addr_byte, Uchar value);
00155
00165 extern Uchar flash_wr_block(Byte _MemType_* src, Uint32 dst, U16 n);
00166
00171 extern void flash_erase(void);
00172
00180 extern U8 flash_rd_byte(Uchar farcode* addr);
00181
00189 extern U16 flash_rd_word(U16 farcode* addr);
00190
00191 #endif
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205