CDMS code for testing sbc

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Revision:
261:1e54415b34d3
Parent:
259:066a7abd2a5f
--- a/Flash.h	Tue Jul 12 17:54:30 2016 +0000
+++ b/Flash.h	Thu Jul 14 13:07:30 2016 +0000
@@ -1,5 +1,8 @@
 #include "FreescaleIAP.h"
 
+int strt_add_thres = flash_size() - (11*SECTOR_SIZE);
+uint32_t flasharray_thres[32] = {0};
+
 void FCTN_CDMS_WR_FLASH(uint16_t , uint32_t);
 int strt_add = flash_size() - (2*SECTOR_SIZE);
 uint32_t flasharray[32];    //256+(3*1024)
@@ -50,7 +53,7 @@
 /*Writing to the Flash*/
 void FCTN_CDMS_WR_FLASH(uint16_t j,uint32_t datablock)  //j-position to write address  ; fdata - flash data to be written
 {
-    for(int i=0;i<5;i++)
+    for(int i=0;i<17;i++)
     {
         flasharray[i]=nativeflash[i];
     }
@@ -61,3 +64,29 @@
 /*End*/
 
 /*===================================================MMS Functions=================================================*/
+
+void FCTN_CDMS_WR_S_FLASH(uint16_t mid,uint32_t datablock);
+
+void FCTN_CDMS_WR_S_FLASH(uint16_t mid,uint32_t datablock)
+{
+    if(mid == 0x0100)
+    {
+        FCTN_CDMS_WR_FLASH(11,(datablock>>16) & 0x000000FF);
+        FCTN_CDMS_WR_FLASH(13,(datablock>>8) & 0x000000FF);
+        FCTN_CDMS_WR_FLASH(14,datablock & 0x000000FF);
+    }
+    else if(mid == 0x0101)
+    {
+        FCTN_CDMS_WR_FLASH(12,(datablock>>16) & 0x000000FF);
+        FCTN_CDMS_WR_FLASH(10,(datablock>>8) & 0x000000FF);
+        FCTN_CDMS_WR_FLASH(15,datablock & 0x000000FF);
+    }
+    else if(mid == 0x0102)
+    {
+        FCTN_CDMS_WR_FLASH(9,datablock & 0x0000FFFF);
+    }
+    else if(mid == 0x0103)
+    {
+        FCTN_CDMS_WR_FLASH(6,datablock & 0x00000001);
+    } 
+}
\ No newline at end of file