microkernel: Rename struct mutex_struct to _k_mutex_struct

This is in preparation to enable private mutex support.
The struct needs to be moved into more visible header
so private mutexes can be declared. This also renames
according to naming convention to be private kernel
objects.

Change-Id: Ifccb60a837b44e443be0b091c2df4f06373718fe
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2015-07-14 11:04:42 -07:00 committed by Anas Nashif
parent ffd802250e
commit 43eed86737
4 changed files with 18 additions and 18 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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

View File

@ -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)