]> rtime.felk.cvut.cz Git - frescor/fosa.git/commitdiff
Work in progress to adapt ADS in fosa
authoriripoll <iripoll@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Thu, 22 Mar 2007 19:09:30 +0000 (19:09 +0000)
committeriripoll <iripoll@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Thu, 22 Mar 2007 19:09:30 +0000 (19:09 +0000)
git-svn-id: http://www.frescor.org/private/svn/frescor/fosa/trunk@366 35b4ef3e-fd22-0410-ab77-dab3279adceb

src_rtlinux/fosa_app_def_sched.h
src_rtlinux/fosa_types.h

index a481450a5c4cd558b9e4905be9204e0713b30448..77b733defb3e4fc90e83a5efeea336961be85085 100644 (file)
  * notify it to the system console and then terminate the FRSH
  * implementation and dependant applications
  **/
-int fosa_ads_scheduler_create
-     (const fosa_ads_scheduler_ops_t * scheduler_ops, 
-      size_t scheduler_data_size,
-      void * init_args, 
-      size_t init_args_size);
+
+extern fosa_ads_scheduler_ops_t fosa_scheduler_operations; // See rtl_appsched.c
+void (*fosa_scheduler_loop)(void *arg);                     // See rtl_appsched.c
+extern void *fosa_scheduler_args;
+extern int   fosa_scheduler_args_size;
+
+//int fosa_ads_scheduler_create
+//     (const fosa_ads_scheduler_ops_t * scheduler_ops, 
+//      size_t scheduler_data_size,
+//      void * init_args, 
+//      size_t init_args_size);
+
+int fosa_ads_scheduler_create (const fosa_ads_scheduler_ops_t * scheduler_ops, 
+                              size_t scheduler_data_size,
+                              void * init_args, 
+                              size_t init_args_size){
+
+    pthread_attr_t  attr; 
+    int ret;
+
+    // There will be only ONE single ADS scheduler facility in the system
+
+
+    fosa_scheduler_args_size = init_args_size
+       fosa_scheduler_args = rtl_malloc(init_args_size);
+    if (!fosa_scheduler_args) { 
+       rtl_printf("ERROR: fosa_ads_scheduler_create, rtl_mallox failed\n");
+       return -1;
+    }
+    memcpy(fosa_scheduler_args, init_args, init_args_size);
+    
+    fosa_scheduler_operations = * scheduler_ops;
+
+    pthread_attr_init (&attr);
+    sched_param.sched_priority = 100; // Only one priority will be
+                                     // used in the system.
+    pthread_attr_setappschedulerstate(&attr,PTHREAD_APPSCHEDULER);
+    pthread_attr_setschedparam (&attr, &sched_param);
+
+    if ( (ret = pthread_create (&fosa_scheduler_thread, &attr, fosa_scheduler_loop , NULL)) ){
+       return ret;
+    }
+
+}
+
+
 
 /**
  * fosa_thread_attr_set_appscheduled()
index e9bfe5c298874618c21cc9898de563ba517c1a0e..b4180b7786dea7b813f2a3d257e67844edef1d36 100644 (file)
@@ -62,6 +62,9 @@
 #ifndef        _FOSA_TYPES_H_
 #define        _FOSA_TYPES_H_
 
+// Include needed to have the "frsh_thread_t" type.
+#include "../../../../frsh/trunk/include/frsh_fosa.h"
+
 #include "fosa_opaque_types.h"
 
 /**