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.)
#define TK_STDTK FALSE /* Standard T-Kernel (always FALSE) */ #define TK_MICROTK TRUE /* μT-Kernel (must be TRUE) */ #define TK_ALLOW_MISALIGN FALSE /* Memory misalign access is permitted */ #define TK_BIGENDIAN FALSE /* Is Big Endian (Must be defined) */ #define TK_VIRTUAL_ADDRESS TRUE /* Use virtual address (physical memory != logical memory) */ #define TK_VIRTUAL_MEMORY FALSE /* Has virtual memory (non-resident memory exists) */ #define TK_TRAP_SVC FALSE /* Use CPU Trap instruction for system call entry */ #define TK_HAS_DOUBLEWORD FALSE /* Support of 64-bit data types (D, UD, VD) */ #define TK_SUPPORT_SERCD FALSE /* Support of sub error code */ #define TK_HAS_SYSSTACK FALSE /* Task has a separate system stack */ #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 */ #define TK_SUPPORT_RESOURCE FALSE /* Support of resource group */ #define TK_SUPPORT_USERBUF TRUE /* Support of user-specified buffer (TA_USERBUF) */ #define TK_SUPPORT_AUTOBUF FALSE /* Support of automatic buffer allocation (No TA_USERBUF specification) */ #define TK_SUPPORT_SLICETIME TRUE /* Support of setting task slice time (tk_chg_slt) */ #define TK_SUPPORT_TASKINF TRUE /* Support of getting task statistics (tk_inf_tsk) */ #define TK_SUPPORT_USEC FALSE /* Support of microsecond */ #define TK_SUPPORT_TASKSPACE FALSE /* Support of task space */ #define TK_SUPPORT_TASKEVENT FALSE /* Support of task event */ #define TK_SUPPORT_DISWAI FALSE /* Support of disabling wait */ #define TK_SUPPORT_REGOPS FALSE /* Support of get/set register operation */ #define TK_SUPPORT_ASM TRUE /* Support of assembly language function entry/exit */ #define TK_SUPPORT_DSNAME FALSE /* Support of DS object names */ #define TK_SUPPORT_TASKEXCEPTION FALSE /* Support of task exception */ #define TK_SUPPORT_LOWPOWER TRUE /* Support of power management */ #define TK_SUPPORT_SSYEVENT FALSE /* Support of subsystem event processing */ #define TK_SUPPORT_LARGEDEV FALSE /* Support of Large Mass-storage Device (64-bit) */ #define TK_SUPPORT_INTCTRL TRUE /* Support of interrupt controller management */ #define TK_HAS_ENAINTLEVEL TRUE /* Can specify interrupt priority level */ #define TK_SUPPORT_CPUINTLEVEL TRUE /* Support of get/set of CPU interrupt mask level */ #define TK_SUPPORT_CTRLINTLEVEL TRUE /* Support of get/set of interrupt controller interrupt mask level */ #define TK_SUPPORT_INTMODE TRUE /* Support of setting interrupt mode */ #define TK_SUPPORT_SYSCONF FALSE /* Support of getting system configuration information */ #define TK_SUPPORT_IOPORT TRUE /* Support of I/O port access */ #define TK_SUPPORT_MICROWAIT TRUE /* Support of micro wait */ #define TK_SUPPORT_CACHECTRL TRUE /* Support of cache control */ #define TK_SUPPORT_WBCACHE TRUE /* Support of write-back cache */ #define TK_SUPPORT_WTCACHE TRUE /* Support of write-through cache */ #define TK_SUPPORT_SYSMEMBLK FALSE /* Support of system memory allocation */ #define TK_SUPPORT_MEMLIB FALSE /* Support of memory allocation library */ #define TK_SUPPORT_ADDRSPACE FALSE /* Support of address space management */ #define TK_SUPPORT_PTIMER TRUE /* Support of physical timer */ #define TK_SUPPORT_DBGSPT FALSE /* Support of T-Kernel/DS */
Although the implementations of μT-Kernel 2.0 must define the profile items mentioned previously, the use of profile where some definitions are missing should be practiced since T-Kernel series OS 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 definition is used in conditional, the judgment is the selection between the two cases: effective or the ineffective/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
![]() | Additional Notes |
---|---|
It is not possible to specify both TK_SUPPORT_USERBUF and TK_SUPPORT_AUTOBUF to be FALSE at the same time. TK_SUPPORT_USEC and TK_SUPPORT_LARGEDEV depend on TK_HAS_DOUBLEWORD. That is, when TK_HAS_DOUBLEWORD is set to be ineffective, these two profile items are also set to be ineffective. |
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_MAJOR 2 /* Major Version number of μT-Kernel*/ #define TK_SPECVER_MINOR 0 /* μT-Kernel minor version number */ #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 number of the task wakeup requests (>= 1) */ #define TK_SEMAPHORE_MAXCNT 65535 /* Maximum semaphore count (>= 32767) */ #define TK_SUSPEND_MAXCNT 65535 /* Maximum queuing count of the forced wait of tasks */ #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(...).