
CDMS code for testing sbc
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Revision 240:946a9342a95f, committed 2016-07-07
- Comitter:
- ee12b079
- Date:
- Thu Jul 07 18:43:12 2016 +0000
- Parent:
- 239:a3a012a0fecc
- Child:
- 241:410c9cdd4f6e
- Commit message:
- pms_testing_latest
Changed in this revision
--- a/CDMS_PL.h Thu Jul 07 17:25:37 2016 +0000 +++ b/CDMS_PL.h Thu Jul 07 18:43:12 2016 +0000 @@ -74,7 +74,14 @@ tm_ptr_standby = FCTN_CDMS_RLY_TMTC(pl_tc_standby);\ VERIFY_TM(tm_ptr_standby);\ delete pl_tc_standby;\ - delete tm_ptr_standby;\ + Base_tm *temp;\ + temp = tm_ptr_standby;\ + while(tm_ptr_standby!=NULL)\ + {\ + temp = temp->next_TM;\ + delete tm_ptr_standby;\ + tm_ptr_standby = temp;\ + }\ } //TC_string[0] should not be 0x00 @@ -100,7 +107,14 @@ tm_ptr_hibernate = FCTN_CDMS_RLY_TMTC(pl_tc_hibernate);\ VERIFY_TM(tm_ptr_hibernate);\ delete pl_tc_hibernate;\ - delete tm_ptr_hibernate;\ + Base_tm *temp;\ + temp = tm_ptr_hibernate;\ + while(tm_ptr_hibernate!=NULL)\ + {\ + temp = temp->next_TM;\ + delete tm_ptr_hibernate;\ + tm_ptr_hibernate = temp;\ + }\ } //TC_string[0] should not be 0x00 @@ -127,7 +141,14 @@ tm_ptr_science = FCTN_CDMS_RLY_TMTC(pl_tc_science);\ VERIFY_TM(tm_ptr_science);\ delete pl_tc_science;\ - delete tm_ptr_science;\ + Base_tm *temp;\ + temp = tm_ptr_science;\ + while(tm_ptr_science!=NULL)\ + {\ + temp = temp->next_TM;\ + delete tm_ptr_science;\ + tm_ptr_science = temp;\ + }\ } void print_processed_block(uint8_t index) {
--- a/COM_MNG_TMTC.h Thu Jul 07 17:25:37 2016 +0000 +++ b/COM_MNG_TMTC.h Thu Jul 07 18:43:12 2016 +0000 @@ -370,8 +370,8 @@ Base_tm *tm_pointer = new Long_tm; Base_tm *tm_ptr = tm_pointer; //Base_tm *tm_ptr = new Long_tm; - Base_tm *tm_pointer_short = new Short_tm; - Base_tm *tm_ptr_short = tm_pointer_short; + //Base_tm *tm_pointer_short = new Short_tm; + //Base_tm *tm_ptr_short = tm_pointer_short; received = 0; switch(GETapid(tc_ptr)) //checking APID's { @@ -385,8 +385,9 @@ if(y==1) { - ACK_L234(tm_ptr_short,0x03,GETpacket_seq_count(tc_ptr)); - return tm_ptr_short; + //ACK_L234(tm_ptr_short,0x03,GETpacket_seq_count(tc_ptr)); + //return tm_ptr_short; + return NULL; } else if(y==0) { @@ -409,17 +410,19 @@ } else if(y==1) { - ACK_L234(tm_ptr_short,0x85,GETpacket_seq_count(tc_ptr)); + //ACK_L234(tm_ptr_short,0x85,GETpacket_seq_count(tc_ptr)); //gPC.printf("\n\rPTE->PDIR = 0x%08X",PTE->PDIR); - return tm_ptr_short; + //return tm_ptr_short; + return NULL; break; } } else if(BAE_I2C_GPIO == 0) //name to be changed later { gPC.printf("BAE_I2C_GPIO is not high\r\n"); - ACK_L234(tm_ptr_short,0x84,GETpacket_seq_count(tc_ptr)); - return tm_ptr_short; + //ACK_L234(tm_ptr_short,0x84,GETpacket_seq_count(tc_ptr)); + //return tm_ptr_short; + return NULL; } } BAE_I2C_mutex.unlock(); @@ -500,7 +503,7 @@ } } } */ - case 0x80: + /*case 0x80: { gPC.printf("service:FUNCTION MANAGEMENT SERVICE\r\n"); if(GETservice_subtype(tc_ptr)==0x1) @@ -772,7 +775,7 @@ tm_pointer->TM_string[133] = (uint8_t)(crc16&0x00FF); tm_pointer->next_TM = NULL; return tm_ptr; */ //incomplete - } + /*} else if(GETpid(tc_ptr)==0xF0) { uint8_t statusbits[64]; @@ -792,7 +795,7 @@ ACK_L234(tm_ptr_short,0x02,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; } - } + }*/ case 0x70: { gPC.printf("\n\n\rService:PAYLOAD MANAGEMENT SERVICE"); @@ -890,19 +893,21 @@ else { gPC.printf("INVALID SERVICE SUBTYPE\r\n"); - ACK_L234(tm_ptr_short,0x02,GETpacket_seq_count(tc_ptr)); - return tm_ptr_short; + //ACK_L234(tm_ptr_short,0x02,GETpacket_seq_count(tc_ptr)); + //return tm_ptr_short; + return NULL; } } default: { gPC.printf("ILLEGAL TC"); - ACK_L234(tm_ptr_short,0x02,GETpacket_seq_count(tc_ptr)); - return tm_ptr_short; + //ACK_L234(tm_ptr_short,0x02,GETpacket_seq_count(tc_ptr)); + //return tm_ptr_short; + return NULL; } } } - case 3: + /*case 3: { //#if DEBUG gPC.printf("\n\rTelecommand is for PL\r\n"); @@ -953,12 +958,13 @@ return tm_ptr_short; } } - } + }*/ default: //invalid TC { gPC.printf("INVALID TC\r\n"); - ACK_L234(tm_ptr_short,0x02,GETpacket_seq_count(tc_ptr)); - return tm_ptr_short; + //ACK_L234(tm_ptr_short,0x02,GETpacket_seq_count(tc_ptr)); + //return tm_ptr_short; + return NULL; } } return;
--- a/TEST_PL.h Thu Jul 07 17:25:37 2016 +0000 +++ b/TEST_PL.h Thu Jul 07 18:43:12 2016 +0000 @@ -233,6 +233,15 @@ test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ + delete test_tc;\ + Base_tm *temp;\ + temp = test_tm_ptr;\ + while(test_tm_ptr!=NULL)\ + {\ + temp = temp->next_TM;\ + delete test_tm_ptr;\ + test_tm_ptr = temp;\ + }\ } #define test_schedule_2(test_tm_ptr) {\ Base_tc *test_tc = new Long_tc;\ @@ -247,6 +256,15 @@ test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ + delete test_tc;\ + Base_tm *temp;\ + temp = test_tm_ptr;\ + while(test_tm_ptr!=NULL)\ + {\ + temp = temp->next_TM;\ + delete test_tm_ptr;\ + test_tm_ptr = temp;\ + }\ } #define test_schedule_3(test_tm_ptr) {\ Base_tc *test_tc = new Long_tc;\ @@ -261,6 +279,15 @@ test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ + delete test_tc;\ + Base_tm *temp;\ + temp = test_tm_ptr;\ + while(test_tm_ptr!=NULL)\ + {\ + temp = temp->next_TM;\ + delete test_tm_ptr;\ + test_tm_ptr = temp;\ + }\ } #define test_schedule_4(test_tm_ptr) {\ Base_tc *test_tc = new Long_tc;\ @@ -275,6 +302,15 @@ test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ + delete test_tc;\ + Base_tm *temp;\ + temp = test_tm_ptr;\ + while(test_tm_ptr!=NULL)\ + {\ + temp = temp->next_TM;\ + delete test_tm_ptr;\ + test_tm_ptr = temp;\ + }\ } #define test_schedule_5(test_tm_ptr) {\ Base_tc *test_tc = new Long_tc;\ @@ -289,6 +325,15 @@ test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ + delete test_tc;\ + Base_tm *temp;\ + temp = test_tm_ptr;\ + while(test_tm_ptr!=NULL)\ + {\ + temp = temp->next_TM;\ + delete test_tm_ptr;\ + test_tm_ptr = temp;\ + }\ } #define test_schedule_6(test_tm_ptr) {\ Base_tc *test_tc = new Long_tc;\ @@ -303,6 +348,15 @@ test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ + delete test_tc;\ + Base_tm *temp;\ + temp = test_tm_ptr;\ + while(test_tm_ptr!=NULL)\ + {\ + temp = temp->next_TM;\ + delete test_tm_ptr;\ + test_tm_ptr = temp;\ + }\ } #define test_schedule_F(test_tm_ptr) {\ Base_tc *test_tc = NULL;\ @@ -323,6 +377,7 @@ test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\ test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\ test_tm_ptr = FCTN_CDMS_RLY_TMTC(test_tc);\ + delete test_tc;\ } void send_verify_0xF(Base_tm* test_tm_ptr) { @@ -330,8 +385,8 @@ uint8_t j=0,tm_data_err_count=0; Base_tm* temp_ptr; test_schedule_F(test_tm_ptr); - //gPC.printf("\n\r----------------------------------------------------------------------------------"); - //gPC.printf("\n\rTC_Schedule_Report(0xF):\n"); + gPC.printf("\n\r----------------------------------------------------------------------------------"); + gPC.printf("\n\rTC_Schedule_Report(0xF):\n"); temp_ptr=test_tm_ptr; while(temp_ptr!=NULL) { @@ -389,7 +444,15 @@ { gPC.printf("\n\rNo errors in TM Data(0xF)"); } - //gPC.printf("\n\r----------------------------------------------------------------------------------"); + gPC.printf("\n\r----------------------------------------------------------------------------------"); + Base_tm *temp;\ + temp = test_tm_ptr;\ + while(test_tm_ptr!=NULL)\ + {\ + temp = temp->next_TM;\ + delete test_tm_ptr;\ + test_tm_ptr = temp;\ + }\ } void verify_extracted(uint8_t c) { @@ -426,7 +489,6 @@ uint32_t temp_pl_block[192] = {0}; uint8_t wrong_modify=0,z; Base_tm* test_tm_ptr; - //Base_tm* temp; for(z=0;z<192;z++) pl_block[z] = 0xFFFFFFFF; // testing 0xF @@ -435,8 +497,8 @@ temp_pl_block[z] = pl_block[z]; //testing TC = 0x1,0x2...0x6 - uint8_t w =1; - for(uint8_t v=1;w<2;w++) + int w =1; + for(uint8_t v=1;w<1000;w++) { /*switch(v) { @@ -453,6 +515,7 @@ case 6: test_schedule_6(test_tm_ptr); break; }*/ + gPC.printf("\n\rIndex:%d",w); if(v==1) { test_schedule_1(test_tm_ptr); @@ -506,7 +569,7 @@ verify_extracted(v); for(z=0;z<192;z++) temp_pl_block[z] = pl_block[z]; - wait(1); + //wait(1); } gPC.printf("\n\rTesting TC_TM block processing complete"); } \ No newline at end of file
--- a/cdms_rtc.h Thu Jul 07 17:25:37 2016 +0000 +++ b/cdms_rtc.h Thu Jul 07 18:43:12 2016 +0000 @@ -40,22 +40,22 @@ gCS_RTC=0; spi.write(0x80); - spi.write(0x01); // set milliseconds value to 00 + spi.write(0x00); // set milliseconds value to 00 gCS_RTC=1; gCS_RTC=0; spi.write(0x81); - spi.write(0x01); //set seconds value to 00 + spi.write(0x00); //set seconds value to 00 gCS_RTC=1; gCS_RTC=0; spi.write(0x82); - spi.write(0x01);//set minutes value to 00 + spi.write(0x00);//set minutes value to 00 gCS_RTC=1; gCS_RTC=0; spi.write(0x83); - spi.write(0x23); //set the hours to 01 + spi.write(0x00); //set the hours to 01 gCS_RTC=1; gCS_RTC=0; @@ -65,17 +65,17 @@ gCS_RTC=0; spi.write(0x85); - spi.write(0x31); //set date of the month to 01 + spi.write(0x01); //set date of the month to 01 gCS_RTC=1; gCS_RTC=0; spi.write(0x86); - spi.write(0x12); //set month to 01 + spi.write(0x01); //set month to 01 gCS_RTC=1; gCS_RTC=0; spi.write(0x87); - spi.write(0x01); //set year to 00(2000) + spi.write(0x00); //set year to 00(2000) gCS_RTC=1; gPC.puts("\n\r rtc initalised \n"); SPI_mutex.unlock();
--- a/main.cpp Thu Jul 07 17:25:37 2016 +0000 +++ b/main.cpp Thu Jul 07 18:43:12 2016 +0000 @@ -107,7 +107,7 @@ // DEBUG //gPC.puts("welcome to mng_tm_tc\r\n"); - gPC.baud(9600);//changed for bypassing COM + gPC.baud(57600);//changed for bypassing COM // COMMON SPI spi.format(8,0);