/* * Author : Sebastien Levieux * Date : 13/12/2024 */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "system.h" #include void lock_Number_Sequence_semaphore(void){ rtems_status_code status; status = rtems_semaphore_obtain( Number_Sequence_semaphore, RTEMS_NO_WAIT, 0 ); while (status != RTEMS_SUCCESSFUL ){ status = rtems_semaphore_obtain( Number_Sequence_semaphore, RTEMS_NO_WAIT, 0 ); } } void unlock_Number_Sequence_semaphore(void){ rtems_semaphore_release( Number_Sequence_semaphore ); } rtems_task Test_task( rtems_task_argument argument ) { uint32_t cpu_self; char *task_name; char name[5]; /* Get the task name */ task_name = rtems_object_get_name( RTEMS_SELF, 5, name ); if(&task_name==NULL) { locked_printf("\n**rtems_object_get_name return NULL**\n"); exit(1); } /* Get the CPU Number */ cpu_self = rtems_scheduler_get_processor(); locked_printf("**Hello World!!! I am task %s and I am executing on CPU%d**\n", task_name, cpu_self); while(1){ //Lock and Update Number_Sequence lock_Number_Sequence_semaphore(); for(int i=0;i