
CDMS code for testing sbc
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Flash.h@248:407ab7e337cd, 2016-07-08 (annotated)
- Committer:
- chaithanyarss
- Date:
- Fri Jul 08 12:53:24 2016 +0000
- Revision:
- 248:407ab7e337cd
- Parent:
- 52:0bd68655c651
- Child:
- 249:1560c64adffb
Completed HK except Flash
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aniruddhv | 52:0bd68655c651 | 1 | #include "FreescaleIAP.h" |
aniruddhv | 52:0bd68655c651 | 2 | |
chaithanyarss | 248:407ab7e337cd | 3 | int strt_add = flash_size() - (2*SECTOR_SIZE); |
chaithanyarss | 248:407ab7e337cd | 4 | uint32_t flasharray[8]; //256+(3*1024) |
chaithanyarss | 248:407ab7e337cd | 5 | /*corrected*/ |
chaithanyarss | 248:407ab7e337cd | 6 | int *nativeflash = (int*)strt_add; |
aniruddhv | 52:0bd68655c651 | 7 | |
aniruddhv | 52:0bd68655c651 | 8 | /*Writing to the Flash*/ |
chaithanyarss | 248:407ab7e337cd | 9 | void FCTN_CDMS_WR_FLASH(uint16_t j,uint32_t fdata) //j-position to write address ; fdata - flash data to be written |
aniruddhv | 52:0bd68655c651 | 10 | { |
chaithanyarss | 248:407ab7e337cd | 11 | for(int i=0;i<8;i++) |
aniruddhv | 52:0bd68655c651 | 12 | { |
aniruddhv | 52:0bd68655c651 | 13 | flasharray[i]=nativeflash[i]; |
aniruddhv | 52:0bd68655c651 | 14 | } |
chaithanyarss | 248:407ab7e337cd | 15 | flasharray[j]=fdata; |
aniruddhv | 52:0bd68655c651 | 16 | erase_sector(strt_add); |
chaithanyarss | 248:407ab7e337cd | 17 | program_flash(strt_add, (char*)flasharray,32); |
aniruddhv | 52:0bd68655c651 | 18 | } |
chaithanyarss | 248:407ab7e337cd | 19 | |
aniruddhv | 52:0bd68655c651 | 20 | /*End*/ |
aniruddhv | 52:0bd68655c651 | 21 | |
aniruddhv | 52:0bd68655c651 | 22 | /*Reading from Flash*/ |
chaithanyarss | 248:407ab7e337cd | 23 | |
chaithanyarss | 248:407ab7e337cd | 24 | uint32_t* FCTN_BAE_RD_FLASH() |
aniruddhv | 52:0bd68655c651 | 25 | { |
chaithanyarss | 248:407ab7e337cd | 26 | for(int i=0;i<8;i++) |
aniruddhv | 52:0bd68655c651 | 27 | { |
aniruddhv | 52:0bd68655c651 | 28 | flasharray[i]=nativeflash[i]; |
aniruddhv | 52:0bd68655c651 | 29 | } |
chaithanyarss | 248:407ab7e337cd | 30 | return flasharray; |
chaithanyarss | 248:407ab7e337cd | 31 | } |
chaithanyarss | 248:407ab7e337cd | 32 | |
chaithanyarss | 248:407ab7e337cd | 33 | /*End*/ |