ubinos
ubik.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_H_
31 #define UBIK_H_
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
46 #include <ubinos_config.h>
47 #include <ubinos/type.h>
48 
50 #define UBIK_ERR__SUCCESS 0
51 
52 #define UBIK_ERR__FAIL -1
53 
55 #define UBIK_ERR__TIMEOUT -20
56 
57 #define UBIK_ERR__DEADLOCK -21
58 
59 #define UBIK_ERR__TERMINATED -30
60 
61 #define UBIK_ERR__OVERFLOWED -50
62 
64 #define UBIK_TAG__USRSTART 0x8000
65 
67 typedef int (*idletaskhookfunc_ft)(void *);
68 
70 #define IDLEHOOKFUNC_OPT__REPEAT 0x00
71 
72 #define IDLEHOOKFUNC_OPT__ONCE 0x80
73 
75 typedef void (*tickhookfunc_ft)(void);
76 
78 typedef struct _tickcount_t
79 {
80  unsigned int high;
81  unsigned int low;
82 } tickcount_t;
83 
98 int ubik_comp_init(unsigned int idle_stackdepth);
99 
107 int ubik_comp_start(void);
108 
114 unsigned int ubik_gettickpersec(void);
115 
122 
137 
147 unsigned int ubik_timemstotick(unsigned int timems);
148 
158 unsigned int ubik_ticktotimems(unsigned int tick);
159 
172 int ubik_settickhookfunc(tickhookfunc_ft tickhookfunc);
173 
180 int ubik_isactive(void);
181 
186 void ubik_entercrit(void);
187 
192 void ubik_exitcrit(void);
193 
200 int ubik_iscrit(void);
201 
208 int ubik_istask(void);
209 
217 int ubik_collectgarbage(void);
218 
233 int ubik_sprintkernelinfo(char * buf, int max);
234 
242 int ubik_printkernelinfo(void);
243 
274 int ubik_setidletaskhookfunc(idletaskhookfunc_ft func, void * arg,
275  const char * name, unsigned int option);
276 
290 int ubik_setrtpriority(int rtpriority);
291 
300 int ubik_getrtpriority(void);
301 
311 int ubik_isrt(void);
312 
313 #include <ubinos/ubik/task.h>
314 #include <ubinos/ubik/signal.h>
315 #include <ubinos/ubik/sem.h>
316 #include <ubinos/ubik/mutex.h>
317 #include <ubinos/ubik/msgq.h>
318 #include <ubinos/ubik/condv.h>
319 #include <ubinos/ubik/hrtick.h>
320 #include <ubinos/ubik/stimer.h>
321 
322 #ifdef __cplusplus
323 }
324 #endif
325 
326 #endif /* UBIK_H_ */
ubik_isactive
int ubik_isactive(void)
ubik_entercrit
void ubik_entercrit(void)
task.h
ubik task API
_tickcount_t
Definition: ubik.h:78
ubik_exitcrit
void ubik_exitcrit(void)
ubik_getrtpriority
int ubik_getrtpriority(void)
sem.h
ubik semaphore API
ubik_comp_init
int ubik_comp_init(unsigned int idle_stackdepth)
ubik_collectgarbage
int ubik_collectgarbage(void)
ubik_timemstotick
unsigned int ubik_timemstotick(unsigned int timems)
hrtick.h
ubik high resolution tick API
type.h
ubinos basic data type
idletaskhookfunc_ft
int(* idletaskhookfunc_ft)(void *)
Definition: ubik.h:67
max
#define max(a, b)
Definition: ubiclib.h:257
ubik_setrtpriority
int ubik_setrtpriority(int rtpriority)
ubik_iscrit
int ubik_iscrit(void)
ubik_settickhookfunc
int ubik_settickhookfunc(tickhookfunc_ft tickhookfunc)
ubik_ticktotimems
unsigned int ubik_ticktotimems(unsigned int tick)
msgq.h
ubik message queue API
ubik_comp_start
int ubik_comp_start(void)
ubik_istask
int ubik_istask(void)
tickhookfunc_ft
void(* tickhookfunc_ft)(void)
Definition: ubik.h:75
signal.h
ubik signal API
ubik_gettickdiff
tickcount_t ubik_gettickdiff(tickcount_t tick1, tickcount_t tick2)
ubik_isrt
int ubik_isrt(void)
_tickcount_t::high
unsigned int high
Definition: ubik.h:80
mutex.h
ubik mutex API
ubik_printkernelinfo
int ubik_printkernelinfo(void)
ubik_gettickcount
tickcount_t ubik_gettickcount(void)
ubik_setidletaskhookfunc
int ubik_setidletaskhookfunc(idletaskhookfunc_ft func, void *arg, const char *name, unsigned int option)
condv.h
ubik condition variable API
stimer.h
ubik semaphore timer API
ubik_gettickpersec
unsigned int ubik_gettickpersec(void)
_tickcount_t::low
unsigned int low
Definition: ubik.h:81
tickcount_t
struct _tickcount_t tickcount_t
ubik_sprintkernelinfo
int ubik_sprintkernelinfo(char *buf, int max)