diff --git a/include/microkernel/base_api.h b/include/microkernel/base_api.h index a731ae9be21..f4f24019cc8 100644 --- a/include/microkernel/base_api.h +++ b/include/microkernel/base_api.h @@ -102,6 +102,16 @@ struct k_msg { } extra; }; +struct _k_mutex_struct { + ktask_t Owner; + kpriority_t OwnerCurrentPrio; + kpriority_t OwnerOriginalPrio; + int Level; + struct k_args *Waiters; + int Count; + int Confl; +}; + typedef enum { _0_TO_N = 0x00000001, _1_TO_N = 0x00000002, diff --git a/kernel/microkernel/include/micro_private_types.h b/kernel/microkernel/include/micro_private_types.h index ed79ff41b71..42863614ebb 100644 --- a/kernel/microkernel/include/micro_private_types.h +++ b/kernel/microkernel/include/micro_private_types.h @@ -507,16 +507,6 @@ struct mbx_struct { int Count; }; -struct mutex_struct { - ktask_t Owner; - kpriority_t OwnerCurrentPrio; - kpriority_t OwnerOriginalPrio; - int Level; - struct k_args *Waiters; - int Count; - int Confl; -}; - struct sem_struct { struct k_args *Waiters; int Level; diff --git a/kernel/microkernel/k_mutex.c b/kernel/microkernel/k_mutex.c index 1377c719913..240a4007d72 100644 --- a/kernel/microkernel/k_mutex.c +++ b/kernel/microkernel/k_mutex.c @@ -72,7 +72,7 @@ void _k_mutex_lock_reply( ) { #ifdef CONFIG_SYS_CLOCK_EXISTS - struct mutex_struct *Mutex; /* pointer to internal mutex structure */ + struct _k_mutex_struct *Mutex; /* pointer to internal mutex structure */ struct k_args *PrioChanger; /* used to change a task's priority level */ struct k_args *FirstWaiter; /* pointer to first task in wait queue */ kpriority_t newPriority; /* priority level to which to drop */ @@ -88,7 +88,7 @@ void _k_mutex_lock_reply( A->Time.rcode = RC_TIME; MutexId = A->Args.l1.mutex; - Mutex = (struct mutex_struct *)MutexId; + Mutex = (struct _k_mutex_struct *)MutexId; FirstWaiter = Mutex->Waiters; @@ -170,7 +170,7 @@ void _k_mutex_lock_request(struct k_args *A /* pointer to mutex lock request arguments */ ) { - struct mutex_struct *Mutex; /* pointer to internal mutex structure */ + struct _k_mutex_struct *Mutex; /* pointer to internal mutex structure */ int MutexId; /* mutex ID obtained from lock request */ struct k_args *PrioBooster; /* used to change a task's priority level */ kpriority_t BoostedPrio; /* new "boosted" priority level */ @@ -178,7 +178,7 @@ void _k_mutex_lock_request(struct k_args *A /* pointer to mutex lock MutexId = A->Args.l1.mutex; - Mutex = (struct mutex_struct *)MutexId; + Mutex = (struct _k_mutex_struct *)MutexId; if (Mutex->Level == 0 || Mutex->Owner == A->Args.l1.task) { /* The mutex is either unowned or this is a nested lock. */ #ifdef CONFIG_OBJECT_MONITOR @@ -317,12 +317,12 @@ void _k_mutex_unlock(struct k_args *A /* pointer to mutex unlock request arguments */ ) { - struct mutex_struct *Mutex; /* pointer internal mutex structure */ + struct _k_mutex_struct *Mutex; /* pointer internal mutex structure */ int MutexId; /* mutex ID obtained from unlock request */ struct k_args *PrioDowner; /* used to change a task's priority level */ MutexId = A->Args.l1.mutex; - Mutex = (struct mutex_struct *)MutexId; + Mutex = (struct _k_mutex_struct *)MutexId; if (Mutex->Owner == A->Args.l1.task && --(Mutex->Level) == 0) { /* * The requesting task owns the mutex and all locks diff --git a/scripts/sysgen b/scripts/sysgen index a93aabba528..65732505ddc 100755 --- a/scripts/sysgen +++ b/scripts/sysgen @@ -519,7 +519,7 @@ def kernel_main_c_mutexes(): kernel_main_c_out("\n") for mutex in mutex_list: name = mutex[0] - kernel_main_c_out("struct mutex_struct _k_mutex_obj_%s = " % (name) + + kernel_main_c_out("struct _k_mutex_struct _k_mutex_obj_%s = " % (name) + "{ANYTASK, 64, 64, 0, NULL, 0, 0};\n") # mutex object identifiers @@ -926,7 +926,7 @@ def generate_zephyr_h_obj_ids(): for mutex in mutex_list: name = mutex[0] zephyr_h_data += \ - "extern struct mutex_struct _k_mutex_obj_%s;\n" % (name) + "extern struct _k_mutex_struct _k_mutex_obj_%s;\n" % (name) zephyr_h_data += \ "#define %s ((kmutex_t)&_k_mutex_obj_%s)\n\n" % (name, name)