Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: COM_MNG_TMTC.h
- Revision:
- 69:20f09a0c3fd2
- Parent:
- 58:5c59f28620bc
- Child:
- 73:6c99294b7802
- Child:
- 75:d03b5d6ef269
- Child:
- 107:396aa26f3fff
--- a/COM_MNG_TMTC.h Fri Jan 15 12:02:12 2016 +0000
+++ b/COM_MNG_TMTC.h Sun Jan 17 14:04:08 2016 +0000
@@ -36,24 +36,6 @@
delete tc_ptr;\
}
-#define print_all_tm(tm_ptr_head){\
- Base_tm *temp_tm_ptr = tm_ptr_head;\
- while( temp_tm_ptr != NULL ){\
- int length = TM_SHORT_SIZE;\
- if( GETshort_or_long_tm(temp_tm_ptr->fields) == SHORT_TM_CODE ){\
- length = TM_SHORT_SIZE;\
- }\
- else{\
- length = TM_LONG_SIZE;\
- }\
- for(int i = 0 ; i < length ; ++i){\
- gPC.putc(temp_tm_ptr->TM_string[i]);\
- }\
- temp_tm_ptr = temp_tm_ptr->next_TM;\
- }\
- /*snd_tm.head_pointer(tm_ptr_head);*/\
-}
-
#define delete_all_tm(tm_ptr_head){\
/*DELETE THE TM AFTER USE*/\
Base_tm *temp_tm_ptr = tm_ptr_head;\
@@ -445,7 +427,7 @@
// CDMS TEAM CODE START
inline Base_tm* FCTN_CDMS_RLY_TMTC(Base_tc *tc_ptr){
uint8_t ACKCODE = 0x00;
- printf("\rTC execution in progress\r\n");
+ //gPC.printf("\rTC execution in progress\r\n");
Base_tm *tm_pointer = new Long_tm;
Base_tm *tm_ptr = tm_pointer;
received = 0;
@@ -453,17 +435,17 @@
{
case 1: //apid=01 implies it corresponds to bae
{
- printf("Telecommand is for BAE\r\n");
- printf("Sending TC to BAE...\r\n"); //interrupt to be sent to the bae
+ //gPC.printf("Telecommand is for BAE\r\n");
+ //gPC.printf("Sending TC to BAE...\r\n"); //interrupt to be sent to the bae
FCTN_I2C_WRITE((char*)tc_ptr->TC_string);
while(1)
{
wait(1); //TimeOut instead of wait
if(tm_status_4m_slv == 1)
{
- printf("receiving...\r\n");
+ //gPC.printf("receiving...\r\n");
FCTN_I2C_READ((char*)tm_pointer->TM_string);
- //printf("%s", tm_pointer->TM_string);
+ //gPC.printf("%s", tm_pointer->TM_string);
received+=1;
tm_pointer = tm_pointer->next_TM;
break; //only for testing purpose
@@ -475,11 +457,11 @@
}
if(received >= 1 )
{
- printf("Telemetry is received from BAE\r\n");
+ //gPC.printf("Telemetry is received from BAE\r\n");
Base_tm *tm_print = tm_ptr;
for(uint8_t i=0;i<received;i++)
{
- printf("%s", tm_print->TM_string);
+ //gPC.printf("%s", tm_print->TM_string);
tm_print = tm_print->next_TM; //for check
}
received = 0;
@@ -487,7 +469,7 @@
}
else
{
- printf("Telemetry is not received from BAE\r\n");
+ //gPC.printf("Telemetry is not received from BAE\r\n");
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -507,17 +489,17 @@
}
case 2:
{
- printf("Telecommand is for CDMS\r\n"); //apid = 10 corresponds to cdms
+ //gPC.printf("Telecommand is for CDMS\r\n"); //apid = 10 corresponds to cdms
switch(GETservice_type(tc_ptr))
{
case 0x60:
{
- printf("service:MMS\r\n");
+ //gPC.printf("service:MMS\r\n");
switch(GETservice_subtype(tc_ptr))
{
case 0x1:
{
- printf("sub_service:Read from RAM_Memory\r\n");
+ //gPC.printf("sub_service:Read from RAM_Memory\r\n");
mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]);
Data[0] = FCTN_CDMS_RD_FLASH(0);
@@ -541,7 +523,7 @@
}
case 0x2:
{
- printf("sub_service:Read from Flash_Memory\r\n");
+ //gPC.printf("sub_service:Read from Flash_Memory\r\n");
mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]);
Data[0] = FCTN_CDMS_RD_FLASH(0);
@@ -565,7 +547,7 @@
}
case 0x5:
{
- printf("WRITE ON FLASH_MEMORY\r\n");
+ //gPC.printf("WRITE ON FLASH_MEMORY\r\n");
mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]);
block = (((uint32_t)(tc_ptr->TC_string[5])<<24)|((uint32_t)(tc_ptr->TC_string[5])<<16)|((uint32_t)(tc_ptr->TC_string[5])<<8)|((uint32_t)(tc_ptr->TC_string[5])));
FCTN_CDMS_WR_FLASH(mid,block);
@@ -587,7 +569,7 @@
}
default:
{
- printf("INVALID TC\r\n"); //Send Invalid TC Telemetry
+ //gPC.printf("INVALID TC\r\n"); //Send Invalid TC Telemetry
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -608,12 +590,12 @@
}
case 0x8:
{
- printf("service:FUNCTION MANAGEMENT SERVICE\r\n");
+ //gPC.printf("service:FUNCTION MANAGEMENT SERVICE\r\n");
if(GETservice_subtype(tc_ptr)==0x1)
{
if(GETpid(tc_ptr)==0x01)
{
- printf("TC_PL_INIT\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_PL_INIT\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -630,7 +612,7 @@
}
else if(GETpid(tc_ptr)==0x02)
{
- printf("TC_PL_MAIN\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_PL_MAIN\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -647,7 +629,7 @@
}
else if(GETpid(tc_ptr)==0x03)
{
- printf("TC_COM_INIT\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_COM_INIT\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -664,7 +646,7 @@
}
else if(GETpid(tc_ptr)==0x04)
{
- printf("TC_CDMS_HK_MAIN\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_CDMS_HK_MAIN\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -681,7 +663,7 @@
}
else if(GETpid(tc_ptr)==0x11)
{
- printf("TC_SW_ON_SD\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_SW_ON_SD\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -698,7 +680,7 @@
}
else if(GETpid(tc_ptr)==0x12)
{
- printf("TC_SW_ON_RTC\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_SW_ON_RTC\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -715,7 +697,7 @@
}
else if(GETpid(tc_ptr)==0x13)
{
- printf("TC_SW_ON_BAE\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_SW_ON_BAE\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -732,7 +714,7 @@
}
else if(GETpid(tc_ptr)==0x14)
{
- printf("TC_SW_ON_PL_DL\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_SW_ON_PL_DL\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -749,7 +731,7 @@
}
else if(GETpid(tc_ptr)==0x15)
{
- printf("TC_SW_ON_PL_AG_HV\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_SW_ON_PL_AG_HV\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -766,7 +748,7 @@
}
else if(GETpid(tc_ptr)==0x16)
{
- printf("TC_SW_ON_V_A_EN\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_SW_ON_V_A_EN\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -783,7 +765,7 @@
}
else if(GETpid(tc_ptr)==0x21)
{
- printf("TC_SW_OFF_SD\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_SW_OFF_SD\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -800,7 +782,7 @@
}
else if(GETpid(tc_ptr)==0x22)
{
- printf("TC_SW_OFF_RTC\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_SW_OFF_RTC\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -817,7 +799,7 @@
}
else if(GETpid(tc_ptr)==0x23)
{
- printf("TC_SW_OFF_BAE\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_SW_OFF_BAE\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -834,7 +816,7 @@
}
else if(GETpid(tc_ptr)==0x24)
{
- printf("TC_SW_OFF_PL_DL\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_SW_OFF_PL_DL\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -851,7 +833,7 @@
}
else if(GETpid(tc_ptr)==0x25)
{
- printf("TC_SW_OFF_PL_AG_HV\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_SW_OFF_PL_AG_HV\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -868,7 +850,7 @@
}
else if(GETpid(tc_ptr)==0x26)
{
- printf("TC_SW_OFF_V_A_EN\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_SW_OFF_V_A_EN\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -885,7 +867,7 @@
}
else if(GETpid(tc_ptr)==0x31)
{
- printf("TC_RST_SD\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_RST_SD\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -902,7 +884,7 @@
}
else if(GETpid(tc_ptr)==0x32)
{
- printf("TC_RST_RTC\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_RST_RTC\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -919,7 +901,7 @@
}
else if(GETpid(tc_ptr)==0x33)
{
- printf("TC_RST_BAE\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_RST_BAE\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -936,7 +918,7 @@
}
else if(GETpid(tc_ptr)==0x34)
{
- printf("TC_RST_PL_DL\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("TC_RST_PL_DL\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -954,7 +936,7 @@
}
else if(GETpid(tc_ptr)==0xC1)
{
- printf("RESET_HK_COUNTER\r\n"); // call PWR_SWCH_ON function
+ //gPC.printf("RESET_HK_COUNTER\r\n"); // call PWR_SWCH_ON function
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -971,7 +953,7 @@
}
else if(GETpid(tc_ptr)==0xF1)
{
- printf("RD_RTC\r\n"); //call RD_RTC
+ //gPC.printf("RD_RTC\r\n"); //call RD_RTC
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xD0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -992,7 +974,7 @@
}
else
{
- printf("INVALID TC\r\n");
+ //gPC.printf("INVALID TC\r\n");
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -1014,7 +996,7 @@
}
default:
{
- printf("INVALID TC"); //send invalid TC TM
+ //gPC.printf("INVALID TC"); //send invalid TC TM
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -1035,10 +1017,10 @@
}
case 3:
{
- printf("Telecommand is for PL\r\n");
- // printf("Informing PL about TC using I2C\r\n"); //interrupt to be sent to the bae
+ //gPC.printf("Telecommand is for PL\r\n");
+ // gPC.printf("Informing PL about TC using I2C\r\n"); //interrupt to be sent to the bae
// FCTN_I2C_WRITE((char*)tc_ptr->TC_string);
- // printf("sent the Telecommand to BAE\r\n"); //packet along with crc will be sent when bae is ready
+ // //gPC.printf("sent the Telecommand to BAE\r\n"); //packet along with crc will be sent when bae is ready
// wait(1); //wait time is to be optimised
// if(tm_status_4m_slv == 1)
// {
@@ -1047,15 +1029,15 @@
// }
// if(received == 1 )
// {
- // printf("Telemetry is received from BAE\r\n");
- // printf("%s", tm_ptr->TM_string);
+ // //gPC.printf("Telemetry is received from BAE\r\n");
+ // //gPC.printf("%s", tm_ptr->TM_string);
// received = 0;
// } // similar to BAE functions
break;
}
default: //invalid TC
{
- printf("INVALID TC\r\n");
+ //gPC.printf("INVALID TC\r\n");
//tm_pointer = new Short_tm;
tm_pointer->TM_string[0] = 0xB0;
tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
@@ -1275,8 +1257,8 @@
}\
}\
if( obosc_executed_count != 0 ){\
- print_all_tm(obosc_tm_head);\
- /*adf_not_SDcard();*/\
+ snd_tm.head_pointer(obosc_tm_head);\
+ adf_not_SDcard;\
}\
delete_all_tm(obosc_tm_head);\
if ( reset_flag == 1 ){\
@@ -1306,7 +1288,9 @@
get_call_sign(tm_ptr_head);\
Base_tm *tm_ptr = tm_ptr_head;\
get_ack_l1(tm_ptr->next_TM);\
- print_all_tm(tm_ptr_head);\
+ /*Send only call sign, ACK_L1*/\
+ snd_tm.head_pointer(tm_ptr_head);\
+ adf_not_SDcard;\
delete_all_tm(tm_ptr_head);\
}\
break;\
@@ -1318,7 +1302,9 @@
get_call_sign(tm_ptr_head);\
Base_tm *tm_ptr = tm_ptr_head;\
get_ack_l1(tm_ptr->next_TM);\
- print_all_tm(tm_ptr_head);\
+ /*Send only call sign, ACK_L1*/\
+ snd_tm.head_pointer(tm_ptr_head);\
+ adf_not_SDcard;\
delete_all_tm(tm_ptr_head);\
break;\
}\
@@ -1406,7 +1392,8 @@
if( tempPAhot == 0x00 ){\
gFLAGS = gFLAGS | COM_PA_HOT_FLAG;\
}\
- print_all_tm(tm_ptr_head);\
+ /*Send call sign, ACK_L1, NON OBSRS TM*/\
+ snd_tm.head_pointer(tm_ptr_head);\
adf_not_SDcard;\
delete_all_tm(tm_ptr_head);\
}\
@@ -1448,7 +1435,9 @@
if( tempPAhot == 0x00 ){\
gFLAGS = gFLAGS | COM_PA_HOT_FLAG;\
}\
- print_all_tm(tm_ptr_head);\
+ /*Send only call sign, ACK_L1, OBSRS TM*/\
+ snd_tm.head_pointer(tm_ptr_head);\
+ adf_not_SDcard;\
delete_all_tm(tm_ptr_head);\
}\
}\
