CDMS_CODE_samp_23SEP_DMA_flag
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE_samp_23SEP_DMA by
Flash.h@208:d14b1c783736, 2016-07-02 (annotated)
- Committer:
- chaithanyarss
- Date:
- Sat Jul 02 13:36:18 2016 +0000
- Revision:
- 208:d14b1c783736
- Parent:
- 52:0bd68655c651
;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chaithanyarss | 208:d14b1c783736 | 1 | //#include "FreescaleIAP.h" |
aniruddhv | 52:0bd68655c651 | 2 | |
aniruddhv | 52:0bd68655c651 | 3 | int strt_add = flash_size() - (4*SECTOR_SIZE); |
aniruddhv | 52:0bd68655c651 | 4 | uint32_t flasharray[256+(3*1024)]; |
aniruddhv | 52:0bd68655c651 | 5 | char *nativeflash = (char*)strt_add; |
aniruddhv | 52:0bd68655c651 | 6 | |
aniruddhv | 52:0bd68655c651 | 7 | /*Writing to the Flash*/ |
aniruddhv | 52:0bd68655c651 | 8 | void FCTN_CDMS_WR_FLASH(uint16_t j,uint32_t block) |
aniruddhv | 52:0bd68655c651 | 9 | { |
aniruddhv | 52:0bd68655c651 | 10 | for(int64_t i=0;i<(256+(3*1024));i++) |
aniruddhv | 52:0bd68655c651 | 11 | { |
aniruddhv | 52:0bd68655c651 | 12 | flasharray[i]=nativeflash[i]; |
aniruddhv | 52:0bd68655c651 | 13 | } |
aniruddhv | 52:0bd68655c651 | 14 | flasharray[j]=block; |
aniruddhv | 52:0bd68655c651 | 15 | erase_sector(strt_add); |
aniruddhv | 52:0bd68655c651 | 16 | program_flash(strt_add, (char*)&flasharray,4*(256+(1024*3))); |
aniruddhv | 52:0bd68655c651 | 17 | } |
aniruddhv | 52:0bd68655c651 | 18 | /*End*/ |
aniruddhv | 52:0bd68655c651 | 19 | |
aniruddhv | 52:0bd68655c651 | 20 | /*Reading from Flash*/ |
aniruddhv | 52:0bd68655c651 | 21 | uint32_t FCTN_CDMS_RD_FLASH(uint16_t j) |
aniruddhv | 52:0bd68655c651 | 22 | { |
aniruddhv | 52:0bd68655c651 | 23 | for(int64_t i=0;i<(256+(3*1024));i++) |
aniruddhv | 52:0bd68655c651 | 24 | { |
aniruddhv | 52:0bd68655c651 | 25 | flasharray[i]=nativeflash[i]; |
aniruddhv | 52:0bd68655c651 | 26 | } |
aniruddhv | 52:0bd68655c651 | 27 | return flasharray[j]; |
aniruddhv | 52:0bd68655c651 | 28 | } |