vr1.1

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of CDMS_RTOS_v1_1 by Team Fox

Committer:
cholletisaik777
Date:
Mon Jul 06 10:31:29 2015 +0000
Revision:
12:cb3ee1ac3638
Parent:
11:d6dc9074075b
Child:
14:cf9f12b6887d
integrated code

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
sakthipriya 3:0c3f7c3fabc9 557 uint8_t* data;
cholletisaik777 7:c270a9e37290 558 FCTN_CDMS_RD_RTC(data);
cholletisaik777 0:d6e3d1e21484 559 telemetry_type2[0]=tmid4_spr_tm;
cholletisaik777 0:d6e3d1e21484 560 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 561 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 562 for(int i=3;i<11;i++)
cholletisaik777 0:d6e3d1e21484 563 {
cholletisaik777 0:d6e3d1e21484 564 telemetry_type2[i]=data[i-3];
cholletisaik777 0:d6e3d1e21484 565 }
cholletisaik777 1:f926f14a52d8 566 for(int i=0;i<13;i++)
cholletisaik777 0:d6e3d1e21484 567 {
cholletisaik777 1:f926f14a52d8 568 sc.printf("%d\r\r\n",telemetry_type2[i]);
cholletisaik777 0:d6e3d1e21484 569 }
cholletisaik777 5:c77b49508927 570 for(int i=11;i<13;i++)
cholletisaik777 5:c77b49508927 571 {
cholletisaik777 0:d6e3d1e21484 572 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 4:cc85cfaa2086 573 }
cholletisaik777 12:cb3ee1ac3638 574
cholletisaik777 12:cb3ee1ac3638 575
cholletisaik777 12:cb3ee1ac3638 576 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 577 //Send IM
cholletisaik777 12:cb3ee1ac3638 578 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 579 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 4:cc85cfaa2086 580 for(int i=0;i<13;i++)
cholletisaik777 4:cc85cfaa2086 581 sd_data[i]=telemetry_type2[i];
cholletisaik777 0:d6e3d1e21484 582 for(int i=13;i<512;i++)
cholletisaik777 5:c77b49508927 583 sd_data[i]='\0';
cholletisaik777 7:c270a9e37290 584 FCTN_WR_SD(sd_data, 512);
cholletisaik777 7:c270a9e37290 585 FCTN_RD_SD(sd_read_data,512);
cholletisaik777 1:f926f14a52d8 586 sc.printf("data read from sd card\r\r\n");
cholletisaik777 1:f926f14a52d8 587 for(int i=0;i<512;i++)
cholletisaik777 4:cc85cfaa2086 588 sc.printf("%d ",sd_read_data[i]);
cholletisaik777 0:d6e3d1e21484 589 }
cholletisaik777 0:d6e3d1e21484 590 else if((appdata[0]&0xF0)==0xF0){
cholletisaik777 1:f926f14a52d8 591 sc.printf("SD_MNGR\r\r\n"); //tm is func_mngmt_service_tm
cholletisaik777 0:d6e3d1e21484 592 //P_CDMS_MNG_SD
cholletisaik777 0:d6e3d1e21484 593
cholletisaik777 0:d6e3d1e21484 594 telemetry_type2[0]=tmid4_spr_tm;
cholletisaik777 0:d6e3d1e21484 595 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 596 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 597 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 598 telemetry_type2[i]=func_mngmt_service_tm[i-3];
cholletisaik777 0:d6e3d1e21484 599 }
cholletisaik777 0:d6e3d1e21484 600 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 601 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 602 }
cholletisaik777 12:cb3ee1ac3638 603
cholletisaik777 12:cb3ee1ac3638 604
cholletisaik777 12:cb3ee1ac3638 605 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 606 //Send IM
cholletisaik777 12:cb3ee1ac3638 607 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 608 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 609 }
cholletisaik777 0:d6e3d1e21484 610 else {
cholletisaik777 0:d6e3d1e21484 611 sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 612 //Send Invalid TC Telemetry
cholletisaik777 12:cb3ee1ac3638 613
cholletisaik777 12:cb3ee1ac3638 614 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 615 //Send IM
cholletisaik777 12:cb3ee1ac3638 616 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 617 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 618 }
cholletisaik777 0:d6e3d1e21484 619 }
cholletisaik777 0:d6e3d1e21484 620 else {
cholletisaik777 0:d6e3d1e21484 621 sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 622 //Send Invalid TC Telemetry
cholletisaik777 12:cb3ee1ac3638 623
cholletisaik777 12:cb3ee1ac3638 624 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 625 //Send IM
cholletisaik777 12:cb3ee1ac3638 626 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 627 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 628 }
cholletisaik777 0:d6e3d1e21484 629 break;
cholletisaik777 0:d6e3d1e21484 630 }
cholletisaik777 0:d6e3d1e21484 631 case 7:
cholletisaik777 0:d6e3d1e21484 632 {
cholletisaik777 1:f926f14a52d8 633 sc.printf("PAYLOAD MANAGEMENT SERVICE\r\r\n"); //TM is ACKL234
cholletisaik777 0:d6e3d1e21484 634 switch(sub_service_type){
cholletisaik777 1:f926f14a52d8 635 case 1:sc.printf("INSERT PL SCHEDULE\r\r\n");
cholletisaik777 0:d6e3d1e21484 636 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 637 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 638 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 639 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 640 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 641 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 642 }
cholletisaik777 0:d6e3d1e21484 643 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 644 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 645 }
cholletisaik777 12:cb3ee1ac3638 646
cholletisaik777 12:cb3ee1ac3638 647 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 648 //Send IM
cholletisaik777 12:cb3ee1ac3638 649 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 650 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 651 break;
cholletisaik777 1:f926f14a52d8 652 case 2:sc.printf("DELETE PL SCHEDULE\r\r\n");
cholletisaik777 0:d6e3d1e21484 653 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 654 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 655 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 656 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 657 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 658 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 659 }
cholletisaik777 0:d6e3d1e21484 660 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 661 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 662 }
cholletisaik777 12:cb3ee1ac3638 663
cholletisaik777 12:cb3ee1ac3638 664 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 665 //Send IM
cholletisaik777 12:cb3ee1ac3638 666 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 667 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 668 break;
cholletisaik777 0:d6e3d1e21484 669 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 670 //send invalid TC TM
cholletisaik777 12:cb3ee1ac3638 671
cholletisaik777 12:cb3ee1ac3638 672 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 673 //Send IM
cholletisaik777 12:cb3ee1ac3638 674 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 675 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 676 break;}
cholletisaik777 0:d6e3d1e21484 677 }
cholletisaik777 0:d6e3d1e21484 678 break;
cholletisaik777 0:d6e3d1e21484 679 }
cholletisaik777 0:d6e3d1e21484 680 case 11:
cholletisaik777 0:d6e3d1e21484 681 {
cholletisaik777 1:f926f14a52d8 682 sc.printf("ONBOARD OPERATIONS SCHEDULING SERVICE\r\r\n");
cholletisaik777 0:d6e3d1e21484 683 switch(sub_service_type){
cholletisaik777 0:d6e3d1e21484 684 case 1:
cholletisaik777 0:d6e3d1e21484 685 {
cholletisaik777 1:f926f14a52d8 686 sc.printf("DISABLE RELEASE OF TCs\r\r\n"); //tm is ack_l1
cholletisaik777 0:d6e3d1e21484 687 telemetry_type2[0]=tmid1_spr_tm;
cholletisaik777 0:d6e3d1e21484 688 telemetry_type2[1]=tc_exec_tm;
cholletisaik777 0:d6e3d1e21484 689 telemetry_type2[2]=tc_service_typeatus_tm;
cholletisaik777 0:d6e3d1e21484 690 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 691 telemetry_type2[i]=pac_seq_cnt_of_tc_tm[i-3];
cholletisaik777 0:d6e3d1e21484 692 }
cholletisaik777 0:d6e3d1e21484 693 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 694 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 695 }
cholletisaik777 12:cb3ee1ac3638 696
cholletisaik777 12:cb3ee1ac3638 697
cholletisaik777 0:d6e3d1e21484 698 break;
cholletisaik777 0:d6e3d1e21484 699 }
cholletisaik777 0:d6e3d1e21484 700 case 2:
cholletisaik777 0:d6e3d1e21484 701 {
cholletisaik777 1:f926f14a52d8 702 sc.printf("ENABLE RELEASE OF TCs\r\r\n");
cholletisaik777 0:d6e3d1e21484 703 break;
cholletisaik777 0:d6e3d1e21484 704 }
cholletisaik777 0:d6e3d1e21484 705 case 5:
cholletisaik777 0:d6e3d1e21484 706 {
cholletisaik777 1:f926f14a52d8 707 sc.printf("DELETE TELECOMMANDS\r\r\n");
cholletisaik777 0:d6e3d1e21484 708 break;
cholletisaik777 0:d6e3d1e21484 709 }
cholletisaik777 0:d6e3d1e21484 710 case 6:
cholletisaik777 0:d6e3d1e21484 711 {
cholletisaik777 1:f926f14a52d8 712 sc.printf("REPORT TC LIST IN DETAILED FORM\r\r\n"); //tm is tc_liservice_type
cholletisaik777 0:d6e3d1e21484 713 for(int i=0;i<9;i++){
cholletisaik777 0:d6e3d1e21484 714 telemetry_type1[i]=tc_liservice_type_packet1_tm[i];
cholletisaik777 0:d6e3d1e21484 715 }
cholletisaik777 0:d6e3d1e21484 716 for(int i=9;i<18;i++){
cholletisaik777 0:d6e3d1e21484 717 telemetry_type1[i]=tc_liservice_type_packet2_tm[i-9];
cholletisaik777 0:d6e3d1e21484 718 }
cholletisaik777 0:d6e3d1e21484 719 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 720 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 721 }
cholletisaik777 0:d6e3d1e21484 722 break;
cholletisaik777 0:d6e3d1e21484 723 }
cholletisaik777 0:d6e3d1e21484 724 case 8:
cholletisaik777 0:d6e3d1e21484 725 {
cholletisaik777 1:f926f14a52d8 726 sc.printf("REPORT STATUS OF TC LIST\r\r\n"); //tm is ack_l1
cholletisaik777 0:d6e3d1e21484 727 telemetry_type2[0]=tmid1_spr_tm;
cholletisaik777 0:d6e3d1e21484 728 telemetry_type2[1]=tc_exec_tm;
cholletisaik777 0:d6e3d1e21484 729 telemetry_type2[2]=tc_service_typeatus_tm;
cholletisaik777 0:d6e3d1e21484 730 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 731 telemetry_type2[i]=pac_seq_cnt_of_tc_tm[i-3];
cholletisaik777 0:d6e3d1e21484 732 }
cholletisaik777 0:d6e3d1e21484 733 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 734 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 735 }
cholletisaik777 0:d6e3d1e21484 736 break;
cholletisaik777 0:d6e3d1e21484 737 }
cholletisaik777 0:d6e3d1e21484 738 case 15:
cholletisaik777 0:d6e3d1e21484 739 {
cholletisaik777 1:f926f14a52d8 740 sc.printf("REPORT STATUS OF LAST UNEXECUTED TC\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 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 754 //send invalid TC TM
cholletisaik777 0:d6e3d1e21484 755 break;}
cholletisaik777 0:d6e3d1e21484 756 }
cholletisaik777 0:d6e3d1e21484 757 break;
cholletisaik777 0:d6e3d1e21484 758 }
cholletisaik777 0:d6e3d1e21484 759 case 13:
cholletisaik777 0:d6e3d1e21484 760 {
cholletisaik777 1:f926f14a52d8 761 sc.printf("LARGE DATA TRANSFER\r\r\n"); //tm is ack_l234
cholletisaik777 0:d6e3d1e21484 762 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 763 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 764 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 765 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 766 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 767 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 768 }
cholletisaik777 0:d6e3d1e21484 769 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 770 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 771 }
cholletisaik777 0:d6e3d1e21484 772 break;
cholletisaik777 0:d6e3d1e21484 773 }
cholletisaik777 0:d6e3d1e21484 774 case 15:
cholletisaik777 0:d6e3d1e21484 775 {
cholletisaik777 1:f926f14a52d8 776 sc.printf("ONBOARD STORAGE AND RETRIEVAL SERVICE\r\r\n");
cholletisaik777 0:d6e3d1e21484 777 switch(sub_service_type){
cholletisaik777 0:d6e3d1e21484 778 case 0:
cholletisaik777 0:d6e3d1e21484 779 {
cholletisaik777 1:f926f14a52d8 780 sc.printf("SCF\r\r\n"); //tm is obsrs
cholletisaik777 0:d6e3d1e21484 781 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm;
cholletisaik777 0:d6e3d1e21484 782 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 783 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 784 }
cholletisaik777 0:d6e3d1e21484 785 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 786 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 787 }
cholletisaik777 0:d6e3d1e21484 788 break;
cholletisaik777 0:d6e3d1e21484 789 }
cholletisaik777 0:d6e3d1e21484 790 case 1:
cholletisaik777 0:d6e3d1e21484 791 {
cholletisaik777 1:f926f14a52d8 792 sc.printf("SFF-AT\r\r\n");
cholletisaik777 0:d6e3d1e21484 793 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm; //tm is obsrs
cholletisaik777 0:d6e3d1e21484 794 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 795 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 796 }
cholletisaik777 0:d6e3d1e21484 797 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 798 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 799 }
cholletisaik777 12:cb3ee1ac3638 800
cholletisaik777 12:cb3ee1ac3638 801 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 802 //Send IM
cholletisaik777 12:cb3ee1ac3638 803 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 804 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 805 break;
cholletisaik777 0:d6e3d1e21484 806 }
cholletisaik777 0:d6e3d1e21484 807 case 2:
cholletisaik777 0:d6e3d1e21484 808 {
cholletisaik777 1:f926f14a52d8 809 sc.printf("SFF-BT\r\r\n"); //tm is obsrs
cholletisaik777 0:d6e3d1e21484 810 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm;
cholletisaik777 0:d6e3d1e21484 811 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 812 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 813 }
cholletisaik777 0:d6e3d1e21484 814 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 815 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 816 }
cholletisaik777 12:cb3ee1ac3638 817
cholletisaik777 12:cb3ee1ac3638 818 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 819 //Send IM
cholletisaik777 12:cb3ee1ac3638 820 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 821 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 822 break;
cholletisaik777 0:d6e3d1e21484 823 }
cholletisaik777 0:d6e3d1e21484 824 case 3:
cholletisaik777 0:d6e3d1e21484 825 {
cholletisaik777 1:f926f14a52d8 826 sc.printf("LOG\r\r\n"); //tm is obsrs
cholletisaik777 0:d6e3d1e21484 827 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm;
cholletisaik777 0:d6e3d1e21484 828 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 829 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 830 }
cholletisaik777 0:d6e3d1e21484 831 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 832 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 833 }
cholletisaik777 12:cb3ee1ac3638 834
cholletisaik777 12:cb3ee1ac3638 835 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 836 //Send IM
cholletisaik777 12:cb3ee1ac3638 837 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 838 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 839 break;
cholletisaik777 0:d6e3d1e21484 840 }
cholletisaik777 0:d6e3d1e21484 841 case 4:
cholletisaik777 0:d6e3d1e21484 842 {
cholletisaik777 1:f926f14a52d8 843 sc.printf("HK_ARCHIVE\r\r\n"); //tm is obsrs
cholletisaik777 0:d6e3d1e21484 844 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm;
cholletisaik777 0:d6e3d1e21484 845 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 846 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 847 }
cholletisaik777 0:d6e3d1e21484 848 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 849 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 850 }
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 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 859 //send invalid TC TM
cholletisaik777 12:cb3ee1ac3638 860
cholletisaik777 12:cb3ee1ac3638 861 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 862 //Send IM
cholletisaik777 12:cb3ee1ac3638 863 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 864 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 865 break;
cholletisaik777 0:d6e3d1e21484 866 }
cholletisaik777 0:d6e3d1e21484 867 }
cholletisaik777 0:d6e3d1e21484 868 break;
cholletisaik777 0:d6e3d1e21484 869 }
cholletisaik777 0:d6e3d1e21484 870 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 871 //send invalid TC TM
cholletisaik777 12:cb3ee1ac3638 872
cholletisaik777 12:cb3ee1ac3638 873 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 874 //Send IM
cholletisaik777 12:cb3ee1ac3638 875 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 876 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 877 break;
cholletisaik777 0:d6e3d1e21484 878 }
cholletisaik777 0:d6e3d1e21484 879 }
cholletisaik777 0:d6e3d1e21484 880 break;
cholletisaik777 0:d6e3d1e21484 881 }
cholletisaik777 0:d6e3d1e21484 882 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 883 //send invalid TC TM
cholletisaik777 12:cb3ee1ac3638 884
cholletisaik777 12:cb3ee1ac3638 885 CDMS_TC_TM_FLAG|= TX_TM_STATUS;
cholletisaik777 12:cb3ee1ac3638 886 //Send IM
cholletisaik777 12:cb3ee1ac3638 887 //if ERR in TM CDMS_TC_TM_FLAG|= TX_TM_ERROR
cholletisaik777 12:cb3ee1ac3638 888 CDMS_TC_TM_FLAG &=~(CDMS_TC_TM_STATUS);
cholletisaik777 0:d6e3d1e21484 889 break;
cholletisaik777 0:d6e3d1e21484 890 }
cholletisaik777 0:d6e3d1e21484 891 }
cholletisaik777 0:d6e3d1e21484 892
cholletisaik777 0:d6e3d1e21484 893 }