|
ubinos
|
ubik (Ubinos Kernel) API More...
#include <ubinos_config.h>#include <ubinos/type.h>#include <ubinos/ubik/task.h>#include <ubinos/ubik/signal.h>#include <ubinos/ubik/sem.h>#include <ubinos/ubik/mutex.h>#include <ubinos/ubik/msgq.h>#include <ubinos/ubik/condv.h>#include <ubinos/ubik/hrtick.h>#include <ubinos/ubik/stimer.h>Go to the source code of this file.
Classes | |
| struct | _tickcount_t |
Macros | |
| #define | UBIK_ERR__SUCCESS 0 |
| #define | UBIK_ERR__FAIL -1 |
| #define | UBIK_ERR__TIMEOUT -20 |
| #define | UBIK_ERR__DEADLOCK -21 |
| #define | UBIK_ERR__TERMINATED -30 |
| #define | UBIK_ERR__OVERFLOWED -50 |
| #define | UBIK_TAG__USRSTART 0x8000 |
| #define | IDLEHOOKFUNC_OPT__REPEAT 0x00 |
| #define | IDLEHOOKFUNC_OPT__ONCE 0x80 |
Typedefs | |
| typedef int(* | idletaskhookfunc_ft) (void *) |
| typedef void(* | tickhookfunc_ft) (void) |
| typedef struct _tickcount_t | tickcount_t |
Functions | |
| int | ubik_comp_init (unsigned int idle_stackdepth) |
| int | ubik_comp_start (void) |
| unsigned int | ubik_gettickpersec (void) |
| tickcount_t | ubik_gettickcount (void) |
| tickcount_t | ubik_gettickdiff (tickcount_t tick1, tickcount_t tick2) |
| unsigned int | ubik_timemstotick (unsigned int timems) |
| unsigned int | ubik_ticktotimems (unsigned int tick) |
| unsigned long | ubik_tickcouttotimems (tickcount_t tc) |
| int | ubik_settickhookfunc (tickhookfunc_ft tickhookfunc) |
| int | ubik_isactive (void) |
| void | ubik_entercrit (void) |
| void | ubik_exitcrit (void) |
| int | ubik_iscrit (void) |
| int | ubik_istask (void) |
| int | ubik_collectgarbage (void) |
| int | ubik_sprintkernelinfo (char *buf, int max) |
| int | ubik_printkernelinfo (void) |
| int | ubik_setidletaskhookfunc (idletaskhookfunc_ft func, void *arg, const char *name, unsigned int option) |
| int | ubik_setrtpriority (int rtpriority) |
| int | ubik_getrtpriority (void) |
| int | ubik_isrt (void) |
ubik (Ubinos Kernel) API
ubik (Ubinos Kernel) API를 정의합니다.
| #define IDLEHOOKFUNC_OPT__ONCE 0x80 |
아이들 태스크 후크 함수 선택 사항: 설정된 후크 함수를 한번만 수행함
| #define IDLEHOOKFUNC_OPT__REPEAT 0x00 |
아이들 태스크 후크 함수 선택 사항: 설정된 후크 함수를 반복해서 수행함(기본 설정)
| #define UBIK_ERR__DEADLOCK -21 |
오류: 교착 상태에 빠질 가능성이 있음
| #define UBIK_ERR__FAIL -1 |
오류: 실패
| #define UBIK_ERR__OVERFLOWED -50 |
오류: 오버플로우 발생
| #define UBIK_ERR__SUCCESS 0 |
오류: 오류 없음
| #define UBIK_ERR__TERMINATED -30 |
오류: 대상 객체가 제거되었음
| #define UBIK_ERR__TIMEOUT -20 |
오류: 제한 시간 초과
| #define UBIK_TAG__USRSTART 0x8000 |
사용자 태그 시작값
| typedef int(* idletaskhookfunc_ft) (void *) |
아이들 태스크 후크 함수 포인터 형 정의
| typedef struct _tickcount_t tickcount_t |
tick 수 형 정의
| typedef void(* tickhookfunc_ft) (void) |
틱 후크 함수 포인터 형 정의
| int ubik_collectgarbage | ( | void | ) |
사용 중이 아닌 자원들을 정리하는 함수
| int ubik_comp_init | ( | unsigned int | idle_stackdepth | ) |
ubik 컴포넌트를 초기화하는 함수
이 함수는 시스템 시작시 bsp 컴포넌트의 main 함수에서 자동적으로 호출됩니다.
| idle_stackdepth | idle task 스택 깊이(스택 영역 크기는 stackdepth * INT_SIZE 바이트가 됨) 0: 기본 스택 깊이 값(task_getdefaultstackdepth 함수가 돌려주는 값) 1 ~ 최저 스택 깊이 값: 최저 스택 깊이 값(task_getminstackdepth 함수가 돌려주는 값) |
| int ubik_comp_start | ( | void | ) |
ubik 컴포넌트를 시작하는 함수
Cortax-M 구현에서는 이 함수를 수행하면 MSP가 초기화되기 때문에 직전까지의 지역 변수들은 사용할 수 없게 된다.
| void ubik_entercrit | ( | void | ) |
크리티컬 섹션으로 들어가는 함수
| void ubik_exitcrit | ( | void | ) |
크리티컬 섹션에서 빠져나오는 함수
| int ubik_getrtpriority | ( | void | ) |
실시간 태스크 우선순위를 가져오는 함수
| tickcount_t ubik_gettickcount | ( | void | ) |
| tickcount_t ubik_gettickdiff | ( | tickcount_t | tick1, |
| tickcount_t | tick2 | ||
| ) |
tick 수의 차이(tick2에서 tick1을 뺀 값)를 돌려주는 함수
비교 대상 tick 1이 비교 대상 tick 2보다 클 경우 오버플로우가 일어난 것으로 간주하고 차이를 계산함
| tick1 | 비교 대상 tick 1 |
| tick2 | 비교 대상 tick 2 |
| unsigned int ubik_gettickpersec | ( | void | ) |
| int ubik_isactive | ( | void | ) |
ubik 컴포넌트가 active 상태인지 여부를 돌려주는 함수
| int ubik_iscrit | ( | void | ) |
크리티컬 섹션 또는 인터럽트 서비스 루틴을 수행 중인지 여부를 알려주는 함수
| int ubik_isrt | ( | void | ) |
실시간 태스크, 태스크 잠금 상태의 태스크, 크리티컬 섹션, 또는 인터럽트 서비스 루틴을 수행 중인지 여부를 알려주는 함수
| int ubik_istask | ( | void | ) |
태스크를 수행 중인지 여부를 알려주는 함수
| int ubik_printkernelinfo | ( | void | ) |
| int ubik_setidletaskhookfunc | ( | idletaskhookfunc_ft | func, |
| void * | arg, | ||
| const char * | name, | ||
| unsigned int | option | ||
| ) |
아이들 태스크 후크 함수를 설정하는 함수
설정된 후크 함수는 아이들 태스크 내에서 호출됨
아이들 태스크는 일반 태스크와는 달리 task_sleep 함수를 호출할 경우 바쁜 기다림busy waiting을 수행한다. 그리고 sem_take, sem_take_timed 함수와 같은 특정 조건이 만족되기를 기다리는 함수를 호출할 경우 스핀 기다림spin waiting을 수행하기 때문에 최대 UBINOS__UBIK__IDLETASK_SPINWAIT_INTERVALTICK 으로 정의된 시스템 틱 수 만큼 응답 시간이 지연될 수 있다.
| func | 설정할 후크 함수 포인터 NULL: 후크 함수 설정 해제 |
| arg | 후크 함수로 전달할 매개변수 |
| name | 후크 함수 이름 NULL: 후크 함수 이름을 지정하지 않음 |
| option | 선택 사항 (IDLEHOOKFUNC_OPT__...) 0: 기본 설정 사용 |
| int ubik_setrtpriority | ( | int | rtpriority | ) |
실시간 태스크 우선순위를 설정하는 함수
이 함수로 설정된 실시간 태스크 우선순위 이상의 우선 순위를 가진 태스크를 실시간 태스크로 간주한다.
실기간 태스트 우선순위가 설정되어 있지 않으면 모든 태스크를 비실시간 태스크로 간주한다.
| rtpriority | 실시간 태스크 우선순위 |
| int ubik_settickhookfunc | ( | tickhookfunc_ft | tickhookfunc | ) |
틱 후크 함수를 등록하는 함수
틱 후크 함수는 시스템 틱 인터럽트가 발생할 때마다 자동적으로 호출된다.
| tickhookfunc | 틱 후크 함수 포인터 NULL: 틱 후크 함수 등록 해제 |
| int ubik_sprintkernelinfo | ( | char * | buf, |
| int | max | ||
| ) |
커널 정보를 문자열 형태로 메모리 버퍼에 기록하는 함수
| buf | 기록할 메모리 버퍼 |
| max | 메모리 버퍼의 크기 |
| unsigned long ubik_tickcouttotimems | ( | tickcount_t | tc | ) |
시스템 tick 수를 시간(천분의 일초)으로 환산하는 함수
| tc | 시스템 tick 수 |
| unsigned int ubik_ticktotimems | ( | unsigned int | tick | ) |
시스템 tick 수를 시간(천분의 일초)으로 환산하는 함수
| tick | 시스템 tick 수 |
| unsigned int ubik_timemstotick | ( | unsigned int | timems | ) |
시간(천분의 일초)을 시스템 tick 수로 환산하는 함수
| timems | 시간(천분의 일초) |