
FM
Dependencies: SimpleDMA eeprom mbed-rtos mbed FreescaleIAP
Fork of CDMS_CODE by
Revision 344:1675dbde0bae, committed 2017-01-08
- Comitter:
- chaithanyarss
- Date:
- Sun Jan 08 14:52:55 2017 +0000
- Parent:
- 343:cd7b1734f7a0
- Child:
- 345:cdde554477cd
- Commit message:
- Some changes
Changed in this revision
--- a/CDMS_HK.h Wed Jan 04 10:55:22 2017 +0000 +++ b/CDMS_HK.h Sun Jan 08 14:52:55 2017 +0000 @@ -240,7 +240,9 @@ y = FCTN_I2C_WRITE((char *)beacon_array,134); if(y == 0) { TIME_LATEST_I2C_BAE = FCTN_CDMS_RD_RTC() >> 7; - //gPC.printf("long Bcn sent\n\r"); + gPC.printf("long Bcn sent\n\n\r"); + for(int i = 0; i<134; i++) + gPC.printf("%2x",beacon_array[i]); } else gPC.printf("long Bcn not sent\r\n"); //gPC.printf("\rCompleted Beacon\n");
--- a/COM_MNG_TMTC.h Wed Jan 04 10:55:22 2017 +0000 +++ b/COM_MNG_TMTC.h Sun Jan 08 14:52:55 2017 +0000 @@ -465,7 +465,7 @@ return tm_ptr_short; } - FCTN_CDMS_WR_S_FLASH(mid,(uint32_t)(tc_ptr->TC_string[5]<<24)+(uint32_t)(tc_ptr->TC_string[6]<<16)+(uint32_t)(tc_ptr->TC_string[7]<<8)+(uint32_t)(tc_ptr->TC_string[8])); + //FCTN_CDMS_WR_S_FLASH(mid,(uint32_t)(tc_ptr->TC_string[5]<<24)+(uint32_t)(tc_ptr->TC_string[6]<<16)+(uint32_t)(tc_ptr->TC_string[7]<<8)+(uint32_t)(tc_ptr->TC_string[8])); ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); @@ -486,8 +486,8 @@ flasharray_thres[z] = scp_threshold_m0[z]; for(uint8_t z=24;z<32;z++) flasharray_thres[z] = scp_threshold_m0[z+8]; - erase_sector(strt_add_thres); - program_flash(strt_add_thres, (char*)flasharray_thres,32); + //erase_sector(strt_add_thres); + //program_flash(strt_add_thres, (char*)flasharray_thres,32); Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); @@ -501,8 +501,8 @@ //uint32_t flasharray[32] = {0}; for(uint8_t z=0;z<12;z++) flasharray_thres[z] = scp_threshold_m0[z+40]; - erase_sector(strt_add_thres+SECTOR_SIZE); - program_flash(strt_add_thres+SECTOR_SIZE, (char*)flasharray_thres,32); + //erase_sector(strt_add_thres+SECTOR_SIZE); + //program_flash(strt_add_thres+SECTOR_SIZE, (char*)flasharray_thres,32); Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -515,8 +515,8 @@ //uint32_t flasharray[32] = {0}; for(uint8_t z=0;z<32;z++) flasharray_thres[z] = scp_threshold_m1[z]; - erase_sector(strt_add_thres+(2*SECTOR_SIZE)); - program_flash(strt_add_thres+(2*SECTOR_SIZE), (char*)flasharray_thres,32); + //erase_sector(strt_add_thres+(2*SECTOR_SIZE)); + //program_flash(strt_add_thres+(2*SECTOR_SIZE), (char*)flasharray_thres,32); Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -529,8 +529,8 @@ //uint32_t flasharray[32] = {0}; for(uint8_t z=0;z<20;z++) flasharray_thres[z] = scp_threshold_m1[z+32]; - erase_sector(strt_add_thres+(3*SECTOR_SIZE)); - program_flash(strt_add_thres+(3*SECTOR_SIZE), (char*)flasharray_thres,32); + //erase_sector(strt_add_thres+(3*SECTOR_SIZE)); + //program_flash(strt_add_thres+(3*SECTOR_SIZE), (char*)flasharray_thres,32); Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -557,8 +557,8 @@ flasharray_thres[9] = scp_sfp_threshold_m0_2[0]; flasharray_thres[10] = scp_sfp_threshold_m0_2[1]; flasharray_thres[11] = scp_sfp_threshold_m0_2[2]; - erase_sector(strt_add_thres+(4*SECTOR_SIZE)); - program_flash(strt_add_thres+(4*SECTOR_SIZE), (char*)flasharray_thres,32); + //erase_sector(strt_add_thres+(4*SECTOR_SIZE)); + //program_flash(strt_add_thres+(4*SECTOR_SIZE), (char*)flasharray_thres,32); Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -575,8 +575,8 @@ flasharray_thres[z] = sfp_threshold_m0[z]; for(uint8_t z=24;z<32;z++) flasharray_thres[z] = sfp_threshold_m0[z+8]; - erase_sector(strt_add_thres+(5*SECTOR_SIZE)); - program_flash(strt_add_thres+(5*SECTOR_SIZE), (char*)flasharray_thres,32); + //erase_sector(strt_add_thres+(5*SECTOR_SIZE)); + //program_flash(strt_add_thres+(5*SECTOR_SIZE), (char*)flasharray_thres,32); Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -589,8 +589,8 @@ //uint32_t flasharray_thres[32] = {0}; for(uint8_t z=0;z<12;z++) flasharray_thres[z] = sfp_threshold_m0[z+40]; - erase_sector(strt_add_thres+(6*SECTOR_SIZE)); - program_flash(strt_add_thres+(6*SECTOR_SIZE), (char*)flasharray_thres,32); + //erase_sector(strt_add_thres+(6*SECTOR_SIZE)); + //program_flash(strt_add_thres+(6*SECTOR_SIZE), (char*)flasharray_thres,32); Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -603,8 +603,8 @@ //uint32_t flasharray_thres[32] = {0}; for(uint8_t z=0;z<32;z++) flasharray_thres[z] = sfp_threshold_m1[z]; - erase_sector(strt_add_thres+(7*SECTOR_SIZE)); - program_flash(strt_add_thres+(7*SECTOR_SIZE), (char*)flasharray_thres,32); + //erase_sector(strt_add_thres+(7*SECTOR_SIZE)); + //program_flash(strt_add_thres+(7*SECTOR_SIZE), (char*)flasharray_thres,32); Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -617,8 +617,8 @@ //uint32_t flasharray_thres[32] = {0}; for(uint8_t z=0;z<20;z++) flasharray_thres[z] = sfp_threshold_m1[z+32]; - erase_sector(strt_add_thres+(8*SECTOR_SIZE)); - program_flash(strt_add_thres+(8*SECTOR_SIZE), (char*)flasharray_thres,32); + //erase_sector(strt_add_thres+(8*SECTOR_SIZE)); + //program_flash(strt_add_thres+(8*SECTOR_SIZE), (char*)flasharray_thres,32); Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short;
--- a/DefinitionsAndGlobals.h Wed Jan 04 10:55:22 2017 +0000 +++ b/DefinitionsAndGlobals.h Sun Jan 08 14:52:55 2017 +0000 @@ -360,6 +360,7 @@ //CDMS FLASH parameters +uint32_t flasharray_thres[32] = {0}; uint8_t EPS_V_A_EN_STATUS; //uint8_t BAE_SW_STATUS; //uint8_t CDMS_SD_SW_STATUS;
--- a/E2PROM.h Wed Jan 04 10:55:22 2017 +0000 +++ b/E2PROM.h Sun Jan 08 14:52:55 2017 +0000 @@ -52,5 +52,4 @@ SD_LIB_BLK_CURRENT = READ_FROM_EERPOM(16); } - #endif \ No newline at end of file
--- a/Flash.h Wed Jan 04 10:55:22 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -#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) -uint32_t INITIAL_FLASH[32]; - -/*corrected*/ -int *nativeflash = (int*)strt_add; - -void FLASH_INI() -{ - INITIAL_FLASH[16] = 80000; - uint32_t read[32]; - for(int i=0;i<32;i++) - { - read[i] = nativeflash[i]; - } - - if(read[0] == -1) - { - for(int j=0;j<32;j++) - { - FCTN_CDMS_WR_FLASH(j,INITIAL_FLASH[j]); - } - } - else - { - for(int j=0;j<32;j++) - { - read[j] = nativeflash[j]; - } - } - EPS_V_A_EN_STATUS = read[0]; - BAE_STATUS = read[1]; - SD_STATUS = read[2]; - PL_STATUS = read[3]; - PL_EPS_LATCH_SW_EN = read[4]; - RTC_INIT_STATUS = read[5]; - CDMS_RTC_DISABLE = read[6]; - CDMS_RESET_COUNTER = read[7]; - TIME_LATEST_CDSMS_RESET = read[8]; - COM_TC_BYTES_LIMIT = read[9]; - COM_RX_CURRENT_MAX = read[10]; - COM_RX_DISABLE_TIMEOUT = read[11]; - COM_PA_TMP_HIGH = read[12]; - COM_PA_RECOVERY_TIMEOUT = read[13]; - COM_SESSION_TIMEOUT = read[14]; - COM_RSSI_MIN = read[15]; - SD_LIB_BLK_CURRENT = read[16]; -} - -/*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<17;i++) - { - flasharray[i]=nativeflash[i]; - } - flasharray[j]=datablock; - erase_sector(strt_add); - program_flash(strt_add, (char*)flasharray,32); -} -/*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); - } -} - -int verify_flash_sector(int mid,uint32_t* flasharray_thres) -{ - int add = strt_add_thres + ((mid-1)*SECTOR_SIZE); - int result = 0; - int* testflash = (int*)add; - for(int i=0;i<32;i++) - { - if(testflash[i] == flasharray_thres[i]) - continue; - else - { - return 1; - } - } - return 0; -} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RAM.h Sun Jan 08 14:52:55 2017 +0000 @@ -0,0 +1,35 @@ +/* Using malloc() to determine free memory.*/ + +#include <stdio.h> +#include <stdlib.h> +#define FREEMEM_CELL 100 +struct elem { /* Definition of a structure that is FREEMEM_CELL bytes in size.) */ + struct elem *next; + char dummy[FREEMEM_CELL-2]; +}; +int FreeMem(void) { + int counter; + struct elem *head, *current, *nextone; + current = head = (struct elem*) malloc(sizeof(struct elem)); + if (head == NULL) + return 0; /*No memory available.*/ + counter = 0; + // __disable_irq(); + do { + counter++; + current->next = (struct elem*) malloc(sizeof(struct elem)); + current = current->next; + } while (current != NULL); + /* Now counter holds the number of type elem + structures we were able to allocate. We + must free them all before returning. */ + current = head; + do { + nextone = current->next; + free(current); + current = nextone; + } while (nextone != NULL); + // __enable_irq(); + + return counter*FREEMEM_CELL; +} \ No newline at end of file
--- a/eeprom.lib Wed Jan 04 10:55:22 2017 +0000 +++ b/eeprom.lib Sun Jan 08 14:52:55 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/bborredon/code/eeprom/#925096a4c7f0 +https://developer.mbed.org/users/bborredon/code/eeprom/#b65b74065b7f
--- a/main.cpp Wed Jan 04 10:55:22 2017 +0000 +++ b/main.cpp Sun Jan 08 14:52:55 2017 +0000 @@ -17,7 +17,7 @@ #include "eeprom.h" #include "E2PROM.h" #include "COM_SND_TM_functions.h" -#include "Flash.h" +//#include "Flash.h" #include "cdms_rtc.h" #include "COM_SND_TM.h" #include "cdms_sd.h"
--- a/mbed-rtos.lib Wed Jan 04 10:55:22 2017 +0000 +++ b/mbed-rtos.lib Sun Jan 08 14:52:55 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#c825593ece39 +http://mbed.org/users/mbed_official/code/mbed-rtos/#4c105b8d7cae