Integrate net_test_router with RM.
[keystone-rtos/netapi.git] / ti / runtime / netapi / test / net_test_router.c
index 2d753a59dac95f235d920c0eda61373bd7859498..44c6cf0c0b577bead71882f3894f4f595803fce2 100755 (executable)
@@ -71,6 +71,9 @@ extern int QUIT;
 #endif
 /* Global definitions */
 
+extern Rm_ServiceHandle   *rmClientServiceHandle;
+
+hplib_spinLock_T net_test_thread_lock;
 netTestConfig_t netTestCfg;
 static  netTestConfigFile_t config_file;
 
@@ -406,13 +409,16 @@ void fast_path_thread(uint32_t index)
     }
     hplib_utilSetupThread(thread_num, &cpu_set, hplib_spinLock_Type_LOL);
 #endif
+    hplib_mSpinLockLock(&net_test_thread_lock);
     worker_nh[thread_num]=netapi_init(NETAPI_CORE_MASTER,
                                       NULL);
     if (worker_nh[thread_num] == NULL)
     {
         printf("fast_path_thread: netapi_init failure, exiting\n");
+        hplib_mSpinLockUnlock(&net_test_thread_lock);
         exit(1);
     }
+    hplib_mSpinLockUnlock(&net_test_thread_lock);
     NETAPI_HANDLE_T * n = (NETAPI_HANDLE_T *) worker_nh[thread_num];
 
    /* open netcp RX channel */
@@ -470,6 +476,13 @@ int main(int argc, char **argv)
     }
     else
     {
+        if (initRm())
+        {
+            printf("main: initRm() returned error\n");
+            exit(1);
+        }
+        hplib_mSpinLockInit(&net_test_thread_lock );
+        our_netapi_default_cfg.rmHandle = rmClientServiceHandle;
         memset(&config_file, 0, sizeof(netTestConfigFile_t));
         memset(&netTestCfg, 0, sizeof(netTestConfig_t));
         netTest_utilProcessConfigFile(fpr,&config_file);