Service Profile

μT-Kernel 3.0 service profile items are shown below. Defining these service profile items is a requirement. The implementor of OS may add original service profile definitions.

Service Profile Items that Represent Function Availability

The service profile item that shows whether a particular function is effective (or enabled) or ineffective (or disabled) is described by using a macro shown below, which is defined to be either TRUE, or FALSE. (The following definitions are given as example only, and each implementation shall define these appropriately.)

Device Driver Functions


#define TK_SUPPORT_TASKEVENT      TRUE   /* Support of task event */
#define TK_SUPPORT_DISWAI         TRUE   /* Support of disabling wait */
#define TK_SUPPORT_IOPORT         TRUE   /* Support of I/O port access */
#define TK_SUPPORT_MICROWAIT      TRUE   /* Support of micro wait */

Setting TK_SUPPORT_TASKEVENT and TK_SUPPORT_DISWAI to TRUE is recommended on systems that use advanced general-purpose device drivers.

Setting TK_SUPPORT_IOPORT and TK_SUPPORT_MICROWAIT to TRUE is generally recommended.

Power Management Functions


#define TK_SUPPORT_LOWPOWER       TRUE   /* Support of power management functions */

Setting TK_SUPPORT_LOWPOWER to TRUE is recommended. However, this may as well be set to FALSE on systems with little need for power-saving or restrictions due to used hardware.

Static/dynamic Memory Management Functions


#define TK_SUPPORT_USERBUF        FALSE  /* Support of user-specified buffer
                                            (TA_USERBUF) */
#define TK_SUPPORT_AUTOBUF        TRUE   /* Support of automatic buffer allocation
                                            (No TA_USERBUF specification) */
#define TK_SUPPORT_MEMLIB         TRUE   /* Support of memory allocation library */

Setting TK_SUPPORT_USERBUF to FALSE is generally recommended.

Setting TK_SUPPORT_AUTOBUF to TRUE is generally recommended.

However, it is acceptable in a system where memory management is staticfally done to set TK_SUPPORT_USERBUF to TRUE, and TK_SUPPORT_AUTOBUF to FALSE.

You cannot set both TK_SUPPORT_USERBUF and TK_SUPPORT_AUTOBUF to FALSE.

Setting TK_SUPPORT_MEMLIB to TRUE is generally recommended.

Task Exception Handling Functions


#define TK_SUPPORT_TASKEXCEPTION  TRUE   /* Support of task exception handling
                                            functions */

Setting TK_SUPPORT_TASKEXCEPTION to TRUE is recommended on a relatively large system that consist of many software modules and that requires flexible handling of abnormal conditions.

Subsystem Management Functions


#define TK_SUPPORT_SUBSYSTEM      TRUE   /* Support of subsystem management
                                            functions */
#define TK_SUPPORT_SSYEVENT       TRUE   /* Support of event processing of subsystems */

Setting TK_SUPPORT_SUBSYSTEM and TK_SUPPORT_SSYEVENT to TRUE is recommended on a relatively large system which use middleware.

System Configuration Information Acquisition Functions


#define TK_SUPPORT_SYSCONF        FALSE  /* Support of system configuration
                                            information management functions */

TK_SUPPORT_SYSCONF need to be set to FALSE on a system where system configuration information such as the maximum counts of objects (e.g. tasks), is fixed statically at OS build time by hard-coding. On the other hand, if the system configuration information is specified flexibly (e.g. at runtime), TK_SUPPORT_SYSCONF need to be set to TRUE.

Supporting 64-bit and 16-bit CPUs


#define TK_HAS_DOUBLEWORD         FALSE  /* Support of 64-bit data types
                                            (D, UD, VD) */
#define TK_SUPPORT_USEC           FALSE  /* Support of microsecond */
#define TK_SUPPORT_LARGEDEV       FALSE  /* Support of large mass-storage device
                                            (64-bit) */
#define TK_SUPPORT_SERCD          TRUE   /* Support of sub error code */

TK_HAS_DOUBLEWORD, TK_SUPPORT_USEC, and TK_SUPPORT_LARGEDEV need to be set to either TRUE or FALSE, according to the target hardware characteristics, and the usage or purpose of the target system.

TK_SUPPORT_USEC and TK_SUPPORT_LARGEDEV depend on TK_HAS_DOUBLEWORD. That is, when TK_HAS_DOUBLEWORD is set to FALSE, these two profile items are also set to FALSE.

