CHAPTER 15 DATA TYPES AND MACROS
This chapter describes the data types, data structures and macros, which are used when issuing service calls provided by the RI850V4.
The definition of the macro and data structures is performed by each header file stored in <ri_root>\include\os.
Note <ri_root> indicates the installation folder of RI850V4.
The default folder is "C:\Program Files\Renesas Electronics\CS+\CC\RI850V4RH.
The Following lists the data types of parameters specified when issuing a service call.
Macro definition of the data type is performed by the header file <ri_root>\include\os\types.h, which is called from the standard header file <ri_root>\include\kernel.h and the ITRON general definition header file <ri_root>\include\os\itron.h.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8-bit value with unknown data type
|
|
|
16-bit value with unknown data type
|
|
|
32-bit value with unknown data type
|
|
|
Pointer to unknown data type
|
|
|
Processing unit start address (pointer to a function)
|
|
|
|
|
|
|
|
|
Boolean value (TRUE or FALSE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Service call operational mode
|
|
|
|
|
|
Memory area size (in bytes)
|
|
|
Timeout (unit:millisecond)
|
|
|
Relative time (unit:millisecond)
|
|
|
Pointer to unknown data type, or signed 32-bit integer
|
|
|
Error code, or boolean value (TRUE or FALSE)
|
|
|
Error code, or object ID number
|
|
|
Error code, or signed 32-bit integer
|
|
|
|
|
|
|
This section explains the data structures (task state packet, semaphore state packet, or the like) used when issuing a service call provided by the RI850V4.
Be sure not to refer from programs to the areas reserved for future use in each data structure.
The following shows task state packet T_RTSK used when issuing
ref_tsk or
iref_tsk.
Definition of task state packet T_RTSK is performed by the header file <ri_root>\include\os\packet.h, which is called from the standard header file <ri_root>\include\kernel.h.
typedef struct t_rtsk {
STAT tskstat; /*Current state*/
PRI tskpri; /*Current priority*/
PRI tskbpri; /*Reserved for future use*/
STAT tskwait; /*Reason for waiting*/
ID wobjid; /*Object ID number for which the task waiting*/
TMO lefttmo; /*Remaining time until timeout*/
UINT actcnt; /*Activation request count*/
UINT wupcnt; /*Wakeup request count*/
UINT suscnt; /*Suspension count*/
ATR tskatr; /*Attribute*/
PRI itskpri; /*Initial priority*/
ID memid; /*Reserved for future use*/
} T_RTSK;
|
The following shows details on task state packet T_RTSK.
- tskstat
Stores the current state.
TTS_WAS: WAITING-SUSPENDED state
- tskpri
Stores the current priority.
- tskbpri
System-reserved area.
- tskwait
Stores the reason for waiting.
TTW_SEM: WAITING state for a semaphore resource
TTW_FLG: WAITING state for an eventflag
TTW_SDTQ: Sending WAITING state for a data queue
TTW_RDTQ: Receiving WAITING state for a data queue
TTW_MBX: Receiving WAITING state for a mailbox
TTW_MTX: WAITING state for a mutex
TTW_MPF: WAITING state for a fixed-sized memory block
TTW_MPL: WAITING state for a variable-sized memory block
- wobjid
Stores the object ID number for which the task waiting.
When the task is not in the WAITING state, 0 is stored.
- lefttmo
Stores the remaining time until timeout (unit:millisecond).
- actcnt
Stores the activation request count.
- wupcnt
Stores the wakeup request count.
- suscnt
Stores the suspension count.
- tskatr
Stores the attribute (coding language, initial activation state, etc.).
TA_HLNG: Start a task through a C language interface.
TA_ASM: Start a task through an assembly language interface.
Initial activation state (bit 1)
TA_ACT: Task is activated after the creation.
Initial preemption state (bit 14)
TA_DISPREEMPT: Preemption is disabled at task activation.
Initial interrupt state (bit 15)
- itskpri
Stores the initial priority.
- memid
System-reserved area.
15.2.2 Task state packet (simplified version)
The following shows task state packet (simplified version) T_RTST used when issuing
ref_tst or
iref_tst.
Definition of task state packet (simplified version) T_RTST is performed by the header file <ri_root>\include\os\packet.h, which is called from the standard header file <ri_root>\include\kernel.h.
typedef struct t_rtst {
STAT tskstat; /*Current state*/
STAT tskwait; /*Reason for waiting*/
} T_RTST;
|
The following shows details on task state packet (simplified version) T_RTST.
- tskstat
Stores the current state.
TTS_WAS: WAITING-SUSPENDED state
- tskwait
Stores the reason for waiting.
TTW_SEM: WAITING state for a semaphore resource
TTW_FLG: WAITING state for an eventflag
TTW_SDTQ: Sending WAITING state for a data queue
TTW_RDTQ: Receiving WAITING state for a data queue
TTW_MBX: Receiving WAITING state for a mailbox
TTW_MTX: WAITING state for a mutex
TTW_MPF: WAITING state for a fixed-sized memory block
TTW_MPL: WAITING state for a variable-sized memory block
15.2.3 Semaphore state packet
The following shows semaphore state packet T_RSEM used when issuing
ref_sem or
iref_sem.
Definition of semaphore state packet T_RSEM is performed by the header file <ri_root>\include\os\packet.h, which is called from the standard header file <ri_root>\include\kernel.h.
typedef struct t_rsem {
ID wtskid; /*Existence of waiting task*/
UINT semcnt; /*Current resource count*/
ATR sematr; /*Attribute*/
UINT maxsem; /*Maximum resource count*/
} T_RSEM;
|
The following shows details on semaphore state packet T_RSEM.
- wtskid
Stores whether a task is queued to the semaphore wait queue.
TSK_NONE: No applicable task
Value: ID number of the task at the head of the wait queue
- semcnt
Stores the current resource count.
- sematr
Stores the attribute (queuing method).
Task queuing method (bit 0)
TA_TFIFO: Task wait queue is in FIFO order.
TA_TPRI: Task wait queue is in task priority order.
- maxsem
Stores the maximum resource count.
15.2.4 Eventflag state packet
The following shows eventflag state packet T_RFLG used when issuing
ref_flg or
iref_flg.
Definition of eventflag state packet T_RFLG is performed by the header file <ri_root>\include\os\packet.h, which is called the from the standard header file <ri_root>\include\kernel.h.
typedef struct t_rflg {
ID wtskid; /*Existence of waiting task*/
FLGPTN flgptn; /*Current bit pattern*/
ATR flgatr; /*Attribute*/
} T_RFLG;
|
The following shows details on eventflag state packet T_RFLG.
- wtskid
Stores whether a task is queued to the event flag wait queue.
TSK_NONE: No applicable task
Value: ID number of the task at the head of the wait queue
- flgptn
Stores the Current bit pattern.
- flgatr
Stores the attribute (queuing method, queuing count, etc.).
Task queuing method (bit 0)
TA_TFIFO: Task wait queue is in FIFO order.
TA_TPRI: Task wait queue is in task priority order.
TA_WSGL: Only one task is allowed to be in the WAITING state for the eventflag.
TA_WMUL: Multiple tasks are allowed to be in the WAITING state for the eventflag.
Bit pattern clear (bit 2)
TA_CLR: Bit pattern is cleared when a task is released from the WAITING state for eventflag.
15.2.5 Data queue state packet
The following shows data queue state packet T_RDTQ used when issuing
ref_dtq or
iref_dtq.
Definition of data queue state packet T_RDTQ is performed by the header file <ri_root>\include\os\packet.h, which is called from the standard header file <ri_root>\include\kernel.h.
typedef struct t_rdtq {
ID stskid; /*Existence of tasks waiting for data transmission*/
ID rtskid; /*Existence of tasks waiting for data reception*/
UINT sdtqcnt; /*number of data elements in the data queue*/
ATR dtqatr; /*Attribute*/
UINT dtqcnt; /*Data count*/
ID memid; /*Reserved for future use*/
} T_RDTQ;
|
The following shows details on data queue state packet T_RDTQ.
- stskid
Stores whether a task is queued to the transmission wait queue of the data queue.
TSK_NONE: No applicable task
Value: ID number of the task at the head of the wait queue
- rtskid
Stores whether a task is queued to the reception wait queue of the data queue.
TSK_NONE: No applicable task
Value: ID number of the task at the head of the wait queue
- sdtqcnt
Stores the number of data elements in data queue.
- dtqatr
Stores the attribute (queuing method).
Task queuing method (bit 0)
TA_TFIFO: Task wait queue is in FIFO order.
TA_TPRI: Task wait queue is in task priority order.
- dtqcnt
Stores the data count.
- memid
System-reserved area.
Definition of message packet T_MSG/T_MSG_PRI is performed by the header file <ri_root>\include\os\types.h, which is called from the standard header file <ri_root>\include\kernel.h and the ITRON general definition header file <ri_root>\include\itron.h.
[Message packet for TA_MFIFO attribute ]
typedef struct t_msg {
struct t_msg *msgnext; /*Reserved for future use*/
} T_MSG;
|
[Message packet for TA_MPRI attribute]
typedef struct t_msg_pri {
struct t_msg msgque; /*Reserved for future use*/
PRI msgpri; /*Message priority*/
} T_MSG_PRI;
|
The following shows details on message packet T_RTSK/T_MSG_PRI.
- msgnext, msgque
System-reserved area.
- msgpri
Stores the message priority.
Note 1 In the RI850V4, a message having a smaller priority number is given a higher priority.
15.2.7 Mailbox state packet
The following shows mailbox state packet T_RMBX used when issuing
ref_mbx or
iref_mbx.
Definition of mailbox state packet T_RMBX is performed by the header file <ri_root>\include\os\packet.h, which is called from the standard header file <ri_root>\include\kernel.h.
typedef struct t_rmbx {
ID wtskid; /*Existence of waiting task*/
T_MSG *pk_msg; /*Existence of waiting message*/
ATR mbxatr; /*Attribute*/
} T_RMBX;
|
The following shows details on mailbox state packet T_RMBX.
- wtskid
Stores whether a task is queued to the mailbox wait queue.
TSK_NONE: No applicable task
Value: ID number of the task at the head of the wait queue
- pk_msg
Stores whether a message is queued to the mailbox wait queue.
NULL: No applicable message
Value: Start address of the message packet at the head of the wait queue
- mbxatr
Stores the attribute (queuing method).
Task queuing method (bit 0)
TA_TFIFO: Task wait queue is in FIFO order.
TA_TPRI: Task wait queue is in task priority order.
Message queuing method (bit 1)
TA_MFIFO: Message wait queue is in FIFO order.
TA_MPRI: Message wait queue is in message priority order.
15.2.8 Mutex state packet
The following shows mutex state packet T_RMTX used when issuing
ref_mtx or
iref_mtx.
Definition of mutex state packet T_RMTX is performed by the header file <ri_root>\include\os\packet.h, which is called from the standard header file <ri_root>\include\kernel.h.
typedef struct t_rmtx {
ID htskid; /*Existence of locked mutex*/
ID wtskid; /*Existence of waiting task*/
ATR mtxatr; /*Attribute*/
PRI ceilpri; /*Reserved for future use*/
} T_RMTX;
|
The following shows details on mutex state packet T_RMTX.
- htskid
Stores whether a task that is locking a mutex exists.
TSK_NONE: No applicable task
Value: ID number of the task locking the mutex
- wtskid
Stores whether a task is queued to the mutex wait queue.
TSK_NONE: No applicable task
Value: ID number of the task at the head of the wait queue
- mtxatr
Stores the attribute (queuing method).
Task queuing method (bit 0 to 1)
TA_TFIFO: Task wait queue is in FIFO order.
TA_TPRI: Task wait queue is in task priority order.
- ceilpri
System-reserved area.
15.2.9 Fixed-sized memory pool state packet
The following shows fixed-sized memory pool state packet T_RMPF used when issuing
ref_mpf or
iref_mpf.
Definition of fixed-sized memory pool state packet T_RMPF is performed by the header file <ri_root>\include\os\packet.h, which is called from the standard header file <ri_root>\include\kernel.h.
typedef struct t_rmpf {
ID wtskid; /*Existence of waiting task*/
UINT fblkcnt; /*Number of free memory blocks*/
ATR mpfatr; /*Attribute*/
ID memid; /*Reserved for future use*/
} T_RMPF;
|
The following shows details on fixed-sized memory pool state packet T_RMPF.
- wtskid
Stores whether a task is queued to the fixed-size memory pool.
TSK_NONE: No applicable task
Value: ID number of the task at the head of the wait queue
- fblkcnt
Stores the number of free memory blocks.
- mpfatr
Stores the attribute (queuing method).
Task queuing method (bit 0)
TA_TFIFO: Task wait queue is in FIFO order.
TA_TPRI: Task wait queue is in task priority order.
- memid
System-reserved area.
15.2.10 Variable-sized memory pool state packet
The following shows variable-sized memory pool state packet T_RMPL used when issuing
ref_mpl or
iref_mpl.
Definition of variable-sized memory pool state packet T_RMPL is performed by the header file <ri_root>\include\os\packet.h, which is called from the standard header file <ri_root>\include\kernel.h.
typedef struct t_rmpl {
ID wtskid; /*Existence of waiting task*/
SIZE fmplsz; /*Total size of free memory blocks*/
UINT fblksz; /*Maximum memory block size available*/
ATR mplatr; /*Attribute*/
ID memid; /*Reserved for future use*/
} T_RMPL;
|
The following shows details on variable-sized memory pool state packet T_RMPL.
- wtskid
Stores whether a task is queued to the variable-size memory pool wait queue.
TSK_NONE: No applicable task
Value: ID number of the task at the head of the wait queue
- fmplsz
Stores the total size of free memory blocks (in bytes).
- fblksz
Stores the maximum memory block size available (in bytes).
- mplatr
Stores the attribute (queuing method).
Task queuing method (bit 0)
TA_TFIFO: Task wait queue is in FIFO order.
TA_TPRI: Task wait queue is in task priority order.
- memid
System-reserved area.
15.2.11 System time packet
Definition of system time packet SYSTIM is performed by the header file <ri_root>\include\os\packet.h, which is called from the standard header file <ri_root>\include\kernel.h.
typedef struct t_systim {
UW ltime; /*System time (lower 32 bits)*/
UH utime; /*System time (higher 16 bits)*/
} SYSTIM;
|
The following shows details on system time packet SYSTIM.
- ltime
Stores the system time (lower 32 bits).
- utime
Stores the system time (higher 16 bits).
15.2.12 Cyclic handler state packet
The following shows cyclic handler state packet T_RCYC used when issuing
ref_cyc or
iref_cyc.
Definition of cyclic handler state packet T_RCYC is performed by the header file <ri_root>\include\os\packet.h, which is called from the standard header file <ri_root>\include\kernel.h.
typedef struct t_rcyc {
STAT cycstat; /*Current state*/
RELTIM lefttim; /*Time left before the next activation*/
ATR cycatr; /*Attribute*/
RELTIM cyctim; /*Activation cycle*/
RELTIM cycphs; /*Activation phase*/
} T_RCYC;
|
The following shows details on cyclic handler state packet T_RCYC.
- cycstat
Store the current state.
TCYC_STP: Non-operational state
TCYC_STA: Operational state
- lefttim
Stores the time left before the next activation (unit:millisecond).
- cycatr
Stores the attribute (coding language, initial activation state, etc.).
TA_HLNG: Start a cyclic handler through a C language interface.
TA_ASM: Start a cyclic handler through an assembly language interface.
Initial activation state (bit 1)
TA_STA: Cyclic handlers is in an operational state after the creation.
Existence of saved activation phases (bit 2)
TA_PHS: Cyclic handler is activated preserving the activation phase.
- cyctim
Stores the activation cycle (unit:millisecond).
- cycphs
Stores the activation phase (unit:millisecond).
In the RI850V4, the initial activation phase means the relative interval from when generation of s cyclic handler is completed until the first activation request is issued.
This section explains the data macros (for current state, processing program attributes, or the like) used when issuing a service call provided by the RI850V4.
The following lists the management object current states acquired by issuing service calls (
ref_tsk,
ref_sem, or the like).
Macro definition of the current state is performed by the header file <ri_root>\include\os\option.h, which is called from standard the header file <ri_root>\include\kernel.h and the ITRON general definition header file <ri_root>\include\itron.h.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WAITING state for a semaphore resource
|
|
|
WAITING state for an eventflag
|
|
|
Sending WAITING state for a data queue
|
|
|
Receiving WAITING state for a data queue
|
|
|
Receiving WAITING state for a mailbox
|
|
|
WAITING state for a mutex
|
|
|
WAITING state for a fixed-sized memory pool
|
|
|
WAITING state for a variable-sized memory pool
|
|
|
|
15.3.2 Processing program attributes
The following lists the processing program attributes acquired by issuing service calls (
ref_tsk,
ref_cyc, or the like).
Macro definition of attributes is performed by the header file<ri_root>\include\os\option.h, which is called from the standard header file <ri_root>\include\kernel.h and the ITRON general definition header file <ri_root>\include\itron.h.
Table 15-3 Processing Program Attributes
|
|
|
|
|
Start a processing unit through a C language interface.
|
|
|
Start a processing unit through an assembly language interface.
|
|
|
Task is activated after the creation.
|
|
|
Preemption is disabled at task activation.
|
|
|
All interrupts are enabled at task activation.
|
|
|
All interrupts are disabled at task activation.
|
|
|
Cyclic handlers is in an operational state after the creation.
|
|
|
Cyclic handler is activated preserving the activation phase.
|
15.3.3 Management object attributes
The following lists the management object attributes acquired by issuing service calls (
ref_sem,
ref_flg, or the like).
Macro definition of attributes is performed by the standard header file <ri_root>\include\kernel.h, which is called from the header file<ri_root>\include\os\option.h and the ITRON general definition header file <ri_root>\include\itron.h.
Table 15-4 Management Object Attributes
|
|
|
|
|
Task wait queue is in FIFO order.
|
|
|
Task wait queue is in task priority order.
|
|
|
Only one task is allowed to be in the WAITING state for the eventflag.
|
|
|
Multiple tasks are allowed to be in the WAITING state for the eventflag.
|
|
|
Bit pattern is cleared when a task is released from the WAITING state for eventflag.
|
|
|
Message wait queue is in FIFO order.
|
|
|
Message wait queue is in message priority order.
|
15.3.4 Service call operating modes
The following lists the service call operating modes used when issuing service calls (
act_tsk,
wup_tsk, or the like).
Macro definition of operating modes is performed by the header file<ri_root>\include\os\option.h, which is called from the standard header file <ri_root>\include\kernel.h and the ITRON general definition header file <ri_root>\include\itron.h.
Table 15-5 Service Call Operating Modes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Current priority of the Invoking task
|
The following lists the values returned from service calls.
Macros for the return values are defined in the header file <ri_root>\include\os\error.h and option.h, which are called from the standard header file <ri_root>\include\kernel.h and the common macro definition file for ITRON specifications <ri_root>\include\itron.h.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forced release from the WAITING state
|
|
|
Polling failure or timeout
|
|
|
|
|
|
|
15.3.6 Kernel configuration constants
The configuration constants are listed below.
The macro definitions of the configuration constants are made in the header file <ri_root>\include\os\component.h, which is called from <ri_root>\include\itron.h. Note, however, that some numerical values with variable macro definitions are defined in the system information header file, in accordance with the settings in the system configuration file.
Table 15-7 Priority Range
Table 15-8 Version Information
|
|
|
|
|
|
|
|
Identification number of kernel
|
|
|
Version number of the ITRON Specification
|
|
|
Version number of the kernel
|
Table 15-9 Maximum Queuing Count
|
|
|
|
|
Maximum task activation request count
|
|
|
Maximum task wakeup request count
|
|
|
|
Table 15-10 Number of Bits in Bit Patterns
|
|
|
|
|
Number of bits in the an eventflag
|
Table 15-11 Base Clock Interval
|
|
|
|
|
base clock interval numerator
|
|
|
base clock interval denominator
|
15.4 Conditional Compile Macro
The header file of the RI850V4 is conditionally compiled by the following macros.
Define macros (such as the compiler activation option -D) according to the environment used when building the source files that include the header file of the RI850V4.
Table 15-12 Conditional Compile Macros
|
|
|
|
|
Add two underscores before and after "rel".
|
|
Add two underscores before and after "ghs".
|
|
|
The assembly language is used.
Add two underscores before and after "asm".
|