]> rtime.felk.cvut.cz Git - frescor/frsh-forb.git/blobdiff - src/forb/src/forbrun/forbrun_rtems.c
RTEMS initialization: a few bugs fixed
[frescor/frsh-forb.git] / src / forb / src / forbrun / forbrun_rtems.c
index 53a0cc49d92b93410c9759d47ec101e6c1f07bf0..e5827aa0139a9f2048acecc6872b7966c2316b41 100644 (file)
 #include <forb/server_id.h>
 
 
+FORB_MAIN(fcb, forb_orb orb, int argc, char *argv[]);
 
-int print_log_domain(ul_log_domain_t *domain, void *context)
-{
-       printf("%s = %d\n", domain->name, domain->level);
-       return 0;
-}
+
+// int print_log_domain(ul_log_domain_t *domain, void *context)
+// {
+//     printf("%s = %d\n", domain->name, domain->level);
+//     return 0;
+// }
 
 struct forb_main_data {
        char *filename;
@@ -48,8 +50,9 @@ int forbrun(forb_orb orb)
        if (ret) error(0, errno, "INET port registration failed");
 #endif
 
-#ifdef CONFIG_FCB              
-       struct forb_main_data *data = malloc(sizeof(*data));
+//#ifdef CONFIG_FCB
+#ifdef RTEMS
+       struct forb_main_data *data = malloc(sizeof(struct forb_main_data));
        data->filename = NULL;
        data->orb = orb;
        // prepare forb_main() parameters
@@ -65,24 +68,24 @@ int forbrun(forb_orb orb)
 
 #ifdef RTEMS           
 #include <frm_rtemscpu.h>
-       struct forb_main_data *data = malloc(sizeof(*data));
-       data->filename = NULL;
-       data->orb = orb;
+       struct forb_main_data *data2 = malloc(sizeof(struct forb_main_data));
+       data2->filename = NULL;
+       data2->orb = orb;
        // prepare forb_main() parameters
-       data->argc = 0;
-       data->argv = NULL;
-       data->forb_main = &forb_main_frm_rtemscpu;      // Component main address
-       fosa_thread_create(&tid, NULL, forb_main_thread, data);
+       data2->argc = 0;
+       data2->argv = NULL;
+       data2->forb_main = &forb_main_frm_rtemscpu;     // Component main address
+       fosa_thread_create(&tid, NULL, forb_main_thread, data2);        
        libs_loaded_cnt++;
-       ret = forb_wait_for_server_ready(orb);
+       ret = forb_wait_for_server_ready(orb);  
+
        if (ret)
                ERR( errno, "forb_wait_for_server_ready");              
 #endif                         
-               
        /* Allow other threads to continue execution, but exit
         * ourselves (without exit()ing the whole process. */
-       if (libs_loaded_cnt > 0)
-               pthread_exit(NULL);     
+//     if (libs_loaded_cnt > 0)
+//             pthread_exit(NULL);     
 
        return 0;
 }