www.pudn.com > DaVinci_Qam.zip > Test_qam_gen_pack_lookup.c


/******************************************************************************* 
Copyright(c) 2000 - 2002 Analog Devices. All Rights Reserved. 
Developed by Joint Development Software Application Team, IPDC, Bangalore, India 
for Blackfin DSPs  ( Micro Signal Architecture 1.0 specification). 
 
By using this module you agree to the terms of the Analog Devices License 
Agreement for DSP Software.  
******************************************************************************** 
File Name       : Test_qam_gen_pack_lookup.c 
Description     : This function tests qam_gen_pack_lookup with 7 test cases and  
                  finds cycle count for symbol size = 2,3,4,5,6,7 and 8 and  
                  number of symbols = 4,8,16,32,64,128 and 256 repectively. 
                    1. Test1 - All combinations of QAM Size(Baud) = 2 
                    2. Test2 - All combinations of QAM Size(Baud) = 3 
                    3. Test3 - All combinations of QAM Size(Baud) = 4 
                    4. Test4 - All combinations of QAM Size(Baud) = 5 
                    5. Test5 - All combinations of QAM Size(Baud) = 6 
                    6. Test6 - All combinations of QAM Size(Baud) = 7 
                    7. Test7 - All combinations of QAM Size(Baud) = 8 
*******************************************************************************/ 
#include "qamdata.h" 
 
void qam_gen_pack_lookup (int *iptr, short *optr, int n, short k,  
                            short *lookuptable); 
 
int error_flag = 0; 
void (*f1)(); 
int cycle_count[10]; 
 
void main() 
 { 
    int n, i; 
    short k; 
    short optr[512]; 
 
    f1 = (void(*)()) qam_gen_pack_lookup;// Function Pointer  
 
  
// Test1 - Test all combinations of QAM Size(Baud) = 2 
 
    k = 2; 
    n = 4; 
 
    cycle_count[0] = Compute_Cycle_Count(&iptr2, optr, n, k, optr2); 
                            //This function inturn calls qam_gen_pack_lookup() 
    for(i=0; i<2*n; i+=2) 
        if( (optr[i] != optr2[i]) || (optr[i+1] != optr2[i+1]) )  
        { 
            error_flag = error_flag | 1; 
        } 
   
// Test2 - Test all combinations of QAM Size(Baud) = 3 
 
    k = 3; 
    n = 8; 
    cycle_count[1] = Compute_Cycle_Count(&iptr3, optr, n, k, optr3); 
                            //This function inturn calls qam_gen_pack_lookup() 
    for(i=0; i<2*n; i+=2) 
        if( (optr[i] != optr3[i]) || (optr[i+1] != optr3[i+1]) )  
        { 
            error_flag = error_flag | 2; 
        } 
 
// Test3 - Test all combinations of QAM Size(Baud) = 4 
 
    k = 4; 
    n = 16; 
    cycle_count[2] = Compute_Cycle_Count(iptr4, optr, n, k, optr4); 
                            //This function inturn calls qam_gen_pack_lookup() 
    for(i=0; i<2*n; i+=2) 
        if( (optr[i] != optr4[i]) || (optr[i+1] != optr4[i+1]) )  
        { 
            error_flag = error_flag | 4; 
        } 
 
// Test4 - Test all combinations of QAM Size(Baud) = 5 
 
    k = 5; 
    n = 32; 
 
    cycle_count[3] = Compute_Cycle_Count(iptr5, optr, n, k, optr5); 
                            //This function inturn calls qam_gen_pack_lookup() 
    for(i=0; i<2*n; i+=2) 
        if( (optr[i] != optr5[i]) || (optr[i+1] != optr5[i+1]) )  
        { 
            error_flag = error_flag | 8; 
        } 
 
// Test5 - Test all combinations of QAM Size(Baud) = 6 
 
    k = 6; 
    n = 64; 
 
    cycle_count[4] = Compute_Cycle_Count(iptr6, optr, n, k, optr6); 
                            //This function inturn calls qam_gen_pack_lookup() 
    for(i=0; i<2*n; i+=2) 
        if( (optr[i] != optr6[i]) || (optr[i+1] != optr6[i+1]) )  
        { 
            error_flag = error_flag | 16; 
        } 
 
// Test6 - Test all combinations of QAM Size(Baud) = 7 
 
    k = 7; 
    n = 128; 
 
    cycle_count[5] = Compute_Cycle_Count(iptr7, optr, n, k, optr7); 
                            //This function inturn calls qam_gen_pack_lookup() 
    for(i=0; i<2*n; i+=2) 
        if( (optr[i] != optr7[i]) || (optr[i+1] != optr7[i+1]) )  
        { 
            error_flag = error_flag | 32; 
        } 
 
 
// Test7 - Test all combinations of QAM Size(Baud) = 8 
 
    k = 8; 
    n = 256; 
 
    cycle_count[6] = Compute_Cycle_Count(iptr8, optr, n, k, optr8); 
                            //This function inturn calls qam_gen_pack_lookup() 
    for(i=0; i<2*n; i+=2) 
        if( (optr[i] != optr8[i]) || (optr[i+1] != optr8[i+1]) )  
        { 
            error_flag = error_flag | 64; 
        } 
    #ifdef PRINTF_SUPPORT 
        if(error_flag & 1) 
            printf("Test Case 1 failed\n"); 
        else 
            printf("Test Case 1 passed\n"); 
        if(error_flag & 2) 
            printf("Test Case 2 failed\n"); 
        else 
            printf("Test Case 2 passed\n"); 
        if(error_flag & 4) 
            printf("Test Case 3 failed\n"); 
        else 
            printf("Test Case 3 passed\n"); 
        if(error_flag & 8) 
            printf("Test Case 4 failed\n"); 
        else 
            printf("Test Case 4 passed\n"); 
        if(error_flag & 16) 
            printf("Test Case 5 failed\n"); 
        else 
            printf("Test Case 5 passed\n"); 
        if(error_flag & 32) 
            printf("Test Case 6 failed\n"); 
        else 
            printf("Test Case 6 passed\n"); 
        if(error_flag & 64) 
            printf("Test Case 7 failed\n"); 
        else 
            printf("Test Case 7 passed\n"); 
    #endif 
 
    printf("cycle_count[0]=%d,cycle_count[1]=%d,cycle_count[2]=%dcycle_count[3]=%d,cycle_count[4]=%d,cycle_count[5]=%dcycle_count[6]=%d\n",cycle_count[0],cycle_count[1],cycle_count[2],cycle_count[3],cycle_count[4],cycle_count[5],cycle_count[6]); 
     
}