vr1.1

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of CDMS_RTOS_v1_1 by Team Fox

Committer:
sakthipriya
Date:
Tue Jun 16 09:04:53 2015 +0000
Revision:
3:0c3f7c3fabc9
Parent:
2:4c79b3dfef31
Child:
4:cc85cfaa2086
vr 1.0 working

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