Skip to content

Commit

Permalink
<HELIOS> Folder Struct Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pranjalchanda08 committed Feb 27, 2023
1 parent d54b30f commit d3d3dd5
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion projects/demo_helios_avr/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ BOOTMSGS := 0
EARLYCON_SERIAL := 0
CONSOLE_SERIAL := 0
OBRDLED_ENABLE := 1
TERRAKERN := 1
TERRAKERN := helios
2 changes: 1 addition & 1 deletion projects/demo_helios_riscv/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ BOOTMSGS := 1
EARLYCON_SERIAL := 1
CONSOLE_SERIAL := 1
OBRDLED_ENABLE := 1
TERRAKERN := 1
TERRAKERN := helios
4 changes: 2 additions & 2 deletions src/visor/terravisor/services/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ T_SERVICES := $(GET_PATH)
include $(T_SERVICES)/bootstrap/build.mk
include $(T_SERVICES)/driver/build.mk

ifeq ($(TERRAKERN),1)
include $(T_SERVICES)/kernel/build.mk
ifneq ($(TERRAKERN),0)
include $(T_SERVICES)/kernel/$(TERRAKERN)/build.mk
endif

DIR := $(T_SERVICES)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <terravisor/helios/helios.h>

/*****************************************************
* GLOBAL/STATIC VARIABLE DECLARATIONS
* DEFINE
*****************************************************/
#define MUTEX_INIT_VAL 1

Expand Down Expand Up @@ -76,13 +76,15 @@ status_t helios_mutex_lock (helios_mutex_t * mutex_ptr, size_t wait_ticks)
else
{
/* If mutex is taken, lock_task must already hold info about the task. */
if (mutex_ptr->lock_task != g_sched_ctrl.curr_task) {
if (mutex_ptr->lock_task != g_sched_ctrl.curr_task)
{
/* If locking task is not current task, wait for mutex */
g_sched_ctrl.curr_task->wait_res.wait_on_resource = (uintptr_t) mutex_ptr;
helios_task_wait(wait_ticks);
}
else if (mutex_ptr->lock_task == g_sched_ctrl.curr_task) {
/* If locking task is current task, allow locking recursively */
else
{
/* If locking task is current task or HELIOS_NULL_PTR, allow locking recursively */
lock_flag = true;
}
}
Expand All @@ -92,7 +94,8 @@ status_t helios_mutex_lock (helios_mutex_t * mutex_ptr, size_t wait_ticks)
lock_flag = true;
}

if (lock_flag) {
if (lock_flag)
{
/* Set locking task as current task and acquire lock. */
mutex_ptr->lock_task = g_sched_ctrl.curr_task;
mutex_ptr->mutex_val--;
Expand All @@ -105,13 +108,21 @@ status_t helios_mutex_unlock (helios_mutex_t * mutex_ptr)
HELIOS_ASSERT_IF_FALSE(mutex_ptr != HELIOS_NULL_PTR);
HELIOS_ASSERT_IF_FALSE(mutex_ptr->mutex_init != false);

if (mutex_ptr->lock_task != g_sched_ctrl.curr_task) {
if (mutex_ptr->lock_task != g_sched_ctrl.curr_task)
{
HELIOS_ERR("Mutex locked by another task");
return error_os_mutex_unlock;
}
else {
else
{
/* Unlock mutex only if current task requests it. */
mutex_ptr->mutex_val++;
if (mutex_ptr->mutex_val == MUTEX_INIT_VAL)
{
/* When Unlocked set current task to NULL */
mutex_ptr->lock_task = HELIOS_NULL_PTR;
}

}
return success;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,6 @@ static void __helios_sched_algo_round_robin_fn(helios_sched_ctrl_t * sched_ctrl)
/* do waitlist adjustment */
helios_sched_tcb_t * ptr = sched_ctrl->curr_task->ready_link.next;

__cc_sched_wait_list_adjustment(sched_ctrl);

if (ptr == sched_ctrl->ready_list_head)
{
/* IDLE Task */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static void __helios_power_save_callback(void)
/*****************************************************
* USER FUNCTION DEFINATION
*****************************************************/
void _helios_idle_task_fn(void)
_NORETURN void _helios_idle_task_fn(void)
{
static helios_sched_tcb_t * ptr = HELIOS_NULL_PTR;
helios_sched_ctrl_t * sched_ctrl = (helios_sched_ctrl_t *) helios_get_args();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ void helios_task_yield()
return;
}

void helios_run(void)
_NORETURN void helios_run(void)
{
/* OS Init code */
/* Initialise IDLE Task */
Expand Down

0 comments on commit d3d3dd5

Please sign in to comment.