Setting TK_SUPPORT_SERCD to TRUE is recommended on a system where INT and ER are 32 bit entities. Setting TK_SUPPORT_SERCD to FALSE is recommended on a system where INT and ER are 16 bit entities.

Functions that Depend on CPU, Hardware, System, and Compiler

Each of the following profiles needs to be set to TRUE or FALSE according to the target hardware and the implementation of the OS.

Interrupt Management Functions


#define TK_SUPPORT_INTCTRL        TRUE   /* Support of interrupt controller
                                            management */
#define TK_HAS_ENAINTLEVEL        TRUE   /* Can specify interrupt priority
                                            level */
#define TK_SUPPORT_CPUINTLEVEL    FALSE  /* Support of CPU interrupt mask level */
#define TK_SUPPORT_CTRLINTLEVEL   TRUE   /* Support of interrupt controller
                                            mask level */
#define TK_SUPPORT_INTMODE        TRUE   /* Support of setting interrupt mode */

Memory Cache Control Functions


#define TK_SUPPORT_CACHECTRL      TRUE   /* Support of memory cache control
                                            functions */
#define TK_SUPPORT_SETCACHEMODE	  TRUE   /* Support of set cache mode function */
#define TK_SUPPORT_WBCACHE        FALSE  /* Support of write-back cache */
#define TK_SUPPORT_WTCACHE        TRUE   /* Support of write-through cache */

FPU(COP) Support Functions


#define TK_SUPPORT_FPU            TRUE   /* Support of FPU */
#define TK_SUPPORT_COP0           TRUE   /* Support of co-processor number 0 */
#define TK_SUPPORT_COP1           FALSE  /* Support of co-processor number 1 */
#define TK_SUPPORT_COP2           FALSE  /* Support of co-processor number 2 */
#define TK_SUPPORT_COP3           FALSE  /* Support of co-processor number 3 */

Miscellaneous Functions


#define TK_SUPPORT_ASM            FALSE  /* Support of assembly language function
                                            entry/exit */
#define TK_SUPPORT_REGOPS         FALSE  /* Support for task-register manipulation
                                            functions */
#define TK_ALLOW_MISALIGN         FALSE  /* Memory misalign access is permitted */
#define TK_BIGENDIAN              FALSE  /* Is big endian (Must be defined) */
#define TK_TRAP_SVC               TRUE   /* Use CPU Trap instruction for system                                             call entry */
#define TK_HAS_SYSSTACK           TRUE   /* Task has a separate system stack */
#define TK_SUPPORT_PTIMER         TRUE   /* Support of physical timer function */
#define TK_SUPPORT_UTC            TRUE   /* Support of UNIX time */
#define TK_SUPPORT_TRONTIME       FALSE  /* Support of TRON time */

At least one of TK_SUPPORT_UTC and TK_SUPPORT_TRONTIME must be set to TRUE.

Debugger Support Functions


#define TK_SUPPORT_DSNAME         FALSE  /* Support of DS object name */
#define TK_SUPPORT_DBGSPT         FALSE  /* Support of μT-Kernel/DS */

Depending on the user's need, TK_SUPPORT_DSNAME and TK_SUPPORT_DBGSPT may be set to either TRUE or FALSE.

TK_SUPPORT_DBGSPT specifies whether the APIs of μT-Kernel/DS, other than td_ref_dsname and td_set_dsname, can be used. Even if TK_SUPPORT_DBGSPT is set to FALSE, td_ref_dsname and td_set_dsname can be used if TK_SUPPORT_DSNAME is set to TRUE.

Check Method of Service Profile

Although the implementations of μT-Kernel 3.0 must define the profile items mentioned previously, the use of profile where some definitions are missing should be practiced since other OSs does not provide profile at all, and there bound to be implementation's failures to define all the profile items. For example, if you want to distinguish the effective/ineffective/undefined status, you can perform the following check:


#if defined(TK_SUPPORT_xxx)
  #if TK_SUPPORT_xxx
    /* when a profile item is set to be effective. */
  #else
    /* when a profile item is set to be ineffective */
  #endif
#else
  /* when a profile item is undefined. */
#endif

Note that if profile item is directly used for the parameter of "#if" macro as follows, you cannot distinguish whether the profile item is ineffective or undefined.


#if TK_SUPPORT_xxx
  /* when a profile item is set to be effective. */
