vr1.1

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of CDMS_RTOS_v1_1 by Team Fox

Committer:
cholletisaik777
Date:
Fri Jul 17 06:35:40 2015 +0000
Revision:
16:7428828a5da2
Parent:
14:cf9f12b6887d
COM INTEGRATION

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cholletisaik777 0:d6e3d1e21484 1 #include "mbed.h"
cholletisaik777 0:d6e3d1e21484 2 #include "TC.h"
cholletisaik777 8:607ae92fa6af 3 #include "all_funcs.h"
cholletisaik777 12:cb3ee1ac3638 4 #include "Flags.h"
cholletisaik777 0:d6e3d1e21484 5
cholletisaik777 0:d6e3d1e21484 6 Serial sc(USBTX,USBRX);
cholletisaik777 0:d6e3d1e21484 7
cholletisaik777 7:c270a9e37290 8 void FCTN_CDMS_RLY_TC()
cholletisaik777 0:d6e3d1e21484 9 {
cholletisaik777 12:cb3ee1ac3638 10 CDMS_TC_TM_FLAG=0x0000000000000000;
cholletisaik777 12:cb3ee1ac3638 11 CDMS_TC_TM_FLAG|=CDMS_TC_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 12
cholletisaik777 8:607ae92fa6af 13 sc.printf("\rin FCTN_CDMS_RLY_TC\r\n");
cholletisaik777 0:d6e3d1e21484 14 uint8_t read;
cholletisaik777 0:d6e3d1e21484 15 sc.scanf("%d",&read); //Packet sequence count
cholletisaik777 0:d6e3d1e21484 16 pac_seq_cnt = read;
cholletisaik777 0:d6e3d1e21484 17 sc.scanf("%d",&read); //Data[0] contains APID,LFB,long_or_short,AoN,Spr and Ack
cholletisaik777 0:d6e3d1e21484 18 apid_size = read;
cholletisaik777 0:d6e3d1e21484 19 apid=(apid_size&0xC0)>>6; //apid is decoded
cholletisaik777 0:d6e3d1e21484 20 long_or_short=(apid_size&0x10)>>4; //size of tc is known
cholletisaik777 0:d6e3d1e21484 21 switch(apid)
cholletisaik777 0:d6e3d1e21484 22 {
cholletisaik777 0:d6e3d1e21484 23 case 1: //apid=01 implies it corresponds to bae
cholletisaik777 0:d6e3d1e21484 24 {
cholletisaik777 12:cb3ee1ac3638 25 CDMS_TC_TM_FLAG|= BAE_TC_STATUS;
cholletisaik777 1:f926f14a52d8 26 sc.printf("BAE\r\r\r\n");
cholletisaik777 0:d6e3d1e21484 27 uint8_t p_i2c_bae[long_or_short*124+11];
cholletisaik777 0:d6e3d1e21484 28 p_i2c_bae[0]=pac_seq_cnt;
cholletisaik777 0:d6e3d1e21484 29 p_i2c_bae[1]=apid_size;
cholletisaik777 0:d6e3d1e21484 30 sc.scanf("%d",&read); //services contains service_type and sub_service_type
cholletisaik777 0:d6e3d1e21484 31 p_i2c_bae[2] = read;
cholletisaik777 0:d6e3d1e21484 32 for(int i=3;i<(long_or_short*124+11);i++){
cholletisaik777 0:d6e3d1e21484 33 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 34 p_i2c_bae[i] = read;
cholletisaik777 0:d6e3d1e21484 35 }
cholletisaik777 12:cb3ee1ac3638 36 sc.printf("informing BAE about TC using I2C\r\r\n");
cholletisaik777 12:cb3ee1ac3638 37 CDMS_TC_TM_FLAG|= TC_I2C_BAE_STATUS;
cholletisaik777 12:cb3ee1ac3638 38 int I2C_BAE; //interrupt to be sent to the bae
cholletisaik777 1:f926f14a52d8 39 if(long_or_short==0)
cholletisaik777 12:cb3ee1ac3638 40 I2C_BAE = FCTN_MASTER_I2C('s', (char *)p_i2c_bae);
cholletisaik777 1:f926f14a52d8 41 else if(long_or_short==1)
cholletisaik777 12:cb3ee1ac3638 42 I2C_BAE = FCTN_MASTER_I2C('l', (char *)p_i2c_bae);
cholletisaik777 1:f926f14a52d8 43 else
cholletisaik777 1:f926f14a52d8 44 sc.printf("long_or_short invalid\r\r\n");
cholletisaik777 1:f926f14a52d8 45 sc.printf("send the packet + CRC to the BAE after receving i2c signal from BAE\r\r\n"); //packet along with crc will be sent when bae is ready
cholletisaik777 12:cb3ee1ac3638 46 if(I2C_BAE!=0)
cholletisaik777 12:cb3ee1ac3638 47 CDMS_TC_TM_FLAG|= TC_BAE_I2C_ERR ;
cholletisaik777 12:cb3ee1ac3638 48 CDMS_TC_TM_FLAG &= ~(TC_I2C_BAE_STATUS);
cholletisaik777 12:cb3ee1ac3638 49 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 12:cb3ee1ac3638 50
cholletisaik777 12:cb3ee1ac3638 51
cholletisaik777 12:cb3ee1ac3638 52
cholletisaik777 0:d6e3d1e21484 53 break;
cholletisaik777 0:d6e3d1e21484 54 }
cholletisaik777 0:d6e3d1e21484 55 case 3:
cholletisaik777 0:d6e3d1e21484 56 {
cholletisaik777 12:cb3ee1ac3638 57 CDMS_TC_TM_FLAG|= PL_TC_STATUS;
cholletisaik777 1:f926f14a52d8 58 sc.printf("SPEED\r\r\n"); //speed corresponds to apid = 11
cholletisaik777 0:d6e3d1e21484 59 uint8_t p_i2c_speed[long_or_short*124+11];
cholletisaik777 0:d6e3d1e21484 60 p_i2c_speed[0]=pac_seq_cnt;
cholletisaik777 0:d6e3d1e21484 61 p_i2c_speed[1]=apid_size;
cholletisaik777 0:d6e3d1e21484 62 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 63 p_i2c_speed[2] = read; //services contains service_type and sub_service_type
cholletisaik777 0:d6e3d1e21484 64 for(int i=3;i<(long_or_short*124+11);i++){
cholletisaik777 0:d6e3d1e21484 65 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 66 p_i2c_speed[i] = read;
cholletisaik777 0:d6e3d1e21484 67 }
cholletisaik777 12:cb3ee1ac3638 68 CDMS_TC_TM_FLAG|= TC_I2C_PL_STATUS;
cholletisaik777 1:f926f14a52d8 69 sc.printf("inform PL about TC using I2C\r\r\n");
cholletisaik777 1:f926f14a52d8 70 sc.printf("send the packet + CRC to the PL after receving i2c signal from PL\r\r\n");
cholletisaik777 12:cb3ee1ac3638 71 //Check err in I2C
cholletisaik777 12:cb3ee1ac3638 72 //if ERROR CDMS_TC_TM_FLAG|= TC_PL_I2C_ERR ;
cholletisaik777 12:cb3ee1ac3638 73 CDMS_TC_TM_FLAG &= ~(TC_I2C_PL_STATUS);
cholletisaik777 12:cb3ee1ac3638 74 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 12:cb3ee1ac3638 75
cholletisaik777 0:d6e3d1e21484 76 break;
cholletisaik777 0:d6e3d1e21484 77 }
cholletisaik777 0:d6e3d1e21484 78 case 2:
cholletisaik777 0:d6e3d1e21484 79 {
cholletisaik777 12:cb3ee1ac3638 80 CDMS_TC_TM_FLAG|= PL_TC_STATUS;
cholletisaik777 1:f926f14a52d8 81 sc.printf("CDMS\r\r\n"); //apid = 10 corresponds to cdms
cholletisaik777 0:d6e3d1e21484 82 uint8_t services,appdata[long_or_short*124+6],crc[2];
cholletisaik777 0:d6e3d1e21484 83 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 84 services = read; //services contains service_type and sub_service_type
cholletisaik777 0:d6e3d1e21484 85 for(int i=3;i<(long_or_short*124+6);i++){
cholletisaik777 0:d6e3d1e21484 86 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 87 appdata[i-3] = read;
cholletisaik777 0:d6e3d1e21484 88 }
cholletisaik777 0:d6e3d1e21484 89 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 90 crc[0] = read;
cholletisaik777 0:d6e3d1e21484 91 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 92 crc[1] = read;
cholletisaik777 0:d6e3d1e21484 93 service_type=(services&0xF0)>>4;
cholletisaik777 0:d6e3d1e21484 94 sub_service_type=(services&0x0F);
cholletisaik777 0:d6e3d1e21484 95 switch(service_type){
cholletisaik777 0:d6e3d1e21484 96 case 6:
cholletisaik777 0:d6e3d1e21484 97 {
cholletisaik777 1:f926f14a52d8 98 sc.printf("memory management syservice_typeem\r\r\n");
cholletisaik777 0:d6e3d1e21484 99 switch(sub_service_type){
cholletisaik777 0:d6e3d1e21484 100 case 1:
cholletisaik777 0:d6e3d1e21484 101 {
cholletisaik777 1:f926f14a52d8 102 sc.printf("READ FROM MEMORY\r\r\n");
cholletisaik777 12:cb3ee1ac3638 103 if(appdata[0]==2){ //appdata[0] is pid
cholletisaik777 12:cb3ee1ac3638 104 sc.printf("RD_L_FLASH1\r\r\n"); //tm is lmb
cholletisaik777 12:cb3ee1ac3638 105 //P_CDMS_RD_FLASH
cholletisaik777 12:cb3ee1ac3638 106
cholletisaik777 12:cb3ee1ac3638 107 for(int i=0;i<128;i++){
cholletisaik777 12:cb3ee1ac3638 108 telemetry_type1[i]=long_memory_block_tm[i-1];
cholletisaik777 12:cb3ee1ac3638 109 }
cholletisaik777 12:cb3ee1ac3638 110 for(int i=128;i<130;i++){
cholletisaik777 12:cb3ee1ac3638 111 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 12:cb3ee1ac3638 112 }
cholletisaik777 12:cb3ee1ac3638 113
cholletisaik777 12:cb3ee1ac3638 114 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 115 //Send IM
cholletisaik777 12:cb3ee1ac3638 116 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 117 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 12:cb3ee1ac3638 118
cholletisaik777 0:d6e3d1e21484 119 }
cholletisaik777 12:cb3ee1ac3638 120 else if ((appdata[0]&0xF0)==0x10){
cholletisaik777 12:cb3ee1ac3638 121 sc.printf("RD_L_FLASH2\r\r\n"); //tm is lmb
cholletisaik777 0:d6e3d1e21484 122 //P_CDMS_RD_FLASH
cholletisaik777 0:d6e3d1e21484 123
cholletisaik777 12:cb3ee1ac3638 124 for(int i=0;i<128;i++){
cholletisaik777 12:cb3ee1ac3638 125 telemetry_type1[i]=long_memory_block_tm[i-1];
cholletisaik777 12:cb3ee1ac3638 126 }
cholletisaik777 12:cb3ee1ac3638 127 for(int i=128;i<130;i++){
cholletisaik777 12:cb3ee1ac3638 128 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 12:cb3ee1ac3638 129 }
cholletisaik777 12:cb3ee1ac3638 130
cholletisaik777 12:cb3ee1ac3638 131
cholletisaik777 12:cb3ee1ac3638 132 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 133 //Send IM
cholletisaik777 12:cb3ee1ac3638 134 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 135 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 12:cb3ee1ac3638 136 }
cholletisaik777 12:cb3ee1ac3638 137 else if (appdata[0]==0x22){
cholletisaik777 12:cb3ee1ac3638 138 sc.printf("RD_S_FLASH1\r\r\n"); //tm is smb
cholletisaik777 12:cb3ee1ac3638 139 //P_CDMS_RD_FLASH
cholletisaik777 12:cb3ee1ac3638 140
cholletisaik777 12:cb3ee1ac3638 141 telemetry_type2[0]=tmid3_spr_tm;
cholletisaik777 12:cb3ee1ac3638 142 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 12:cb3ee1ac3638 143 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 12:cb3ee1ac3638 144 for(int i=4;i<11;i++){
cholletisaik777 12:cb3ee1ac3638 145 telemetry_type2[i]=small_memory_block_tm[i-4];
cholletisaik777 0:d6e3d1e21484 146 }
cholletisaik777 12:cb3ee1ac3638 147 for(int i=11;i<13;i++){
cholletisaik777 12:cb3ee1ac3638 148 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 149 }
cholletisaik777 12:cb3ee1ac3638 150
cholletisaik777 12:cb3ee1ac3638 151
cholletisaik777 12:cb3ee1ac3638 152 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 153 //Send IM
cholletisaik777 12:cb3ee1ac3638 154 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 155 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 12:cb3ee1ac3638 156 }
cholletisaik777 12:cb3ee1ac3638 157 else if ((appdata[0]&0xF0)==0x30){
cholletisaik777 1:f926f14a52d8 158 sc.printf("RD_S_FLASH2\r\r\n"); //tm is smb
cholletisaik777 0:d6e3d1e21484 159 //P_CDMS_RD_FLASH
cholletisaik777 0:d6e3d1e21484 160
cholletisaik777 0:d6e3d1e21484 161 telemetry_type2[0]=tmid3_spr_tm;
cholletisaik777 0:d6e3d1e21484 162 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 163 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 164 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 165 telemetry_type2[i]=small_memory_block_tm[i-3];
cholletisaik777 0:d6e3d1e21484 166 }
cholletisaik777 0:d6e3d1e21484 167 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 168 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 169 }
cholletisaik777 12:cb3ee1ac3638 170
cholletisaik777 12:cb3ee1ac3638 171
cholletisaik777 12:cb3ee1ac3638 172 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 173 //Send IM
cholletisaik777 12:cb3ee1ac3638 174 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 175 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 176 }
cholletisaik777 0:d6e3d1e21484 177 else if (appdata[0]==0x42){
cholletisaik777 1:f926f14a52d8 178 sc.printf("RD_L_RAM1\r\r\n"); //tm is lmb
cholletisaik777 0:d6e3d1e21484 179 //P_CDMS_RD_RAM
cholletisaik777 0:d6e3d1e21484 180
cholletisaik777 0:d6e3d1e21484 181 for(int i=0;i<128;i++){
cholletisaik777 0:d6e3d1e21484 182 telemetry_type1[i]=long_memory_block_tm[i-1];
cholletisaik777 0:d6e3d1e21484 183 }
cholletisaik777 0:d6e3d1e21484 184 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 185 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 186 }
cholletisaik777 12:cb3ee1ac3638 187
cholletisaik777 12:cb3ee1ac3638 188
cholletisaik777 12:cb3ee1ac3638 189 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 190 //Send IM
cholletisaik777 12:cb3ee1ac3638 191 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 192 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 193 }
cholletisaik777 0:d6e3d1e21484 194 else if ((appdata[0]&0xF0)==0x50){
cholletisaik777 1:f926f14a52d8 195 sc.printf("RD_L_RAM2\r\r\n"); //tm is lmb
cholletisaik777 0:d6e3d1e21484 196 //P_CDMS_RD_RAM
cholletisaik777 0:d6e3d1e21484 197
cholletisaik777 0:d6e3d1e21484 198 for(int i=0;i<128;i++){
cholletisaik777 0:d6e3d1e21484 199 telemetry_type1[i]=long_memory_block_tm[i-1];
cholletisaik777 0:d6e3d1e21484 200 }
cholletisaik777 0:d6e3d1e21484 201 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 202 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 203 }
cholletisaik777 12:cb3ee1ac3638 204
cholletisaik777 12:cb3ee1ac3638 205
cholletisaik777 12:cb3ee1ac3638 206 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 207 //Send IM
cholletisaik777 12:cb3ee1ac3638 208 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 209 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 210 }
cholletisaik777 0:d6e3d1e21484 211 else if (appdata[0]==0x62){
cholletisaik777 1:f926f14a52d8 212 sc.printf("RD_S_RAM\r\r\n"); //tm is smb
cholletisaik777 0:d6e3d1e21484 213 //P_CDMS_RD_RAM
cholletisaik777 0:d6e3d1e21484 214
cholletisaik777 0:d6e3d1e21484 215 telemetry_type2[0]=tmid3_spr_tm;
cholletisaik777 0:d6e3d1e21484 216 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 217 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 218 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 219 telemetry_type2[i]=small_memory_block_tm[i-3];
cholletisaik777 0:d6e3d1e21484 220 }
cholletisaik777 0:d6e3d1e21484 221 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 222 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 223 }
cholletisaik777 12:cb3ee1ac3638 224
cholletisaik777 12:cb3ee1ac3638 225
cholletisaik777 12:cb3ee1ac3638 226 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 227 //Send IM
cholletisaik777 12:cb3ee1ac3638 228 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 229 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 230 }
cholletisaik777 0:d6e3d1e21484 231 else if ((appdata[0]&0xF0)==0x70){
cholletisaik777 1:f926f14a52d8 232 sc.printf("RD_S_RAM2\r\r\n"); //tm is smb
cholletisaik777 0:d6e3d1e21484 233 //P_CDMS_RD_RAM
cholletisaik777 0:d6e3d1e21484 234
cholletisaik777 0:d6e3d1e21484 235 telemetry_type2[0]=tmid3_spr_tm;
cholletisaik777 0:d6e3d1e21484 236 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 237 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 238 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 239 telemetry_type2[i]=small_memory_block_tm[i-3];
cholletisaik777 0:d6e3d1e21484 240 }
cholletisaik777 0:d6e3d1e21484 241 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 242 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 243 }
cholletisaik777 12:cb3ee1ac3638 244
cholletisaik777 12:cb3ee1ac3638 245
cholletisaik777 12:cb3ee1ac3638 246 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 247 //Send IM
cholletisaik777 12:cb3ee1ac3638 248 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 249 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 250 }
cholletisaik777 0:d6e3d1e21484 251 else {
cholletisaik777 0:d6e3d1e21484 252 sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 253 //Send Invalid TC Telemetry
cholletisaik777 12:cb3ee1ac3638 254
cholletisaik777 12:cb3ee1ac3638 255 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 256 //Send IM
cholletisaik777 12:cb3ee1ac3638 257 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 258 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 259 }
cholletisaik777 0:d6e3d1e21484 260 break;
cholletisaik777 0:d6e3d1e21484 261 }
cholletisaik777 0:d6e3d1e21484 262 case 5:
cholletisaik777 0:d6e3d1e21484 263 {
cholletisaik777 1:f926f14a52d8 264 sc.printf("WRITE ON MEMORY\r\r\n");
cholletisaik777 0:d6e3d1e21484 265 switch(appdata[0]){
cholletisaik777 1:f926f14a52d8 266 case 0:sc.printf("WR_S_FLASH\r\r\n");
cholletisaik777 0:d6e3d1e21484 267 //P_CDMS_WR_FLASH
cholletisaik777 0:d6e3d1e21484 268 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 269 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 270 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 271 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 272 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 273 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 274 }
cholletisaik777 12:cb3ee1ac3638 275
cholletisaik777 12:cb3ee1ac3638 276 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 277 //Send IM
cholletisaik777 12:cb3ee1ac3638 278 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 279 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 280
cholletisaik777 0:d6e3d1e21484 281 break;
cholletisaik777 1:f926f14a52d8 282 case 1:sc.printf("WR_S_RAM\r\r\n");
cholletisaik777 0:d6e3d1e21484 283 //P_CDMS_WR_RAM
cholletisaik777 0:d6e3d1e21484 284 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 285 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 286 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 287 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 288 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 289 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 290 }
cholletisaik777 0:d6e3d1e21484 291
cholletisaik777 0:d6e3d1e21484 292 break;
cholletisaik777 1:f926f14a52d8 293 case 16:sc.printf("WR_L_FLASH\r\r\n");
cholletisaik777 0:d6e3d1e21484 294 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 295 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 296 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 297 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 298 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 299 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 300 }
cholletisaik777 12:cb3ee1ac3638 301
cholletisaik777 12:cb3ee1ac3638 302 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 303 //Send IM
cholletisaik777 12:cb3ee1ac3638 304 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 305 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 306 //P_CDMS_WR_FLASH
cholletisaik777 0:d6e3d1e21484 307
cholletisaik777 0:d6e3d1e21484 308 break;
cholletisaik777 1:f926f14a52d8 309 case 17:sc.printf("WR_L_RAM\r\r\n");
cholletisaik777 0:d6e3d1e21484 310 //P_CDMS_WR_RAM
cholletisaik777 0:d6e3d1e21484 311 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 312 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 313 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 314 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 315 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 316 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 317 }
cholletisaik777 12:cb3ee1ac3638 318
cholletisaik777 12:cb3ee1ac3638 319 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 320 //Send IM
cholletisaik777 12:cb3ee1ac3638 321 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 322 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 323
cholletisaik777 0:d6e3d1e21484 324 break;
cholletisaik777 0:d6e3d1e21484 325 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 326 //send invalid TC TM
cholletisaik777 12:cb3ee1ac3638 327
cholletisaik777 12:cb3ee1ac3638 328 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 329 //Send IM
cholletisaik777 12:cb3ee1ac3638 330 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 331 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 332 break;}
cholletisaik777 0:d6e3d1e21484 333 }
cholletisaik777 0:d6e3d1e21484 334 break;
cholletisaik777 0:d6e3d1e21484 335 }
cholletisaik777 0:d6e3d1e21484 336 case 6:
cholletisaik777 0:d6e3d1e21484 337 {
cholletisaik777 1:f926f14a52d8 338 sc.printf("WRITE FROM ONE MEMORY TO ANOTHER\r\r\n");
cholletisaik777 0:d6e3d1e21484 339 switch(appdata[0]){
cholletisaik777 1:f926f14a52d8 340 case 0:sc.printf("WR_S_FLASH\r\r\n");
cholletisaik777 0:d6e3d1e21484 341 //P_CDMS_WR_FLASH
cholletisaik777 0:d6e3d1e21484 342 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 343 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 344 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 345 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 346 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 347 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 348 }
cholletisaik777 12:cb3ee1ac3638 349
cholletisaik777 12:cb3ee1ac3638 350 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 351 //Send IM
cholletisaik777 12:cb3ee1ac3638 352 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 353 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 354 break;
cholletisaik777 1:f926f14a52d8 355 case 1:sc.printf("WR_S_RAM\r\r\n");
cholletisaik777 0:d6e3d1e21484 356 //P_CDMS_WR_RAM
cholletisaik777 0:d6e3d1e21484 357 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 358 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 359 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 360 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 361 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 362 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 363 }
cholletisaik777 12:cb3ee1ac3638 364
cholletisaik777 12:cb3ee1ac3638 365 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 366 //Send IM
cholletisaik777 12:cb3ee1ac3638 367 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 368 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 369 break;
cholletisaik777 1:f926f14a52d8 370 case 16:sc.printf("WR_L_FLASH\r\r\n");
cholletisaik777 0:d6e3d1e21484 371 //P_CDMS_WR_FLASH
cholletisaik777 0:d6e3d1e21484 372 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 373 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 374 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 375 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 376 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 377 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 378 }
cholletisaik777 12:cb3ee1ac3638 379
cholletisaik777 12:cb3ee1ac3638 380 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 381 //Send IM
cholletisaik777 12:cb3ee1ac3638 382 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 383 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 384 break;
cholletisaik777 1:f926f14a52d8 385 case 17:sc.printf("WR_L_RAM\r\r\n");
cholletisaik777 0:d6e3d1e21484 386 //P_CDMS_WR_RAM
cholletisaik777 0:d6e3d1e21484 387 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 388 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 389 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 390 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 391 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 392 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 393 }
cholletisaik777 12:cb3ee1ac3638 394
cholletisaik777 12:cb3ee1ac3638 395 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 396 //Send IM
cholletisaik777 12:cb3ee1ac3638 397 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 398 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 399 break;
cholletisaik777 0:d6e3d1e21484 400 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 401 //send invalid TC TM
cholletisaik777 12:cb3ee1ac3638 402
cholletisaik777 12:cb3ee1ac3638 403 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 404 //Send IM
cholletisaik777 12:cb3ee1ac3638 405 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 406 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 407 break;}
cholletisaik777 0:d6e3d1e21484 408 }
cholletisaik777 0:d6e3d1e21484 409 break;
cholletisaik777 0:d6e3d1e21484 410 }
cholletisaik777 0:d6e3d1e21484 411 case 9:
cholletisaik777 0:d6e3d1e21484 412 {
cholletisaik777 1:f926f14a52d8 413 sc.printf("SEND CRC OF FLASH MEMORY\r\r\n");
cholletisaik777 0:d6e3d1e21484 414 if(appdata[0]==2){
cholletisaik777 1:f926f14a52d8 415 sc.printf("GET_FLASH_CRC\r\r\n"); //tm is crc_flash
cholletisaik777 0:d6e3d1e21484 416 //P_CDMS_GET_FLASH_CRC
cholletisaik777 0:d6e3d1e21484 417
cholletisaik777 0:d6e3d1e21484 418 for(int i=0;i<2;i++){
cholletisaik777 0:d6e3d1e21484 419 telemetry_type1[i]=crc1_tm[i];
cholletisaik777 0:d6e3d1e21484 420 }
cholletisaik777 0:d6e3d1e21484 421 for(int i=2;i<4;i++){
cholletisaik777 0:d6e3d1e21484 422 telemetry_type1[i]=crc2_tm[i-2];
cholletisaik777 0:d6e3d1e21484 423 }
cholletisaik777 0:d6e3d1e21484 424 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 425 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 426 }
cholletisaik777 12:cb3ee1ac3638 427
cholletisaik777 12:cb3ee1ac3638 428 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 429 //Send IM
cholletisaik777 12:cb3ee1ac3638 430 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 431 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 432 }
cholletisaik777 0:d6e3d1e21484 433 else {
cholletisaik777 0:d6e3d1e21484 434 sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 435 //Send Invalid TC Telemetry
cholletisaik777 12:cb3ee1ac3638 436
cholletisaik777 12:cb3ee1ac3638 437 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 438 //Send IM
cholletisaik777 12:cb3ee1ac3638 439 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 440 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 441 }
cholletisaik777 0:d6e3d1e21484 442 break;
cholletisaik777 0:d6e3d1e21484 443 }
cholletisaik777 0:d6e3d1e21484 444 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 445 //send invalid TC TM
cholletisaik777 12:cb3ee1ac3638 446
cholletisaik777 12:cb3ee1ac3638 447 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 448 //Send IM
cholletisaik777 12:cb3ee1ac3638 449 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 450 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 451 break;}
cholletisaik777 0:d6e3d1e21484 452 }
cholletisaik777 0:d6e3d1e21484 453 break;
cholletisaik777 0:d6e3d1e21484 454 }
cholletisaik777 0:d6e3d1e21484 455 case 8:
cholletisaik777 0:d6e3d1e21484 456 {
cholletisaik777 7:c270a9e37290 457 sc.printf("FCTNTION MANAGEMENT SERVICE\r\r\n");
cholletisaik777 0:d6e3d1e21484 458 if(sub_service_type==1){
cholletisaik777 0:d6e3d1e21484 459 if((appdata[0]&0xF0)==0x00){
cholletisaik777 1:f926f14a52d8 460 sc.printf("RUN_PRCS\r\r\n");
cholletisaik777 0:d6e3d1e21484 461 switch(appdata[0]){
cholletisaik777 1:f926f14a52d8 462 case 1:sc.printf("P_PL_INIT\r\r\n");//tm is ack_l234
cholletisaik777 0:d6e3d1e21484 463 //P_PL_INIT
cholletisaik777 0:d6e3d1e21484 464 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 465 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 466 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 467 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 468 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 469 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 470 }
cholletisaik777 0:d6e3d1e21484 471 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 472 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 473 }
cholletisaik777 12:cb3ee1ac3638 474
cholletisaik777 12:cb3ee1ac3638 475 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 476 //Send IM
cholletisaik777 12:cb3ee1ac3638 477 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 478 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 479 break;
cholletisaik777 1:f926f14a52d8 480 case 2:sc.printf("P_PL_MNGR\r\r\n");//tm is ack_l234
cholletisaik777 0:d6e3d1e21484 481 //P_PL_MNGR
cholletisaik777 0:d6e3d1e21484 482 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 483 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 484 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 485 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 486 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 487 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 488 }
cholletisaik777 0:d6e3d1e21484 489 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 490 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 491 }
cholletisaik777 12:cb3ee1ac3638 492
cholletisaik777 12:cb3ee1ac3638 493 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 494 //Send IM
cholletisaik777 12:cb3ee1ac3638 495 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 496 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 497 break;
cholletisaik777 1:f926f14a52d8 498 case 3:sc.printf("P_COM_INIT\r\r\n");//tm is ack_l234
cholletisaik777 0:d6e3d1e21484 499 //P_COM_INIT
cholletisaik777 0:d6e3d1e21484 500 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 501 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 502 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 503 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 504 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 505 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 506 }
cholletisaik777 0:d6e3d1e21484 507 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 508 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 509 }
cholletisaik777 12:cb3ee1ac3638 510
cholletisaik777 12:cb3ee1ac3638 511 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 512 //Send IM
cholletisaik777 12:cb3ee1ac3638 513 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 514 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 515 break;
cholletisaik777 1:f926f14a52d8 516 case 4:sc.printf("P_CDMS_HK_MNGR\r\r\n");//tm is ack_l234
cholletisaik777 0:d6e3d1e21484 517 //P_CDMS_HK_MNGR
cholletisaik777 0:d6e3d1e21484 518 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 519 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 520 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 521 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 522 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 523 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 524 }
cholletisaik777 0:d6e3d1e21484 525 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 526 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 527 }
cholletisaik777 12:cb3ee1ac3638 528
cholletisaik777 12:cb3ee1ac3638 529 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 530 //Send IM
cholletisaik777 12:cb3ee1ac3638 531 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 532 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 533 break;
cholletisaik777 0:d6e3d1e21484 534 default:{sc.printf("INVALID TC");
cholletisaik777 12:cb3ee1ac3638 535
cholletisaik777 0:d6e3d1e21484 536 //send invalid TC TM
cholletisaik777 12:cb3ee1ac3638 537
cholletisaik777 12:cb3ee1ac3638 538 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 539 //Send IM
cholletisaik777 12:cb3ee1ac3638 540 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 541 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 542 break;}
cholletisaik777 0:d6e3d1e21484 543 }
cholletisaik777 0:d6e3d1e21484 544 }
cholletisaik777 0:d6e3d1e21484 545 else if((appdata[0]&0xF0)==0x10){
cholletisaik777 1:f926f14a52d8 546 sc.printf("PWR_SWCH\r\r\n");
cholletisaik777 0:d6e3d1e21484 547 //P_CDMS_SWCH_PWR
cholletisaik777 0:d6e3d1e21484 548
cholletisaik777 0:d6e3d1e21484 549 }
cholletisaik777 0:d6e3d1e21484 550 else if((appdata[0]&0xF0)==0x20){
cholletisaik777 1:f926f14a52d8 551 sc.printf("PWR_Rservice_type\r\r\n");
cholletisaik777 0:d6e3d1e21484 552 //P_CDMS_RST_PWR
cholletisaik777 0:d6e3d1e21484 553
cholletisaik777 0:d6e3d1e21484 554 }
cholletisaik777 0:d6e3d1e21484 555 else if((appdata[0]&0xF0)==0xE0){
cholletisaik777 1:f926f14a52d8 556 sc.printf("RD_RTC\r\n"); //tm is func_mngmt_service_tm
cholletisaik777 0:d6e3d1e21484 557 telemetry_type2[0]=tmid4_spr_tm;
cholletisaik777 0:d6e3d1e21484 558 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 559 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 5:c77b49508927 560 for(int i=11;i<13;i++)
cholletisaik777 5:c77b49508927 561 {
cholletisaik777 0:d6e3d1e21484 562 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 4:cc85cfaa2086 563 }
cholletisaik777 14:cf9f12b6887d 564 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 14:cf9f12b6887d 565 //Send IM
cholletisaik777 14:cf9f12b6887d 566 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 14:cf9f12b6887d 567 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 568 }
cholletisaik777 0:d6e3d1e21484 569 else if((appdata[0]&0xF0)==0xF0){
cholletisaik777 1:f926f14a52d8 570 sc.printf("SD_MNGR\r\r\n"); //tm is func_mngmt_service_tm
cholletisaik777 0:d6e3d1e21484 571 //P_CDMS_MNG_SD
cholletisaik777 0:d6e3d1e21484 572
cholletisaik777 0:d6e3d1e21484 573 telemetry_type2[0]=tmid4_spr_tm;
cholletisaik777 0:d6e3d1e21484 574 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 575 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 576 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 577 telemetry_type2[i]=func_mngmt_service_tm[i-3];
cholletisaik777 0:d6e3d1e21484 578 }
cholletisaik777 0:d6e3d1e21484 579 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 580 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 581 }
cholletisaik777 12:cb3ee1ac3638 582
cholletisaik777 12:cb3ee1ac3638 583
cholletisaik777 12:cb3ee1ac3638 584 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 585 //Send IM
cholletisaik777 12:cb3ee1ac3638 586 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 587 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 588 }
cholletisaik777 0:d6e3d1e21484 589 else {
cholletisaik777 0:d6e3d1e21484 590 sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 591 //Send Invalid TC Telemetry
cholletisaik777 12:cb3ee1ac3638 592
cholletisaik777 12:cb3ee1ac3638 593 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 594 //Send IM
cholletisaik777 12:cb3ee1ac3638 595 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 596 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 597 }
cholletisaik777 0:d6e3d1e21484 598 }
cholletisaik777 0:d6e3d1e21484 599 else {
cholletisaik777 0:d6e3d1e21484 600 sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 601 //Send Invalid TC Telemetry
cholletisaik777 12:cb3ee1ac3638 602
cholletisaik777 12:cb3ee1ac3638 603 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 604 //Send IM
cholletisaik777 12:cb3ee1ac3638 605 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 606 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 607 }
cholletisaik777 0:d6e3d1e21484 608 break;
cholletisaik777 0:d6e3d1e21484 609 }
cholletisaik777 0:d6e3d1e21484 610 case 7:
cholletisaik777 0:d6e3d1e21484 611 {
cholletisaik777 1:f926f14a52d8 612 sc.printf("PAYLOAD MANAGEMENT SERVICE\r\r\n"); //TM is ACKL234
cholletisaik777 0:d6e3d1e21484 613 switch(sub_service_type){
cholletisaik777 1:f926f14a52d8 614 case 1:sc.printf("INSERT PL SCHEDULE\r\r\n");
cholletisaik777 0:d6e3d1e21484 615 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 616 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 617 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 618 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 619 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 620 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 621 }
cholletisaik777 0:d6e3d1e21484 622 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 623 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 624 }
cholletisaik777 12:cb3ee1ac3638 625
cholletisaik777 12:cb3ee1ac3638 626 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 627 //Send IM
cholletisaik777 12:cb3ee1ac3638 628 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 629 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 630 break;
cholletisaik777 1:f926f14a52d8 631 case 2:sc.printf("DELETE PL SCHEDULE\r\r\n");
cholletisaik777 0:d6e3d1e21484 632 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 633 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 634 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 635 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 636 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 637 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 638 }
cholletisaik777 0:d6e3d1e21484 639 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 640 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 641 }
cholletisaik777 12:cb3ee1ac3638 642
cholletisaik777 12:cb3ee1ac3638 643 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 644 //Send IM
cholletisaik777 12:cb3ee1ac3638 645 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 646 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 647 break;
cholletisaik777 0:d6e3d1e21484 648 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 649 //send invalid TC TM
cholletisaik777 12:cb3ee1ac3638 650
cholletisaik777 12:cb3ee1ac3638 651 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 652 //Send IM
cholletisaik777 12:cb3ee1ac3638 653 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 654 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 655 break;}
cholletisaik777 0:d6e3d1e21484 656 }
cholletisaik777 0:d6e3d1e21484 657 break;
cholletisaik777 0:d6e3d1e21484 658 }
cholletisaik777 0:d6e3d1e21484 659 case 11:
cholletisaik777 0:d6e3d1e21484 660 {
cholletisaik777 1:f926f14a52d8 661 sc.printf("ONBOARD OPERATIONS SCHEDULING SERVICE\r\r\n");
cholletisaik777 0:d6e3d1e21484 662 switch(sub_service_type){
cholletisaik777 0:d6e3d1e21484 663 case 1:
cholletisaik777 0:d6e3d1e21484 664 {
cholletisaik777 1:f926f14a52d8 665 sc.printf("DISABLE RELEASE OF TCs\r\r\n"); //tm is ack_l1
cholletisaik777 0:d6e3d1e21484 666 telemetry_type2[0]=tmid1_spr_tm;
cholletisaik777 0:d6e3d1e21484 667 telemetry_type2[1]=tc_exec_tm;
cholletisaik777 0:d6e3d1e21484 668 telemetry_type2[2]=tc_service_typeatus_tm;
cholletisaik777 0:d6e3d1e21484 669 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 670 telemetry_type2[i]=pac_seq_cnt_of_tc_tm[i-3];
cholletisaik777 0:d6e3d1e21484 671 }
cholletisaik777 0:d6e3d1e21484 672 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 673 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 674 }
cholletisaik777 12:cb3ee1ac3638 675
cholletisaik777 12:cb3ee1ac3638 676
cholletisaik777 0:d6e3d1e21484 677 break;
cholletisaik777 0:d6e3d1e21484 678 }
cholletisaik777 0:d6e3d1e21484 679 case 2:
cholletisaik777 0:d6e3d1e21484 680 {
cholletisaik777 1:f926f14a52d8 681 sc.printf("ENABLE RELEASE OF TCs\r\r\n");
cholletisaik777 0:d6e3d1e21484 682 break;
cholletisaik777 0:d6e3d1e21484 683 }
cholletisaik777 0:d6e3d1e21484 684 case 5:
cholletisaik777 0:d6e3d1e21484 685 {
cholletisaik777 1:f926f14a52d8 686 sc.printf("DELETE TELECOMMANDS\r\r\n");
cholletisaik777 0:d6e3d1e21484 687 break;
cholletisaik777 0:d6e3d1e21484 688 }
cholletisaik777 0:d6e3d1e21484 689 case 6:
cholletisaik777 0:d6e3d1e21484 690 {
cholletisaik777 1:f926f14a52d8 691 sc.printf("REPORT TC LIST IN DETAILED FORM\r\r\n"); //tm is tc_liservice_type
cholletisaik777 0:d6e3d1e21484 692 for(int i=0;i<9;i++){
cholletisaik777 0:d6e3d1e21484 693 telemetry_type1[i]=tc_liservice_type_packet1_tm[i];
cholletisaik777 0:d6e3d1e21484 694 }
cholletisaik777 0:d6e3d1e21484 695 for(int i=9;i<18;i++){
cholletisaik777 0:d6e3d1e21484 696 telemetry_type1[i]=tc_liservice_type_packet2_tm[i-9];
cholletisaik777 0:d6e3d1e21484 697 }
cholletisaik777 0:d6e3d1e21484 698 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 699 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 700 }
cholletisaik777 0:d6e3d1e21484 701 break;
cholletisaik777 0:d6e3d1e21484 702 }
cholletisaik777 0:d6e3d1e21484 703 case 8:
cholletisaik777 0:d6e3d1e21484 704 {
cholletisaik777 1:f926f14a52d8 705 sc.printf("REPORT STATUS OF TC LIST\r\r\n"); //tm is ack_l1
cholletisaik777 0:d6e3d1e21484 706 telemetry_type2[0]=tmid1_spr_tm;
cholletisaik777 0:d6e3d1e21484 707 telemetry_type2[1]=tc_exec_tm;
cholletisaik777 0:d6e3d1e21484 708 telemetry_type2[2]=tc_service_typeatus_tm;
cholletisaik777 0:d6e3d1e21484 709 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 710 telemetry_type2[i]=pac_seq_cnt_of_tc_tm[i-3];
cholletisaik777 0:d6e3d1e21484 711 }
cholletisaik777 0:d6e3d1e21484 712 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 713 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 714 }
cholletisaik777 0:d6e3d1e21484 715 break;
cholletisaik777 0:d6e3d1e21484 716 }
cholletisaik777 0:d6e3d1e21484 717 case 15:
cholletisaik777 0:d6e3d1e21484 718 {
cholletisaik777 1:f926f14a52d8 719 sc.printf("REPORT STATUS OF LAST UNEXECUTED TC\r\r\n"); //tm is ack_l234
cholletisaik777 0:d6e3d1e21484 720 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 721 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 722 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 723 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 724 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 725 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 726 }
cholletisaik777 0:d6e3d1e21484 727 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 728 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 729 }
cholletisaik777 0:d6e3d1e21484 730 break;
cholletisaik777 0:d6e3d1e21484 731 }
cholletisaik777 0:d6e3d1e21484 732 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 733 //send invalid TC TM
cholletisaik777 0:d6e3d1e21484 734 break;}
cholletisaik777 0:d6e3d1e21484 735 }
cholletisaik777 0:d6e3d1e21484 736 break;
cholletisaik777 0:d6e3d1e21484 737 }
cholletisaik777 0:d6e3d1e21484 738 case 13:
cholletisaik777 0:d6e3d1e21484 739 {
cholletisaik777 1:f926f14a52d8 740 sc.printf("LARGE DATA TRANSFER\r\r\n"); //tm is ack_l234
cholletisaik777 0:d6e3d1e21484 741 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 742 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 743 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 744 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 745 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 746 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 747 }
cholletisaik777 0:d6e3d1e21484 748 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 749 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 750 }
cholletisaik777 0:d6e3d1e21484 751 break;
cholletisaik777 0:d6e3d1e21484 752 }
cholletisaik777 0:d6e3d1e21484 753 case 15:
cholletisaik777 0:d6e3d1e21484 754 {
cholletisaik777 1:f926f14a52d8 755 sc.printf("ONBOARD STORAGE AND RETRIEVAL SERVICE\r\r\n");
cholletisaik777 0:d6e3d1e21484 756 switch(sub_service_type){
cholletisaik777 0:d6e3d1e21484 757 case 0:
cholletisaik777 0:d6e3d1e21484 758 {
cholletisaik777 1:f926f14a52d8 759 sc.printf("SCF\r\r\n"); //tm is obsrs
cholletisaik777 0:d6e3d1e21484 760 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm;
cholletisaik777 0:d6e3d1e21484 761 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 762 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 763 }
cholletisaik777 0:d6e3d1e21484 764 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 765 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 766 }
cholletisaik777 0:d6e3d1e21484 767 break;
cholletisaik777 0:d6e3d1e21484 768 }
cholletisaik777 0:d6e3d1e21484 769 case 1:
cholletisaik777 0:d6e3d1e21484 770 {
cholletisaik777 1:f926f14a52d8 771 sc.printf("SFF-AT\r\r\n");
cholletisaik777 0:d6e3d1e21484 772 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm; //tm is obsrs
cholletisaik777 0:d6e3d1e21484 773 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 774 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 775 }
cholletisaik777 0:d6e3d1e21484 776 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 777 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 778 }
cholletisaik777 12:cb3ee1ac3638 779
cholletisaik777 12:cb3ee1ac3638 780 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 781 //Send IM
cholletisaik777 12:cb3ee1ac3638 782 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 783 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 784 break;
cholletisaik777 0:d6e3d1e21484 785 }
cholletisaik777 0:d6e3d1e21484 786 case 2:
cholletisaik777 0:d6e3d1e21484 787 {
cholletisaik777 1:f926f14a52d8 788 sc.printf("SFF-BT\r\r\n"); //tm is obsrs
cholletisaik777 0:d6e3d1e21484 789 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm;
cholletisaik777 0:d6e3d1e21484 790 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 791 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 792 }
cholletisaik777 0:d6e3d1e21484 793 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 794 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 795 }
cholletisaik777 12:cb3ee1ac3638 796
cholletisaik777 12:cb3ee1ac3638 797 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 798 //Send IM
cholletisaik777 12:cb3ee1ac3638 799 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 800 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 801 break;
cholletisaik777 0:d6e3d1e21484 802 }
cholletisaik777 0:d6e3d1e21484 803 case 3:
cholletisaik777 0:d6e3d1e21484 804 {
cholletisaik777 1:f926f14a52d8 805 sc.printf("LOG\r\r\n"); //tm is obsrs
cholletisaik777 0:d6e3d1e21484 806 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm;
cholletisaik777 0:d6e3d1e21484 807 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 808 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 809 }
cholletisaik777 0:d6e3d1e21484 810 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 811 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 812 }
cholletisaik777 12:cb3ee1ac3638 813
cholletisaik777 12:cb3ee1ac3638 814 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 815 //Send IM
cholletisaik777 12:cb3ee1ac3638 816 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 817 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 818 break;
cholletisaik777 0:d6e3d1e21484 819 }
cholletisaik777 0:d6e3d1e21484 820 case 4:
cholletisaik777 0:d6e3d1e21484 821 {
cholletisaik777 1:f926f14a52d8 822 sc.printf("HK_ARCHIVE\r\r\n"); //tm is obsrs
cholletisaik777 0:d6e3d1e21484 823 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm;
cholletisaik777 0:d6e3d1e21484 824 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 825 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 826 }
cholletisaik777 0:d6e3d1e21484 827 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 828 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 829 }
cholletisaik777 12:cb3ee1ac3638 830
cholletisaik777 12:cb3ee1ac3638 831 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 832 //Send IM
cholletisaik777 12:cb3ee1ac3638 833 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 834 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 835 break;
cholletisaik777 0:d6e3d1e21484 836 }
cholletisaik777 0:d6e3d1e21484 837 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 838 //send invalid TC TM
cholletisaik777 12:cb3ee1ac3638 839
cholletisaik777 12:cb3ee1ac3638 840 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 841 //Send IM
cholletisaik777 12:cb3ee1ac3638 842 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 843 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 844 break;
cholletisaik777 0:d6e3d1e21484 845 }
cholletisaik777 0:d6e3d1e21484 846 }
cholletisaik777 0:d6e3d1e21484 847 break;
cholletisaik777 0:d6e3d1e21484 848 }
cholletisaik777 0:d6e3d1e21484 849 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 850 //send invalid TC TM
cholletisaik777 12:cb3ee1ac3638 851
cholletisaik777 12:cb3ee1ac3638 852 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 853 //Send IM
cholletisaik777 12:cb3ee1ac3638 854 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 855 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 856 break;
cholletisaik777 0:d6e3d1e21484 857 }
cholletisaik777 0:d6e3d1e21484 858 }
cholletisaik777 0:d6e3d1e21484 859 break;
cholletisaik777 0:d6e3d1e21484 860 }
cholletisaik777 0:d6e3d1e21484 861 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 862 //send invalid TC TM
cholletisaik777 12:cb3ee1ac3638 863
cholletisaik777 12:cb3ee1ac3638 864 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 865 //Send IM
cholletisaik777 12:cb3ee1ac3638 866 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 867 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 868 break;
cholletisaik777 0:d6e3d1e21484 869 }
cholletisaik777 0:d6e3d1e21484 870 }
cholletisaik777 0:d6e3d1e21484 871
cholletisaik777 0:d6e3d1e21484 872 }