Index: /ossiedev/branches/smeuleners/CIREN/components/CIREN_SIM/CIREN_SIM.cpp
===================================================================
--- /ossiedev/branches/smeuleners/CIREN/components/CIREN_SIM/CIREN_SIM.cpp	(revision 8441)
+++ /ossiedev/branches/smeuleners/CIREN/components/CIREN_SIM/CIREN_SIM.cpp	(revision 8461)
@@ -250,8 +250,13 @@
     portRxControlInB = new USRP_RX_Control_i(this,"RX_Control_B","DomainName1");
     portTxControlInB = new USRP_TX_Control_i(this,"TX_Control_B","DomainName1");
-    portRxDataOut1A = new standardInterfaces_i::complexShort_u("RX_Data_1_A");
-    portRxDataOut2A = new standardInterfaces_i::complexShort_u("RX_Data_2_A");
-    portRxDataOut1B = new standardInterfaces_i::complexShort_u("RX_Data_1_B");
-    portRxDataOut2B = new standardInterfaces_i::complexShort_u("RX_Data_2_B");
+    portRxDataOut1A = new standardInterfaces_i::complexShort_u("RX_Data_1_B");
+    portRxDataOut2A = new standardInterfaces_i::complexShort_u("RX_Data_2_B");
+    portRxDataOut1B = new standardInterfaces_i::complexShort_u("RX_Data_1_A");
+    portRxDataOut2B = new standardInterfaces_i::complexShort_u("RX_Data_2_A");
+    
+    channel_0_thread = new omni_thread(CIREN_SIM_i::do_channel_0_process, (void *) this);
+    channel_0_thread->start();
+    channel_1_thread = new omni_thread(CIREN_SIM_i::do_channel_1_process, (void *) this);
+    channel_1_thread->start();
 
 }
@@ -272,5 +277,4 @@
 
 void CIREN_SIM_i::tx_data_process()