#else
  /* when a profile item is set to be ineffective or undefined. */
#endif

Service Profile Items that Represent Values

A service profile item that represents a limit value or version number will be specified as a MACRO that holds the value. (The following definitions are given as example only. The real values of profile items are implementation-dependent.)


#define  TK_SPECVER_MAGIC            6      /* Magic number of μT-Kernel */
#define  TK_SPECVER_MAJOR            3      /* Major Version number of μT-Kernel */
#define  TK_SPECVER_MINOR            0      /* Minor Version number of μT-Kernel */
#define  TK_SPECVER                  ((TK_SPECVER_MAJOR << 8) | TK_SPECVER_MINOR)

                                            /* Version number of μT-Kernel */
#define  TK_MAX_TSKPRI               32     /* Maximum task priority (>= 16) */
#define  TK_WAKEUP_MAXCNT            65535  /* Maximum queuing count of the task wakeup
                                               requests (>= 1) */
#define  TK_SEMAPHORE_MAXCNT         65535  /* Upper limit of maximum semaphore resource
                                               count (maxsem) (>= 32767) */
#define  TK_SUSPEND_MAXCNT           65535  /* Maximum nest count of the forced wait
                                               of tasks (>= 1) */
#define  TK_MEM_RNG0                 0      /* Real memory protection level of TA_RNG0
                                               (0〜3) */
#define  TK_MEM_RNG1                 0      /* Real memory protection level of TA_RNG1
                                               (0〜3) */
#define  TK_MEM_RNG2                 0      /* Real memory protection level of TA_RNG2
                                               (0〜3) */
#define  TK_MEM_RNG3                 3      /* Real memory protection level of TA_RNG3
                                               (0〜3) */
#define  TK_MAX_PTIMER               2      /* Maximum number of physical timers (>= 0)
                                               (Values from 1 to TK_MAX_PTIMER can be used
                                               as physical timer number) */

TK_MEM_RNGn defines the real memory protection level of memory specified by TA_RNGn, and if TK_MEM_RNGn == TK_MEM_RNGm, then as far as memory access protection level goes, TA_RNGn and TA_RNGm are equivalent. In other words, it is guaranteed that a task with protection level m can access memory with protection level n without generating access privilege violation exception.

It is recommended that the developer is prepared for the case of missing definitions for service profile items that are supposed to have a value by means of coding such as defined(...).

Examples of Service Profile Items

Following are concrete examples of service profile items.

Service Profile Items for a Very Small-scale System using 16-bit CPU


#define TK_SUPPORT_TASKEVENT      FALSE
#define TK_SUPPORT_DISWAI         FALSE
#define TK_SUPPORT_IOPORT         TRUE
#define TK_SUPPORT_MICROWAIT      TRUE

#define TK_SUPPORT_LOWPOWER       TRUE

#define TK_SUPPORT_USERBUF        TRUE
#define TK_SUPPORT_AUTOBUF        FALSE
#define TK_SUPPORT_MEMLIB         FALSE

#define TK_SUPPORT_TASKEXCEPTION  FALSE

#define TK_SUPPORT_SUBSYSTEM      FALSE
#define TK_SUPPORT_SSYEVENT       FALSE

#define TK_SUPPORT_SYSCONF        FALSE

#define TK_HAS_DOUBLEWORD         FALSE
#define TK_SUPPORT_USEC           FALSE
#define TK_SUPPORT_LARGEDEV       FALSE
#define TK_SUPPORT_SERCD          FALSE

#define TK_SUPPORT_INTCTRL        FALSE
#define TK_HAS_ENAINTLEVEL        FALSE
#define TK_SUPPORT_CPUINTLEVEL    FALSE
#define TK_SUPPORT_CTRLINTLEVEL   FALSE
#define TK_SUPPORT_INTMODE        TRUE

#define TK_SUPPORT_CACHECTRL      FALSE
#define TK_SUPPORT_SETCACHEMODE   FALSE
#define TK_SUPPORT_WBCACHE        FALSE
#define TK_SUPPORT_WTCACHE        FALSE

#define TK_SUPPORT_FPU            FALSE
#define TK_SUPPORT_COP0           FALSE
#define TK_SUPPORT_COP1           FALSE
#define TK_SUPPORT_COP2           FALSE
#define TK_SUPPORT_COP3           FALSE

