This file documents the use of the URIBO-uITRON4.0-Kernel.
Copyright (C) 2007,2008,2009,2010
256TECH Co., Ltd.
Masahiro Sakamoto
mail:m-sakamoto(AT)users.sourceforge.net
http://uribo.sourceforge.net
This is a real-time OS based on uITRON4.0 full specification.
URIBO is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
URIBO is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with URIBO; see the file COPYING and COPYING.LESSER.
If not, see (http://www.gnu.org/licenses/).
Table of Contents
Introduction
URIBO is easy to use because it generates a object dynamically
without configurator.
This is designed to be suitable for even 16 bits microcomputer.
The C compiler suitable for this is only GCC.
Documents
Documents are in the directory: (URIBO INSTALLED DIR)/doc/.
Targets being supported now
- AKIZUKI AE-H8/3069-LAN (H3/300H core)
- Altera FPGA Evaluation Board (Nios II core) ###Under construction###
- TAC T-SH7706LSR Board (SH3 core) ###Under construction###
- CQ LPC2388 Board (ARM7DTMI-S core) ###Under construction###
- CQ STM32F103VB Board (Cortex-M3 core) ###Under construction###
- CQ MCF52233 Board (ColdFire core) ###Under construction###
- CQ uPD70F3716GC Board (V850ES core) ###Under construction###
- CQ MB91FV310A Board (FR60 core) ###Under construction###
About uITRON
- TRON is the abbreviation of "The Real-time Operating systen Nucleus."
- ITRON is the abbreviation of "Industrial TRON."
- uITRON is the abbreviation of "Micro Industrial TRON."
- TRON,ITRON, and uITRON do not refer to any specific product or products.
The uITRON4.0 Specification is an open real-time kernel specification
developed by ITRON Association. The uITRON4.0 Specification document
can be obtained from the TRON Association web site
(http://www.assoc.tron.org).
uITRON abbreviations
The kernel objects as follows.
TSK |
Task
|
SEM |
Semaphore
|
FLG |
Eventflag
|
DTQ |
Data Queue
|
MBX |
Mailbox
|
MTX |
Mutex
|
MBF |
Message Buffer
|
POR |
Rendezvous Port
|
INH |
(uITRON) Interrupt Handler
|
ISR |
Interrupt Serivce Routine
|
MPL |
Variable-sized Memory Pool
|
MPF |
Fixed-sized Memory Pool
|
CYC |
Cyclic Handler
|
ALM |
Alarm Handler
|
OVR |
Overrun Handler
|
SVC |
Extended Serivce Call
|
SEM |
Semaphore
|
1 Quick start
Install GCC, GDB, and GDB-stub
Please refer to (URIBO INSTALLED DIR)/doc/inst_(TARGET NAME).html
Build sample application
$ cd (URIBO INSTALLED DIR)/(CPU NAME)/app_(TARGET NAME)
$ make
Load the application to RAM of the target by GDB
e.g., The target is AE-H8/3069-LAN.
$ h8300-linux-elf-gdb test.elf
If you want to use USB-serial cable, please specify /dev/ttyUSB0
etc. instead of /dev/ttyS0 in .gdbinit script.
Current directory is /home/saka/uribo/h8300h/app_ae_h8_3069_lan/
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=h8300-linux-elf"...
0x000013ac in ?? ()
Loading section .text, size 0x4236 lma 0x400000
Loading section .data, size 0x3e lma 0x404236
Start address 0x400000, load size 17012
Transfer rate: 5443 bits/sec, 50 bytes/write.
(gdb)
Run
Please do continue command.
(gdb) cont
Sample appplication outputs printf messages to GDB console as follows.
task1 started. (exinf=11)
task1 slept and gave CPU.
task2 started. (exinf=22)
task2 has been waiting for one second...
task2 woke task1 up and gave CPU.
task1 was waken up and got CPU.
task1 slept and gave CPU.
task2 got CPU.
task2 has been waiting for one second...
task2 woke task1 up and gave CPU.
task1 was waken up and got CPU.
task1 slept and gave CPU.
task2 got CPU.
task2 has been waiting for one second...
task2 woke task1 up and gave CPU.
task1 was waken up and got CPU.
task1 slept and gave CPU.
task2 got CPU.
...
2 Configuration
2.1 Kernel compiling options
You can enable or disable some kernel functions.
These are pre-processor symbols when compiling kernel.
e.g., Please add "-D_KERNEL_ASSERT" option to the CFLAGS line
in the Makefile if you want to enable service call assertion.
2.1.1 Service call assertion (_KERNEL_ASSERT)
The service call assertion is enabled if "_KERNEL_ASSERT" symbol is defined.
The kernel displays the message following "KERNEL ASSERT"
when an error is found at the exit of service calls or
system functions
, and passes GDB the control.
However, the following errors are ignored: E_TMOUT, E_RLWAI, and E_DLT.
2.1.2 Enable mutex (_KERNEL_MTX)
The mutex function is enabled if "_KERNEL_MTX" symbol is defined.
The kernel is impemented under not "the strict priority control rule"
but "the simplified priority control roule".
However, if you do not need mutex,
I recommend it not to be enabled because mutex code is too heavy
for uITRON kernel.
2.1.3 Enable overrun handler (_KERNEL_OVR)
The overrun handler is enabled if "_KERNEL_OVR" symbol is defined.
The kernel defines system timer interrupt handler as not INH but ISR
if this is enabled.
2.1.4 No static error checking (_KERNEL_NO_STATIC_ERR)
The omission of checking static error is enabled
if "_KERNEL_NO_STATIC_ERR" symbol is defined.
"static errro" means the check on parameters of service call at the entrance.
This option is used to omit that checking and make fast.
The kernel will record the found error in "SYSER" variable.
(However, the following errors are ignored: E_TMOUT, E_RLWAI, and E_DLT.)
So, you might be able to enable this if "SYSER" keeps 0.
2.1.5 No stack filling (_KERNEL_NO_STKFIL)
The omission of filling stacks with fixed pattern is enabled
if "_KERNEL_NO_STKFIL" symbol is defined.
The kernel will fill stacks of user task with the ID of the task at cre_tsk().
The kernel will fill stack of interrupt handler with 0xdd
and will fill stack of system timer task with 0xee at sysini().
These are used to check the quantity consumed of the stack later.
You can make initialization fast at sysini() and cre_tsk() by this option.
2.1.6 Not cleared BSS (_KERNEL_NO_BSSCLR)
The kernel will clear some important variables of itself at sysini()
if "_KERNEL_NO_BSSCLR" symbol is defined.
You must use this option if your C start up routine omits to
clear BSS section by 0.
2.1.7 Kernel debugging (_KERNEL_DEBUG)
The kernel debugging code is enabled if "_KERNEL_DEBUG" symbol is defined.
That code can find kernel internal error.
2.2 Kernel configuration header
Please inlcude "config.h" at only by one of application source files.
This header file defines default values of kernel configuration and
defines pointer array for objects, etc.
It is all done if you are satisfied with those default values.
(e.g., "main.c" includes "config.h")
#include "kernel.h"
#include "config.h" /* Default configuration only */
int main()
{
sysini();
...
Or, please define the value at before "config.h"
if you want to override defaults.
(e.g., Override muximum number of task priority)
#include "kernel.h"
#define TPRI_MAX 2 /* Override the default value */
#include "config.h"
int main()
{
sysini();
...
2.2.1 Maximum number of task priority (TPRI_MAX)
This value defines the muximum number of task priority.
Default value is 8. So, in that case you can use priority from 1 to 8.
It relates to the size of ready-queue and of waiting-queue
in any object: e.g., semaphore which has "TA_TPRI" attribute.
The size of a priority queue is TPRI_MAX * sizeof(void *).
2.2.2 Maximum number of kernel objects (?????_MAX)
These values defines the muximum value of object ID.
e.g., You can use ID from 1 to 8 if the value is 8.
The size of an array for object pointer which is defined at "config.h"
is (the maximum number) * sizeof(void *).
symbol |
minimum |
maximum |
default |
comment |
TPRI_MAX |
0
| 255
| 8
| Task Priority
|
TSKID_MAX |
0
| 255
| 8
| Task ID
|
SEMID_MAX |
0
| 32767
| 8
| Semaphore ID
|
FLGID_MAX |
0
| 32767
| 8
| Eventflag ID
|
DTQID_MAX |
0
| 32767
| 8
| Data Queue ID
|
MBXID_MAX |
0
| 32767
| 8
| Mailbox ID
|
MTXID_MAX |
0
| 32767
| 8
| Mutex ID
|
MBFID_MAX |
0
| 32767
| 8
| Message Buffer ID
|
PORID_MAX |
0
| 32767
| 8
| Rendezvous Port ID
|
ISRID_MAX |
0
| 32767
| 8
| Interrupt Service Routine ID
|
MPLID_MAX |
0
| 32767
| 8
| Variable-sized Memory Pool ID
|
MPFID_MAX |
0
| 32767
| 8
| Fixed-sized Memory Pool ID
|
CYCNO_MAX |
0
| 32767
| 8
| Cyclic Handler ID
|
ALMNO_MAX |
0
| 32767
| 8
| Alarm Handler ID
|
SVCFN_MAX |
0
| 32767
| 8
| Extended Service Call Function Code
|
2.2.3 Stack size for non-task contexts (ISTKSZ/TSTKSZ)
"Non-task contexts" means two contexts of interrupt handler and
of time event handler.
The kernel will fill stack of interrupt handler with 0xdd
and will fill stack of system timer task with 0xee at sysini().
These are used to check the quantity consumed of the stack later.
symbol |
default |
comment |
ISTKSZ |
sizeof(T_CTX) * 4
| Stack size of Interrupt Handler (INH/ISR Hanlder)
|
TSTKSZ |
sizeof(T_CTX) * 4
| Stack size of System Timer Task (OVR/CYC/ALM Handler)
|
Note: "T_CTX" is structured data set of task context and it includes
the image of the CPU registers.
2.2.4 Memory pool sizes (SYSMSZ/MPLMSZ/STKMSZ)
The kernel has 3 internal memory pools.
- Pool of System memory
- Pool of Memory pool memory
- Pool of Stack memory
System memory size (SYSMSZ)
"System memory" is a space for structured data of kernel objects.
e.g., "T_TCB" structured data will be allocated in pool of system memory
at cre_tsk() or "T_SEM" will be allocated at cre_sem().
Default value is 0 and you are able not to define "SYSMSZ"
if you are not interested about this size.
In that case, the data will be allocated in pool of stack memory
and it is easy.
Memory pool memory size (MPLMSZ)
"Memory pool memory" is a space for buffers of MPL/MPF/MBF.
e.g., The message buffer will be allocated in pool of memory pool memory
at cre_mbf().
Default value is 0 and you are able not to define "MPLMSZ"
if you are not interested about this size.
In that case, the buffer will be allocated in pool of stack memory
and it is easy.
Stack memory size (STKMSZ)
"Stack memory" is a space for stack of user tasks,
stack of interrupt handler, and stack of system timer task.
Default value is 0 and you are able not to define "STKMSZ"
if you are not interested about this size.
In that case, most amounts of main() stack will be allocated as pool
of stack memory and it is easy.
2.2.5 Hashed queue sizes (TMRQSZ/CYCQSZ/ALMQSZ/ISRQSZ)
The kernel has 4 hashed queues.
The memory size of a queue is (queue size) * sizeof(void *).
The size and throughput are in the relation of the trade-off.
- The timer queue for user tasks
- The timer queue for cyclic handlers
- The timer queue for alarm handlers
- The queue for interrupt service routines
symbol |
range |
default |
comment |
TMRQSZ |
1,2,4,8,16,32,64,128,256
| 8 |
Size of the timer queue for user tasks |
CYCQSZ |
1,2,4,8,16,32,64,128,256
| 8 |
Size of the timer queue for cyclic handlers |
ALMQSZ |
1,2,4,8,16,32,64,128,256
| 8 |
Size of the timer queue for alarm handlers |
ISRQSZ |
1,2,4,8,16,32,64,128,256,0x200,0x400,0x800, 0x1000,0x2000,0x4000,0x8000,0x10000
| 8 |
Size of the queue for interrupt service routines |
2.2.6 Kernel interrupt level (KNL_LEVEL)
You can change kernel interrupt level if the CPU has two or more levels.
The kernel sets interrupt level to this value at inner critical section.
Please note that the interrupt which has higher level than this value
is out of control by kernel, and the handler for that can not call
uITRON service calls.
In addition, the "higer" handler must be defined by NOT def_inh()/cre_isr()
service calls but as interrupt function
(e.g., with "#pragma interrupt" or with "interrupt" attribute,
and which will be driven by interrupt vector directly).
The default value is defined at "config_s.h" in each taget directory.
Level 1 is lowest level and NEVER define this to 0.
2.3 System timer interval (MSEC)
This value means system timer interval in millisecond.
This is convenient for the apprlication but the kernel never use.
The default value is defined to 10 at "kernel.h".
e.g., This value used like as follows if you want 1000 milliseconds delay.
dly_tsk(1000/MSEC); /* delay current task while one second */
e.g., If you want to change interval to 1 millisecond,
You must define "MSEC" before "kernel.h" at all of application source file.
#define MSEC 1
#include "kernel.h"
And you must change initial count of timer hardware at intsta()
to adjust for interval to be 1 millisecond.
Please note that the kernel load grows when interval is shortened.
3 Enhanced API from uITRON4.0 specification
3.1 System functions (Not uITRON)
Most system functions are used to initializes the kernel.
e.g., The initialization of a simple application with two tasks
that switches over alternately is as follows.
--- main.c ---
#include "kernel.h"
#include "config.h"
TASK task1()
{
for (;;) slp_tsk(); /* sleep until be waken up */
}
TASK task2()
{
for (;;) wup_tsk(1); /* wake up task1 */
}
const T_CTSK ctsk1 = {TA_STA, 0, task1, 1 /* 1st priority */, 256};
const T_CTSK ctsk2 = {TA_STA, 0, task2, 2 /* 2nd priority */, 256};
void main()
{
sysini(); /* INITIALIZE SYSTEM */
cre_tsk(1, &ctsk1); /* create task1 */
cre_tsk(2, &ctsk2); /* create task2 */
intsta(); /* START INTERRUPT BY SYSTEM TIMER */
syssta(); /* START SYSTEM */
}
3.1.1 sysini
SYNOPSIS
ER sysini(void);
DESCRIPTION
This is kernel initializer function.
You can call any uITRON service call only after initialization.
The CPU interrupt level is set to "KNL_LEVEL",
and all interrupts under kernel control are disabled.
ERRORS
symbol |
comment |
E_SYS |
Can not allocate pool of system memory (SYSMSZ) |
E_NOMEM |
Can not allocate pool of memory pool memory (MPLMSZ) ||
Can not allocate pool of stack memory (STKMSZ) ||
Can not allocate interrupt handler stack (ISTKSZ) ||
Can not allocate system timer task stack (TSTKSZ) ||
Can not allocate mutex inheritance buffer (size=TPRI_MAX bytes)
|
3.1.2 intsta
SYNOPSIS
ER intsta(void);
DESCRIPTION
This function initializes system timer hardware and enables timer interrupt.
ERRORS
It depends on each target.
3.1.3 syssta
SYNOPSIS
ER syssta(void);
DESCRIPTION
This function starts the multitask and never return.
However, when some errors occurred at previous system functions or
service calls,
it will return with that error code.
ERRORS
It depends on previous service calls.
3.1.4 intext
SYNOPSIS
ER intext(void);
DESCRIPTION
This function stops system timer hardware and disables timer interrupt.
ERRORS
It depends on each target.
3.2 Enhanced service calls
3.2.1 create TSK/DTQ/MBF/MPF/MPL with auto allocation
SYNOPSIS
ER cre_tsk(ID tskid, T_CTSK *pk_ctsk);
ER_ID acre_tsk(T_CTSK *pk_ctsk);
ER cre_dtq(ID dtqid, T_CDTQ *pk_cdtq);
ER_ID acre_dtq(T_CDTQ *pk_cdtq);
ER cre_mbf(ID mbfid, T_CMBF *pk_cmbf);
ER_ID acre_mbf(T_CMBF *pk_cmbf);
ER cre_mpf(ID mpfid, T_CMPF *pk_cmpf);
ER_ID acre_mpf(T_CMPF *pk_cmpf);
ER cre_mpl(ID mplid, T_CMPL *pk_cmpl);
ER_ID acre_mpl(T_CMPL *pk_cmpl);
DESCRIPTION
The stack or the buffer will be allocated automatically
if that address in initialization parameters is NULL and it is easy.
Service call |
Address parameter (=NULL) |
Which kernel memory pool will be used |
cre_tsk/acre_tsk |
stk |
Stack memory |
cre_dtq/acre_dtq |
dtq |
System memory |
cre_mbf/acre_mbf |
mbf |
Memory pool memory |
cre_mpf/acre_mpf |
mpf |
Memory pool memory |
cre_mpl/acre_mpl |
mpl |
Memory pool memory |
3.2.2 INH/ISR with interrupt mask
SYNOPSIS
ER def_inh(INHNO inhno, T_DINH *pk_dinh);
ER cre_isr(ID isrid, T_CISR *pk_cisr);
ER_ID acre_isr(T_CISR *pk_cisr);
ER ref_isr(ID isrid, T_RISR *pk_risr);
DESCRIPTION
This is almost the same as the uITRON4.0 specification.
However, "imask" member is added.
The kernel sets CPU interrupt mask to this value while interrupt handler
is executing.
typedef struct t_dinh {
ATR inhatr;
FP inthdr;
UINT imask; /* added */
} T_DINH;
typedef struct t_cisr {
ATR isratr;
VP_INT exinf;
INTNO intno;
FP isr;
UINT imask; /* added */
} T_CISR;
typedef struct t_risr {
INTNO intno;
UINT imask; /* added */
} T_RISR;
ERRORS
This is almost the same as the uITRON4.0 specification.
3.2.3 chg_ims
SYNOPSIS
ER chg_ims(UINT imask);
DESCRIPTION
This function changes interrupt level, kernel lock status, and kernel
dispatch possibility. The "imask" means not real CPU interrupt mask
but kernel interrupt (logical) level: 0,1,2,...
The reserved dispatch requests are processed if "imask" = 0.
Please note that loc_cpu/unl_cpu service calls can control lock status
and dis_dsp/ena_dsp service calls can control dispatch possibility,
independently.
imask (interrupt level) |
kernel lock status |
kernel dispatch possibility |
0 |
unlocked (=unl_cpu()) |
enabled (=ena_dsp()) |
smaller than "KNL_LEVEL" |
unlocked (=unl_cpu()) |
disabled (=dis_dsp()) |
equal to or larger than "KNL_LEVEL" |
locked (=loc_cpu()) |
disabled (=dis_dsp()) |
ERRORS
3.2.4 get_ims
SYNOPSIS
ER get_ims(UINT *p_imask);
DESCRIPTION
This function returns current kernel interrupt level to the area
which is pointed by "p_imask".
The "imask" means not real CPU mask but kernel interrupt (logical)
level: 0,1,2,...
ERRORS
symbol |
comment |
E_PAR |
"p_imask" is NULL |
3.2.5 ref_sys
SYNOPSIS
ER ref_sys(ID id, T_RSYS *pk_rsys);
typedef struct t_rsys {
INT sysstat;
} T_RSYS;
DESCRIPTION
This function returns current system states of the kernel.
"sysstat" values:
symbol of value |
context state |
dispatch state |
interrupt state |
TSS_TSK |
Task
| Enabled
| Enabled
|
TSS_DDSP |
Task
| Disabled
| Enabled
|
TSS_LOC |
Task
| Disabled
| Disabled
|
TSS_INDP |
Non-task
| (Don't care)
| (Don't care)
|
ERRORS
symbol |
comment |
E_PAR |
"pk_rsys" is NULL |
3.2.6 ref_cfg
SYNOPSIS
ER ref_cfg(T_RCFG *pk_rcfg);
typedef struct t_rcfg {
ID tskid_max;
ID semid_max;
ID flgid_max;
ID mbxid_max;
ID mbfid_max;
ID porid_max;
ID mplid_max;
ID mpfid_max;
ID cycno_max;
ID almno_max;
PRI tpri_max;
int tmrqsz;
int cycqsz;
int almqsz;
int istksz;
int tstksz;
SIZE sysmsz;
SIZE mplmsz;
SIZE stkmsz;
ID dtqid_max;
ID mtxid_max;
ID isrid_max;
ID svcfn_max;
int isrqsz;
} T_RCFG;
DESCRIPTION
This function returns kernel configuration values that will be defined at
"config.h".
ERRORS
symbol |
comment |
E_PAR |
"pk_rcfg" is NULL |
3.2.7 vcan_wup (Not uITRON)
SYNOPSIS
void vcan_wup();
DESCRIPTION
This function cancels all wake up requests for current task.
It works same as can_wup, howerver it is simple and fast.
3.2.8 vget_tid (Not uITRON)
SYNOPSIS
ID vget_tid();
DESCRIPTION
This function returns current running task ID.
It works same as get_tid, howerver it is simple and fast.
3.2.9 vdis_psw (Not uITRON)
SYNOPSIS
UINT vdis_psw(void);
DESCRIPTION
This function disables all interrupts that are under kernel control.
This is faster than loc_cpu() and you should use for short critical
section like as follows.
UINT psw;
psw = vdis_psw(); /* start critical section */
...
vset_psw(psw); /* end of critical section */
Please note that NEVER call a service call which causes dispatch
at the critical section.
RETURN VALUES
This function returns previous value of CPU program status word register etc.
It depends on each target.
3.2.10 vset_psw (Not uITRON)
SYNOPSIS
void vset_psw(UINT psw);
DESCRIPTION
This function sets CPU program status word register etc.
This is faster than unl_cpu() and you should use for short critical
section like as follows.
UINT psw;
psw = vdis_psw(); /* start critical section */
...
vset_psw(psw); /* end of critical section */
Please note that NEVER call a service call which causes dispatch
at the critical section.
3.2.11 No effect of TA_HLNG/TA_ASM attributes
A task or a handler has TA_HLNG (High-level language) or TA_ASM (Assembly
language) attribute in uITRON specification. However, the kernel will ignore these
attributes because it assumes that all tasks and all handlers are in
C language. And, you must write same calling sequence as C function
if you want in assembly language.
3.2.12 Get inner kernel memory information by ref_mpl
The kernel has
3 internal memory pools.
You can get usage information of these pools by ref_mpl service call
with special ID as follows.
special ID |
comment |
-4 |
Get information of the stack memory
|
-3 |
Get information of the system memory
|
-2 |
Get information of the memory-pool memory
|
3.2.13 Byte mode data queue
"TA_BYTE" attribute was added to data queue at (a)cre_dtq.
You can reduce buffer memory size by this option if you need only 8-bits
data in data queue.
The kernel sends only lower 8-bits data to data queue at (p|ip|t|f|if)snd_dtq.
The kernel gets only 8-bits data from data queue and fill
upper 24-bits of data by 0 at (p|t)rcv_dtq.
e.g., 16 bytes data queue:
stataic const T_CDTQ cdtq = {TA_TFIFO | TA_BYTE, 16};
id = acre_dtq(&cdtq);
4 URIBO service calls list
Note: The service calls list includes abbreviations as follows.
TSK: Permission to be called on the task context.
SYS: Permission to be called on system timer task (CYC/ALM/OVR handler) context or initial handler (main()) context.
INT: Permission to be called on the interrupt (INH/ISR) hander context.
LOC: Permission to be called on CPU locked state with any context.
(SYS and INT are "non-task" context)
O: Permitted
X: Not permitted
4.1 Task management
service call |
TSK |
SYS |
INT |
LOC |
comment |
(a)cre_tsk |
O |
O |
X |
X |
Create task |
del_tsk |
O |
O |
X |
X |
Delete task |
(i)act_tsk |
O |
O |
O |
X |
Activate task with queuing independently of the task state |
can_act |
O |
O |
O |
X |
Cancel activation |
sta_tsk |
O |
O |
O |
X |
Start from DORMANT state with start code |
ext_tsk |
O |
X |
X |
X |
Exit task |
exd_tsk |
O |
X |
X |
X |
Exit and delete task |
ter_tsk |
O |
O |
O |
X |
Terminate other task |
chg_pri |
O |
O |
O |
X |
Change task priority |
get_pri |
O |
O |
O |
X |
Get task priority |
ref_tsk |
O |
O |
O |
X |
Reference task state |
ref_tst |
O |
O |
O |
X |
Reference task state. (simplified) |
4.2 Task dependent synchronization
service call |
TSK |
SYS |
INT |
LOC |
comment |
(t)slp_tsk |
O |
X |
X |
X |
Sleep until waken up |
(i)wup_tsk |
O |
O |
O |
X |
Wake a task up |
can_wup |
O |
O |
O |
X |
Cancel requests of waking up |
vcan_wup |
O |
X |
X |
X |
Cancel requests of waking up. (current task only) |
(i)rel_wai |
O |
O |
O |
X |
Release a task from waiting |
sus_tsk |
O |
O |
O |
X |
Suspend a task |
rsm_tsk |
O |
O |
O |
X |
Resume suspended task |
frsm_tsk |
O |
O |
O |
X |
Force a task off from suspended state |
dly_tsk |
O |
X |
X |
X |
Delay |
4.3 Task exception
service call |
TSK |
SYS |
INT |
LOC |
comment |
def_tex |
O |
O |
X |
X |
Define task exception handler |
(i)ras_tex |
O |
O |
O |
X |
Raise task exception handler |
dis_tex |
O |
O |
O |
X |
Disable task exceptions |
ena_tex |
O |
O |
O |
X |
Enable task exceptions |
sns_tex |
O |
O |
O |
O |
Sensing of task exception hander state |
ref_tex |
O |
O |
O |
X |
Reference task exception state |
4.4 Synchronization and communication
service call |
TSK |
SYS |
INT |
LOC |
comment |
(a)cre_sem |
O |
O |
X |
X |
Create semaphore |
del_sem |
O |
O |
X |
X |
Delete semaphore |
(i)sig_sem |
O |
O |
O |
X |
Send signal to semaphore |
(t)wai_sem |
O |
X |
X |
X |
Wait signal from semaphore |
pol_sem |
O |
O |
O |
X |
Check signal from semaphore with polling |
ref_sem |
O |
O |
O |
X |
Reference semaphore state |
service call |
TSK |
SYS |
INT |
LOC |
comment |
(a)cre_flg |
O |
O |
X |
X |
Create eventflag |
del_flg |
O |
O |
X |
X |
Delete eventflag |
(i)set_flg |
O |
O |
O |
X |
Set eventflag bits |
clr_flg |
O |
O |
O |
X |
Clear eventflag bits |
(t)wai_flg |
O |
X |
X |
X |
Wait eventflag bits |
pol_flg |
O |
O |
O |
X |
Check eventflags bits with polling |
ref_flg |
O |
O |
O |
X |
Reference eventflag state |
service call |
TSK |
SYS |
INT |
LOC |
comment |
(a)cre_dtq |
O |
O |
X |
X |
Create data queue |
del_dtq |
O |
O |
X |
X |
Delete data queue |
(t)snd_dtq |
O |
X |
X |
X |
Send to data queue |
(i)psnd_dtq |
O |
O |
O |
X |
Send to data queue with polling |
(i)fsnd_dtq |
O |
O |
O |
X |
Force send to data queue |
(t)rcv_dtq |
O |
X |
X |
X |
Receive from data queue |
prcv_dtq |
O |
O |
O |
X |
Receive from data queue with polling |
ref_dtq |
O |
O |
O |
X |
Reference data queue state |
service call |
TSK |
SYS |
INT |
LOC |
comment |
(a)cre_mbx |
O |
O |
X |
X |
Create mailmox |
del_mbx |
O |
O |
X |
X |
Delete mailbox |
snd_mbx |
O |
O |
O |
X |
Send to mailbox |
(t)rcv_mbx |
O |
X |
X |
X |
Receive from mailbox |
prcv_mbx |
O |
O |
O |
X |
Receive from mailbox with polling |
ref_mbx |
O |
O |
O |
X |
Reference mailbox state |
4.5 Extended synchronization and communication
service call |
TSK |
SYS |
INT |
LOC |
comment |
(a)cre_mtx |
O |
O |
X |
X |
Create mutex |
del_mtx |
O |
O |
X |
X |
Delete mutex |
(t)loc_mtx |
O |
X |
X |
X |
Lock mutex |
ploc_mtx |
O |
X |
X |
X |
Lock mutex with polling |
unl_mtx |
O |
X |
X |
X |
Unlock mutex |
ref_mtx |
O |
O |
O |
X |
Reference mutex state |
service call |
TSK |
SYS |
INT |
LOC |
comment |
(a)cre_mbf |
O |
O |
X |
X |
Create message buffer |
del_mbf |
O |
O |
X |
X |
Delete message buffer |
(t)snd_mbf |
O |
X |
X |
X |
Send to message buffer |
psnd_mbf |
O |
O |
O |
X |
Send to message buffer with polling |
(t)rcv_mbf |
O |
X |
X |
X |
Receive from message buffer |
prcv_mbf |
O |
O |
O |
X |
Receive from message buffer with polling |
ref_mbf |
O |
O |
O |
X |
Reference message buffer state |
service call |
TSK |
SYS |
INT |
LOC |
comment |
(a)cre_por |
O |
O |
X |
X |
Create rendezvous port |
del_por |
O |
O |
X |
X |
Delete rendezvous port |
(t)cal_por |
O |
X |
X |
X |
Call rendezvous port |
(t)acp_por |
O |
X |
X |
X |
Accept rendezvous port |
pacp_por |
O |
O |
O |
X |
Accept rendezvous port with polling |
fwd_por |
O |
O |
O |
X |
Forward to rendezvous port |
rpl_rdv |
O |
O |
O |
X |
Reply to rendezvous port |
ref_por |
O |
O |
O |
X |
Reference rendezvous port state |
ref_rdv |
O |
O |
O |
X |
Reference rendezvous state |
4.6 Memory pool
service call |
TSK |
SYS |
INT |
LOC |
comment |
(a)cre_mpf |
O |
O |
X |
X |
Create fixed-sized memory pool |
del_mpf |
O |
O |
X |
X |
Delete fixed-sized memory pool |
(t)get_mpf |
O |
X |
X |
X |
Get fixed-sized memory pool |
pget_mpf |
O |
O |
O |
X |
Get fixed-sized memory pool with polling |
rel_mpf |
O |
O |
O |
X |
Release fixed-sized memory pool |
ref_mpf |
O |
O |
O |
X |
Reference fixed-sized memory pool state |
service call |
TSK |
SYS |
INT |
LOC |
comment |
(a)cre_mpl |
O |
O |
X |
X |
Create variable-sized memory pool |
del_mpl |
O |
O |
X |
X |
Delete variable-sized memory pool |
(t)get_mpl |
O |
X |
X |
X |
Get variable-sized memory pool |
pget_mpl |
O |
O |
X |
X |
Get variable-sized memory pool with polling |
rel_mpl |
O |
O |
X |
X |
Release variable-sized memory pool |
ref_mpl |
O |
O |
X |
X |
Reference variable-sized memory pool state |
4.7 Timer
service call |
TSK |
SYS |
INT |
LOC |
comment |
set_tim |
O |
O |
O |
X |
Set system time |
get_tim |
O |
O |
O |
X |
Get system time |
isig_tim |
X |
X |
O |
O |
Time tick signal for system time |
service call |
TSK |
SYS |
INT |
LOC |
comment |
(a)cre_cyc |
O |
O |
X |
X |
Create cyclic handler |
del_cyc |
O |
O |
X |
X |
Delete cyclic handler |
sta_cyc |
O |
O |
O |
X |
Start cyclic handler |
stp_cyc |
O |
O |
O |
X |
Stop cyclic handler |
ref_cyc |
O |
O |
O |
X |
Reference cyclic handler state |
service call |
TSK |
SYS |
INT |
LOC |
comment |
(a)cre_alm |
O |
O |
X |
X |
Create alarm handler |
del_alm |
O |
O |
X |
X |
Delete alarm handler |
sta_alm |
O |
O |
O |
X |
Start alarm handler |
stp_alm |
O |
O |
O |
X |
Stop alarm handler |
ref_alm |
O |
O |
O |
X |
Reference alarm handler state |
service call |
TSK |
SYS |
INT |
LOC |
comment |
def_ovr |
O |
O |
X |
X |
Define overrun handler |
sta_ovr |
O |
O |
O |
X |
Start overrun handler |
stp_ovr |
O |
O |
O |
X |
Stop overrun handler |
ref_ovr |
O |
O |
O |
X |
Reference overrun handler |
4.8 System state management
service call |
TSK |
SYS |
INT |
LOC |
comment |
(i)rot_rdq |
O |
O |
O |
X |
Rotate ready queue |
(i)get_tid |
O |
O |
O |
X |
Get current running task ID |
vget_tid |
O |
O |
O |
X |
Get current running task ID (simplified) |
(i)loc_cpu |
O |
O |
O |
O |
Lock CPU |
(i)unl_cpu |
O |
O |
O |
O |
Unlock CPU |
dis_dsp |
O |
X |
X |
X |
Disable dispatch |
ena_dsp |
O |
X |
X |
X |
Enable dispatch |
sns_ctx |
O |
O |
O |
O |
Sensing of context |
sns_loc |
O |
O |
O |
O |
Sensing of CPU lock state |
sns_dsp |
O |
O |
O |
O |
Sensing of dispatch permission |
sns_dpn |
O |
O |
O |
O |
Sensing of dispatch pending state |
ref_sys |
O |
O |
O |
O |
Reference system state |
4.9 Interrupt
service call |
TSK |
SYS |
INT |
LOC |
comment |
def_inh |
O |
O |
O |
X |
Define interrupt handler |
(a)cre_isr |
O |
O |
X |
X |
Create interrupt service routine |
del_isr |
O |
O |
X |
X |
Delete interrupt service routine |
ref_isr |
O |
O |
O |
X |
Reference interrupt service routine |
dis_int |
O |
O |
X |
X |
Disable individual interrupt (target dependent) |
ena_int |
O |
O |
X |
X |
Enable individual interrupt (target dependent) |
chg_ims |
O |
O |
O |
X |
Change interrupt mask level |
get_ims |
O |
O |
O |
X |
Get interrupt mask level |
vset_psw |
O |
O |
O |
X |
Set processor status word |
vdis_psw |
O |
O |
O |
X |
Disable interrupt and return previous processor status word |
4.10 Extended service call
service call |
TSK |
SYS |
INT |
LOC |
comment |
def_svc |
O |
O |
X |
X |
Define extended serivce call |
cal_svc |
O |
O |
O |
X |
Call extended service call |
4.11 System configuration
service call |
TSK |
SYS |
INT |
LOC |
comment |
ref_cfg |
O |
O |
O |
X |
Reference kernel configuration |
ref_ver |
O |
O |
O |
X |
Reference kernel version |
5 How to boot from ROM
5.1 Build
There is a sample application to boot from ROM at
(URIBO INSTALLED DIR)/(CPU NAME)/app_(TARGET NAME)_ROM/
e.g., A sample for AE-H8/3069-LAN
(URIBO INSTALL DIR)/h8300h/app_ae_h8_3069_lan_ROM/test.mot
Please use files as follows to build a ROM application.
file |
comment |
Makefile |
"-D_ROM_" option added to CFLAGS and .mot (HEX) file will be built.
|
rom.x |
The linker script for ROM application.
|
romcrt0.S |
Interrupt vectors and C start up for ROM application.
|
5.2 Program target
Please install the HEX file of application to target ROM.
(e.g., For AE-H8/3069-LAN)
Please install test.mot same as
h8-stub installation .
This application output printf messages to not GDB console but SCI1
port (CN4) because it is not include GDB stub. So, you should use
serial terminal emulator like as "gtkterm" to see messages.
Please set serial to: 38400bps, no-parity, 1 stop bit, no-flow.
6 SIO driver (data queueu sample)
There is an innterupt driven SIO driver sample (sio.h/sio.c).
This is an usage example of data queue, too.
6.1 ini_sio
SYNOPSIS
ER ini_sio(int ch, int bps, int option, UINT bufsiz);
DESCRIPTION
This function will create 2 data queues and initialize SIO driver.
"bufsiz" will be passed to acre_dtq.
Please see sio.c of each target for more detail.
RETURN VALUES
E_OK: OK
-1: Bad parameter
other: Service call error (E_???)
6.2 put_sio
SYNOPSIS
void put_sio(int ch, int data);
DESCRIPTION
This function will send byte data to SIO.
Please see sio.c of each target for more detail.
6.3 get_sio
SYNOPSIS
int get_sio(int ch, TMO tmout)
DESCRIPTION
This function will receive byte data from SIO.
You can specify timeout value or TMO_FEVR or TMO_POL to "tmout".
Please see sio.c of each target for more detail.
RETURN VALUES
>= 0: received character
< 0: trcv_dtq error (E_???)
Copyright (C) 256TECH Co., Ltd.
Masahiro Sakamoto
mail:m-sakamoto(AT)users.sourceforge.net