![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
kgkjgkj
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of CDMS_SD_MNG_OVERDRIVE by
TMTC.cpp@1:aa24178260d2, 2015-12-16 (annotated)
- Committer:
- pradeepvk2208
- Date:
- Wed Dec 16 11:55:46 2015 +0000
- Revision:
- 1:aa24178260d2
- Parent:
- 0:bcbd76c86cde
ffjfiug
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cholletisaik777 | 0:bcbd76c86cde | 1 | #include "structure.h" |
cholletisaik777 | 0:bcbd76c86cde | 2 | #include "i2c.h" |
cholletisaik777 | 0:bcbd76c86cde | 3 | #include "pinconfig.h" |
cholletisaik777 | 0:bcbd76c86cde | 4 | #include "crc.h" |
cholletisaik777 | 0:bcbd76c86cde | 5 | #include "TMTC.h" |
cholletisaik777 | 0:bcbd76c86cde | 6 | #include "cdms_rtc.h" |
cholletisaik777 | 0:bcbd76c86cde | 7 | #include "cdms_sd.h" |
cholletisaik777 | 0:bcbd76c86cde | 8 | #include "Flash.h" |
cholletisaik777 | 0:bcbd76c86cde | 9 | |
pradeepvk2208 | 1:aa24178260d2 | 10 | //DigitalIn tm_status_4m_slv(PIN39); //I2C interrupt to CDMS from BAE |
cholletisaik777 | 0:bcbd76c86cde | 11 | //DigitalIn tm_status_4m_pl(PIN61); //I2C interrupt to CDMS from PL |
cholletisaik777 | 0:bcbd76c86cde | 12 | |
cholletisaik777 | 0:bcbd76c86cde | 13 | uint8_t received = 0; |
cholletisaik777 | 0:bcbd76c86cde | 14 | uint16_t mid1; |
cholletisaik777 | 0:bcbd76c86cde | 15 | uint16_t mid2; |
cholletisaik777 | 0:bcbd76c86cde | 16 | uint16_t Nbytes; |
cholletisaik777 | 0:bcbd76c86cde | 17 | uint32_t Data; |
cholletisaik777 | 0:bcbd76c86cde | 18 | uint16_t nbytes; |
cholletisaik777 | 0:bcbd76c86cde | 19 | uint8_t flash_counter = 0; |
cholletisaik777 | 0:bcbd76c86cde | 20 | uint16_t crc16; |
cholletisaik777 | 0:bcbd76c86cde | 21 | uint16_t mid; |
cholletisaik777 | 0:bcbd76c86cde | 22 | uint32_t block; |
cholletisaik777 | 0:bcbd76c86cde | 23 | |
cholletisaik777 | 0:bcbd76c86cde | 24 | Base_tm *FCTN_CDMS_RLY_TMTC(Base_tc *tc) |
cholletisaik777 | 0:bcbd76c86cde | 25 | { |
cholletisaik777 | 0:bcbd76c86cde | 26 | Base_tm *tm = new Long_tm; |
cholletisaik777 | 0:bcbd76c86cde | 27 | Base_tm *tm_pointer = tm; |
pradeepvk2208 | 1:aa24178260d2 | 28 | switch(GETservice_type(tc)) |
cholletisaik777 | 0:bcbd76c86cde | 29 | { |
cholletisaik777 | 0:bcbd76c86cde | 30 | case 6: |
cholletisaik777 | 0:bcbd76c86cde | 31 | { |
cholletisaik777 | 0:bcbd76c86cde | 32 | printf("service:MMS\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 33 | switch(GETservice_subtype(tc)) |
cholletisaik777 | 0:bcbd76c86cde | 34 | { |
cholletisaik777 | 0:bcbd76c86cde | 35 | case 1: |
cholletisaik777 | 0:bcbd76c86cde | 36 | { |
cholletisaik777 | 0:bcbd76c86cde | 37 | printf("sub_service:Read from Memory\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 38 | if(GETpid(tc) == 2) |
cholletisaik777 | 0:bcbd76c86cde | 39 | { |
cholletisaik777 | 0:bcbd76c86cde | 40 | printf("pid:RD_L_FLASH\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 41 | mid1 = ((((uint16_t)tc->TC_string[5])<<8)|(uint16_t)(tc->TC_string[6])); |
cholletisaik777 | 0:bcbd76c86cde | 42 | mid2 = ((((uint16_t)tc->TC_string[7])<<8)|(uint16_t)(tc->TC_string[8])); |
cholletisaik777 | 0:bcbd76c86cde | 43 | Nbytes = (((mid2-mid1)*32)/8)+4; |
cholletisaik777 | 0:bcbd76c86cde | 44 | uint8_t data[4*Nbytes]; |
cholletisaik777 | 0:bcbd76c86cde | 45 | for(uint8_t i=0;i<mid2-mid1+1;i++) |
cholletisaik777 | 0:bcbd76c86cde | 46 | { |
cholletisaik777 | 0:bcbd76c86cde | 47 | Data = FCTN_CDMS_RD_FLASH(mid1+i); |
cholletisaik777 | 0:bcbd76c86cde | 48 | data[4*i] = (uint8_t)((Data&0xFF000000)>>24); |
cholletisaik777 | 0:bcbd76c86cde | 49 | data[4*i+1] = (uint8_t)((Data&0xFF000000)>>16); |
cholletisaik777 | 0:bcbd76c86cde | 50 | data[4*i+2] = (uint8_t)((Data&0xFF000000)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 51 | data[4*i+3] = (uint8_t)(Data&0xFF000000); |
cholletisaik777 | 0:bcbd76c86cde | 52 | } |
cholletisaik777 | 0:bcbd76c86cde | 53 | nbytes = Nbytes; |
cholletisaik777 | 0:bcbd76c86cde | 54 | flash_counter = 0; |
cholletisaik777 | 0:bcbd76c86cde | 55 | while(nbytes>=8) |
cholletisaik777 | 0:bcbd76c86cde | 56 | { |
cholletisaik777 | 0:bcbd76c86cde | 57 | tm_pointer = new Long_tm; |
cholletisaik777 | 0:bcbd76c86cde | 58 | tm_pointer->TM_string[0] = 0x30; |
cholletisaik777 | 0:bcbd76c86cde | 59 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 60 | tm_pointer->TM_string[2] = (uint8_t)(flash_counter); |
cholletisaik777 | 0:bcbd76c86cde | 61 | for(uint8_t i=0;i<8;i++) |
cholletisaik777 | 0:bcbd76c86cde | 62 | { |
cholletisaik777 | 0:bcbd76c86cde | 63 | tm_pointer->TM_string[3+i] = data[i+128*flash_counter]; |
cholletisaik777 | 0:bcbd76c86cde | 64 | } |
cholletisaik777 | 0:bcbd76c86cde | 65 | crc16 = CRC::crc16_gen(tm->TM_string,9); |
cholletisaik777 | 0:bcbd76c86cde | 66 | tm_pointer->TM_string[9] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 67 | tm_pointer->TM_string[10] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 68 | tm_pointer = tm_pointer->next_TM; |
cholletisaik777 | 0:bcbd76c86cde | 69 | nbytes-=128; |
cholletisaik777 | 0:bcbd76c86cde | 70 | flash_counter++; |
cholletisaik777 | 0:bcbd76c86cde | 71 | } |
cholletisaik777 | 0:bcbd76c86cde | 72 | if(nbytes>0) |
cholletisaik777 | 0:bcbd76c86cde | 73 | { |
cholletisaik777 | 0:bcbd76c86cde | 74 | tm_pointer->TM_string[0] = 0x30; |
cholletisaik777 | 0:bcbd76c86cde | 75 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 76 | tm_pointer->TM_string[2] = (uint8_t)((flash_counter&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 77 | tm_pointer->TM_string[3] = (uint8_t)(flash_counter&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 78 | for(uint8_t i=0;i<nbytes;i++) |
cholletisaik777 | 0:bcbd76c86cde | 79 | { |
cholletisaik777 | 0:bcbd76c86cde | 80 | tm_pointer->TM_string[4+i] = data[i+128*flash_counter]; |
cholletisaik777 | 0:bcbd76c86cde | 81 | } |
cholletisaik777 | 0:bcbd76c86cde | 82 | for(uint8_t i=nbytes;i<128;i++) |
cholletisaik777 | 0:bcbd76c86cde | 83 | { |
cholletisaik777 | 0:bcbd76c86cde | 84 | tm_pointer->TM_string[4+i] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 85 | } |
cholletisaik777 | 0:bcbd76c86cde | 86 | crc16 = CRC::crc16_gen(tm->TM_string,132); |
cholletisaik777 | 0:bcbd76c86cde | 87 | tm_pointer->TM_string[132] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 88 | tm_pointer->TM_string[133] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 89 | } |
cholletisaik777 | 0:bcbd76c86cde | 90 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 91 | } |
cholletisaik777 | 0:bcbd76c86cde | 92 | else if (GETpid(tc)==0x22) |
cholletisaik777 | 0:bcbd76c86cde | 93 | { |
cholletisaik777 | 0:bcbd76c86cde | 94 | printf("RD_S_FLASH\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 95 | mid1 = ((((uint16_t)tc->TC_string[5])<<8)|(uint16_t)(tc->TC_string[6])); |
cholletisaik777 | 0:bcbd76c86cde | 96 | mid2 = ((((uint16_t)tc->TC_string[7])<<8)|(uint16_t)(tc->TC_string[8])); |
cholletisaik777 | 0:bcbd76c86cde | 97 | Nbytes = (((mid2-mid1)*32)/8)+4; |
cholletisaik777 | 0:bcbd76c86cde | 98 | uint8_t data[4*Nbytes]; |
cholletisaik777 | 0:bcbd76c86cde | 99 | for(uint8_t i=0;i<mid2-mid1+1;i++) |
cholletisaik777 | 0:bcbd76c86cde | 100 | { |
cholletisaik777 | 0:bcbd76c86cde | 101 | Data = FCTN_CDMS_RD_FLASH(mid1+i); |
cholletisaik777 | 0:bcbd76c86cde | 102 | data[4*i] = (uint8_t)((Data&0xFF000000)>>24); |
cholletisaik777 | 0:bcbd76c86cde | 103 | data[4*i+1] = (uint8_t)((Data&0xFF000000)>>16); |
cholletisaik777 | 0:bcbd76c86cde | 104 | data[4*i+2] = (uint8_t)((Data&0xFF000000)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 105 | data[4*i+3] = (uint8_t)(Data&0xFF000000); |
cholletisaik777 | 0:bcbd76c86cde | 106 | } |
cholletisaik777 | 0:bcbd76c86cde | 107 | nbytes = Nbytes; |
cholletisaik777 | 0:bcbd76c86cde | 108 | flash_counter = 0; |
cholletisaik777 | 0:bcbd76c86cde | 109 | while(nbytes>=8) |
cholletisaik777 | 0:bcbd76c86cde | 110 | { |
cholletisaik777 | 0:bcbd76c86cde | 111 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 112 | tm_pointer->TM_string[0] = 0xC0; |
cholletisaik777 | 0:bcbd76c86cde | 113 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 114 | tm_pointer->TM_string[2] = (uint8_t)(flash_counter); |
cholletisaik777 | 0:bcbd76c86cde | 115 | for(uint8_t i=0;i<8;i++) |
cholletisaik777 | 0:bcbd76c86cde | 116 | { |
cholletisaik777 | 0:bcbd76c86cde | 117 | tm_pointer->TM_string[3+i] = data[i+8*flash_counter]; |
cholletisaik777 | 0:bcbd76c86cde | 118 | } |
cholletisaik777 | 0:bcbd76c86cde | 119 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 120 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 121 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 122 | tm_pointer = tm_pointer->next_TM; |
cholletisaik777 | 0:bcbd76c86cde | 123 | nbytes-=8; |
cholletisaik777 | 0:bcbd76c86cde | 124 | flash_counter++; |
cholletisaik777 | 0:bcbd76c86cde | 125 | } |
cholletisaik777 | 0:bcbd76c86cde | 126 | if(nbytes>0) |
cholletisaik777 | 0:bcbd76c86cde | 127 | { |
cholletisaik777 | 0:bcbd76c86cde | 128 | tm_pointer->TM_string[0] = 0xC0; |
cholletisaik777 | 0:bcbd76c86cde | 129 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 130 | tm_pointer->TM_string[2] = (uint8_t)(flash_counter); |
cholletisaik777 | 0:bcbd76c86cde | 131 | for(uint8_t i=0;i<nbytes;i++) |
cholletisaik777 | 0:bcbd76c86cde | 132 | { |
cholletisaik777 | 0:bcbd76c86cde | 133 | tm_pointer->TM_string[3+i] = data[i+8*flash_counter]; |
cholletisaik777 | 0:bcbd76c86cde | 134 | } |
cholletisaik777 | 0:bcbd76c86cde | 135 | for(uint8_t i=nbytes;i<128;i++) |
cholletisaik777 | 0:bcbd76c86cde | 136 | { |
cholletisaik777 | 0:bcbd76c86cde | 137 | tm_pointer->TM_string[3+i] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 138 | } |
cholletisaik777 | 0:bcbd76c86cde | 139 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 140 | tm_pointer->TM_string[132] = (uint8_t)((crc16&0xFF00)>>2); |
cholletisaik777 | 0:bcbd76c86cde | 141 | tm_pointer->TM_string[133] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 142 | } |
cholletisaik777 | 0:bcbd76c86cde | 143 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 144 | } |
cholletisaik777 | 0:bcbd76c86cde | 145 | else if (GETpid(tc)==0x42) |
cholletisaik777 | 0:bcbd76c86cde | 146 | { |
cholletisaik777 | 0:bcbd76c86cde | 147 | printf("RD_L_RAM\r\r\n"); //to be discussed which RAM variables are to read; |
cholletisaik777 | 0:bcbd76c86cde | 148 | tm_pointer = new Short_tm; //for now sending ACKL234 |
cholletisaik777 | 0:bcbd76c86cde | 149 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 150 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 151 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 152 | tm_pointer->TM_string[3] = ACKCODE; |
cholletisaik777 | 0:bcbd76c86cde | 153 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 154 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 155 | { |
cholletisaik777 | 0:bcbd76c86cde | 156 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 157 | } |
cholletisaik777 | 0:bcbd76c86cde | 158 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 159 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 160 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 161 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 162 | } |
cholletisaik777 | 0:bcbd76c86cde | 163 | else if (GETpid(tc)==0x62) |
cholletisaik777 | 0:bcbd76c86cde | 164 | { |
cholletisaik777 | 0:bcbd76c86cde | 165 | printf("RD_S_RAM\r\r\n"); //to be discussed which RAM variables are to read; |
cholletisaik777 | 0:bcbd76c86cde | 166 | tm_pointer = new Short_tm; //for now sending ACKL234 |
cholletisaik777 | 0:bcbd76c86cde | 167 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 168 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 169 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 170 | tm_pointer->TM_string[3] = ACKCODE; |
cholletisaik777 | 0:bcbd76c86cde | 171 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 172 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 173 | { |
cholletisaik777 | 0:bcbd76c86cde | 174 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 175 | } |
cholletisaik777 | 0:bcbd76c86cde | 176 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 177 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 178 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 179 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 180 | } |
cholletisaik777 | 0:bcbd76c86cde | 181 | else |
cholletisaik777 | 0:bcbd76c86cde | 182 | { |
cholletisaik777 | 0:bcbd76c86cde | 183 | printf("INVALID TC\r\n"); //Send Invalid TC Telemetry |
cholletisaik777 | 0:bcbd76c86cde | 184 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 185 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 186 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 187 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 188 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 189 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 190 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 191 | { |
cholletisaik777 | 0:bcbd76c86cde | 192 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 193 | } |
cholletisaik777 | 0:bcbd76c86cde | 194 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 195 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 196 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 197 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 198 | } |
cholletisaik777 | 0:bcbd76c86cde | 199 | break; |
cholletisaik777 | 0:bcbd76c86cde | 200 | } |
cholletisaik777 | 0:bcbd76c86cde | 201 | case 5: |
cholletisaik777 | 0:bcbd76c86cde | 202 | { |
cholletisaik777 | 0:bcbd76c86cde | 203 | printf("WRITE ON MEMORY\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 204 | switch(GETpid(tc)) |
cholletisaik777 | 0:bcbd76c86cde | 205 | { |
cholletisaik777 | 0:bcbd76c86cde | 206 | case 0: |
cholletisaik777 | 0:bcbd76c86cde | 207 | { |
cholletisaik777 | 0:bcbd76c86cde | 208 | printf("WR_S_FLASH\r\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 209 | mid = ((uint16_t)tc->TC_string[4]); |
cholletisaik777 | 0:bcbd76c86cde | 210 | block = (((uint32_t)(tc->TC_string[5])<<24)|((uint32_t)(tc->TC_string[5])<<16)|((uint32_t)(tc->TC_string[5])<<8)|((uint32_t)(tc->TC_string[5]))); |
cholletisaik777 | 0:bcbd76c86cde | 211 | FCTN_CDMS_WR_FLASH(mid,block); |
cholletisaik777 | 0:bcbd76c86cde | 212 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 213 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 214 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 215 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 216 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 217 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 218 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 219 | { |
cholletisaik777 | 0:bcbd76c86cde | 220 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 221 | } |
cholletisaik777 | 0:bcbd76c86cde | 222 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 223 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 224 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 225 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 226 | break; |
cholletisaik777 | 0:bcbd76c86cde | 227 | } |
cholletisaik777 | 0:bcbd76c86cde | 228 | case 1: |
cholletisaik777 | 0:bcbd76c86cde | 229 | { |
cholletisaik777 | 0:bcbd76c86cde | 230 | printf("WR_S_RAM\r\r\n"); //RAM variables to be written is to be decided |
cholletisaik777 | 0:bcbd76c86cde | 231 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 232 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 233 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 234 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 235 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 236 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 237 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 238 | { |
cholletisaik777 | 0:bcbd76c86cde | 239 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 240 | } |
cholletisaik777 | 0:bcbd76c86cde | 241 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 242 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 243 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 244 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 245 | break; |
cholletisaik777 | 0:bcbd76c86cde | 246 | } |
cholletisaik777 | 0:bcbd76c86cde | 247 | case 16: |
cholletisaik777 | 0:bcbd76c86cde | 248 | { |
cholletisaik777 | 0:bcbd76c86cde | 249 | printf("WR_L_FLASH\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 250 | mid = ((uint16_t)tc->TC_string[4]); |
cholletisaik777 | 0:bcbd76c86cde | 251 | for(uint8_t i=0;i<32;i++) |
cholletisaik777 | 0:bcbd76c86cde | 252 | { |
cholletisaik777 | 0:bcbd76c86cde | 253 | block = (((uint32_t)(tc->TC_string[5])<<24)|((uint32_t)(tc->TC_string[5])<<16)|((uint32_t)(tc->TC_string[5])<<8)|((uint32_t)(tc->TC_string[5]))); |
cholletisaik777 | 0:bcbd76c86cde | 254 | FCTN_CDMS_WR_FLASH(mid+i,block); |
cholletisaik777 | 0:bcbd76c86cde | 255 | } |
cholletisaik777 | 0:bcbd76c86cde | 256 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 257 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 258 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 259 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 260 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 261 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 262 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 263 | { |
cholletisaik777 | 0:bcbd76c86cde | 264 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 265 | } |
cholletisaik777 | 0:bcbd76c86cde | 266 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 267 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 268 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 269 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 270 | break; |
pradeepvk2208 | 1:aa24178260d2 | 271 | |
cholletisaik777 | 0:bcbd76c86cde | 272 | } |
cholletisaik777 | 0:bcbd76c86cde | 273 | case 17: |
cholletisaik777 | 0:bcbd76c86cde | 274 | { |
cholletisaik777 | 0:bcbd76c86cde | 275 | printf("WR_L_RAM\r\r\n"); //RAM variables to be written is to be decided |
cholletisaik777 | 0:bcbd76c86cde | 276 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 277 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 278 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 279 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 280 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 281 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 282 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 283 | { |
cholletisaik777 | 0:bcbd76c86cde | 284 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 285 | } |
cholletisaik777 | 0:bcbd76c86cde | 286 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 287 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 288 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 289 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 290 | break; |
cholletisaik777 | 0:bcbd76c86cde | 291 | } |
cholletisaik777 | 0:bcbd76c86cde | 292 | default: |
cholletisaik777 | 0:bcbd76c86cde | 293 | { |
cholletisaik777 | 0:bcbd76c86cde | 294 | printf("INVALID TC"); //send invalid TC TM |
cholletisaik777 | 0:bcbd76c86cde | 295 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 296 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 297 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 298 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 299 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 300 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 301 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 302 | { |
cholletisaik777 | 0:bcbd76c86cde | 303 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 304 | } |
cholletisaik777 | 0:bcbd76c86cde | 305 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 306 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 307 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 308 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 309 | break; |
cholletisaik777 | 0:bcbd76c86cde | 310 | } |
cholletisaik777 | 0:bcbd76c86cde | 311 | } |
cholletisaik777 | 0:bcbd76c86cde | 312 | break; |
cholletisaik777 | 0:bcbd76c86cde | 313 | } |
cholletisaik777 | 0:bcbd76c86cde | 314 | // case 6: |
cholletisaik777 | 0:bcbd76c86cde | 315 | // { |
cholletisaik777 | 0:bcbd76c86cde | 316 | // printf("WRITE FROM ONE MEMORY TO ANOTHER\r\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 317 | // switch(appdata[0]) |
cholletisaik777 | 0:bcbd76c86cde | 318 | // { |
cholletisaik777 | 0:bcbd76c86cde | 319 | // case 0: |
cholletisaik777 | 0:bcbd76c86cde | 320 | // { |
cholletisaik777 | 0:bcbd76c86cde | 321 | // printf("WR_S_FLASH\r\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 322 | // telemetry_type2[0]=0XB0; |
cholletisaik777 | 0:bcbd76c86cde | 323 | // telemetry_type2[1]=tc_pac_seq_cnt_tm; |
cholletisaik777 | 0:bcbd76c86cde | 324 | // telemetry_type2[2]=tm_pac_seq_cnt_tm; |
cholletisaik777 | 0:bcbd76c86cde | 325 | // telemetry_type2[3]=ackcode_tm; |
cholletisaik777 | 0:bcbd76c86cde | 326 | // for(int i=4;i<11;i++) |
cholletisaik777 | 0:bcbd76c86cde | 327 | // { |
cholletisaik777 | 0:bcbd76c86cde | 328 | // telemetry_type2[i]=0X00; |
cholletisaik777 | 0:bcbd76c86cde | 329 | // } |
cholletisaik777 | 0:bcbd76c86cde | 330 | // break; |
cholletisaik777 | 0:bcbd76c86cde | 331 | // } |
cholletisaik777 | 0:bcbd76c86cde | 332 | // case 1: |
cholletisaik777 | 0:bcbd76c86cde | 333 | // { |
cholletisaik777 | 0:bcbd76c86cde | 334 | // printf("WR_S_RAM\r\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 335 | // telemetry_type2[0]=0XB0; |
cholletisaik777 | 0:bcbd76c86cde | 336 | // telemetry_type2[1]=tc_pac_seq_cnt_tm; |
cholletisaik777 | 0:bcbd76c86cde | 337 | // telemetry_type2[2]=tm_pac_seq_cnt_tm; |
cholletisaik777 | 0:bcbd76c86cde | 338 | // telemetry_type2[3]=ackcode_tm; |
cholletisaik777 | 0:bcbd76c86cde | 339 | // for(int i=4;i<11;i++) |
cholletisaik777 | 0:bcbd76c86cde | 340 | // { |
cholletisaik777 | 0:bcbd76c86cde | 341 | // telemetry_type2[i]=0X00; |
cholletisaik777 | 0:bcbd76c86cde | 342 | // } |
cholletisaik777 | 0:bcbd76c86cde | 343 | // break; |
cholletisaik777 | 0:bcbd76c86cde | 344 | // } |
cholletisaik777 | 0:bcbd76c86cde | 345 | // case 16: |
cholletisaik777 | 0:bcbd76c86cde | 346 | // { |
cholletisaik777 | 0:bcbd76c86cde | 347 | // printf("WR_L_FLASH\r\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 348 | // telemetry_type2[0]=0XB0; |
cholletisaik777 | 0:bcbd76c86cde | 349 | // telemetry_type2[1]=tc_pac_seq_cnt_tm; |
cholletisaik777 | 0:bcbd76c86cde | 350 | // telemetry_type2[2]=tm_pac_seq_cnt_tm; |
cholletisaik777 | 0:bcbd76c86cde | 351 | // telemetry_type2[3]=ackcode_tm; |
cholletisaik777 | 0:bcbd76c86cde | 352 | // for(int i=4;i<11;i++) |
cholletisaik777 | 0:bcbd76c86cde | 353 | // { |
cholletisaik777 | 0:bcbd76c86cde | 354 | // telemetry_type2[i]=0X00; |
cholletisaik777 | 0:bcbd76c86cde | 355 | // } |
cholletisaik777 | 0:bcbd76c86cde | 356 | // break; |
cholletisaik777 | 0:bcbd76c86cde | 357 | // } |
cholletisaik777 | 0:bcbd76c86cde | 358 | // case 17: |
cholletisaik777 | 0:bcbd76c86cde | 359 | // { |
cholletisaik777 | 0:bcbd76c86cde | 360 | // printf("WR_L_RAM\r\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 361 | // telemetry_type2[0]=0XB0; |
cholletisaik777 | 0:bcbd76c86cde | 362 | // telemetry_type2[1]=tc_pac_seq_cnt_tm; |
cholletisaik777 | 0:bcbd76c86cde | 363 | // telemetry_type2[2]=tm_pac_seq_cnt_tm; |
cholletisaik777 | 0:bcbd76c86cde | 364 | // telemetry_type2[3]=ackcode_tm; |
cholletisaik777 | 0:bcbd76c86cde | 365 | // for(int i=4;i<11;i++) |
cholletisaik777 | 0:bcbd76c86cde | 366 | // { |
cholletisaik777 | 0:bcbd76c86cde | 367 | // telemetry_type2[i]=0X00; |
cholletisaik777 | 0:bcbd76c86cde | 368 | // } |
cholletisaik777 | 0:bcbd76c86cde | 369 | // break; |
cholletisaik777 | 0:bcbd76c86cde | 370 | // } |
cholletisaik777 | 0:bcbd76c86cde | 371 | // default: |
cholletisaik777 | 0:bcbd76c86cde | 372 | // { |
cholletisaik777 | 0:bcbd76c86cde | 373 | // printf("INVALID TC"); //send invalid TC TM |
cholletisaik777 | 0:bcbd76c86cde | 374 | // break; |
cholletisaik777 | 0:bcbd76c86cde | 375 | // } |
cholletisaik777 | 0:bcbd76c86cde | 376 | // } |
cholletisaik777 | 0:bcbd76c86cde | 377 | // break; |
cholletisaik777 | 0:bcbd76c86cde | 378 | // } |
cholletisaik777 | 0:bcbd76c86cde | 379 | case 9: |
cholletisaik777 | 0:bcbd76c86cde | 380 | { |
cholletisaik777 | 0:bcbd76c86cde | 381 | printf("SEND CRC OF FLASH MEMORY\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 382 | if(GETpid(tc)==2) |
cholletisaik777 | 0:bcbd76c86cde | 383 | { |
cholletisaik777 | 0:bcbd76c86cde | 384 | printf("GET_FLASH_CRC\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 385 | mid1 = ((((uint16_t)tc->TC_string[5])<<8)|(uint16_t)(tc->TC_string[6])); |
cholletisaik777 | 0:bcbd76c86cde | 386 | mid2 = ((((uint16_t)tc->TC_string[7])<<8)|(uint16_t)(tc->TC_string[8])); |
cholletisaik777 | 0:bcbd76c86cde | 387 | Nbytes = (((mid2-mid1)*32)/8)+4; |
cholletisaik777 | 0:bcbd76c86cde | 388 | uint8_t data[4*Nbytes]; |
cholletisaik777 | 0:bcbd76c86cde | 389 | uint8_t flash_counter = 0; |
cholletisaik777 | 0:bcbd76c86cde | 390 | tm_pointer = new Long_tm; |
cholletisaik777 | 0:bcbd76c86cde | 391 | tm_pointer->TM_string[0] = 0x80; |
cholletisaik777 | 0:bcbd76c86cde | 392 | tm_pointer->TM_string[1] = 0x00; //spare |
cholletisaik777 | 0:bcbd76c86cde | 393 | tm_pointer->TM_string[2] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 394 | tm_pointer->TM_string[3] = (uint8_t)(flash_counter); |
cholletisaik777 | 0:bcbd76c86cde | 395 | for(uint8_t i=0;i<mid2-mid1+1;i++) |
cholletisaik777 | 0:bcbd76c86cde | 396 | { |
cholletisaik777 | 0:bcbd76c86cde | 397 | Data = FCTN_CDMS_RD_FLASH(mid1+i); |
cholletisaik777 | 0:bcbd76c86cde | 398 | data[4*i] = (uint8_t)((Data&0xFF000000)>>24); |
cholletisaik777 | 0:bcbd76c86cde | 399 | data[4*i+1] = (uint8_t)((Data&0xFF000000)>>16); |
cholletisaik777 | 0:bcbd76c86cde | 400 | data[4*i+2] = (uint8_t)((Data&0xFF000000)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 401 | data[4*i+3] = (uint8_t)(Data&0xFF000000); |
cholletisaik777 | 0:bcbd76c86cde | 402 | } |
cholletisaik777 | 0:bcbd76c86cde | 403 | nbytes = Nbytes; |
cholletisaik777 | 0:bcbd76c86cde | 404 | while(nbytes>=32) |
cholletisaik777 | 0:bcbd76c86cde | 405 | { |
cholletisaik777 | 0:bcbd76c86cde | 406 | crc16 = CRC::crc16_gen((data+32*flash_counter),32); |
cholletisaik777 | 0:bcbd76c86cde | 407 | tm_pointer->TM_string[11+2*flash_counter] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 408 | tm_pointer->TM_string[12+2*flash_counter] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 409 | nbytes-=32; |
cholletisaik777 | 0:bcbd76c86cde | 410 | flash_counter++; |
cholletisaik777 | 0:bcbd76c86cde | 411 | } |
cholletisaik777 | 0:bcbd76c86cde | 412 | if(nbytes>0) |
cholletisaik777 | 0:bcbd76c86cde | 413 | { |
cholletisaik777 | 0:bcbd76c86cde | 414 | crc16 = CRC::crc16_gen((data+32*flash_counter),nbytes); |
cholletisaik777 | 0:bcbd76c86cde | 415 | tm_pointer->TM_string[11+2*flash_counter] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 416 | tm_pointer->TM_string[12+2*flash_counter] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 417 | } |
cholletisaik777 | 0:bcbd76c86cde | 418 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 419 | } |
cholletisaik777 | 0:bcbd76c86cde | 420 | else |
cholletisaik777 | 0:bcbd76c86cde | 421 | { |
cholletisaik777 | 0:bcbd76c86cde | 422 | printf("INVALID TC"); //Send Invalid TC Telemetry |
cholletisaik777 | 0:bcbd76c86cde | 423 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 424 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 425 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 426 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 427 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 428 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 429 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 430 | { |
cholletisaik777 | 0:bcbd76c86cde | 431 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 432 | } |
cholletisaik777 | 0:bcbd76c86cde | 433 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 434 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 435 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 436 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 437 | } |
cholletisaik777 | 0:bcbd76c86cde | 438 | break; |
pradeepvk2208 | 1:aa24178260d2 | 439 | |
pradeepvk2208 | 1:aa24178260d2 | 440 | } |
pradeepvk2208 | 1:aa24178260d2 | 441 | } |
pradeepvk2208 | 1:aa24178260d2 | 442 | |
cholletisaik777 | 0:bcbd76c86cde | 443 | case 8: |
cholletisaik777 | 0:bcbd76c86cde | 444 | { |
cholletisaik777 | 0:bcbd76c86cde | 445 | printf("service:FUNCTION MANAGEMENT SERVICE\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 446 | if(GETservice_subtype(tc)==1) |
cholletisaik777 | 0:bcbd76c86cde | 447 | { |
cholletisaik777 | 0:bcbd76c86cde | 448 | if((GETpid(tc)&0xF0)==0x00) |
cholletisaik777 | 0:bcbd76c86cde | 449 | { |
cholletisaik777 | 0:bcbd76c86cde | 450 | printf("RUN_PRCS\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 451 | switch(GETpid(tc)) |
cholletisaik777 | 0:bcbd76c86cde | 452 | { |
cholletisaik777 | 0:bcbd76c86cde | 453 | case 1: |
cholletisaik777 | 0:bcbd76c86cde | 454 | { |
pradeepvk2208 | 1:aa24178260d2 | 455 | printf("P_EPS_INIT\r\n"); //call P_PL_INIT using CDMS_RUN_PRCS |
cholletisaik777 | 0:bcbd76c86cde | 456 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 457 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 458 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 459 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 460 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 461 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 462 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 463 | { |
cholletisaik777 | 0:bcbd76c86cde | 464 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 465 | } |
cholletisaik777 | 0:bcbd76c86cde | 466 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 467 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 468 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 469 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 470 | break; |
cholletisaik777 | 0:bcbd76c86cde | 471 | } |
cholletisaik777 | 0:bcbd76c86cde | 472 | case 2: |
cholletisaik777 | 0:bcbd76c86cde | 473 | { |
pradeepvk2208 | 1:aa24178260d2 | 474 | printf("P_EPS_MAIN\r\n"); //call P_PL_MNGR using CDMS_RUN_PRCS |
cholletisaik777 | 0:bcbd76c86cde | 475 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 476 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 477 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 478 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 479 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 480 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 481 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 482 | { |
cholletisaik777 | 0:bcbd76c86cde | 483 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 484 | } |
cholletisaik777 | 0:bcbd76c86cde | 485 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 486 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 487 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 488 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 489 | break; |
cholletisaik777 | 0:bcbd76c86cde | 490 | } |
cholletisaik777 | 0:bcbd76c86cde | 491 | case 3: |
cholletisaik777 | 0:bcbd76c86cde | 492 | { |
pradeepvk2208 | 1:aa24178260d2 | 493 | printf("P_ACS_INIT\r\n"); //call P_COM_INIT using CDMS_RUN_PRCS |
cholletisaik777 | 0:bcbd76c86cde | 494 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 495 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 496 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 497 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 498 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 499 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 500 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 501 | { |
cholletisaik777 | 0:bcbd76c86cde | 502 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 503 | } |
cholletisaik777 | 0:bcbd76c86cde | 504 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 505 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 506 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 507 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 508 | break; |
cholletisaik777 | 0:bcbd76c86cde | 509 | } |
cholletisaik777 | 0:bcbd76c86cde | 510 | case 4: |
cholletisaik777 | 0:bcbd76c86cde | 511 | { |
pradeepvk2208 | 1:aa24178260d2 | 512 | printf("P_ACS_ACQ_DATA\r\n"); //call P_CDMS_HK_MNGR using CDMS_RUN_PRCS |
pradeepvk2208 | 1:aa24178260d2 | 513 | tm_pointer = new Short_tm; |
pradeepvk2208 | 1:aa24178260d2 | 514 | tm_pointer->TM_string[0] = 0xB0; |
pradeepvk2208 | 1:aa24178260d2 | 515 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
pradeepvk2208 | 1:aa24178260d2 | 516 | tm_pointer->TM_string[2] = 0x01; |
pradeepvk2208 | 1:aa24178260d2 | 517 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
pradeepvk2208 | 1:aa24178260d2 | 518 | tm_pointer->TM_string[4] = 0x01; |
pradeepvk2208 | 1:aa24178260d2 | 519 | for(uint8_t i=0;i<6;i++) |
pradeepvk2208 | 1:aa24178260d2 | 520 | { |
pradeepvk2208 | 1:aa24178260d2 | 521 | tm_pointer->TM_string[i+5] = 0; |
pradeepvk2208 | 1:aa24178260d2 | 522 | } |
pradeepvk2208 | 1:aa24178260d2 | 523 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
pradeepvk2208 | 1:aa24178260d2 | 524 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
pradeepvk2208 | 1:aa24178260d2 | 525 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
pradeepvk2208 | 1:aa24178260d2 | 526 | return tm; |
pradeepvk2208 | 1:aa24178260d2 | 527 | break; |
pradeepvk2208 | 1:aa24178260d2 | 528 | } |
pradeepvk2208 | 1:aa24178260d2 | 529 | case 5: |
pradeepvk2208 | 1:aa24178260d2 | 530 | { |
pradeepvk2208 | 1:aa24178260d2 | 531 | printf("P_ACS_MAIN\r\n"); //call P_CDMS_HK_MNGR using CDMS_RUN_PRCS |
pradeepvk2208 | 1:aa24178260d2 | 532 | tm_pointer = new Short_tm; |
pradeepvk2208 | 1:aa24178260d2 | 533 | tm_pointer->TM_string[0] = 0xB0; |
pradeepvk2208 | 1:aa24178260d2 | 534 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
pradeepvk2208 | 1:aa24178260d2 | 535 | tm_pointer->TM_string[2] = 0x01; |
pradeepvk2208 | 1:aa24178260d2 | 536 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
pradeepvk2208 | 1:aa24178260d2 | 537 | tm_pointer->TM_string[4] = 0x01; |
pradeepvk2208 | 1:aa24178260d2 | 538 | for(uint8_t i=0;i<6;i++) |
pradeepvk2208 | 1:aa24178260d2 | 539 | { |
pradeepvk2208 | 1:aa24178260d2 | 540 | tm_pointer->TM_string[i+5] = 0; |
pradeepvk2208 | 1:aa24178260d2 | 541 | } |
pradeepvk2208 | 1:aa24178260d2 | 542 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
pradeepvk2208 | 1:aa24178260d2 | 543 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
pradeepvk2208 | 1:aa24178260d2 | 544 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
pradeepvk2208 | 1:aa24178260d2 | 545 | return tm; |
pradeepvk2208 | 1:aa24178260d2 | 546 | break; |
pradeepvk2208 | 1:aa24178260d2 | 547 | } |
pradeepvk2208 | 1:aa24178260d2 | 548 | case 6: |
pradeepvk2208 | 1:aa24178260d2 | 549 | { |
pradeepvk2208 | 1:aa24178260d2 | 550 | printf("P_BCN_INIT\r\n"); //call P_CDMS_HK_MNGR using CDMS_RUN_PRCS |
pradeepvk2208 | 1:aa24178260d2 | 551 | tm_pointer = new Short_tm; |
pradeepvk2208 | 1:aa24178260d2 | 552 | tm_pointer->TM_string[0] = 0xB0; |
pradeepvk2208 | 1:aa24178260d2 | 553 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
pradeepvk2208 | 1:aa24178260d2 | 554 | tm_pointer->TM_string[2] = 0x01; |
pradeepvk2208 | 1:aa24178260d2 | 555 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
pradeepvk2208 | 1:aa24178260d2 | 556 | tm_pointer->TM_string[4] = 0x01; |
pradeepvk2208 | 1:aa24178260d2 | 557 | for(uint8_t i=0;i<6;i++) |
pradeepvk2208 | 1:aa24178260d2 | 558 | { |
pradeepvk2208 | 1:aa24178260d2 | 559 | tm_pointer->TM_string[i+5] = 0; |
pradeepvk2208 | 1:aa24178260d2 | 560 | } |
pradeepvk2208 | 1:aa24178260d2 | 561 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
pradeepvk2208 | 1:aa24178260d2 | 562 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
pradeepvk2208 | 1:aa24178260d2 | 563 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
pradeepvk2208 | 1:aa24178260d2 | 564 | return tm; |
pradeepvk2208 | 1:aa24178260d2 | 565 | break; |
pradeepvk2208 | 1:aa24178260d2 | 566 | } |
pradeepvk2208 | 1:aa24178260d2 | 567 | case 7: |
pradeepvk2208 | 1:aa24178260d2 | 568 | { |
pradeepvk2208 | 1:aa24178260d2 | 569 | printf("P_BCN_MAIN\r\n"); //call P_CDMS_HK_MNGR using CDMS_RUN_PRCS |
cholletisaik777 | 0:bcbd76c86cde | 570 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 571 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 572 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 573 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 574 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 575 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 576 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 577 | { |
cholletisaik777 | 0:bcbd76c86cde | 578 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 579 | } |
cholletisaik777 | 0:bcbd76c86cde | 580 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 581 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 582 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 583 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 584 | break; |
cholletisaik777 | 0:bcbd76c86cde | 585 | } |
cholletisaik777 | 0:bcbd76c86cde | 586 | default: |
cholletisaik777 | 0:bcbd76c86cde | 587 | { |
cholletisaik777 | 0:bcbd76c86cde | 588 | printf("INVALID TC\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 589 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 590 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 591 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 592 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 593 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 594 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 595 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 596 | { |
cholletisaik777 | 0:bcbd76c86cde | 597 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 598 | } |
cholletisaik777 | 0:bcbd76c86cde | 599 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 600 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 601 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 602 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 603 | break; |
cholletisaik777 | 0:bcbd76c86cde | 604 | } |
cholletisaik777 | 0:bcbd76c86cde | 605 | } |
cholletisaik777 | 0:bcbd76c86cde | 606 | } |
cholletisaik777 | 0:bcbd76c86cde | 607 | else if((GETpid(tc)&0xF0)==0x10) |
cholletisaik777 | 0:bcbd76c86cde | 608 | { |
cholletisaik777 | 0:bcbd76c86cde | 609 | printf("PWR_SWCH_ON\r\n"); // call PWR_SWCH_ON function |
cholletisaik777 | 0:bcbd76c86cde | 610 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 611 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 612 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 613 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 614 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 615 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 616 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 617 | { |
cholletisaik777 | 0:bcbd76c86cde | 618 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 619 | } |
cholletisaik777 | 0:bcbd76c86cde | 620 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 621 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 622 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 623 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 624 | break; |
cholletisaik777 | 0:bcbd76c86cde | 625 | } |
cholletisaik777 | 0:bcbd76c86cde | 626 | else if((GETpid(tc)&0xF0)==0x20) |
cholletisaik777 | 0:bcbd76c86cde | 627 | { |
cholletisaik777 | 0:bcbd76c86cde | 628 | printf("PWR_SWCH_OFF\r\n"); // call PWR_SWCH_OFF function |
cholletisaik777 | 0:bcbd76c86cde | 629 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 630 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 631 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 632 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 633 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 634 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 635 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 636 | { |
cholletisaik777 | 0:bcbd76c86cde | 637 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 638 | } |
cholletisaik777 | 0:bcbd76c86cde | 639 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 640 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 641 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 642 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 643 | break; |
cholletisaik777 | 0:bcbd76c86cde | 644 | } |
cholletisaik777 | 0:bcbd76c86cde | 645 | else if((GETpid(tc)&0xF0)==0x20) |
cholletisaik777 | 0:bcbd76c86cde | 646 | { |
cholletisaik777 | 0:bcbd76c86cde | 647 | printf("PWR_RST\r\n"); // call PWR_RST function |
cholletisaik777 | 0:bcbd76c86cde | 648 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 649 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 650 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 651 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 652 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 653 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 654 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 655 | { |
cholletisaik777 | 0:bcbd76c86cde | 656 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 657 | } |
cholletisaik777 | 0:bcbd76c86cde | 658 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 659 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 660 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 661 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 662 | break; |
cholletisaik777 | 0:bcbd76c86cde | 663 | } |
cholletisaik777 | 0:bcbd76c86cde | 664 | else if((GETpid(tc)&0xF0)==0xE0) |
cholletisaik777 | 0:bcbd76c86cde | 665 | { |
cholletisaik777 | 0:bcbd76c86cde | 666 | printf("RD_RTC\r\n"); //call RD_RTC |
cholletisaik777 | 0:bcbd76c86cde | 667 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 668 | tm_pointer->TM_string[0] = 0xD0; |
cholletisaik777 | 0:bcbd76c86cde | 669 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 670 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 671 | uint64_t time = FCTN_CDMS_RD_RTC(); |
cholletisaik777 | 0:bcbd76c86cde | 672 | tm_pointer->TM_string[3] = (uint8_t)((time&0xFF00000000000000)>>56); |
cholletisaik777 | 0:bcbd76c86cde | 673 | tm_pointer->TM_string[4] = (uint8_t)((time&0x00FF000000000000)>>48); |
cholletisaik777 | 0:bcbd76c86cde | 674 | tm_pointer->TM_string[5] = (uint8_t)((time&0x0000FF0000000000)>>40); |
cholletisaik777 | 0:bcbd76c86cde | 675 | tm_pointer->TM_string[6] = (uint8_t)((time&0x000000FF00000000)>>32); |
cholletisaik777 | 0:bcbd76c86cde | 676 | tm_pointer->TM_string[7] = (uint8_t)((time&0x00000000FF000000)>>24); |
cholletisaik777 | 0:bcbd76c86cde | 677 | tm_pointer->TM_string[8] = (uint8_t)((time&0x0000000000FF0000)>>16); |
cholletisaik777 | 0:bcbd76c86cde | 678 | tm_pointer->TM_string[9] = (uint8_t)((time&0x000000000000FF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 679 | tm_pointer->TM_string[10] = (uint8_t)(time&0x00000000000000FF); |
cholletisaik777 | 0:bcbd76c86cde | 680 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 681 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 682 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 683 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 684 | } |
cholletisaik777 | 0:bcbd76c86cde | 685 | else if((GETpid(tc)&0xF0)==0xF0) |
cholletisaik777 | 0:bcbd76c86cde | 686 | { |
cholletisaik777 | 0:bcbd76c86cde | 687 | printf("SD_MNGR\r\n"); //call SD_MNGR function and send required information in FMS TM |
cholletisaik777 | 0:bcbd76c86cde | 688 | tm_pointer = new Short_tm; // for now sending ACK L_234 |
cholletisaik777 | 0:bcbd76c86cde | 689 | tm_pointer->TM_string[0] = 0xD0; |
cholletisaik777 | 0:bcbd76c86cde | 690 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 691 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 692 | for(uint8_t i=3;i<11;i++) |
cholletisaik777 | 0:bcbd76c86cde | 693 | { |
cholletisaik777 | 0:bcbd76c86cde | 694 | tm_pointer->TM_string[i] = 0; // for now filling with zeroes instead of SD_MNGR Data |
cholletisaik777 | 0:bcbd76c86cde | 695 | } |
cholletisaik777 | 0:bcbd76c86cde | 696 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 697 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 698 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 699 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 700 | } |
cholletisaik777 | 0:bcbd76c86cde | 701 | else |
cholletisaik777 | 0:bcbd76c86cde | 702 | { |
cholletisaik777 | 0:bcbd76c86cde | 703 | printf("INVALID TC\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 704 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 705 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 706 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 707 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 708 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 709 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 710 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 711 | { |
cholletisaik777 | 0:bcbd76c86cde | 712 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 713 | } |
cholletisaik777 | 0:bcbd76c86cde | 714 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 715 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 716 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 717 | return tm; |
cholletisaik777 | 0:bcbd76c86cde | 718 | } |
cholletisaik777 | 0:bcbd76c86cde | 719 | } |
cholletisaik777 | 0:bcbd76c86cde | 720 | default: |
cholletisaik777 | 0:bcbd76c86cde | 721 | { |
cholletisaik777 | 0:bcbd76c86cde | 722 | printf("INVALID TC\r\n"); |
cholletisaik777 | 0:bcbd76c86cde | 723 | tm_pointer = new Short_tm; |
cholletisaik777 | 0:bcbd76c86cde | 724 | tm_pointer->TM_string[0] = 0xB0; |
cholletisaik777 | 0:bcbd76c86cde | 725 | tm_pointer->TM_string[1] = GETpacket_seq_count(tc); |
cholletisaik777 | 0:bcbd76c86cde | 726 | tm_pointer->TM_string[2] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 727 | tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided |
cholletisaik777 | 0:bcbd76c86cde | 728 | tm_pointer->TM_string[4] = 0x01; |
cholletisaik777 | 0:bcbd76c86cde | 729 | for(uint8_t i=0;i<6;i++) |
cholletisaik777 | 0:bcbd76c86cde | 730 | { |
cholletisaik777 | 0:bcbd76c86cde | 731 | tm_pointer->TM_string[i+5] = 0; |
cholletisaik777 | 0:bcbd76c86cde | 732 | } |
cholletisaik777 | 0:bcbd76c86cde | 733 | crc16 = CRC::crc16_gen(tm->TM_string,11); |
cholletisaik777 | 0:bcbd76c86cde | 734 | tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8); |
cholletisaik777 | 0:bcbd76c86cde | 735 | tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF); |
cholletisaik777 | 0:bcbd76c86cde | 736 | return tm; |
pradeepvk2208 | 1:aa24178260d2 | 737 | |
cholletisaik777 | 0:bcbd76c86cde | 738 | } |
cholletisaik777 | 0:bcbd76c86cde | 739 | break; |
pradeepvk2208 | 1:aa24178260d2 | 740 | } |
pradeepvk2208 | 1:aa24178260d2 | 741 | } |
pradeepvk2208 | 1:aa24178260d2 | 742 | } |
pradeepvk2208 | 1:aa24178260d2 | 743 | } |
pradeepvk2208 | 1:aa24178260d2 | 744 |