29 #include <pkgconf/kernel.h> 30 #include <pkgconf/os_ecos.h> 33 #include "../fosi_internal_interface.hpp" 34 #include <cyg/kernel/kapi.h> 45 const char* name =
"main";
46 main_task->
name = strcpy( (
char*)malloc( (strlen(name) + 1) *
sizeof(
char)), name);
52 free(main_task->
name);
53 main_task->
name = NULL;
60 unsigned cpu_affinity,
64 void * (*start_routine)(
void *),
68 if ( strlen(name) == 0 )
70 task->
name = strcpy( (
char*)malloc( (strlen(name) + 1) *
sizeof(
char)), name);
76 cyg_thread_create((cyg_addrword_t) priority,
77 (cyg_thread_entry_t *) start_routine,
81 OROSEM_OS_ECOS_STACK_SIZE,
92 cyg_thread_resume(task->
handle);
102 cyg_sem_t * wakeup_sem = (cyg_sem_t *) data;
103 cyg_semaphore_post(wakeup_sem);
134 mytask->
period = nanosecs;
139 mytask->
period = nanosecs;
183 bool succeed = cyg_thread_delete(mytask->
handle);
184 if (succeed ==
false)
185 diag_printf(
"cyg_thread_delete: Error deleting task\n");
193 cyg_thread_info info;
194 bool succeed = cyg_thread_get_info(t->
handle,cyg_thread_get_id(t->
handle),&info);
195 if (succeed ==
false) {
196 diag_printf(
"fosi_internal.hpp rtos_task_get_name() WARNING: cyg_thread_get_info returned false...\n");
197 return "(destroyed)";
204 cyg_thread_set_priority(t->
handle,(cyg_priority_t) priority);
205 return int(cyg_thread_get_priority(t->
handle)) == priority ? 0 : 1;
210 return (
int) cyg_thread_get_priority(t->
handle);
int rtos_task_get_priority(const RTOS_TASK *task)
INTERNAL_QUAL void rtos_task_make_periodic(RTOS_TASK *mytask, NANO_TIME nanosecs)
unsigned int rtos_task_get_pid(const RTOS_TASK *task)
INTERNAL_QUAL int rtos_task_delete_main(RTOS_TASK *main_task)
int rtos_task_set_scheduler(RTOS_TASK *t, int sched_type)
int rtos_task_set_cpu_affinity(RTOS_TASK *task, unsigned cpu_affinity)
unsigned rtos_task_get_cpu_affinity(const RTOS_TASK *task)
INTERNAL_QUAL int rtos_task_check_priority(int *scheduler, int *priority)
#define OROSEM_OS_ECOS_STACK_SIZE
void rtos_task_set_wait_period_policy(RTOS_TASK *task, int policy)
void rtos_task_delete(RTOS_TASK *mytask)
INTERNAL_QUAL void rtos_task_yield(RTOS_TASK *)
int rtos_task_set_priority(RTOS_TASK *task, int priority)
const char * rtos_task_get_name(const RTOS_TASK *task)
int rtos_task_check_scheduler(int *sched_type)
int rtos_task_wait_period(RTOS_TASK *task)
TICK_TIME rtos_get_time_ticks(void)
TICK_TIME nano2ticks(NANO_TIME nano)
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
INTERNAL_QUAL int rtos_task_create_main(RTOS_TASK *main_task)
void rtos_task_set_period(RTOS_TASK *mytask, NANO_TIME nanosecs)
static Logger::LogFunction endlog()
INTERNAL_QUAL int rtos_task_create(RTOS_TASK *task, int priority, unsigned cpu_affinity, const char *name, int sched_type, size_t stack_size, void *(*start_routine)(void *), ThreadInterface *obj)
INTERNAL_QUAL void wakeup_handler(cyg_handle_t alarm_handle, cyg_addrword_t data)
int rtos_task_get_scheduler(const RTOS_TASK *t)