* 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()