ubinos
mutex.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 Sung Ho Park
3  Contact: ubinos.org@gmail.com
4 
5  This file is part of the itf_ubinos component of the Ubinos.
6 
7  GNU General Public License Usage
8  This file may be used under the terms of the GNU
9  General Public License version 3.0 as published by the Free Software
10  Foundation and appearing in the file license_gpl3.txt included in the
11  packaging of this file. Please review the following information to
12  ensure the GNU General Public License version 3.0 requirements will be
13  met: http://www.gnu.org/copyleft/gpl.html.
14 
15  GNU Lesser General Public License Usage
16  Alternatively, this file may be used under the terms of the GNU Lesser
17  General Public License version 2.1 as published by the Free Software
18  Foundation and appearing in the file license_lgpl.txt included in the
19  packaging of this file. Please review the following information to
20  ensure the GNU Lesser General Public License version 2.1 requirements
21  will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22 
23  Commercial Usage
24  Alternatively, licensees holding valid commercial licenses may
25  use this file in accordance with the commercial license agreement
26  provided with the software or, alternatively, in accordance with the
27  terms contained in a written agreement between you and rightful owner.
28  */
29 
30 #ifndef UBIK_MUTEX_H_
31 #define UBIK_MUTEX_H_
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
250 #include <ubinos_config.h>
251 #include <ubinos/type.h>
252 
254 #define MUTEX_OPT__NOPRIORITYINHERITANCE 0x80
255 
257 typedef struct __mutex_tip_t
258 {
259  unsigned int type :8;
260  unsigned int valid :1;
261  unsigned int reserved :7;
262  unsigned int reserved2 :16;
263 } _mutex_tip_t;
264 
267 
279 int mutex_create(mutex_pt * mutex_p);
280 
296 int mutex_create_ext(mutex_pt * mutex_p, unsigned int option);
297 
311 int mutex_delete(mutex_pt * mutex_p);
312 
326 int mutex_lock(mutex_pt mutex);
327 
345 int mutex_lock_timed(mutex_pt mutex, unsigned int tick);
346 
364 int mutex_lock_timedms(mutex_pt mutex, unsigned int timems);
365 
377 int mutex_unlock(mutex_pt mutex);
378 
391 int mutex_islocked(mutex_pt mutex);
392 
393 #ifdef __cplusplus
394 }
395 #endif
396 
397 #endif /* UBIK_MUTEX_H_ */
_mutex_tip_t
struct __mutex_tip_t _mutex_tip_t
mutex_unlock
int mutex_unlock(mutex_pt mutex)
__mutex_tip_t::reserved2
unsigned int reserved2
Definition: mutex.h:262
__mutex_tip_t::reserved
unsigned int reserved
Definition: mutex.h:261
mutex_lock
int mutex_lock(mutex_pt mutex)
__mutex_tip_t::valid
unsigned int valid
Definition: mutex.h:260
mutex_delete
int mutex_delete(mutex_pt *mutex_p)
__mutex_tip_t::type
unsigned int type
Definition: mutex.h:259
type.h
ubinos basic data type
__mutex_tip_t
Definition: mutex.h:257
mutex_islocked
int mutex_islocked(mutex_pt mutex)
mutex_lock_timedms
int mutex_lock_timedms(mutex_pt mutex, unsigned int timems)
mutex_pt
_mutex_tip_t * mutex_pt
Definition: mutex.h:266
mutex_create
int mutex_create(mutex_pt *mutex_p)
mutex_create_ext
int mutex_create_ext(mutex_pt *mutex_p, unsigned int option)
mutex_lock_timed
int mutex_lock_timed(mutex_pt mutex, unsigned int tick)