#define TK_SUPPORT_ASM            TRUE
#define TK_SUPPORT_REGOPS         FALSE
#define TK_ALLOW_MISALIGN         FALSE
#define TK_BIGENDIAN              FALSE
#define TK_TRAP_SVC               FALSE
#define TK_HAS_SYSSTACK           FALSE
#define TK_SUPPORT_PTIMER         FALSE
#define TK_SUPPORT_UTC            TRUE
#define TK_SUPPORT_TRONTIME       FALSE

#define TK_SUPPORT_DSNAME         FALSE
#define TK_SUPPORT_DBGSPT         FALSE

#define TK_SPECVER_MAGIC          6
#define TK_SPECVER_MAJOR          3
#define TK_SPECVER_MINOR          0
#define TK_SPECVER                ((TK_SPECVER_MAJOR << 8) | TK_SPECVER_MINOR)

#define TK_MAX_TSKPRI             16
#define TK_WAKEUP_MAXCNT          4095
#define TK_SEMAPHORE_MAXCNT       4095
#define TK_SUSPEND_MAXCNT         4095
#define TK_MEM_RNG0               0
#define TK_MEM_RNG1               0
#define TK_MEM_RNG2               0
#define TK_MEM_RNG3               0
#define TK_MAX_PTIMER             0

Service Profile Items for a Relatively Large-scale System


#define TK_SUPPORT_TASKEVENT      TRUE
#define TK_SUPPORT_DISWAI         TRUE
#define TK_SUPPORT_IOPORT         TRUE
#define TK_SUPPORT_MICROWAIT      TRUE

#define TK_SUPPORT_LOWPOWER       TRUE

#define TK_SUPPORT_USERBUF        FALSE
#define TK_SUPPORT_AUTOBUF        TRUE
#define TK_SUPPORT_MEMLIB         TRUE

#define TK_SUPPORT_TASKEXCEPTION  TRUE

#define TK_SUPPORT_SUBSYSTEM      TRUE
#define TK_SUPPORT_SSYEVENT       TRUE

#define TK_SUPPORT_SYSCONF        TRUE

#define TK_HAS_DOUBLEWORD         TRUE
#define TK_SUPPORT_USEC           TRUE
#define TK_SUPPORT_LARGEDEV       TRUE
#define TK_SUPPORT_SERCD          TRUE

#define TK_SUPPORT_INTCTRL        TRUE
#define TK_HAS_ENAINTLEVEL        TRUE
#define TK_SUPPORT_CPUINTLEVEL    FALSE
#define TK_SUPPORT_CTRLINTLEVEL   TRUE
#define TK_SUPPORT_INTMODE        TRUE

#define TK_SUPPORT_CACHECTRL      TRUE
#define TK_SUPPORT_SETCACHEMODE   TRUE
#define TK_SUPPORT_WBCACHE        TRUE
#define TK_SUPPORT_WTCACHE        TRUE

#define TK_SUPPORT_FPU            TRUE
#define TK_SUPPORT_COP0           TRUE
#define TK_SUPPORT_COP1           FALSE
#define TK_SUPPORT_COP2           FALSE
#define TK_SUPPORT_COP3           FALSE

#define TK_SUPPORT_ASM            TRUE
#define TK_SUPPORT_REGOPS         TRUE
#define TK_ALLOW_MISALIGN         FALSE
#define TK_BIGENDIAN              FALSE
#define TK_TRAP_SVC               TRUE
#define TK_HAS_SYSSTACK           TRUE
#define TK_SUPPORT_PTIMER         TRUE
#define TK_SUPPORT_UTC            TRUE
#define TK_SUPPORT_TRONTIME       FALSE

#define TK_SUPPORT_DSNAME         TRUE
#define TK_SUPPORT_DBGSPT         TRUE

#define TK_SPECVER_MAGIC          6
#define TK_SPECVER_MAJOR          3
#define TK_SPECVER_MINOR          0
#define TK_SPECVER                ((TK_SPECVER_MAJOR << 8) | TK_SPECVER_MINOR)

#define TK_MAX_TSKPRI             140
#define TK_WAKEUP_MAXCNT          65535
#define TK_SEMAPHORE_MAXCNT       65535
#define TK_SUSPEND_MAXCNT         65535
#define TK_MEM_RNG0               0
#define TK_MEM_RNG1               0
#define TK_MEM_RNG2               0
#define TK_MEM_RNG3               3
#define TK_MAX_PTIMER             10