![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
bae
Fork of telecommand_bae by
main.cpp
- Committer:
- cholletisaik777
- Date:
- 2015-05-21
- Revision:
- 0:b9b1bedf49e5
File content as of revision 0:b9b1bedf49e5:
funtion BAE_RLY_TMTC{ uint8_t los; uint8_t tcp[los*124+11]; st=(tcp[2]&0xF0)>>4; sst=(tcp[2]&0x0F); switch(st){ case 6:printf("memory management system\n"); switch(sst){ case 1:printf("READ FROM MEMORY\n"); if(tcp[3]==2){ //tcp[3] is pid printf("RD_L_FLASH1\n"); uint8_t lmb_tm[128],crc_tm[2]; uint8_t tmp[130]; for(int i=0;i<128;i++){ tmp[i]=lmb_tm[i-1]; } for(int i=128;i<130;i++){ tmp[i]=crc_tm[i-128]; } } else if ((tcp[3]&0xF0)==0x10){ printf("RD_L_FLASH2\n"); uint8_t lmb_tm[128],crc_tm[2]; uint8_t tmp[130]; for(int i=0;i<128;i++){ tmp[i]=lmb_tm[i-1]; } for(int i=128;i<130;i++){ tmp[i]=crc_tm[i-128]; } } else if (tcp[3]==0x22){ printf("RD_S_FLASH1\n"); uint8_t tmid_spr_tm=0xC0,tc_psc_tm,tm_psc_tm,smb_tm[8],crc_tm[2]; uint8_t tmp[13]; tmp[0]=tmid_spr_tm; tmp[1]=tc_psc_tm; tmp[2]=tm_psc_tm; tmp[3]=ackcode_tm; for(int i=3;i<11;i++){ tmp[i]=smb_tm[i-3]; } for(int i=11;i<13;i++){ tmp[i]=crc_tm[i-11]; } } else if ((tcp[3]&0xF0)==0x30){ printf("RD_S_FLASH2\n"); uint8_t tmid_spr_tm=0xC0,tc_psc_tm,tm_psc_tm,smb_tm[8],crc_tm[2]; uint8_t tmp[13]; tmp[0]=tmid_spr_tm; tmp[1]=tc_psc_tm; tmp[2]=tm_psc_tm; tmp[3]=ackcode_tm; for(int i=3;i<11;i++){ tmp[i]=smb_tm[i-3]; } for(int i=11;i<13;i++){ tmp[i]=crc_tm[i-11]; } } else if (tcp[3]==0x42){ printf("RD_L_RAM1\n"); uint8_t lmb_tm[128],crc_tm[2]; uint8_t tmp[130]; for(int i=0;i<128;i++){ tmp[i]=lmb_tm[i-1]; } for(int i=128;i<130;i++){ tmp[i]=crc_tm[i-128]; } } else if ((tcp[3]&0xF0)==0x50){ printf("RD_L_RAM2\n"); uint8_t lmb_tm[128],crc_tm[2]; uint8_t tmp[130]; for(int i=0;i<128;i++){ tmp[i]=lmb_tm[i-1]; } for(int i=128;i<130;i++){ tmp[i]=crc_tm[i-128]; } } else if (tcp[3]==0x62){ printf("RD_S_RAM\n"); uint8_t tmid_spr_tm=0xC0,tc_psc_tm,tm_psc_tm,smb_tm[8],crc_tm[2]; uint8_t tmp[13]; tmp[0]=tmid_spr_tm; tmp[1]=tc_psc_tm; tmp[2]=tm_psc_tm; tmp[3]=ackcode_tm; for(int i=3;i<11;i++){ tmp[i]=smb_tm[i-3]; } for(int i=11;i<13;i++){ tmp[i]=crc_tm[i-11]; } } else if ((tcp[3]&0xF0)==0x70){ printf("RD_S_RAM2\n"); uint8_t tmid_spr_tm=0xC0,tc_psc_tm,tm_psc_tm,smb_tm[8],crc_tm[2]; uint8_t tmp[13]; tmp[0]=tmid_spr_tm; tmp[1]=tc_psc_tm; tmp[2]=tm_psc_tm; tmp[3]=ackcode_tm; for(int i=3;i<11;i++){ tmp[i]=smb_tm[i-3]; } for(int i=11;i<13;i++){ tmp[i]=crc_tm[i-11]; } } break; case 5:printf("WRITE ON MEMORY\n"); switch(tcp[3]){ case 0:printf("WR_S_FLASH\n"); break; case 1:printf("WR_S_RAM\n"); break; case 16:printf("WR_L_FLASH\n"); break; case 17:printf("WR_L_RAM\n"); break; } break; case 6:printf("WRITE FROM ONE MEMORY TO ANOTHER\n"); switch(tcp[3]){ case 0:printf("WR_S_FLASH\n"); break; case 1:printf("WR_S_RAM\n"); break; case 16:printf("WR_L_FLASH\n"); break; case 17:printf("WR_L_RAM\n"); break; } break; case 9:printf("SEND CRC OF FLASH MEMORY\n"); if(tcp[3]==2){ printf("GET_FLASH_CRC\n"); uint8_t crc1_tm[2],crc2_tm[2],crc_tm[2]; uint8_t tmp[130]; for(int i=0;i<2;i++){ tmp[i]=crc1_tm[i]; } for(int i=2;i<4;i++){ tmp[i]=crc2_tm[i-2]; } for(int i=128;i<130;i++){ tmp[i]=crc_tm[i-128]; } } break; } break; case 8:printf("FUNCTION MANAGEMENT SERVICE\n"); if(sst==1){ if((tcp[3]&0xF0)==0x00){ printf("RUN_PRCS\n"); switch(tcp[3]){ case 1:printf("P_EPS_INIT\n"); break; case 2:printf("P_EPS_MAIN\n"); break; case 3:printf("P_ACS_INIT\n"); break; case 4:printf("P_ACS_ACQ_DATA\n"); break; case 5:printf("P_ACS_MAIN\n"); break; case 6:printf("P_BCN_INIT\n"); break; case 7:printf("P_BCN_MAIN\n"); break; } } else if((tcp[3]&0xF0)==0x10){ printf("PWR_SWCH\n"); } else if((tcp[3]&0xF0)==0x20){ printf("PWR_RST\n"); } else if((tcp[3]&0xF0)==0xE0){ printf("COMSN_ACS_ALGO\n"); uint8_t tmid_spr_tm=0xD0,tc_psc_tm,tm_psc_tm,ackcode_tm,crc_tm[2]; uint8_t tmp[13]; tmp[0]=tmid_spr_tm; tmp[1]=tc_psc_tm; tmp[2]=tm_psc_tm; tmp[3]=ackcode_tm; for(int i=3;i<11;i++){ tmp[i]=fms[i-3]; } for(int i=11;i<13;i++){ tmp[i]=crc_tm[i-11]; } } else if((tcp[3]&0xF0)==0xF0){ printf("COMSN_ACS_HW\n"); uint8_t tmid_spr_tm=0xD0,tc_psc_tm,tm_psc_tm,ackcode_tm,crc_tm[2]; uint8_t tmp[13]; tmp[0]=tmid_spr_tm; tmp[1]=tc_psc_tm; tmp[2]=tm_psc_tm; tmp[3]=ackcode_tm; for(int i=3;i<11;i++){ tmp[i]=fms[i-3]; } for(int i=11;i<13;i++){ tmp[i]=crc_tm[i-11]; } } } break; } }