Changeset 8461

Show
Ignore:
Timestamp:
11/16/08 14:24:36 (5 years ago)
Author:
jmatzen
Message:

Updated CIREN_SIM.cpp and CIREN_SIM.h

Location:
ossiedev/branches/smeuleners/CIREN/components/CIREN_SIM
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/smeuleners/CIREN/components/CIREN_SIM/CIREN_SIM.cpp

    r8441 r8461  
    250250    portRxControlInB = new USRP_RX_Control_i(this,"RX_Control_B","DomainName1"); 
    251251    portTxControlInB = new USRP_TX_Control_i(this,"TX_Control_B","DomainName1"); 
    252     portRxDataOut1A = new standardInterfaces_i::complexShort_u("RX_Data_1_A"); 
    253     portRxDataOut2A = new standardInterfaces_i::complexShort_u("RX_Data_2_A"); 
    254     portRxDataOut1B = new standardInterfaces_i::complexShort_u("RX_Data_1_B"); 
    255     portRxDataOut2B = new standardInterfaces_i::complexShort_u("RX_Data_2_B"); 
     252    portRxDataOut1A = new standardInterfaces_i::complexShort_u("RX_Data_1_B"); 
     253    portRxDataOut2A = new standardInterfaces_i::complexShort_u("RX_Data_2_B"); 
     254    portRxDataOut1B = new standardInterfaces_i::complexShort_u("RX_Data_1_A"); 
     255    portRxDataOut2B = new standardInterfaces_i::complexShort_u("RX_Data_2_A"); 
     256     
     257    channel_0_thread = new omni_thread(CIREN_SIM_i::do_channel_0_process, (void *) this); 
     258    channel_0_thread->start(); 
     259    channel_1_thread = new omni_thread(CIREN_SIM_i::do_channel_1_process, (void *) this); 
     260    channel_1_thread->start(); 
    256261 
    257262} 
     
    272277 
    273278void CIREN_SIM_i::tx_data_process() 
    274  
    275279{ 
    276280    PortTypes::ShortSequence I_out_0, Q_out_0; 
     
    279283    PortTypes::ShortSequence *I_in_0(NULL), *Q_in_0(NULL); 
    280284    CORBA::UShort I_in_0_length, Q_in_0_length; 
    281     I_out_0.length(1024); 
    282     Q_out_0.length(1024); 
    283     I_out_1.length(1024); 
    284     Q_out_1.length(1024);     
    285  
    286     for (unsigned int i=0; i<1024; i++) 
    287     { 
    288     I_out_0[i] = 0; 
    289     Q_out_0[i] = 0; 
    290     I_out_1[i] = 0; 
    291     Q_out_1[i] = 0;  
    292     } 
    293285     
    294286    while(1) 
    295287    { 
    296         //portTxDataInA->getData(I_in_0, Q_in_0); 
     288        portTxDataInA->getData(I_in_0, Q_in_0); 
    297289         
    298290        I_in_0_length = I_in_0->length(); 
    299291        Q_in_0_length = Q_in_0->length(); 
    300292 
    301 //        I_out_0.length(1024); //must define length of output 
    302 //        Q_out_0.length(1024); //must define length of output 
    303  
    304 //        I_out_1.length(1024); //must define length of output 
    305 //        Q_out_1.length(1024); //must define length of output 
    306  
     293        I_out_0.length(I_in_0_length); //must define length of output 
     294        Q_out_0.length(Q_in_0_length); //must define length of output 
     295 
     296        I_out_1.length(I_in_0_length); //must define length of output 
     297        Q_out_1.length(Q_in_0_length); //must define length of output 
     298 
     299        for (int i = 0; i < I_in_0_length; ++i) { 
     300            I_out_0[i] = (*I_in_0)[i]; 
     301            I_out_1[i] = (*I_in_0)[i]; 
     302             
     303            Q_out_0[i] = (*Q_in_0)[i]; 
     304            Q_out_1[i] = (*Q_in_0)[i];             
     305        } 
    307306        portTxDataInA->bufferEmptied(); 
    308307        portRxDataOut1A->pushPacket(I_out_0, Q_out_0); 
    309308        portRxDataOut2A->pushPacket(I_out_1, Q_out_1); 
    310          
    311         usleep(1000); 
     309 
    312310    } 
    313311 
     
    317315 
    318316void CIREN_SIM_i::rx_data_process() 
    319  
    320317{ 
    321318    PortTypes::ShortSequence I_out_2, Q_out_2; 
    322319    PortTypes::ShortSequence I_out_3, Q_out_3; 
    323  
     320     
    324321    PortTypes::ShortSequence *I_in_1(NULL), *Q_in_1(NULL); 
    325322    CORBA::UShort I_in_1_length, Q_in_1_length; 
     323 
     324    while(1) 
     325    { 
     326        portTxDataInB->getData(I_in_1, Q_in_1); 
     327        
     328        I_in_1_length = I_in_1->length(); 
     329        Q_in_1_length = Q_in_1->length(); 
     330 
     331        I_out_2.length(I_in_1_length); //must define length of output 
     332        Q_out_2.length(Q_in_1_length); //must define length of output 
     333         
     334        I_out_3.length(I_in_1_length); //must define length of output 
     335        Q_out_3.length(Q_in_1_length); //must define length of output 
     336         
     337        for (int i = 0; i < I_in_1_length; ++i) { 
     338            I_out_2[i] = (*I_in_1)[i]; 
     339            I_out_3[i] = (*I_in_1)[i];    
     340             
     341            Q_out_2[i] = (*Q_in_1)[i]; 
     342            Q_out_3[i] = (*Q_in_1)[i];     
     343        } 
     344 
     345        /*insert code here to do work*/ 
     346 
     347        portTxDataInB->bufferEmptied(); 
     348        portRxDataOut1B->pushPacket(I_out_2, Q_out_2); 
     349        portRxDataOut2B->pushPacket(I_out_3, Q_out_3); 
     350 
     351    } 
     352 
     353    rx_thread->exit(); 
     354} 
     355 
     356void CIREN_SIM_i::channel_0_process() 
     357{ 
     358    PortTypes::ShortSequence I_out_0, Q_out_0; 
     359    PortTypes::ShortSequence I_out_1, Q_out_1; 
     360 
     361    I_out_0.length(1024); //must define length of output 
     362    Q_out_0.length(1024); //must define length of output 
     363    I_out_1.length(1024); //must define length of output 
     364    Q_out_1.length(1024); //must define length of output 
     365    
     366    for (unsigned int i=0; i<1024; i++){ 
     367        I_out_0[i] = 0; 
     368        Q_out_0[i] = 0; 
     369        I_out_1[i] = 0; 
     370        Q_out_1[i] = 0; 
     371    } 
     372 
     373    while(1) 
     374    { 
     375         
     376        for (int i = 0; i < 1024; ++i) { 
     377            I_out_0[i] = 0; 
     378            I_out_0[i] = 0; 
     379             
     380            Q_out_1[i] = 0; 
     381            Q_out_1[i] = 0;             
     382        } 
     383 
     384        /*insert code here to do work*/ 
     385 
     386        portRxDataOut1A->pushPacket(I_out_0, Q_out_0); 
     387        portRxDataOut2A->pushPacket(I_out_1, Q_out_1); 
     388 
     389    } 
     390 
     391    channel_0_thread->exit(); 
     392} 
     393 
     394void CIREN_SIM_i::channel_1_process() 
     395{ 
     396    PortTypes::ShortSequence I_out_2, Q_out_2; 
     397    PortTypes::ShortSequence I_out_3, Q_out_3; 
    326398 
    327399    I_out_2.length(1024); //must define length of output 
     
    330402    Q_out_3.length(1024); //must define length of output 
    331403    
    332     for (unsigned int i=0; i<1024; i++) 
    333     { 
    334     I_out_2[i] = 0; 
    335     Q_out_2[i] = 0; 
    336     I_out_3[i] = 0; 
    337     Q_out_3[i] = 0; 
     404    for (unsigned int i=0; i<1024; i++){ 
     405        I_out_2[i] = 0; 
     406        Q_out_2[i] = 0; 
     407        I_out_3[i] = 0; 
     408        Q_out_3[i] = 0; 
    338409    } 
    339410 
    340411    while(1) 
    341412    { 
    342         //portTxDataInB->getData(I_in_1, Q_in_1); 
    343         I_in_1_length = I_in_1->length(); 
    344         Q_in_1_length = Q_in_1->length(); 
    345  
    346 //        I_out_2.length(1024); //must define length of output 
    347 //        Q_out_2.length(1024); //must define length of output 
    348  
    349 //        I_out_3.length(1024); //must define length of output 
    350 //        Q_out_3.length(1024); //must define length of output 
     413         
     414        for (int i = 0; i < 1024; ++i) { 
     415            I_out_2[i] = 0; 
     416            I_out_3[i] = 0; 
     417             
     418            Q_out_2[i] = 0; 
     419            Q_out_3[i] = 0;             
     420        } 
    351421 
    352422        /*insert code here to do work*/ 
    353423 
    354         portTxDataInB->bufferEmptied(); 
    355424        portRxDataOut1B->pushPacket(I_out_2, Q_out_2); 
    356425        portRxDataOut2B->pushPacket(I_out_3, Q_out_3); 
    357426 
    358         usleep(1000); 
    359     } 
    360  
    361     rx_thread->exit(); 
    362 } 
    363  
     427    } 
     428 
     429    channel_1_thread->exit(); 
     430} 
    364431 
    365432// Static function for omni thread 
  • ossiedev/branches/smeuleners/CIREN/components/CIREN_SIM/CIREN_SIM.h

    r8417 r8461  
    177177    omni_thread *rx_thread; 
    178178    omni_thread *tx_thread; 
     179    omni_thread *channel_0_thread; 
     180    omni_thread *channel_1_thread; 
    179181 
    180182    static void do_rx_data_process(void *u) {((CIREN_SIM_i *)u)->rx_data_process(); }; 
    181183    static void do_tx_data_process(void *u) {((CIREN_SIM_i *)u)->tx_data_process(); }; 
    182  
    183  
     184    static void do_channel_0_process(void *u) {((CIREN_SIM_i *)u)->channel_0_process(); }; 
     185    static void do_channel_1_process(void *u) {((CIREN_SIM_i *)u)->channel_1_process(); }; 
     186     
     187     
    184188    void rx_data_process(); 
    185189    void tx_data_process(); 
     190    void channel_0_process(); 
     191    void channel_1_process();     
    186192    
    187193    omni_condition *component_running;  ///< for component shutdown