cdms_update
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of CDMS_SD_MNG_OVERDRIVE by
main.cpp
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 #include "pinconfig.h" 00004 #include "cdms_sd.h" 00005 #include "structure.h" 00006 #include "i2c.h" 00007 #include "cdms_rtc.h" 00008 #include "main_funcs.h" 00009 #include "CDMS_HK.h" 00010 #include "TMTC.h" 00011 #include "main.h" 00012 00013 00014 Serial pc(USBTX,USBRX); 00015 00016 Thread *ptr_t_sc_data; 00017 Thread *ptr_t_tmtc; 00018 00019 InterruptIn pl_sc_data(PIN81); 00020 InterruptIn cdms_rcv_tc(PIN38); 00021 extern DigitalOut irpt_2_slv; 00022 00023 00024 /* only for sd testing*/ 00025 uint8_t write_to_sd[512]; 00026 uint8_t read_from_sd[512]; 00027 /*end*/ 00028 00029 Base_tc *tc_test = new Long_tc; 00030 Base_tm *tm_test = new Long_tm; 00031 00032 00033 00034 00035 void TSC_HK_BAE_CDMS_PL_MODE(void const *args) 00036 { 00037 00038 FCTN_CDMS_HK_MAIN(); 00039 00040 } 00041 00042 void BAE_HK() 00043 { 00044 printf("\n\rBAE_HK Function Executed\r\n"); 00045 } 00046 00047 00048 00049 void PL_MODE() 00050 { 00051 printf("\n\rPL_MODE Function Executed\r\n"); 00052 00053 } 00054 00055 void T_CDMS_RLY_TMTC(void const *args) 00056 { 00057 00058 00059 printf("\rin T_CDMS_RLY_TMTC\r\n"); 00060 printf("\r \n Enter a valid TC \n\r"); 00061 uint8_t read; 00062 /* for(int i=0;i <4 ; i++) 00063 { 00064 scanf("%d",&tc_test->TC_string[i]); 00065 }*/ 00066 00067 tc_test->TC_string[0] = 43; 00068 tc_test->TC_string[1] = 0x40; 00069 tc_test->TC_string[2] = 0x81; 00070 tc_test->TC_string[3] = 0x13; 00071 00072 for(int i=4;i < 135 ; i++) 00073 tc_test->TC_string[i] = 43; 00074 printf("%s", tc_test->TC_string); 00075 tm_test = FCTN_CDMS_RLY_TMTC(tc_test); 00076 printf("%s", tm_test->TM_string); 00077 // for(int i =0;i<134;i++)\ 00078 // { 00079 // printf("ack"); 00080 // printf("%c", tm_test->TM_string[i]); 00081 // } 00082 //FUNC_CDMS_RLY_TM(); 00083 00084 } 00085 00086 void T_PL_RCV_SC_DATA(void const *args) 00087 { 00088 while(1) 00089 { 00090 Thread::signal_wait(0x1); 00091 //uint8_t* buff=FCTN_PL_RCV_SC_DATA(); 00092 uint8_t* buff; 00093 FCTN_COM_COMP_SC_DATA(); 00094 FCTN_CDMS_RD_RTC(); 00095 uint8_t fsc=FCTN_SD_MNGR(0x0); 00096 SD_WRITE(buff,fsc,0x0); 00097 /*for(int i=0;i<512;i++) 00098 { 00099 printf("%d",read_from_sd[i]); 00100 }*/ 00101 } 00102 } 00103 00104 void ISR_PL_RCV_SC_DATA() 00105 { 00106 ptr_t_sc_data->signal_set(0x1); 00107 } 00108 00109 /*uint8_t* FCTN_PL_RCV_SC_DATA() 00110 { 00111 printf("\n\rFCTN_PL_RCV_SC_DATA Function Executed\r\n"); 00112 uint8_t buff[512]; 00113 for(int i=0;i<512;i++) 00114 { 00115 buff[i]=0x32; 00116 } 00117 return buff; 00118 00119 } */ 00120 00121 void FCTN_COM_COMP_SC_DATA() 00122 { 00123 printf("\n\rFCTN_COM_COMP_SC_DATA Function Executed\r\n"); 00124 } 00125 00126 00127 00128 void ISR_TMTC_THREAD() 00129 { 00130 ptr_t_tmtc->signal_set(0x3); 00131 } 00132 00133 00134 int main() 00135 { 00136 irpt_2_slv=0; 00137 FCTN_CDMS_SD_INIT(); 00138 FCTN_CDMS_INIT_RTC(); 00139 RtosTimer TIMER_HK_ACQ(T_CDMS_RLY_TMTC,osTimerPeriodic); 00140 TIMER_HK_ACQ.start(20000); 00141 ptr_t_tmtc = new Thread (T_CDMS_RLY_TMTC); 00142 ptr_t_sc_data = new Thread (T_PL_RCV_SC_DATA); 00143 pl_sc_data.rise(&ISR_PL_RCV_SC_DATA); 00144 cdms_rcv_tc.rise(&ISR_TMTC_THREAD); 00145 while(1) 00146 { 00147 Thread::wait(10); 00148 00149 } 00150 }
Generated on Thu Jul 14 2022 03:00:44 by 1.7.2