-
 {
     PortTypes::ShortSequence I_out_0, Q_out_0;
@@ -279,35 +283,29 @@
     PortTypes::ShortSequence *I_in_0(NULL), *Q_in_0(NULL);
     CORBA::UShort I_in_0_length, Q_in_0_length;
-    I_out_0.length(1024);
-    Q_out_0.length(1024);
-    I_out_1.length(1024);
-    Q_out_1.length(1024);    
-
-    for (unsigned int i=0; i<1024; i++)
-    {
-    I_out_0[i] = 0;
-    Q_out_0[i] = 0;
-    I_out_1[i] = 0;
-    Q_out_1[i] = 0; 
-    }
     
     while(1)
     {
-        //portTxDataInA->getData(I_in_0, Q_in_0);
+        portTxDataInA->getData(I_in_0, Q_in_0);
         
 	I_in_0_length = I_in_0->length();
         Q_in_0_length = Q_in_0->length();
 
-//        I_out_0.length(1024); //must define length of output
-//        Q_out_0.length(1024); //must define length of output
-
-//        I_out_1.length(1024); //must define length of output
-//        Q_out_1.length(1024); //must define length of output
-
+        I_out_0.length(I_in_0_length); //must define length of output
+        Q_out_0.length(Q_in_0_length); //must define length of output
+
+        I_out_1.length(I_in_0_length); //must define length of output
+        Q_out_1.length(Q_in_0_length); //must define length of output
+
+        for (int i = 0; i < I_in_0_length; ++i) {
+            I_out_0[i] = (*I_in_0)[i];
+            I_out_1[i] = (*I_in_0)[i];
+            
+            Q_out_0[i] = (*Q_in_0)[i];
+            Q_out_1[i] = (*Q_in_0)[i];            
+        }
         portTxDataInA->bufferEmptied();
         portRxDataOut1A->pushPacket(I_out_0, Q_out_0);
         portRxDataOut2A->pushPacket(I_out_1, Q_out_1);
-	
-	usleep(1000);
+
     }
 
@@ -317,11 +315,85 @@
 
 void CIREN_SIM_i::rx_data_process()
-
 {
     PortTypes::ShortSequence I_out_2, Q_out_2;
     PortTypes::ShortSequence I_out_3, Q_out_3;
-
+    
     PortTypes::ShortSequence *I_in_1(NULL), *Q_in_1(NULL);
     CORBA::UShort I_in_1_length, Q_in_1_length;
+
+    while(1)
+    {
+        portTxDataInB->getData(I_in_1, Q_in_1);
+       
+        I_in_1_length = I_in_1->length();
+        Q_in_1_length = Q_in_1->length();
+
+        I_out_2.length(I_in_1_length); //must define length of output
+        Q_out_2.length(Q_in_1_length); //must define length of output
+        
+        I_out_3.length(I_in_1_length); //must define length of output
+        Q_out_3.length(Q_in_1_length); //must define length of output
+        
+        for (int i = 0; i < I_in_1_length; ++i) {
+            I_out_2[i] = (*I_in_1)[i];
+            I_out_3[i] = (*I_in_1)[i];   
+            
+            Q_out_2[i] = (*Q_in_1)[i];
+            Q_out_3[i] = (*Q_in_1)[i];    
+        }
+
+        /*insert code here to do work*/
+
+	portTxDataInB->bufferEmptied();
+        portRxDataOut1B->pushPacket(I_out_2, Q_out_2);
+        portRxDataOut2B->pushPacket(I_out_3, Q_out_3);
+
+    }
+
+    rx_thread->exit();
+}
+
+void CIREN_SIM_i::channel_0_process()
+{
+    PortTypes::ShortSequence I_out_0, Q_out_0;
+    PortTypes::ShortSequence I_out_1, Q_out_1;
+
+    I_out_0.length(1024); //must define length of output
+    Q_out_0.length(1024); //must define length of output
+    I_out_1.length(1024); //must define length of output
+    Q_out_1.length(1024); //must define length of output
+   
+    for (unsigned int i=0; i<1024; i++){
+        I_out_0[i] = 0;
+        Q_out_0[i] = 0;
+        I_out_1[i] = 0;
+        Q_out_1[i] = 0;
+    }
+
+    while(1)
+    {
+        
+        for (int i = 0; i < 1024; ++i) {
+            I_out_0[i] = 0;
+            I_out_0[i] = 0;
+            
+            Q_out_1[i] = 0;
+            Q_out_1[i] = 0;            
+        }
+
+        /*insert code here to do work*/
+
+        portRxDataOut1A->pushPacket(I_out_0, Q_out_0);
+        portRxDataOut2A->pushPacket(I_out_1, Q_out_1);
+
+    }
+
+    channel_0_thread->exit();
+}
+
+void CIREN_SIM_i::channel_1_process()
+{
+    PortTypes::ShortSequence I_out_2, Q_out_2;
+    PortTypes::ShortSequence I_out_3, Q_out_3;
 
     I_out_2.length(1024); //must define length of output
@@ -330,36 +402,31 @@
     Q_out_3.length(1024); //must define length of output
    
-    for (unsigned int i=0; i<1024; i++)
-    {
-    I_out_2[i] = 0;
-    Q_out_2[i] = 0;
-    I_out_3[i] = 0;
-    Q_out_3[i] = 0;
+    for (unsigned int i=0; i<1024; i++){
+        I_out_2[i] = 0;
+        Q_out_2[i] = 0;
+        I_out_3[i] = 0;
+        Q_out_3[i] = 0;
     }
 
     while(1)
     {
-        //portTxDataInB->getData(I_in_1, Q_in_1);
-        I_in_1_length = I_in_1->length();
-        Q_in_1_length = Q_in_1->length();
-
-//        I_out_2.length(1024); //must define length of output
-//        Q_out_2.length(1024); //must define length of output
-
-//        I_out_3.length(1024); //must define length of output
-//        Q_out_3.length(1024); //must define length of output
+        
+        for (int i = 0; i < 1024; ++i) {
+            I_out_2[i] = 0;
+            I_out_3[i] = 0;
+            
+            Q_out_2[i] = 0;
+            Q_out_3[i] = 0;            
+        }
 
         /*insert code here to do work*/
 
-	portTxDataInB->bufferEmptied();
         portRxDataOut1B->pushPacket(I_out_2, Q_out_2);
         portRxDataOut2B->pushPacket(I_out_3, Q_out_3);
 
-	usleep(1000);
-    }
-
-    rx_thread->exit();
-}
-
+    }
+
+    channel_1_thread->exit();
+}
 
 // Static function for omni thread
Index: /ossiedev/branches/smeuleners/CIREN/components/CIREN_SIM/CIREN_SIM.h
===================================================================
--- /ossiedev/branches/smeuleners/CIREN/components/CIREN_SIM/CIREN_SIM.h	(revision 8417)
+++ /ossiedev/branches/smeuleners/CIREN/components/CIREN_SIM/CIREN_SIM.h	(revision 8461)
@@ -177,11 +177,17 @@
     omni_thread *rx_thread;
     omni_thread *tx_thread;
+    omni_thread *channel_0_thread;
+    omni_thread *channel_1_thread;
 
     static void do_rx_data_process(void *u) {((CIREN_SIM_i *)u)->rx_data_process(); };
     static void do_tx_data_process(void *u) {((CIREN_SIM_i *)u)->tx_data_process(); };
-
-
+    static void do_channel_0_process(void *u) {((CIREN_SIM_i *)u)->channel_0_process(); };
+    static void do_channel_1_process(void *u) {((CIREN_SIM_i *)u)->channel_1_process(); };
+    
+    
     void rx_data_process();
     void tx_data_process();
+    void channel_0_process();
+    void channel_1_process();    
    
     omni_condition *component_running;  ///< for component shutdown
