ubinos
task.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_TASK_H_
31 #define UBIK_TASK_H_
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
347 #include <ubinos_config.h>
348 #include <ubinos/type.h>
349 
352 #define TASK_WAITOPT__IGNOREINVALID 0x80
353 
355 #define TASK_WAITOPT__ALL 0x40
356 
358 typedef void (*taskfunc_ft)(void *);
359 
361 typedef struct __task_tip_t
362 {
363  unsigned int type :8;
364  unsigned int valid :1;
365  unsigned int reserved :7;
366  unsigned int reserved2 :16;
367 } _task_tip_t;
368 
371 
407 int task_create(task_pt * task_p, taskfunc_ft func, void * arg, int priority,
408  unsigned int stackdepth, const char * name);
409 
456 int task_create_ext(task_pt * task_p, taskfunc_ft func, void * arg,
457  int priority, unsigned int stackdepth, const char * name,
458  unsigned int tag, unsigned int option);
459 
474 int task_delete(task_pt * task_p);
475 
488 int task_suspend(task_pt task);
489 
501 int task_resume(task_pt task);
502 
513 int task_sleep(unsigned int tick);
514 
525 int task_sleepms(unsigned int timems);
526 
547 int task_setpriority(task_pt task, int priority);
548 
564 int task_getpriority(task_pt task);
565 
571 int task_gethighestpriority(void);
572 
578 int task_getlowestpriority(void);
579 
585 int task_getmiddlepriority(void);
586 
590 void task_lock(void);
591 
595 void task_unlock(void);
596 
612 int task_setmaxwaitsigobj(task_pt task, int max);
613 
627 
664 int task_waitforsigobjs(void ** sigobj_p, int * sigtype_p, void ** param_p,
665  int count, unsigned int waitopt);
666 
707 int task_waitforsigobjs_timed(void ** sigobj_p, int * sigtype_p,
708  void ** param_p, int count, unsigned int waitopt, unsigned int tick);
709 
750 int task_waitforsigobjs_timedms(void ** sigobj_p, int * sigtype_p,
751  void ** param_p, int count, unsigned int waitopt, unsigned int timems);
752 
776 int task_join(task_pt * task_p, int * result_p, int count);
777 
806 int task_join_timed(task_pt * task_p, int * result_p, int count,
807  unsigned int tick);
808 
837 int task_join_timedms(task_pt * task_p, int * result_p, int count,
838  unsigned int timems);
839 
847 task_pt task_getcur(void);
848 
857 unsigned int task_getremainingtimeout(void);
858 
867 unsigned int task_getremainingtimeoutms(void);
868 
874 unsigned int task_getminstackdepth(void);
875 
881 unsigned int task_getdefaultstackdepth(void);
882 
898 int task_getstacksize(task_pt task, unsigned int * stacksize_p);
899 
915 int task_getmaxstackusage(task_pt task, unsigned int * maxstackusage_p);
916 
917 #ifdef __cplusplus
918 }
919 #endif
920 
921 #endif /* UBIK_TASK_H_ */
task_resume
int task_resume(task_pt task)
task_pt
_task_tip_t * task_pt
Definition: task.h:370
task_delete
int task_delete(task_pt *task_p)
task_join
int task_join(task_pt *task_p, int *result_p, int count)
task_getremainingtimeoutms
unsigned int task_getremainingtimeoutms(void)
task_lock
void task_lock(void)
task_getmaxwaitsigobj
int task_getmaxwaitsigobj(task_pt task)
task_setpriority
int task_setpriority(task_pt task, int priority)
__task_tip_t::valid
unsigned int valid
Definition: task.h:364
__task_tip_t::type
unsigned int type
Definition: task.h:363
task_waitforsigobjs
int task_waitforsigobjs(void **sigobj_p, int *sigtype_p, void **param_p, int count, unsigned int waitopt)
task_getlowestpriority
int task_getlowestpriority(void)
type.h
ubinos basic data type
max
#define max(a, b)
Definition: ubiclib.h:257
task_getremainingtimeout
unsigned int task_getremainingtimeout(void)
__task_tip_t
Definition: task.h:361
task_getcur
task_pt task_getcur(void)
task_getminstackdepth
unsigned int task_getminstackdepth(void)
task_unlock
void task_unlock(void)
task_getmaxstackusage
int task_getmaxstackusage(task_pt task, unsigned int *maxstackusage_p)
task_create
int task_create(task_pt *task_p, taskfunc_ft func, void *arg, int priority, unsigned int stackdepth, const char *name)
_task_tip_t
struct __task_tip_t _task_tip_t
task_sleepms
int task_sleepms(unsigned int timems)
task_getstacksize
int task_getstacksize(task_pt task, unsigned int *stacksize_p)
task_join_timed
int task_join_timed(task_pt *task_p, int *result_p, int count, unsigned int tick)
task_getpriority
int task_getpriority(task_pt task)
task_join_timedms
int task_join_timedms(task_pt *task_p, int *result_p, int count, unsigned int timems)
taskfunc_ft
void(* taskfunc_ft)(void *)
Definition: task.h:358
task_setmaxwaitsigobj
int task_setmaxwaitsigobj(task_pt task, int max)
task_suspend
int task_suspend(task_pt task)
task_getmiddlepriority
int task_getmiddlepriority(void)
__task_tip_t::reserved2
unsigned int reserved2
Definition: task.h:366
task_waitforsigobjs_timedms
int task_waitforsigobjs_timedms(void **sigobj_p, int *sigtype_p, void **param_p, int count, unsigned int waitopt, unsigned int timems)
task_sleep
int task_sleep(unsigned int tick)
task_getdefaultstackdepth
unsigned int task_getdefaultstackdepth(void)
__task_tip_t::reserved
unsigned int reserved
Definition: task.h:365
task_waitforsigobjs_timed
int task_waitforsigobjs_timed(void **sigobj_p, int *sigtype_p, void **param_p, int count, unsigned int waitopt, unsigned int tick)
task_create_ext
int task_create_ext(task_pt *task_p, taskfunc_ft func, void *arg, int priority, unsigned int stackdepth, const char *name, unsigned int tag, unsigned int option)
task_gethighestpriority
int task_gethighestpriority(void)