ubinos
sem.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_SEM_H_
31 #define UBIK_SEM_H_
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
142 #include <ubinos_config.h>
143 #include <ubinos/type.h>
144 
145 #include "task.h"
146 
148 #define SEM_OPT__IGNOREOVERFLOW 0x80
149 
151 typedef struct __sem_tip_t
152 {
153  unsigned int type :8;
154  unsigned int valid :1;
155  unsigned int reserved :7;
156  unsigned int reserved2 :16;
157 } _sem_tip_t;
158 
160 typedef _sem_tip_t * sem_pt;
161 
175 int sem_create(sem_pt * sem_p);
176 
190 int semb_create(sem_pt * sem_p);
191 
213 int sem_create_ext(sem_pt * sem_p, unsigned int initcount,
214  unsigned int maxcount, unsigned int option);
215 
229 int sem_delete(sem_pt * sem_p);
230 
244 int sem_take(sem_pt sem);
245 
263 int sem_take_timed(sem_pt sem, unsigned int tick);
264 
282 int sem_take_timedms(sem_pt sem, unsigned int timems);
283 
296 int sem_give(sem_pt sem);
297 
309 int sem_clear(sem_pt sem);
310 
326 int sem_setsender(sem_pt sem, task_pt task);
327 
342 int sem_getcount(sem_pt sem, unsigned int * count_p);
343 
344 #ifdef __cplusplus
345 }
346 #endif
347 
348 #endif /* UBIK_SEM_H_ */
__sem_tip_t::type
unsigned int type
Definition: sem.h:153
task.h
ubik task API
sem_create
int sem_create(sem_pt *sem_p)
__sem_tip_t::valid
unsigned int valid
Definition: sem.h:154
sem_getcount
int sem_getcount(sem_pt sem, unsigned int *count_p)
type.h
ubinos basic data type
__task_tip_t
Definition: task.h:361
sem_take_timed
int sem_take_timed(sem_pt sem, unsigned int tick)
sem_take
int sem_take(sem_pt sem)
__sem_tip_t::reserved
unsigned int reserved
Definition: sem.h:155
sem_delete
int sem_delete(sem_pt *sem_p)
sem_setsender
int sem_setsender(sem_pt sem, task_pt task)
_sem_tip_t
struct __sem_tip_t _sem_tip_t
__sem_tip_t
Definition: sem.h:151
sem_give
int sem_give(sem_pt sem)
sem_create_ext
int sem_create_ext(sem_pt *sem_p, unsigned int initcount, unsigned int maxcount, unsigned int option)
semb_create
int semb_create(sem_pt *sem_p)
__sem_tip_t::reserved2
unsigned int reserved2
Definition: sem.h:156
sem_pt
_sem_tip_t * sem_pt
Definition: sem.h:160
sem_clear
int sem_clear(sem_pt sem)
sem_take_timedms
int sem_take_timedms(sem_pt sem, unsigned int timems)