for frequency correction testing

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TEST_PL.h Source File

TEST_PL.h

00001 //F11 to exit full screen mode
00002 /*---------------------------------------------------------------------------
00003                             Testing PL_MAIN
00004 ----------------------------------------------------------------------------*/
00005 
00006 
00007 /* Testing as per the flow chart  */
00008 /* columns of the array schedule1[][] correspond to Year,Month,Day,Hours,Minutes,Seconds,SID and EXEC_STATUS in integer formats*/
00009 Base_tm* FCTN_CDMS_RLY_TMTC(Base_tc *tc_ptr);
00010 
00011 extern uint8_t schedule1[32][8]=
00012                         {
00013                             {0,1,1,0,0,15,3,3},
00014                             {0,1,1,0,0,45,2,3},
00015                             {0,1,1,0,1,0,1,3},
00016                             {0,1,1,0,1,25,0,3},     
00017                             {0,1,1,0,1,50,3,3},
00018                             {0,1,1,0,2,10,2,3},
00019                             {0,1,1,0,1,40,2,3},
00020                             {0,1,1,0,1,10,2,3},
00021                             {0,1,1,0,3,40,2,0},
00022                             {0,1,1,0,4,10,2,3},
00023                             
00024                             {0,1,1,0,4,40,0,1},
00025                             {0,1,1,0,5,10,3,3},
00026                             {0,1,1,0,5,40,3,3},
00027                             {0,1,1,0,6,10,2,3},
00028                             {0,1,1,0,6,40,1,0},
00029                             {0,1,1,0,7,10,2,3},
00030                             {0,1,1,0,7,40,3,3},
00031                             {0,1,1,0,8,10,0,3},
00032                             {0,1,1,0,8,40,1,3},
00033                             {0,1,1,0,9,10,1,2},                           
00034 
00035                             {0,1,1,0,9,40,2,3},
00036                             {0,1,1,0,10,10,3,1},
00037                             {0,1,1,0,10,40,3,3},                         
00038                             {0,1,1,0,11,10,2,1},
00039                             {0,0,0,0,11,40,0,0},
00040                             {0,1,1,0,12,10,0,0},
00041                             {0,1,1,0,12,40,0,0},
00042                             {0,1,1,0,13, 0,0,0},
00043                             {0,1,1,0,0, 0,0,0},
00044                             {0,1,1,0,0, 0,0,0},
00045 
00046                             {0,1,1,0,0, 0,0,0},
00047                             {0,1,1,0,0, 0,0,0},
00048                         };
00049 
00050 void convert(Base_tc* test_tc)
00051 {    
00052     for(uint8_t k=3;k<=127;k+=4)
00053     {
00054         /*-----------1st byte of a block----------*/
00055         test_tc->TC_string[k] &= 0x00;
00056         //setting Year (2 bits)
00057         //test_tc->TC_string[k] &= (~0xC0);
00058         test_tc->TC_string[k] |= ((schedule1[(k-3)/4][0] & 0x03)<<6);
00059 
00060         //setting Month (4 bits)
00061         //test_tc->TC_string[k] &= (~0x3C);
00062         test_tc->TC_string[k] |= ((schedule1[(k-3)/4][1] & 0x0F)<<2);
00063 
00064         //setting first two bits(MSB) of Day
00065         //test_tc->TC_string[k] &= (~0x03);
00066         test_tc->TC_string[k] |= ((schedule1[(k-3)/4][2] & 0x18)>>3);
00067         /*------------end of 1st byte-------------*/
00068 
00069         /*-----------2nd byte of a block----------*/
00070         test_tc->TC_string[k+1] &= 0x00000000;
00071         //setting remaining 3 bits of Day
00072         //test_tc->TC_string[k+1] &= (~0xE0);
00073         test_tc->TC_string[k+1] |= ((schedule1[(k-3)/4][2] & 0x07)<<5);
00074 
00075         //setting Hours (5 bits)
00076         //test_tc->TC_string[k+1] &= (~0x1F);
00077         test_tc->TC_string[k+1] |= ((schedule1[(k-3)/4][3] & 0x1F));
00078         /*------------end of 2nd byte-------------*/
00079 
00080         /*-----------3rd byte of a block----------*/
00081         test_tc->TC_string[k+2] &= 0x00000000;
00082         //setting Minutes (6 bits)
00083         //test_tc->TC_string[k+2] &= (~0xFC);
00084         test_tc->TC_string[k+2] |= ((schedule1[(k-3)/4][4] & 0x3F)<<2);
00085 
00086         //setting first 2 bits(MSB) of Seconds
00087         //test_tc->TC_string[k+2] &= (~0x03);
00088         test_tc->TC_string[k+2] |= ((schedule1[(k-3)/4][5] & 0x30)>>4);
00089         /*------------end of 3rd byte-------------*/        
00090 
00091         /*-----------4th byte of a block----------*/
00092         test_tc->TC_string[k+3] &= 0x00;
00093         //setting remaining 4 bits of Seconds
00094         //test_tc->TC_string[k+3] &= (~0xF0);
00095         test_tc->TC_string[k+3] |= ((schedule1[(k-3)/4][5] & 0x0F)<<4);
00096 
00097         //setting STATE_ID (2 bits)
00098         //test_tc->TC_string[k+3] &= (~0x0C);
00099         test_tc->TC_string[k+3] |= ((schedule1[(k-3)/4][6] & 0x03)<<2);
00100 
00101         //setting EXEC_STATUS (2 bits)
00102         //test_tc->TC_string[k+3] &= (~0x03);
00103         test_tc->TC_string[k+3] |= ((schedule1[(k-3)/4][7] & 0x03));
00104         /*------------end of 4th byte-------------*/                
00105     }    
00106 }
00107 /*void test_schedule_1(Base_tm *test_tm_ptr)
00108 {
00109     Base_tc *test_tc = new Long_tc;
00110     test_tc->next_TC = NULL;
00111     test_tc->TC_string[0] = 0x01;
00112     test_tc->TC_string[1] = 0xB2;
00113     test_tc->TC_string[2] = 0x71;
00114     convert(test_tc);
00115     test_tc->TC_string[131] = 0x00;
00116     test_tc->TC_string[132] = 0x00;
00117     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);
00118     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;
00119     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);
00120     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);
00121 }
00122 
00123 void test_schedule_2(Base_tm *test_tm_ptr)
00124 {
00125     Base_tc *test_tc = new Long_tc;
00126     test_tc->next_TC = NULL;
00127     test_tc->TC_string[0] = 0x01;
00128     test_tc->TC_string[1] = 0xB2;
00129     test_tc->TC_string[2] = 0x72;
00130     convert(test_tc);
00131     test_tc->TC_string[131] = 0x00;
00132     test_tc->TC_string[132] = 0x00;
00133     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);
00134     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;
00135     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);
00136     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);
00137 }
00138 
00139 void test_schedule_3(Base_tm *test_tm_ptr)
00140 {
00141     Base_tc *test_tc = new Long_tc;
00142     test_tc->next_TC = NULL;
00143     test_tc->TC_string[0] = 0x01;
00144     test_tc->TC_string[1] = 0xB2;
00145     test_tc->TC_string[2] = 0x73;
00146     convert(test_tc);
00147     test_tc->TC_string[131] = 0x00;
00148     test_tc->TC_string[132] = 0x00;
00149     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);
00150     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;
00151     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);
00152     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);
00153 }
00154 
00155 void test_schedule_4(Base_tm *test_tm_ptr)
00156 {
00157     Base_tc *test_tc = new Long_tc;
00158     test_tc->next_TC = NULL;
00159     test_tc->TC_string[0] = 0x01;
00160     test_tc->TC_string[1] = 0xB2;
00161     test_tc->TC_string[2] = 0x74;
00162     convert(test_tc);
00163     test_tc->TC_string[131] = 0x00;
00164     test_tc->TC_string[132] = 0x00;
00165     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);
00166     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;
00167     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);
00168     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);
00169 }
00170 
00171 void test_schedule_5(Base_tm *test_tm_ptr)
00172 {
00173     Base_tc *test_tc = new Long_tc;
00174     test_tc->next_TC = NULL;
00175     test_tc->TC_string[0] = 0x01;
00176     test_tc->TC_string[1] = 0xB2;
00177     test_tc->TC_string[2] = 0x75;
00178     convert(test_tc);
00179     test_tc->TC_string[131] = 0x00;
00180     test_tc->TC_string[132] = 0x00;
00181     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);
00182     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;
00183     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);
00184     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);
00185 }
00186 
00187 void test_schedule_6(Base_tm *test_tm_ptr)
00188 {
00189     Base_tc *test_tc = new Long_tc;
00190     test_tc->next_TC = NULL;
00191     test_tc->TC_string[0] = 0x01;
00192     test_tc->TC_string[1] = 0xB2;
00193     test_tc->TC_string[2] = 0x76;
00194     convert(test_tc);
00195     test_tc->TC_string[131] = 0x00;
00196     test_tc->TC_string[132] = 0x00;
00197     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);
00198     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;
00199     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);
00200     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);
00201 }
00202 
00203 void test_schedule_F(Base_tm *test_tm_ptr)
00204 {
00205     Base_tc *test_tc = new Long_tc;
00206     test_tc->next_TC = NULL;
00207     test_tc->TC_string[0] = 0x01;
00208     test_tc->TC_string[1] = 0xB2;
00209     test_tc->TC_string[2] = 0x7F;
00210     convert(test_tc);
00211     test_tc->TC_string[131] = 0x00;
00212     test_tc->TC_string[132] = 0x00;
00213     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);
00214     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;
00215     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);
00216     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);
00217 }*/
00218 #define test_schedule_1(test_tm_ptr) {\
00219     Base_tc *test_tc = NULL;\
00220     if(!(test_tc  = new Long_tc))\
00221     {\
00222        gPC.printf("\n\rError: out of memory");\
00223        return;\
00224     }\
00225     test_tc->next_TC = NULL;\
00226     test_tc->TC_string[0] = 0x01;\
00227     test_tc->TC_string[1] = 0xB2;\
00228     test_tc->TC_string[2] = 0x71;\
00229     convert(test_tc);\
00230     test_tc->TC_string[131] = 0x00;\
00231     test_tc->TC_string[132] = 0x00;\
00232     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\
00233     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\
00234     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\
00235     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);\
00236     delete test_tc;\
00237     Base_tm *temp;\
00238     temp = test_tm_ptr;\
00239     while(test_tm_ptr!=NULL)\
00240     {\
00241         temp = temp->next_TM;\
00242         delete test_tm_ptr;\
00243         test_tm_ptr = temp;\
00244     }\
00245 }
00246 #define test_schedule_2(test_tm_ptr) {\
00247     Base_tc *test_tc = new Long_tc;\
00248     test_tc->next_TC = NULL;\
00249     test_tc->TC_string[0] = 0x01;\
00250     test_tc->TC_string[1] = 0xB2;\
00251     test_tc->TC_string[2] = 0x72;\
00252     convert(test_tc);\
00253     test_tc->TC_string[131] = 0x00;\
00254     test_tc->TC_string[132] = 0x00;\
00255     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\
00256     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\
00257     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\
00258     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);\
00259     delete test_tc;\
00260     Base_tm *temp;\
00261     temp = test_tm_ptr;\
00262     while(test_tm_ptr!=NULL)\
00263     {\
00264         temp = temp->next_TM;\
00265         delete test_tm_ptr;\
00266         test_tm_ptr = temp;\
00267     }\
00268 }
00269 #define test_schedule_3(test_tm_ptr) {\
00270     Base_tc *test_tc = new Long_tc;\
00271     test_tc->next_TC = NULL;\
00272     test_tc->TC_string[0] = 0x01;\
00273     test_tc->TC_string[1] = 0xB2;\
00274     test_tc->TC_string[2] = 0x73;\
00275     convert(test_tc);\
00276     test_tc->TC_string[131] = 0x00;\
00277     test_tc->TC_string[132] = 0x00;\
00278     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\
00279     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\
00280     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\
00281     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);\
00282     delete test_tc;\
00283     Base_tm *temp;\
00284     temp = test_tm_ptr;\
00285     while(test_tm_ptr!=NULL)\
00286     {\
00287         temp = temp->next_TM;\
00288         delete test_tm_ptr;\
00289         test_tm_ptr = temp;\
00290     }\
00291 }
00292 #define test_schedule_4(test_tm_ptr) {\
00293     Base_tc *test_tc = new Long_tc;\
00294     test_tc->next_TC = NULL;\
00295     test_tc->TC_string[0] = 0x01;\
00296     test_tc->TC_string[1] = 0xB2;\
00297     test_tc->TC_string[2] = 0x74;\
00298     convert(test_tc);\
00299     test_tc->TC_string[131] = 0x00;\
00300     test_tc->TC_string[132] = 0x00;\
00301     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\
00302     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\
00303     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\
00304     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);\
00305     delete test_tc;\
00306     Base_tm *temp;\
00307     temp = test_tm_ptr;\
00308     while(test_tm_ptr!=NULL)\
00309     {\
00310         temp = temp->next_TM;\
00311         delete test_tm_ptr;\
00312         test_tm_ptr = temp;\
00313     }\
00314 }
00315 #define test_schedule_5(test_tm_ptr) {\
00316     Base_tc *test_tc = new Long_tc;\
00317     test_tc->next_TC = NULL;\
00318     test_tc->TC_string[0] = 0x01;\
00319     test_tc->TC_string[1] = 0xB2;\
00320     test_tc->TC_string[2] = 0x75;\
00321     convert(test_tc);\
00322     test_tc->TC_string[131] = 0x00;\
00323     test_tc->TC_string[132] = 0x00;\
00324     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\
00325     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\
00326     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\
00327     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);\
00328     delete test_tc;\
00329     Base_tm *temp;\
00330     temp = test_tm_ptr;\
00331     while(test_tm_ptr!=NULL)\
00332     {\
00333         temp = temp->next_TM;\
00334         delete test_tm_ptr;\
00335         test_tm_ptr = temp;\
00336     }\
00337 }
00338 #define test_schedule_6(test_tm_ptr) {\
00339     Base_tc *test_tc = new Long_tc;\
00340     test_tc->next_TC = NULL;\
00341     test_tc->TC_string[0] = 0x01;\
00342     test_tc->TC_string[1] = 0xB2;\
00343     test_tc->TC_string[2] = 0x76;\
00344     convert(test_tc);\
00345     test_tc->TC_string[131] = 0x00;\
00346     test_tc->TC_string[132] = 0x00;\
00347     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\
00348     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\
00349     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\
00350     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);\
00351     delete test_tc;\
00352     Base_tm *temp;\
00353     temp = test_tm_ptr;\
00354     while(test_tm_ptr!=NULL)\
00355     {\
00356         temp = temp->next_TM;\
00357         delete test_tm_ptr;\
00358         test_tm_ptr = temp;\
00359     }\
00360 }
00361 #define test_schedule_F(test_tm_ptr) {\
00362     Base_tc *test_tc = NULL;\
00363     if(!(test_tc  = new Long_tc))\
00364     {\
00365        gPC.printf("\n\rError: out of memory");\
00366        return;\
00367     }\
00368     test_tc->next_TC = NULL;\
00369     test_tc->TC_string[0] = 0x01;\
00370     test_tc->TC_string[1] = 0xB2;\
00371     test_tc->TC_string[2] = 0x7F;\
00372     for(uint8_t i=3;i<133;i++)\
00373     {\
00374         test_tc->TC_string[i] = 0;\
00375     }\
00376     uint16_t crc16 = crc16_gen(test_tc->TC_string,133);\
00377     test_tc->TC_string[133] = (uint8_t)(crc16 & 0xFF00)>>8;\
00378     test_tc->TC_string[134] = (uint8_t)(crc16 & 0x00FF);\
00379     test_tm_ptr =  FCTN_CDMS_RLY_TMTC(test_tc);\
00380     delete test_tc;\
00381 }
00382 void send_verify_0xF(Base_tm* test_tm_ptr)
00383 {
00384     uint32_t temp_blk[4] = {0};
00385     uint8_t j=0,tm_data_err_count=0;
00386     Base_tm* temp_ptr;
00387     test_schedule_F(test_tm_ptr);
00388     gPC.printf("\n\r----------------------------------------------------------------------------------");
00389     gPC.printf("\n\rTC_Schedule_Report(0xF):\n");
00390     temp_ptr=test_tm_ptr;
00391     while(temp_ptr!=NULL)
00392     {
00393         /*gPC.printf("\n\rTM[0] = %02X",temp_ptr->TM_string[0]);
00394         gPC.printf("\tTM[1] = %02X",temp_ptr->TM_string[1]);
00395         gPC.printf("\tTM[2] = %02X",temp_ptr->TM_string[2]);
00396         gPC.printf("\tTM[3] = %02X",temp_ptr->TM_string[3]);*/
00397         for(uint8_t i=0;i<=112;i+=16)
00398         {
00399             temp_blk[0] &= 0x00000000;
00400             temp_blk[0] |= (((uint32_t)(temp_ptr->TM_string[i+4]))&0x000000FF)<<24;
00401             temp_blk[0] |= (((uint32_t)(temp_ptr->TM_string[i+5]))&0x000000FF)<<16;
00402             temp_blk[0] |= (((uint32_t)(temp_ptr->TM_string[i+6]))&0x000000FF)<<8;
00403             temp_blk[0] |= (((uint32_t)(temp_ptr->TM_string[i+7]))&0x000000FF);
00404 
00405             temp_blk[1] &= 0x00000000;
00406             temp_blk[1] |= (((uint32_t)(temp_ptr->TM_string[i+8]))&0x000000FF)<<24;
00407             temp_blk[1] |= (((uint32_t)(temp_ptr->TM_string[i+9]))&0x000000FF)<<16;
00408             temp_blk[1] |= (((uint32_t)(temp_ptr->TM_string[i+10]))&0x000000FF)<<8;
00409             temp_blk[1] |= (((uint32_t)(temp_ptr->TM_string[i+11]))&0x000000FF);
00410 
00411             temp_blk[2] &= 0x00000000;
00412             temp_blk[2] |= (((uint32_t)(temp_ptr->TM_string[i+12]))&0x000000FF)<<24;
00413             temp_blk[2] |= (((uint32_t)(temp_ptr->TM_string[i+13]))&0x000000FF)<<16;
00414             temp_blk[2] |= (((uint32_t)(temp_ptr->TM_string[i+14]))&0x000000FF)<<8;
00415             temp_blk[2] |= (((uint32_t)(temp_ptr->TM_string[i+15]))&0x000000FF);
00416             
00417             temp_blk[3] &= 0x00000000;
00418             temp_blk[3] |= (((uint32_t)(temp_ptr->TM_string[i+16]))&0x000000FF)<<24;
00419             temp_blk[3] |= (((uint32_t)(temp_ptr->TM_string[i+17]))&0x000000FF)<<16;
00420             temp_blk[3] |= (((uint32_t)(temp_ptr->TM_string[i+18]))&0x000000FF)<<8;
00421             temp_blk[3] |= (((uint32_t)(temp_ptr->TM_string[i+19]))&0x000000FF);
00422 
00423             if(temp_blk[0]!=pl_block[(i/4)+j])
00424                 tm_data_err_count++;
00425             if(temp_blk[1]!=pl_block[(i/4)+j+1])
00426                 tm_data_err_count++;
00427             if(temp_blk[2]!=pl_block[(i/4)+j+2])
00428                 tm_data_err_count++;
00429             if(temp_blk[3]!=pl_block[(i/4)+j+3])
00430                 tm_data_err_count++;
00431             //gPC.printf("\n\r%03d-0x%08X\t%03d-0x%08X",(i/4)+j,temp_blk[0],(i/4)+1+j,temp_blk[1]);
00432             //gPC.printf("\t%03d-0x%08X\t%03d-0x%08X\n",(i/4)+2+j,temp_blk[2],(i/4)+3+j,temp_blk[3]);             
00433         }
00434         j+=32;
00435         //gPC.printf("\n");
00436         temp_ptr = temp_ptr->next_TM;
00437     }
00438     if(tm_data_err_count!=0)
00439     {
00440         gPC.printf("\n\rTM Data(0xF) not matching pl_block!!!");
00441         gPC.printf("\n\rNumber of mismatches = %d",tm_data_err_count);
00442     }
00443     else if(tm_data_err_count==0)
00444     {
00445         gPC.printf("\n\rNo errors in TM Data(0xF)");
00446     }
00447     gPC.printf("\n\r----------------------------------------------------------------------------------");
00448     Base_tm *temp;\
00449     temp = test_tm_ptr;\
00450     while(test_tm_ptr!=NULL)\
00451     {\
00452         temp = temp->next_TM;\
00453         delete test_tm_ptr;\
00454         test_tm_ptr = temp;\
00455     }\
00456 }
00457 void verify_extracted(uint8_t c)
00458 {
00459     uint8_t wrong_extracted=0;
00460     uint8_t temp_extracted[8] = {0};
00461     for(uint8_t z=(32*(c-1));z<(32*c);z++)
00462     {        
00463         temp_extracted[0] = (uint8_t)((pl_block[z]&0xC0000000)>>30);
00464         temp_extracted[1] = (uint8_t)((pl_block[z]&0x3C000000)>>26);
00465         temp_extracted[2] = (uint8_t)((pl_block[z]&0x03E00000)>>21);
00466         temp_extracted[3] = (uint8_t)((pl_block[z]&0x001F0000)>>16);
00467         temp_extracted[4] = (uint8_t)((pl_block[z]&0x0000FC00)>>10);
00468         temp_extracted[5] = (uint8_t)((pl_block[z]&0x000003F0)>>4);
00469         temp_extracted[6] = (uint8_t)((pl_block[z]&0x0000000C)>>2);
00470         temp_extracted[7] = (uint8_t)((pl_block[z]&0x00000003));
00471         
00472         for(uint8_t y=0;y<8;y++)
00473         {
00474             if(temp_extracted[y]!=schedule1[z-(32*(c-1))][y])
00475                 wrong_extracted++;
00476         }
00477     }
00478     if(wrong_extracted!=0)
00479     {
00480         gPC.printf("\n\rExtracted values do not match input values!!!");
00481         gPC.printf("\n\rNumber of wrong extracted values = %d",wrong_extracted);
00482         wrong_extracted = 0;
00483     }
00484     else if(wrong_extracted==0)
00485         gPC.printf("\n\rExtracted values are correct(0x%d)",c);        
00486 }
00487 void test_pl_main()
00488 {
00489     uint32_t temp_pl_block[192] = {0};
00490     uint8_t wrong_modify=0,z;
00491     Base_tm* test_tm_ptr;    
00492     for(z=0;z<192;z++)
00493         pl_block[z] = 0xFFFFFFFF;
00494    // testing 0xF
00495     send_verify_0xF(test_tm_ptr);
00496     for(z=0;z<192;z++)  
00497         temp_pl_block[z] = pl_block[z];
00498         
00499     //testing TC = 0x1,0x2...0x6
00500     int w =1;
00501     for(uint8_t v=1;v<7;v++)
00502     {        
00503         switch(v)
00504         {
00505             case 1: test_schedule_1(test_tm_ptr);
00506                     break;
00507             case 2: test_schedule_2(test_tm_ptr);
00508                     break;
00509             case 3: test_schedule_3(test_tm_ptr);
00510                     break;
00511             case 4: test_schedule_4(test_tm_ptr);
00512                     break;
00513             case 5: test_schedule_5(test_tm_ptr);
00514                     break;
00515             case 6: test_schedule_6(test_tm_ptr);
00516                     break;
00517         }
00518         //gPC.printf("\n\rIndex:%d",w);
00519         if(v==1)
00520         {
00521             test_schedule_1(test_tm_ptr);
00522         }
00523         else if(v==2)
00524         {
00525             test_schedule_2(test_tm_ptr);
00526         }
00527         else if(v==3)
00528         {
00529             test_schedule_3(test_tm_ptr);
00530         }
00531         else if(v==4)        
00532         {
00533             test_schedule_4(test_tm_ptr);
00534         }
00535         else if(v==5)
00536         {
00537             test_schedule_5(test_tm_ptr);
00538         }
00539         else if(v==6)
00540         {
00541             test_schedule_6(test_tm_ptr);
00542         }
00543         for(z=0;z<192;z++)
00544         {
00545             if((z>=((v-1)*32)) && (z<=((v*32)-1)))
00546                 z++;
00547             else
00548             {
00549                 if(temp_pl_block[z]!=pl_block[z])
00550                     wrong_modify++;
00551             }
00552         }
00553         if(wrong_modify!=0)
00554         {
00555             gPC.printf("\n\rWrong values of pl_block modified by TC = 0x%d",v);
00556             gPC.printf("\n\rNumber of wrong modifications = %d",wrong_modify);
00557             wrong_modify = 0;
00558         }
00559         else if(wrong_modify==0)
00560         {
00561             gPC.printf("\n\rTC(0x%d) updated pl_block correctly",v);
00562             for(uint8_t i=0;i<=188;i+=4)
00563             {
00564                 //gPC.printf("\n\r%03d-0x%08X\t%03d-0x%08X",(i),pl_block[i],(i)+1,pl_block[(i)+1]);
00565                 //gPC.printf("\t%03d-0x%08X\t%03d-0x%08X\n",(i)+2,pl_block[(i)+2],(i)+3,pl_block[(i)+3]);
00566             }
00567         }
00568         send_verify_0xF(test_tm_ptr);
00569         verify_extracted(v);
00570         for(z=0;z<192;z++)
00571             temp_pl_block[z] = pl_block[z];
00572         wait(1);
00573     }
00574     gPC.printf("\n\rTesting TC_TM block processing complete");
00575 }