vr1.1

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of CDMS_RTOS_v1_1 by Team Fox

Committer:
cholletisaik777
Date:
Mon Jul 06 06:25:14 2015 +0000
Revision:
11:d6dc9074075b
Parent:
8:607ae92fa6af
Child:
12:cb3ee1ac3638
changes made

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 0:d6e3d1e21484 4
cholletisaik777 0:d6e3d1e21484 5 Serial sc(USBTX,USBRX);
cholletisaik777 0:d6e3d1e21484 6
cholletisaik777 7:c270a9e37290 7 void FCTN_CDMS_RLY_TC()
cholletisaik777 0:d6e3d1e21484 8 {
cholletisaik777 8:607ae92fa6af 9 sc.printf("\rin FCTN_CDMS_RLY_TC\r\n");
cholletisaik777 0:d6e3d1e21484 10 uint8_t read;
cholletisaik777 0:d6e3d1e21484 11 sc.scanf("%d",&read); //Packet sequence count
cholletisaik777 0:d6e3d1e21484 12 pac_seq_cnt = read;
cholletisaik777 0:d6e3d1e21484 13 sc.scanf("%d",&read); //Data[0] contains APID,LFB,long_or_short,AoN,Spr and Ack
cholletisaik777 0:d6e3d1e21484 14 apid_size = read;
cholletisaik777 0:d6e3d1e21484 15 apid=(apid_size&0xC0)>>6; //apid is decoded
cholletisaik777 0:d6e3d1e21484 16 long_or_short=(apid_size&0x10)>>4; //size of tc is known
cholletisaik777 0:d6e3d1e21484 17 switch(apid)
cholletisaik777 0:d6e3d1e21484 18 {
cholletisaik777 0:d6e3d1e21484 19 case 1: //apid=01 implies it corresponds to bae
cholletisaik777 0:d6e3d1e21484 20 {
cholletisaik777 1:f926f14a52d8 21 sc.printf("BAE\r\r\r\n");
cholletisaik777 0:d6e3d1e21484 22 uint8_t p_i2c_bae[long_or_short*124+11];
cholletisaik777 0:d6e3d1e21484 23 p_i2c_bae[0]=pac_seq_cnt;
cholletisaik777 0:d6e3d1e21484 24 p_i2c_bae[1]=apid_size;
cholletisaik777 0:d6e3d1e21484 25 sc.scanf("%d",&read); //services contains service_type and sub_service_type
cholletisaik777 0:d6e3d1e21484 26 p_i2c_bae[2] = read;
cholletisaik777 0:d6e3d1e21484 27 for(int i=3;i<(long_or_short*124+11);i++){
cholletisaik777 0:d6e3d1e21484 28 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 29 p_i2c_bae[i] = read;
cholletisaik777 0:d6e3d1e21484 30 }
cholletisaik777 1:f926f14a52d8 31 sc.printf("informing BAE about TC using I2C\r\r\n"); //interrupt to be sent to the bae
cholletisaik777 1:f926f14a52d8 32 if(long_or_short==0)
cholletisaik777 1:f926f14a52d8 33 FCTN_MASTER_I2C('s', (char *)p_i2c_bae);
cholletisaik777 1:f926f14a52d8 34 else if(long_or_short==1)
cholletisaik777 1:f926f14a52d8 35 FCTN_MASTER_I2C('l', (char *)p_i2c_bae);
cholletisaik777 1:f926f14a52d8 36 else
cholletisaik777 1:f926f14a52d8 37 sc.printf("long_or_short invalid\r\r\n");
cholletisaik777 1:f926f14a52d8 38 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 0:d6e3d1e21484 39 break;
cholletisaik777 0:d6e3d1e21484 40 }
cholletisaik777 0:d6e3d1e21484 41 case 3:
cholletisaik777 0:d6e3d1e21484 42 {
cholletisaik777 1:f926f14a52d8 43 sc.printf("SPEED\r\r\n"); //speed corresponds to apid = 11
cholletisaik777 0:d6e3d1e21484 44 uint8_t p_i2c_speed[long_or_short*124+11];
cholletisaik777 0:d6e3d1e21484 45 p_i2c_speed[0]=pac_seq_cnt;
cholletisaik777 0:d6e3d1e21484 46 p_i2c_speed[1]=apid_size;
cholletisaik777 0:d6e3d1e21484 47 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 48 p_i2c_speed[2] = read; //services contains service_type and sub_service_type
cholletisaik777 0:d6e3d1e21484 49 for(int i=3;i<(long_or_short*124+11);i++){
cholletisaik777 0:d6e3d1e21484 50 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 51 p_i2c_speed[i] = read;
cholletisaik777 0:d6e3d1e21484 52 }
cholletisaik777 1:f926f14a52d8 53 sc.printf("inform PL about TC using I2C\r\r\n");
cholletisaik777 1:f926f14a52d8 54 sc.printf("send the packet + CRC to the PL after receving i2c signal from PL\r\r\n");
cholletisaik777 0:d6e3d1e21484 55 break;
cholletisaik777 0:d6e3d1e21484 56 }
cholletisaik777 0:d6e3d1e21484 57 case 2:
cholletisaik777 0:d6e3d1e21484 58 {
cholletisaik777 1:f926f14a52d8 59 sc.printf("CDMS\r\r\n"); //apid = 10 corresponds to cdms
cholletisaik777 0:d6e3d1e21484 60 uint8_t services,appdata[long_or_short*124+6],crc[2];
cholletisaik777 0:d6e3d1e21484 61 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 62 services = read; //services contains service_type and sub_service_type
cholletisaik777 0:d6e3d1e21484 63 for(int i=3;i<(long_or_short*124+6);i++){
cholletisaik777 0:d6e3d1e21484 64 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 65 appdata[i-3] = read;
cholletisaik777 0:d6e3d1e21484 66 }
cholletisaik777 0:d6e3d1e21484 67 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 68 crc[0] = read;
cholletisaik777 0:d6e3d1e21484 69 sc.scanf("%d",&read);
cholletisaik777 0:d6e3d1e21484 70 crc[1] = read;
cholletisaik777 0:d6e3d1e21484 71 service_type=(services&0xF0)>>4;
cholletisaik777 0:d6e3d1e21484 72 sub_service_type=(services&0x0F);
cholletisaik777 0:d6e3d1e21484 73 switch(service_type){
cholletisaik777 0:d6e3d1e21484 74 case 6:
cholletisaik777 0:d6e3d1e21484 75 {
cholletisaik777 1:f926f14a52d8 76 sc.printf("memory management syservice_typeem\r\r\n");
cholletisaik777 0:d6e3d1e21484 77 switch(sub_service_type){
cholletisaik777 0:d6e3d1e21484 78 case 1:
cholletisaik777 0:d6e3d1e21484 79 {
cholletisaik777 1:f926f14a52d8 80 sc.printf("READ FROM MEMORY\r\r\n");
cholletisaik777 11:d6dc9074075b 81 if(appdata[0]==2)
cholletisaik777 11:d6dc9074075b 82 { //appdata[0] is pid
cholletisaik777 11:d6dc9074075b 83 sc.printf("RD_L_FLASH1\r\r\n"); //tm is lmb
cholletisaik777 11:d6dc9074075b 84 if((appdata[4]<<8|appdata[5])<=4+((appdata[2]<<8)|appdata[3]))
cholletisaik777 11:d6dc9074075b 85 {
cholletisaik777 11:d6dc9074075b 86 for(uint16_t i=((appdata[2]<<8)|appdata[3]);i<(appdata[4]<<8|appdata[5])+1;i++)
cholletisaik777 11:d6dc9074075b 87 {
cholletisaik777 11:d6dc9074075b 88 long_memory_block_tm[i]=FCTN_CDMS_RD_FLASH(i);
cholletisaik777 11:d6dc9074075b 89 }
cholletisaik777 11:d6dc9074075b 90 }
cholletisaik777 11:d6dc9074075b 91 else
cholletisaik777 11:d6dc9074075b 92 {
cholletisaik777 11:d6dc9074075b 93 for(uint16_t i=((appdata[2]<<8)|appdata[3]);i<(appdata[2]<<8|appdata[3])+5;i++)
cholletisaik777 11:d6dc9074075b 94 {
cholletisaik777 11:d6dc9074075b 95 long_memory_block_tm[i]=FCTN_CDMS_RD_FLASH(i);
cholletisaik777 11:d6dc9074075b 96 }
cholletisaik777 11:d6dc9074075b 97 }
cholletisaik777 11:d6dc9074075b 98 for(int i=0;i<128;i++)
cholletisaik777 11:d6dc9074075b 99 {
cholletisaik777 11:d6dc9074075b 100 telemetry_type1[i]=long_memory_block_tm[i-1];
cholletisaik777 11:d6dc9074075b 101 }
cholletisaik777 11:d6dc9074075b 102 for(int i=128;i<130;i++)
cholletisaik777 11:d6dc9074075b 103 {
cholletisaik777 11:d6dc9074075b 104 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 11:d6dc9074075b 105 }
cholletisaik777 0:d6e3d1e21484 106 }
cholletisaik777 11:d6dc9074075b 107 else if ((appdata[0]&0xF0)==0x10)
cholletisaik777 11:d6dc9074075b 108 {
cholletisaik777 11:d6dc9074075b 109 sc.printf("RD_L_FLASH2\r\r\n"); //tm is lmb
cholletisaik777 11:d6dc9074075b 110 for(int i=0;i<128;i++)
cholletisaik777 11:d6dc9074075b 111 {
cholletisaik777 11:d6dc9074075b 112 telemetry_type1[i]=long_memory_block_tm[i-1];
cholletisaik777 11:d6dc9074075b 113 }
cholletisaik777 11:d6dc9074075b 114 for(int i=128;i<130;i++)
cholletisaik777 11:d6dc9074075b 115 {
cholletisaik777 11:d6dc9074075b 116 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 11:d6dc9074075b 117 }
cholletisaik777 11:d6dc9074075b 118 }
cholletisaik777 11:d6dc9074075b 119 else if (appdata[0]==0x22)
cholletisaik777 11:d6dc9074075b 120 {
cholletisaik777 11:d6dc9074075b 121 sc.printf("RD_S_FLASH1\r\r\n"); //tm is smb
cholletisaik777 0:d6e3d1e21484 122 //P_CDMS_RD_FLASH
cholletisaik777 0:d6e3d1e21484 123
cholletisaik777 11:d6dc9074075b 124 telemetry_type2[0]=tmid3_spr_tm;
cholletisaik777 11:d6dc9074075b 125 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 11:d6dc9074075b 126 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 11:d6dc9074075b 127 for(int i=4;i<11;i++)
cholletisaik777 11:d6dc9074075b 128 {
cholletisaik777 11:d6dc9074075b 129 telemetry_type2[i]=small_memory_block_tm[i-4];
cholletisaik777 0:d6e3d1e21484 130 }
cholletisaik777 11:d6dc9074075b 131 for(int i=11;i<13;i++)
cholletisaik777 11:d6dc9074075b 132 {
cholletisaik777 11:d6dc9074075b 133 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 134 }
cholletisaik777 11:d6dc9074075b 135 }
cholletisaik777 11:d6dc9074075b 136 else if ((appdata[0]&0xF0)==0x30){
cholletisaik777 1:f926f14a52d8 137 sc.printf("RD_S_FLASH2\r\r\n"); //tm is smb
cholletisaik777 0:d6e3d1e21484 138 //P_CDMS_RD_FLASH
cholletisaik777 0:d6e3d1e21484 139
cholletisaik777 0:d6e3d1e21484 140 telemetry_type2[0]=tmid3_spr_tm;
cholletisaik777 0:d6e3d1e21484 141 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 142 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 143 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 144 telemetry_type2[i]=small_memory_block_tm[i-3];
cholletisaik777 0:d6e3d1e21484 145 }
cholletisaik777 0:d6e3d1e21484 146 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 147 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 148 }
cholletisaik777 0:d6e3d1e21484 149 }
cholletisaik777 0:d6e3d1e21484 150 else if (appdata[0]==0x42){
cholletisaik777 1:f926f14a52d8 151 sc.printf("RD_L_RAM1\r\r\n"); //tm is lmb
cholletisaik777 0:d6e3d1e21484 152 //P_CDMS_RD_RAM
cholletisaik777 0:d6e3d1e21484 153
cholletisaik777 0:d6e3d1e21484 154 for(int i=0;i<128;i++){
cholletisaik777 0:d6e3d1e21484 155 telemetry_type1[i]=long_memory_block_tm[i-1];
cholletisaik777 0:d6e3d1e21484 156 }
cholletisaik777 0:d6e3d1e21484 157 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 158 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 159 }
cholletisaik777 0:d6e3d1e21484 160 }
cholletisaik777 0:d6e3d1e21484 161 else if ((appdata[0]&0xF0)==0x50){
cholletisaik777 1:f926f14a52d8 162 sc.printf("RD_L_RAM2\r\r\n"); //tm is lmb
cholletisaik777 0:d6e3d1e21484 163 //P_CDMS_RD_RAM
cholletisaik777 0:d6e3d1e21484 164
cholletisaik777 0:d6e3d1e21484 165 for(int i=0;i<128;i++){
cholletisaik777 0:d6e3d1e21484 166 telemetry_type1[i]=long_memory_block_tm[i-1];
cholletisaik777 0:d6e3d1e21484 167 }
cholletisaik777 0:d6e3d1e21484 168 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 169 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 170 }
cholletisaik777 0:d6e3d1e21484 171 }
cholletisaik777 0:d6e3d1e21484 172 else if (appdata[0]==0x62){
cholletisaik777 1:f926f14a52d8 173 sc.printf("RD_S_RAM\r\r\n"); //tm is smb
cholletisaik777 0:d6e3d1e21484 174 //P_CDMS_RD_RAM
cholletisaik777 0:d6e3d1e21484 175
cholletisaik777 0:d6e3d1e21484 176 telemetry_type2[0]=tmid3_spr_tm;
cholletisaik777 0:d6e3d1e21484 177 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 178 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 179 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 180 telemetry_type2[i]=small_memory_block_tm[i-3];
cholletisaik777 0:d6e3d1e21484 181 }
cholletisaik777 0:d6e3d1e21484 182 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 183 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 184 }
cholletisaik777 0:d6e3d1e21484 185 }
cholletisaik777 0:d6e3d1e21484 186 else if ((appdata[0]&0xF0)==0x70){
cholletisaik777 1:f926f14a52d8 187 sc.printf("RD_S_RAM2\r\r\n"); //tm is smb
cholletisaik777 0:d6e3d1e21484 188 //P_CDMS_RD_RAM
cholletisaik777 0:d6e3d1e21484 189
cholletisaik777 0:d6e3d1e21484 190 telemetry_type2[0]=tmid3_spr_tm;
cholletisaik777 0:d6e3d1e21484 191 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 192 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 193 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 194 telemetry_type2[i]=small_memory_block_tm[i-3];
cholletisaik777 0:d6e3d1e21484 195 }
cholletisaik777 0:d6e3d1e21484 196 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 197 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 198 }
cholletisaik777 0:d6e3d1e21484 199 }
cholletisaik777 0:d6e3d1e21484 200 else {
cholletisaik777 0:d6e3d1e21484 201 sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 202 //Send Invalid TC Telemetry
cholletisaik777 0:d6e3d1e21484 203 }
cholletisaik777 0:d6e3d1e21484 204 break;
cholletisaik777 0:d6e3d1e21484 205 }
cholletisaik777 0:d6e3d1e21484 206 case 5:
cholletisaik777 0:d6e3d1e21484 207 {
cholletisaik777 1:f926f14a52d8 208 sc.printf("WRITE ON MEMORY\r\r\n");
cholletisaik777 0:d6e3d1e21484 209 switch(appdata[0]){
cholletisaik777 1:f926f14a52d8 210 case 0:sc.printf("WR_S_FLASH\r\r\n");
cholletisaik777 0:d6e3d1e21484 211 //P_CDMS_WR_FLASH
cholletisaik777 0:d6e3d1e21484 212 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 213 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 214 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 215 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 216 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 217 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 218 }
cholletisaik777 0:d6e3d1e21484 219
cholletisaik777 0:d6e3d1e21484 220 break;
cholletisaik777 1:f926f14a52d8 221 case 1:sc.printf("WR_S_RAM\r\r\n");
cholletisaik777 0:d6e3d1e21484 222 //P_CDMS_WR_RAM
cholletisaik777 0:d6e3d1e21484 223 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 224 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 225 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 226 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 227 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 228 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 229 }
cholletisaik777 0:d6e3d1e21484 230
cholletisaik777 0:d6e3d1e21484 231 break;
cholletisaik777 1:f926f14a52d8 232 case 16:sc.printf("WR_L_FLASH\r\r\n");
cholletisaik777 0:d6e3d1e21484 233 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 234 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 235 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 236 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 237 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 238 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 239 }
cholletisaik777 0:d6e3d1e21484 240 //P_CDMS_WR_FLASH
cholletisaik777 0:d6e3d1e21484 241
cholletisaik777 0:d6e3d1e21484 242 break;
cholletisaik777 1:f926f14a52d8 243 case 17:sc.printf("WR_L_RAM\r\r\n");
cholletisaik777 0:d6e3d1e21484 244 //P_CDMS_WR_RAM
cholletisaik777 0:d6e3d1e21484 245 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 246 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 247 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 248 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 249 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 250 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 251 }
cholletisaik777 0:d6e3d1e21484 252
cholletisaik777 0:d6e3d1e21484 253 break;
cholletisaik777 0:d6e3d1e21484 254 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 255 //send invalid TC TM
cholletisaik777 0:d6e3d1e21484 256 break;}
cholletisaik777 0:d6e3d1e21484 257 }
cholletisaik777 0:d6e3d1e21484 258 break;
cholletisaik777 0:d6e3d1e21484 259 }
cholletisaik777 0:d6e3d1e21484 260 case 6:
cholletisaik777 0:d6e3d1e21484 261 {
cholletisaik777 1:f926f14a52d8 262 sc.printf("WRITE FROM ONE MEMORY TO ANOTHER\r\r\n");
cholletisaik777 0:d6e3d1e21484 263 switch(appdata[0]){
cholletisaik777 1:f926f14a52d8 264 case 0:sc.printf("WR_S_FLASH\r\r\n");
cholletisaik777 0:d6e3d1e21484 265 //P_CDMS_WR_FLASH
cholletisaik777 0:d6e3d1e21484 266 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 267 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 268 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 269 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 270 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 271 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 272 }
cholletisaik777 0:d6e3d1e21484 273 break;
cholletisaik777 1:f926f14a52d8 274 case 1:sc.printf("WR_S_RAM\r\r\n");
cholletisaik777 0:d6e3d1e21484 275 //P_CDMS_WR_RAM
cholletisaik777 0:d6e3d1e21484 276 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 277 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 278 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 279 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 280 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 281 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 282 }
cholletisaik777 0:d6e3d1e21484 283 break;
cholletisaik777 1:f926f14a52d8 284 case 16:sc.printf("WR_L_FLASH\r\r\n");
cholletisaik777 0:d6e3d1e21484 285 //P_CDMS_WR_FLASH
cholletisaik777 0:d6e3d1e21484 286 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 287 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 288 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 289 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 290 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 291 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 292 }
cholletisaik777 0:d6e3d1e21484 293 break;
cholletisaik777 1:f926f14a52d8 294 case 17:sc.printf("WR_L_RAM\r\r\n");
cholletisaik777 0:d6e3d1e21484 295 //P_CDMS_WR_RAM
cholletisaik777 0:d6e3d1e21484 296 telemetry_type2[0]=0XB0;
cholletisaik777 0:d6e3d1e21484 297 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 298 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 299 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 300 for(int i=4;i<11;i++){
cholletisaik777 0:d6e3d1e21484 301 telemetry_type2[i]=0X00;
cholletisaik777 0:d6e3d1e21484 302 }
cholletisaik777 0:d6e3d1e21484 303 break;
cholletisaik777 0:d6e3d1e21484 304 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 305 //send invalid TC TM
cholletisaik777 0:d6e3d1e21484 306 break;}
cholletisaik777 0:d6e3d1e21484 307 }
cholletisaik777 0:d6e3d1e21484 308 break;
cholletisaik777 0:d6e3d1e21484 309 }
cholletisaik777 0:d6e3d1e21484 310 case 9:
cholletisaik777 0:d6e3d1e21484 311 {
cholletisaik777 1:f926f14a52d8 312 sc.printf("SEND CRC OF FLASH MEMORY\r\r\n");
cholletisaik777 0:d6e3d1e21484 313 if(appdata[0]==2){
cholletisaik777 1:f926f14a52d8 314 sc.printf("GET_FLASH_CRC\r\r\n"); //tm is crc_flash
cholletisaik777 0:d6e3d1e21484 315 //P_CDMS_GET_FLASH_CRC
cholletisaik777 0:d6e3d1e21484 316
cholletisaik777 0:d6e3d1e21484 317 for(int i=0;i<2;i++){
cholletisaik777 0:d6e3d1e21484 318 telemetry_type1[i]=crc1_tm[i];
cholletisaik777 0:d6e3d1e21484 319 }
cholletisaik777 0:d6e3d1e21484 320 for(int i=2;i<4;i++){
cholletisaik777 0:d6e3d1e21484 321 telemetry_type1[i]=crc2_tm[i-2];
cholletisaik777 0:d6e3d1e21484 322 }
cholletisaik777 0:d6e3d1e21484 323 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 324 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 325 }
cholletisaik777 0:d6e3d1e21484 326 }
cholletisaik777 0:d6e3d1e21484 327 else {
cholletisaik777 0:d6e3d1e21484 328 sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 329 //Send Invalid TC Telemetry
cholletisaik777 0:d6e3d1e21484 330 }
cholletisaik777 0:d6e3d1e21484 331 break;
cholletisaik777 0:d6e3d1e21484 332 }
cholletisaik777 0:d6e3d1e21484 333 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 334 //send invalid TC TM
cholletisaik777 0:d6e3d1e21484 335 break;}
cholletisaik777 0:d6e3d1e21484 336 }
cholletisaik777 0:d6e3d1e21484 337 break;
cholletisaik777 0:d6e3d1e21484 338 }
cholletisaik777 0:d6e3d1e21484 339 case 8:
cholletisaik777 0:d6e3d1e21484 340 {
cholletisaik777 7:c270a9e37290 341 sc.printf("FCTNTION MANAGEMENT SERVICE\r\r\n");
cholletisaik777 0:d6e3d1e21484 342 if(sub_service_type==1){
cholletisaik777 0:d6e3d1e21484 343 if((appdata[0]&0xF0)==0x00){
cholletisaik777 1:f926f14a52d8 344 sc.printf("RUN_PRCS\r\r\n");
cholletisaik777 0:d6e3d1e21484 345 switch(appdata[0]){
cholletisaik777 1:f926f14a52d8 346 case 1:sc.printf("P_PL_INIT\r\r\n");//tm is ack_l234
cholletisaik777 0:d6e3d1e21484 347 //P_PL_INIT
cholletisaik777 0:d6e3d1e21484 348 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 349 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 350 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 351 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 352 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 353 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 354 }
cholletisaik777 0:d6e3d1e21484 355 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 356 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 357 }
cholletisaik777 0:d6e3d1e21484 358 break;
cholletisaik777 1:f926f14a52d8 359 case 2:sc.printf("P_PL_MNGR\r\r\n");//tm is ack_l234
cholletisaik777 0:d6e3d1e21484 360 //P_PL_MNGR
cholletisaik777 0:d6e3d1e21484 361 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 362 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 363 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 364 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 365 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 366 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 367 }
cholletisaik777 0:d6e3d1e21484 368 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 369 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 370 }
cholletisaik777 0:d6e3d1e21484 371 break;
cholletisaik777 1:f926f14a52d8 372 case 3:sc.printf("P_COM_INIT\r\r\n");//tm is ack_l234
cholletisaik777 0:d6e3d1e21484 373 //P_COM_INIT
cholletisaik777 0:d6e3d1e21484 374 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 375 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 376 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 377 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 378 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 379 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 380 }
cholletisaik777 0:d6e3d1e21484 381 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 382 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 383 }
cholletisaik777 0:d6e3d1e21484 384 break;
cholletisaik777 1:f926f14a52d8 385 case 4:sc.printf("P_CDMS_HK_MNGR\r\r\n");//tm is ack_l234
cholletisaik777 0:d6e3d1e21484 386 //P_CDMS_HK_MNGR
cholletisaik777 0:d6e3d1e21484 387 telemetry_type2[0]=tmid2_spr_tm;
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=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 392 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 393 }
cholletisaik777 0:d6e3d1e21484 394 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 395 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 396 }
cholletisaik777 0:d6e3d1e21484 397 break;
cholletisaik777 0:d6e3d1e21484 398 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 399 //send invalid TC TM
cholletisaik777 0:d6e3d1e21484 400 break;}
cholletisaik777 0:d6e3d1e21484 401 }
cholletisaik777 0:d6e3d1e21484 402 }
cholletisaik777 0:d6e3d1e21484 403 else if((appdata[0]&0xF0)==0x10){
cholletisaik777 1:f926f14a52d8 404 sc.printf("PWR_SWCH\r\r\n");
cholletisaik777 0:d6e3d1e21484 405 //P_CDMS_SWCH_PWR
cholletisaik777 0:d6e3d1e21484 406
cholletisaik777 0:d6e3d1e21484 407 }
cholletisaik777 0:d6e3d1e21484 408 else if((appdata[0]&0xF0)==0x20){
cholletisaik777 1:f926f14a52d8 409 sc.printf("PWR_Rservice_type\r\r\n");
cholletisaik777 0:d6e3d1e21484 410 //P_CDMS_RST_PWR
cholletisaik777 0:d6e3d1e21484 411
cholletisaik777 0:d6e3d1e21484 412 }
cholletisaik777 0:d6e3d1e21484 413 else if((appdata[0]&0xF0)==0xE0){
cholletisaik777 1:f926f14a52d8 414 sc.printf("RD_RTC\r\n"); //tm is func_mngmt_service_tm
sakthipriya 3:0c3f7c3fabc9 415 uint8_t* data;
cholletisaik777 7:c270a9e37290 416 FCTN_CDMS_RD_RTC(data);
cholletisaik777 0:d6e3d1e21484 417 telemetry_type2[0]=tmid4_spr_tm;
cholletisaik777 0:d6e3d1e21484 418 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 419 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 420 for(int i=3;i<11;i++)
cholletisaik777 0:d6e3d1e21484 421 {
cholletisaik777 0:d6e3d1e21484 422 telemetry_type2[i]=data[i-3];
cholletisaik777 0:d6e3d1e21484 423 }
cholletisaik777 1:f926f14a52d8 424 for(int i=0;i<13;i++)
cholletisaik777 0:d6e3d1e21484 425 {
cholletisaik777 1:f926f14a52d8 426 sc.printf("%d\r\r\n",telemetry_type2[i]);
cholletisaik777 0:d6e3d1e21484 427 }
cholletisaik777 5:c77b49508927 428 for(int i=11;i<13;i++)
cholletisaik777 5:c77b49508927 429 {
cholletisaik777 0:d6e3d1e21484 430 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 4:cc85cfaa2086 431 }
cholletisaik777 4:cc85cfaa2086 432 for(int i=0;i<13;i++)
cholletisaik777 4:cc85cfaa2086 433 sd_data[i]=telemetry_type2[i];
cholletisaik777 0:d6e3d1e21484 434 for(int i=13;i<512;i++)
cholletisaik777 5:c77b49508927 435 sd_data[i]='\0';
cholletisaik777 7:c270a9e37290 436 FCTN_WR_SD(sd_data, 512);
cholletisaik777 7:c270a9e37290 437 FCTN_RD_SD(sd_read_data,512);
cholletisaik777 1:f926f14a52d8 438 sc.printf("data read from sd card\r\r\n");
cholletisaik777 1:f926f14a52d8 439 for(int i=0;i<512;i++)
cholletisaik777 4:cc85cfaa2086 440 sc.printf("%d ",sd_read_data[i]);
cholletisaik777 0:d6e3d1e21484 441 }
cholletisaik777 0:d6e3d1e21484 442 else if((appdata[0]&0xF0)==0xF0){
cholletisaik777 1:f926f14a52d8 443 sc.printf("SD_MNGR\r\r\n"); //tm is func_mngmt_service_tm
cholletisaik777 0:d6e3d1e21484 444 //P_CDMS_MNG_SD
cholletisaik777 0:d6e3d1e21484 445
cholletisaik777 0:d6e3d1e21484 446 telemetry_type2[0]=tmid4_spr_tm;
cholletisaik777 0:d6e3d1e21484 447 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 448 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 449 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 450 telemetry_type2[i]=func_mngmt_service_tm[i-3];
cholletisaik777 0:d6e3d1e21484 451 }
cholletisaik777 0:d6e3d1e21484 452 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 453 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 454 }
cholletisaik777 0:d6e3d1e21484 455 }
cholletisaik777 0:d6e3d1e21484 456 else {
cholletisaik777 0:d6e3d1e21484 457 sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 458 //Send Invalid TC Telemetry
cholletisaik777 0:d6e3d1e21484 459 }
cholletisaik777 0:d6e3d1e21484 460 }
cholletisaik777 0:d6e3d1e21484 461 else {
cholletisaik777 0:d6e3d1e21484 462 sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 463 //Send Invalid TC Telemetry
cholletisaik777 0:d6e3d1e21484 464 }
cholletisaik777 0:d6e3d1e21484 465 break;
cholletisaik777 0:d6e3d1e21484 466 }
cholletisaik777 0:d6e3d1e21484 467 case 7:
cholletisaik777 0:d6e3d1e21484 468 {
cholletisaik777 1:f926f14a52d8 469 sc.printf("PAYLOAD MANAGEMENT SERVICE\r\r\n"); //TM is ACKL234
cholletisaik777 0:d6e3d1e21484 470 switch(sub_service_type){
cholletisaik777 1:f926f14a52d8 471 case 1:sc.printf("INSERT PL SCHEDULE\r\r\n");
cholletisaik777 0:d6e3d1e21484 472 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 473 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 474 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 475 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 476 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 477 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 478 }
cholletisaik777 0:d6e3d1e21484 479 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 480 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 481 }
cholletisaik777 0:d6e3d1e21484 482 break;
cholletisaik777 1:f926f14a52d8 483 case 2:sc.printf("DELETE PL SCHEDULE\r\r\n");
cholletisaik777 0:d6e3d1e21484 484 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 485 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 486 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 487 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 488 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 489 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 490 }
cholletisaik777 0:d6e3d1e21484 491 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 492 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 493 }
cholletisaik777 0:d6e3d1e21484 494 break;
cholletisaik777 0:d6e3d1e21484 495 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 496 //send invalid TC TM
cholletisaik777 0:d6e3d1e21484 497 break;}
cholletisaik777 0:d6e3d1e21484 498 }
cholletisaik777 0:d6e3d1e21484 499 break;
cholletisaik777 0:d6e3d1e21484 500 }
cholletisaik777 0:d6e3d1e21484 501 case 11:
cholletisaik777 0:d6e3d1e21484 502 {
cholletisaik777 1:f926f14a52d8 503 sc.printf("ONBOARD OPERATIONS SCHEDULING SERVICE\r\r\n");
cholletisaik777 0:d6e3d1e21484 504 switch(sub_service_type){
cholletisaik777 0:d6e3d1e21484 505 case 1:
cholletisaik777 0:d6e3d1e21484 506 {
cholletisaik777 1:f926f14a52d8 507 sc.printf("DISABLE RELEASE OF TCs\r\r\n"); //tm is ack_l1
cholletisaik777 0:d6e3d1e21484 508 telemetry_type2[0]=tmid1_spr_tm;
cholletisaik777 0:d6e3d1e21484 509 telemetry_type2[1]=tc_exec_tm;
cholletisaik777 0:d6e3d1e21484 510 telemetry_type2[2]=tc_service_typeatus_tm;
cholletisaik777 0:d6e3d1e21484 511 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 512 telemetry_type2[i]=pac_seq_cnt_of_tc_tm[i-3];
cholletisaik777 0:d6e3d1e21484 513 }
cholletisaik777 0:d6e3d1e21484 514 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 515 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 516 }
cholletisaik777 0:d6e3d1e21484 517 break;
cholletisaik777 0:d6e3d1e21484 518 }
cholletisaik777 0:d6e3d1e21484 519 case 2:
cholletisaik777 0:d6e3d1e21484 520 {
cholletisaik777 1:f926f14a52d8 521 sc.printf("ENABLE RELEASE OF TCs\r\r\n");
cholletisaik777 0:d6e3d1e21484 522 break;
cholletisaik777 0:d6e3d1e21484 523 }
cholletisaik777 0:d6e3d1e21484 524 case 5:
cholletisaik777 0:d6e3d1e21484 525 {
cholletisaik777 1:f926f14a52d8 526 sc.printf("DELETE TELECOMMANDS\r\r\n");
cholletisaik777 0:d6e3d1e21484 527 break;
cholletisaik777 0:d6e3d1e21484 528 }
cholletisaik777 0:d6e3d1e21484 529 case 6:
cholletisaik777 0:d6e3d1e21484 530 {
cholletisaik777 1:f926f14a52d8 531 sc.printf("REPORT TC LIST IN DETAILED FORM\r\r\n"); //tm is tc_liservice_type
cholletisaik777 0:d6e3d1e21484 532 for(int i=0;i<9;i++){
cholletisaik777 0:d6e3d1e21484 533 telemetry_type1[i]=tc_liservice_type_packet1_tm[i];
cholletisaik777 0:d6e3d1e21484 534 }
cholletisaik777 0:d6e3d1e21484 535 for(int i=9;i<18;i++){
cholletisaik777 0:d6e3d1e21484 536 telemetry_type1[i]=tc_liservice_type_packet2_tm[i-9];
cholletisaik777 0:d6e3d1e21484 537 }
cholletisaik777 0:d6e3d1e21484 538 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 539 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 540 }
cholletisaik777 0:d6e3d1e21484 541 break;
cholletisaik777 0:d6e3d1e21484 542 }
cholletisaik777 0:d6e3d1e21484 543 case 8:
cholletisaik777 0:d6e3d1e21484 544 {
cholletisaik777 1:f926f14a52d8 545 sc.printf("REPORT STATUS OF TC LIST\r\r\n"); //tm is ack_l1
cholletisaik777 0:d6e3d1e21484 546 telemetry_type2[0]=tmid1_spr_tm;
cholletisaik777 0:d6e3d1e21484 547 telemetry_type2[1]=tc_exec_tm;
cholletisaik777 0:d6e3d1e21484 548 telemetry_type2[2]=tc_service_typeatus_tm;
cholletisaik777 0:d6e3d1e21484 549 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 550 telemetry_type2[i]=pac_seq_cnt_of_tc_tm[i-3];
cholletisaik777 0:d6e3d1e21484 551 }
cholletisaik777 0:d6e3d1e21484 552 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 553 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 554 }
cholletisaik777 0:d6e3d1e21484 555 break;
cholletisaik777 0:d6e3d1e21484 556 }
cholletisaik777 0:d6e3d1e21484 557 case 15:
cholletisaik777 0:d6e3d1e21484 558 {
cholletisaik777 1:f926f14a52d8 559 sc.printf("REPORT STATUS OF LAST UNEXECUTED TC\r\r\n"); //tm is ack_l234
cholletisaik777 0:d6e3d1e21484 560 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 561 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 562 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 563 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 564 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 565 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 566 }
cholletisaik777 0:d6e3d1e21484 567 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 568 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 569 }
cholletisaik777 0:d6e3d1e21484 570 break;
cholletisaik777 0:d6e3d1e21484 571 }
cholletisaik777 0:d6e3d1e21484 572 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 573 //send invalid TC TM
cholletisaik777 0:d6e3d1e21484 574 break;}
cholletisaik777 0:d6e3d1e21484 575 }
cholletisaik777 0:d6e3d1e21484 576 break;
cholletisaik777 0:d6e3d1e21484 577 }
cholletisaik777 0:d6e3d1e21484 578 case 13:
cholletisaik777 0:d6e3d1e21484 579 {
cholletisaik777 1:f926f14a52d8 580 sc.printf("LARGE DATA TRANSFER\r\r\n"); //tm is ack_l234
cholletisaik777 0:d6e3d1e21484 581 telemetry_type2[0]=tmid2_spr_tm;
cholletisaik777 0:d6e3d1e21484 582 telemetry_type2[1]=tc_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 583 telemetry_type2[2]=tm_pac_seq_cnt_tm;
cholletisaik777 0:d6e3d1e21484 584 telemetry_type2[3]=ackcode_tm;
cholletisaik777 0:d6e3d1e21484 585 for(int i=3;i<11;i++){
cholletisaik777 0:d6e3d1e21484 586 telemetry_type2[i]=0x00;
cholletisaik777 0:d6e3d1e21484 587 }
cholletisaik777 0:d6e3d1e21484 588 for(int i=11;i<13;i++){
cholletisaik777 0:d6e3d1e21484 589 telemetry_type2[i]=crc_tm[i-11];
cholletisaik777 0:d6e3d1e21484 590 }
cholletisaik777 0:d6e3d1e21484 591 break;
cholletisaik777 0:d6e3d1e21484 592 }
cholletisaik777 0:d6e3d1e21484 593 case 15:
cholletisaik777 0:d6e3d1e21484 594 {
cholletisaik777 1:f926f14a52d8 595 sc.printf("ONBOARD STORAGE AND RETRIEVAL SERVICE\r\r\n");
cholletisaik777 0:d6e3d1e21484 596 switch(sub_service_type){
cholletisaik777 0:d6e3d1e21484 597 case 0:
cholletisaik777 0:d6e3d1e21484 598 {
cholletisaik777 1:f926f14a52d8 599 sc.printf("SCF\r\r\n"); //tm is obsrs
cholletisaik777 0:d6e3d1e21484 600 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm;
cholletisaik777 0:d6e3d1e21484 601 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 602 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 603 }
cholletisaik777 0:d6e3d1e21484 604 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 605 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 606 }
cholletisaik777 0:d6e3d1e21484 607 break;
cholletisaik777 0:d6e3d1e21484 608 }
cholletisaik777 0:d6e3d1e21484 609 case 1:
cholletisaik777 0:d6e3d1e21484 610 {
cholletisaik777 1:f926f14a52d8 611 sc.printf("SFF-AT\r\r\n");
cholletisaik777 0:d6e3d1e21484 612 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm; //tm is obsrs
cholletisaik777 0:d6e3d1e21484 613 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 614 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 615 }
cholletisaik777 0:d6e3d1e21484 616 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 617 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 618 }
cholletisaik777 0:d6e3d1e21484 619 break;
cholletisaik777 0:d6e3d1e21484 620 }
cholletisaik777 0:d6e3d1e21484 621 case 2:
cholletisaik777 0:d6e3d1e21484 622 {
cholletisaik777 1:f926f14a52d8 623 sc.printf("SFF-BT\r\r\n"); //tm is obsrs
cholletisaik777 0:d6e3d1e21484 624 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm;
cholletisaik777 0:d6e3d1e21484 625 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 626 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 627 }
cholletisaik777 0:d6e3d1e21484 628 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 629 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 630 }
cholletisaik777 0:d6e3d1e21484 631 break;
cholletisaik777 0:d6e3d1e21484 632 }
cholletisaik777 0:d6e3d1e21484 633 case 3:
cholletisaik777 0:d6e3d1e21484 634 {
cholletisaik777 1:f926f14a52d8 635 sc.printf("LOG\r\r\n"); //tm is obsrs
cholletisaik777 0:d6e3d1e21484 636 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm;
cholletisaik777 0:d6e3d1e21484 637 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 638 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 639 }
cholletisaik777 0:d6e3d1e21484 640 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 641 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 642 }
cholletisaik777 0:d6e3d1e21484 643 break;
cholletisaik777 0:d6e3d1e21484 644 }
cholletisaik777 0:d6e3d1e21484 645 case 4:
cholletisaik777 0:d6e3d1e21484 646 {
cholletisaik777 1:f926f14a52d8 647 sc.printf("HK_ARCHIVE\r\r\n"); //tm is obsrs
cholletisaik777 0:d6e3d1e21484 648 telemetry_type1[0]=frmseqcnt_fileheadpointer_tm;
cholletisaik777 0:d6e3d1e21484 649 for(int i=1;i<128;i++){
cholletisaik777 0:d6e3d1e21484 650 telemetry_type1[i]=multi_obsrs_tm_packets[i-1];
cholletisaik777 0:d6e3d1e21484 651 }
cholletisaik777 0:d6e3d1e21484 652 for(int i=128;i<130;i++){
cholletisaik777 0:d6e3d1e21484 653 telemetry_type1[i]=crc_tm[i-128];
cholletisaik777 0:d6e3d1e21484 654 }
cholletisaik777 0:d6e3d1e21484 655 break;
cholletisaik777 0:d6e3d1e21484 656 }
cholletisaik777 0:d6e3d1e21484 657 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 658 //send invalid TC TM
cholletisaik777 0:d6e3d1e21484 659 break;
cholletisaik777 0:d6e3d1e21484 660 }
cholletisaik777 0:d6e3d1e21484 661 }
cholletisaik777 0:d6e3d1e21484 662 break;
cholletisaik777 0:d6e3d1e21484 663 }
cholletisaik777 0:d6e3d1e21484 664 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 665 //send invalid TC TM
cholletisaik777 0:d6e3d1e21484 666 break;
cholletisaik777 0:d6e3d1e21484 667 }
cholletisaik777 0:d6e3d1e21484 668 }
cholletisaik777 0:d6e3d1e21484 669 break;
cholletisaik777 0:d6e3d1e21484 670 }
cholletisaik777 0:d6e3d1e21484 671 default:{sc.printf("INVALID TC");
cholletisaik777 0:d6e3d1e21484 672 //send invalid TC TM
cholletisaik777 0:d6e3d1e21484 673 break;
cholletisaik777 0:d6e3d1e21484 674 }
cholletisaik777 0:d6e3d1e21484 675 }
cholletisaik777 0:d6e3d1e21484 676
cholletisaik777 0:d6e3d1e21484 677 }