⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ctask.doc

📁 一个嵌入式实时操作系统源码
💻 DOC
📖 第 1 页 / 共 5 页
字号:
             the malloc/free run-time routines. This option has no effect
             if TSK_DYNAMIC is FALSE. The default is TRUE.

             This option is normally enabled (TRUE).

        TSK_NAMEPAR
             If TRUE, all create_xxx calls accept an additional
             parameter, the name of the created control block. This name
             should contain only printeable characters, and should not be
             longer than 8 characters plus the zero terminator. This
             option is used together with TSK_NAMED (see below).

             This option is normally enabled (TRUE).
             It must be enabled for DOS.


        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -             Page 17


        TSK_NAMED
             If TRUE, all control blocks (except timer control blocks)
             are named and linked on creation. This allows the snapshot
             dump routine to display the system state, and also allows
             linking to control blocks from secondary kernels.
             TSK_NAMEPAR must be defined for this option to work. Since
             it may be desirable to switch off the handling of the names
             after the debugging phase, without having to change all
             create_xxx calls to omit the name parameter, the name
             parameter is ignored if TSK_NAMED is undefined, but
             TSK_NAMEPAR is defined.

             This option is normally enabled (TRUE).
             It must be enabled for DOS.

        GROUPS
             If enabled, task groups, i.e. multiple invocations of CTask,
             are supported.

             This option is normally enabled (TRUE).
             It must be enabled for DOS.

        CLOCK_MSEC
             If TRUE, all timeouts are specified in milliseconds instead
             of timer ticks. This allows programming of delays and
             timeouts independent of the speedup-parameter or the system
             tick rate.

             This option is normally disabled (FALSE).

        PRI_TIMER
             Specifies the priority of the timer task. Normally the timer
             task should have a higher priority than any other task in
             the system.

             The value is normally 0xf000.

        PRI_STD
             This value may be used in your programs as the standard
             priority of user tasks. Its value is arbitrary. It is not
             used in the kernel except for the definition of PRI_INT9
             (see below).

             The value is normally 100 (decimal).









        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -             Page 18


        PRI_INT8
             Determines the priority of the "int8"-task. This task chains
             to the previous interrupt vector for the sytem timer tick,
             and thus may activate resident TSR's. Since TSR's normally
             use polling when accessing the keyboard and other devices,
             the priority of the int8-task should be equal to or lower
             than normal user-defined tasks to allow your program to con-
             tinue to run while the TSR is active. You can tune this
             value so that some tasks are blocked by the TSR to avoid
             trashing the screen.

             The value is normally  PRI_STD.

        AT_BIOS
             If enabled, the AT BIOS wait/post handler is installed. May
             be disabled when compatibility problems arise. You can also
             disable installation of this handler with an install flag in
             the install_tasker call, but using the configuration flag
             will save some code. Embedded systems likely will use FALSE.

             This option is normally enabled (TRUE).

        INT8_EARLY
             If TRUE, the timer interrupt always uses early INT8 proces-
             sing, regardless of the IFL_INT8_EARLY installation flag.
             Setting this flag saves some code and data, but eliminates
             some flexibility. Under DOS, timer ticks can be missed under
             certain circumstances when set, so DOS based configurations
             always should use FALSE. The installation flag has a
             slightly different effect, and may be used under DOS with no
             adverse effects. Embedded systems likely will always use
             TRUE.

             This option is normally disabled (FALSE).

        INT8_LATE
             If TRUE, the timer interrupt always uses late INT8 proces-
             sing, regardless of the IFL_INT8_EARLY installation flag.
             Setting this flag saves some code, but eliminates some
             flexibility. Embedded systems likely will always use FALSE.

             This option is normally disabled (FALSE).

        IBM
        DOS
             Both IBM and DOS are more or less of informative value only,
             to point out those areas in the kernel that need attention
             when converting to non-IBM or non-DOS environments.
             Disabling one or both of this options requires the
             substitution of your own routines for installation, timer,
             and keyboard handling.

             Both options must normally be enabled (TRUE).
        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -             Page 19


        SINGLE_DATA
             If enabled, only a single global data block is used. This
             speeds up processing, but prohibits linkage of multiple
             groups. Useful for dedicated systems, and also if your
             program is known to never interact with another copy of
             CTask. Should be left FALSE if you're not so sure, must be
             FALSE if GROUPS is enabled. The current version of the DOS
             handler requires GROUPS to be used, so it should only be
             TRUE for embedded systems.

             This option is normally disabled (FALSE).

        EMS
             If TRUE, EMS support is included. For DOS applications using
             spawn or going TSR, this should always be TRUE, unless it is
             known that the program will never be executed in an EMS
             environment. It must also be TRUE for programs using EMS.

             This option is normally enabled (TRUE).

        EMS_SAVE_SIZE
             Size of the EMS page info save area. For LIM 4.0 drivers,
             only four pages are saved, so 16 bytes should be sufficient.
             If the partial page map function is not available in the
             driver, more space may be required for holding the full page
             map.

             The value is normally 16.

        NDP
             If TRUE, 80x87 support is included. If this option is
             enabled, and no coprocessor is present, the machine can hang
             if the BIOS equipment configuration is set incorrectly.
             NOTE: Coprocessor support is not yet tested. Please report
             your experiences with this option.

             This option is normally disabled (FALSE).

        HOTKEYS
             If TRUE, keyboard hotkey support is included. Embedded
             systems likely will not use hotkeys, and may set this to
             FALSE.

             This option is normally enabled (TRUE).


        CHECKING
             Enables pointer and stack checks when TRUE. Checking
             pointers and task stacks slows down the system, but it is
             highly recommended to enable this option during development.
             Only turn off checking after debugging is complete.

             This option is normally disabled (FALSE).
        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -             Page 20


                                Memory Allocation

        TSKALLOC.C is needed if TSK_DYNAMIC is enabled in tskconf.h to
        handle the allocation and free calls. If you want to use dynamic
        allocation in your own tasks, you should also use the functions
        tsk_alloc and tsk_free to avoid the reentrancy problems mentioned
        in the introduction. If you should need other forms of alloc
        (like calloc) the recommended way is to add those functions to
        TSKALLOC.C, requesting the resource alloc_resource before calling
        the C memory-allocation function.

        Joe Urso provided the following tip on how to force all memory
        allocation to pass through the resource handling functions:

        "I have found that some MS Library functions call the allocate
        and free library functions, namely the first call to fread(),
        fopen(), and fclose().

        To fix this situation I have

           - extracted FMALLOC from the llibce library,

           - renamed the functions within that object (via the Norton
             Utilities) to the upper case spelling of the functions
             (FREE, MALLOC, _FFREE and _FMALLOC) and replaced the file in
             the lib. I also did the same for object EXPAND because of
             the function REALLOC.

           - then modified TSKALLOC.C to contain the lower case spelling
             of malloc, free, and expand. These functions aquire the
             alloc resource, then call the upper case spelling of the
             name.

        At link time I now link with /NOIGNORECASE and /NODEFAULTLIB."

        An option is provided in tskalloc.c to compile the module with
        the modifications suggested by Joe Urso.


                                     Snapshot

        TSKSNAP.C is only needed if you want to include the snapshot dump
        into your program. Note that you can *not* use snapshot if you
        disable TSK_NAMED in tskconf.h.









        
        
        Ctask Manual       - Version 2.2 - 90-10-12 -             Page 21


                                   Task Stacks

        When compiling your application, turn stack checking off. The
        standard stack check is of little use with task stacks, and may
        interfere with CTask's operation. The stack area for tasks should
        be allocated on the main program's stack, not in the static or
        heap data space. The reason for this is that some of the C
        library routines check for stack overflow regardless of your
        compile-time switches, and will crash your application if you use
        stacks outside the normal stack. The stack allocation parameter
        with LINK (MS-C), or the _stacksize variable (Turbo C) have to be
        increased to reflect the additional stack space. When calculating
        task stack sizes, keep in mind that library routines (esp.
        printf) allocate a lot of space on the stack for temporary
        variables. A minimum of 1k for tasks using library routines is
        recommended, 2k puts you on the safe side. Tasks not using C
        library routines may use a smaller stack, about 256 bytes at a
        minimum, plus space for any local variables and nested routines.
        Then add up all task stacks, and add space for the main task (the
        function calling install_tasker), with this size also dependent
        on what you will do in the main task while CTask is active.
        Stacks for tasks that do not use C library routines may be
        allocated anywhere.

        If you have the CHECKING option enabled, the snapshot dump will
        output the number of unused bytes of stack for each task. This
        can help you determine the optimum stack size for your
        application.


                                     Drivers

        The keyboard and DOS handlers are always installed with CTask.
        Using the serial I/O and printer drivers is optional, so you have
        to 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -