T-Kernel 2.0 Overview

Positioning and Basic Policy of T-Kernel 2.0

As the T-Kernel (T-Kernel 1.0), which was published when T-Engine Forum was established, is showing proved achievement and steady increase of products adopting it, there are requests for additional functions to take advantage of the hardware with higher performance and more functionalities. To meet these requests, T-Kernel 2.0 specification for the real-time operating system was developed as a step to the new and wider deployment.

T-Kernel 2.0 specification is compatible with T-Kernel 1.0 specification to take advantage of the past T-Kernel achievements and forsters smooth migration of users to the enhanced kernel. T-Kernel 2.0 specification is not only source compatible but also binary compatible with T-Kernel 1.0 specification. For example, after T-Kernel 1.0 is upgraded to T-Kernel 2.0, existing device drivers, middleware, applications, etc. that were running on T-Kernel 1.0 will run on T-Kernel 2.0 without recompilation.

Additionally, for T-Kernel 2.0, readability and searchability of this specification are significantly improved by using XML-based document source, besides improving the expression and explanation through the review of the complicated or immature description.

Additional Functions to T-Kernel 2.0

  1. Time management functions in microseconds

    While T-Kernel 1.0 used milliseconds for the time management functions such as the cyclic handler and alarm handler, and the time-related function such as the timeout, T-Kernel 2.0 adds APIs that handle them in microseconds.

    Since data with 32-bit width can handle only very short period of time when expressed in microseconds, data with 64-bit width is introduced as time-related parameters (see Introduction of 64-bit integer data type).

    For a name of API with 64-bit parameter in microseconds, "_u" is appended to the end of the corresponding API name in T-Kernel 1.0. u means μ. For 64-bit parameter in microseconds, "_u" is appended to the end of the parameter name also.

    Example 1. Example of API for 64-bit microseconds

    /* API of T-Kernel 1.0 for 32-bit milliseconds */
    tk_sta_alm( ID almid, RELTIM almtim )
    
    /* API of T-Kernel 2.0 for 64-bit microseconds */
    tk_sta_alm_u( ID almid, RELTIM_U almtim_u )

    However, time handling APIs are not unified to use only microseconds in T-Kernel 2.0. According to the basic policy of keeping upward compatibility, APIs for milliseconds of T-Kernel 1.0 can still be used in T-Kernel 2.0 making both time units co-exist.

    Actual time resolution in T-Kernel time management functions uses one that is specified by the "timer interrupt interval" (TTimPeriod) in the Section called Standard System Configuration Information in the Chapter called T-Kernel/SM Functions. Therefore, the "timer interrupt interval" (TTimPeriod) must be set to an enough short period of time to precisely specify parameters for the time management functions in microseconds. For more details, see the Section called Standard System Configuration Information in the Chapter called T-Kernel/SM Functions.

    For comparison, while the maximum time length handled by 32-bit signed integer is approximately 24 days in milliseconds, it is approximately 35 minutes in microseconds. When using data with 64-bit width, virtually unlimited time length can be handled.

  2. Support for large mass-storage device

    Some parameters of device management functions also can handle data with 64-bit width to support large mass-storage device such as a hard disk.

    For a name of API with 64-bit parameter, "_d" is appended to the end of the corresponding API name in T-Kernel 1.0. "_d" means double integer. For 64-bit parameter, "_d" is appended to the end of the parameter name also.

    Example 2. Example of API with 64-bit Parameters

    /* API of T-Kernel 1.0 */
    tk_swri_dev( ID dd, W start, VP buf, W size, W *asize )
    
    /* API of T-Kernel 2.0 with 64-bit Parameters */
    tk_swri_dev_d( ID dd, D start_d, void *buf, W size, W *asize )

    For example, the maximum storage size that can be handled by T-Kernel 1.0 with 32-bit data width was approximately 1 TB (= 512-byte x MATH: 2^31) for a general hard disk with 512-byte block size. In T-Kernel 2.0, this limit is increased by the addition of API with 64-bit data width.

  3. Introduction of 64-bit integer data type

    64-bit integer data type is introduced for API parameters to realize the features in preceding two sections. For this reason, T-Kernel specification adopts a long long data type that is formally specified as a part of C language standard.

    The name of data type that represents 64-bit integer is D for signed integer and UD for unsigned integer. 'D' means Double integer.

  4. Other additional functions

    Cache-related function, physical timer function, utility function, etc. are added.