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

📄 uitron.h

📁 ecos为实时嵌入式操作系统
💻 H
📖 第 1 页 / 共 3 页
字号:
#ifdef CYGPKG_UITRON_MBOXES#define CYGPKG_UITRON_MBOXES_CREATE_DELETE#ifdef  CYGPKG_UITRON_MBOXES_CREATE_DELETE#define CYGNUM_UITRON_MBOXES_INITIALLY 4#endif // CYGPKG_UITRON_MBOXES_CREATE_DELETE#endif // CYGPKG_UITRON_MBOXES/* {{CFG_DATA   cdl_component CYGPKG_UITRON_FLAGS {       display "Eventflags"       type    boolean       parent  CYGPKG_UITRON       description "uITRON Eventflag objects are used with functions                named xxx_flg(); they support communication between                tasks by means of setting and clearing bits in a word                or flag value.                Waiting for all or any of a set of bits is supported."   }   cdl_option CYGNUM_UITRON_FLAGS {       display          "Number of eventflags"       parent           CYGPKG_UITRON_FLAGS       type             count       legal_values     1 to 65535       description "The number of uITRON eventflag                objects present in the system.                Valid eventflag object IDs will range                from 1 to this value."   }   cdl_component CYGPKG_UITRON_FLAGS_CREATE_DELETE {       display "Support create and delete"       parent  CYGPKG_UITRON_FLAGS       type    boolean       description "Support                eventflag                create and delete operations                (cre_flg, del_flg).                Otherwise all eventflags are created,                up to the number specified above."   }   cdl_option CYGNUM_UITRON_FLAGS_INITIALLY {       display          "Number of eventflags created initially"       parent           CYGPKG_UITRON_FLAGS_CREATE_DELETE       type             count       legal_values     0 to 65535       description "The number of uITRON eventflags initially created.                This number should not be more than the number                of eventflags in the system, though setting it to a large                value to mean 'all' is acceptable.                Initially, only eventflags numbered 1 to this number exist;                higher numbered ones must be created before use."   }   }}CFG_DATA */// Flags: xxx_flg ops in uITRON.#define CYGPKG_UITRON_FLAGS#define CYGNUM_UITRON_FLAGS   5#ifdef CYGPKG_UITRON_FLAGS#define CYGPKG_UITRON_FLAGS_CREATE_DELETE#ifdef  CYGPKG_UITRON_FLAGS_CREATE_DELETE#define CYGNUM_UITRON_FLAGS_INITIALLY 5#endif // CYGPKG_UITRON_FLAGS_CREATE_DELETE#endif // CYGPKG_UITRON_FLAGS// ------------------------------------------------------------------------// Next, uITRON tasks.  These must be initialized, and the number of them// must match the number of entries in the initializer definition.//// CYGNUM_UITRON_TASKS defines the number of tasks; they are numbered 1// through CYGNUM_UITRON_TASKS.//// CYGDAT_UITRON_TASK_EXTERNS is used to declare external symbols which are// used in the initializations, typically the addresses of the functions who// implement each of the tasks.  Other objects might also be declared, for// example stack data or scratch data which is used by the tasks.//// CYGDAT_UITRON_TASK_INITIALIZERS defines a list of CYG_UIT_TASK()// initializers, separated by commas.  The number of these defines how many// uITRON tasks exist in the system.// // Both of these symbols must be defined.//// Task IDs in the uITRON sense are from 1 to the number of uITRON tasks// which exist in the system, defined by CYGDAT_UITRON_TASK_INITIALIZERS.//// Tasks are dormant by default from the start; they must be resumed in// order to run when the scheduler starts.  Code to do this is provided in// the uITRON package; it is present if this symbol is defined, and can be// called from plain C code://   CYGNUM_UITRON_START_TASKS > 0: start tasks 1..<value>//   CYGNUM_UITRON_START_TASKS = 0: start all uITRON tasks//                                ie. 1..CYGNUM_UITRON_TASKS//// Alternatively, an expert programmer could start the uITRON tasks// individually using the C++ system calls on the static array of tasks// declared in uit_objs.hxx/* {{CFG_DATA   cdl_component CYGPKG_UITRON_TASKS {       display "Tasks"       type    dummy       parent  CYGPKG_UITRON       description "uITRON Tasks are the basic blocks of multi-tasking                in the uITRON world; they are threads or lightweight                processes, sharing the address space and the CPU.                They communicate using the primitives outlined above.                Each has a stack, an entry point (a C or C++ function),                and (where appropriate) a scheduling priority."   }   cdl_option CYGNUM_UITRON_TASKS {       display          "Number of tasks"       parent           CYGPKG_UITRON_TASKS       type             count       legal_values     1 to 65535       description "The number of uITRON tasks                present in the system.                Valid task object IDs will range                from 1 to this value."   }   cdl_option CYGNUM_UITRON_START_TASKS {       display          "Start tasks"       parent           CYGPKG_UITRON_TASKS       type             count       legal_values     0 to 65535       description "The number of uITRON tasks                to start automatically.                Tasks from 1 to this value will be started                at the beginning of application execution.                A value of zero here means to start them all.                Tasks started in this way have a start code of                zero, as if they were started by sta_tsk(i,0).                If create and delete operations are supported,                this number should be no greater than the number                of tasks created initially."   }   cdl_component CYGPKG_UITRON_TASKS_CREATE_DELETE {       display "Support create and delete"       parent  CYGPKG_UITRON_TASKS       type    boolean       description "Support                task                create and delete operations                (cre_tsk, del_tsk).                Otherwise all tasks are created,                up to the number specified above."   }   cdl_option CYGNUM_UITRON_TASKS_INITIALLY {       display          "Number of tasks created initially"       parent           CYGPKG_UITRON_TASKS_CREATE_DELETE       type             count       legal_values     1 to 65535       description "The number of uITRON tasks initially created.                This number should not be more than the number                of tasks in the system, though setting it to a large                value to mean 'all' is acceptable.                Initially, only tasks numbered 1 to this number exist;                higher numbered ones must be created before use."   }   cdl_option CYGNUM_UITRON_STACK_SIZE {       display          "Default stack size"       parent           CYGPKG_UITRON_TASKS       type             count       legal_values     128 to 0x7FFFFFFF       description "Define a default stack size for uITRON tasks,                for use in the initialization options below.                This will be overridden where it is used if the                architectural HAL requires a minimum stack size                to handle interrupts correctly."   }   cdl_option CYGDAT_UITRON_TASK_EXTERNS {       display          "Externs for initialization"       parent           CYGPKG_UITRON_TASKS       type             multiline       description "Task initializers may refer to external objects                such as memory for stack or functions to call.                Use this option to define or declare any external                objects needed by the task static initializer below.                Example: create some memory for a stack using                 'static char stack1[CYGNUM_UITRON_STACK_SIZE];'                to set up a chunk of memory of the default stack size.                Note: this option is invoked in the 'outermost' context                of C++ source, where global/static objects are created;                it should contain valid, self-contained, C++ source."   }   cdl_option CYGDAT_UITRON_TASK_INITIALIZERS {       display          "Static initializers"       parent           CYGPKG_UITRON_TASKS       type             multiline       description "Tasks must be statically                initialized: enter a list of initializers                separated by commas, one per line.                An initializer is                'CYG_UIT_TASK(NAME,PRIO,FUNC,STACK,SIZE)'                where name is a quoted string to name the task,                prio is the initial priority of the task,                func is the name of the entry point,                stack is the address of the task's stack,                and size is the size of the task's stack.                When create and delete operations are supported,                'CYG_UIT_TASK_NOEXS(NAME,STACK,SIZE)' should be                used for tasks which are not initially created,                in order to tell the system what memory to use                for stacks when these tasks are created later on.                Using 'CYGNUM_UITRON_STACK_SIZE' for size                is recommended, to use the option defined above,                so long as that truly is the size of your stack(s).                Note: this option is invoked in the context of a                C++ array initializer, between curly brackets.                Ensure that the number of initializers here exactly                matches the number of tasks specified."   }   }}CFG_DATA */// This default configuration has 4 tasks called task1, task2, task3 and// task4, and only task1 is started up by cyg_uitron_start().// first specify how many tasks we have// no PKG define, tasks are not optional#define CYGNUM_UITRON_TASKS 4#define CYGNUM_UITRON_START_TASKS 1 // start task1 only#define CYGNUM_UITRON_STACK_SIZE 2048#define CYGDAT_UITRON_TASK_EXTERNS \extern "C" void task1( unsigned int ); \extern "C" void task2( unsigned int ); \extern "C" void task3( unsigned int ); \extern "C" void task4( unsigned int ); \static char stack1[ CYGNUM_UITRON_STACK_SIZE ], \            stack2[ CYGNUM_UITRON_STACK_SIZE ], \            stack3[ CYGNUM_UITRON_STACK_SIZE ], \            stack4[ CYGNUM_UITRON_STACK_SIZE ];// then initialize in terms of//          CYG_UIT_TASK( "name", prio, func, stackaddress, stacksize )// [or CYG_UIT_TASK_NOEXS( "name",            stackaddress, stacksize ) ]// [for create/delete enabled, tasks which are not initially created.   ]#define CYGDAT_UITRON_TASK_INITIALIZERS \   CYG_UIT_TASK( "t1", 1, task1, &stack1, CYGNUM_UITRON_STACK_SIZE ), \   CYG_UIT_TASK( "t2", 2, task2, &stack2, CYGNUM_UITRON_STACK_SIZE ), \   CYG_UIT_TASK( "t3", 3, task3, &stack3, CYGNUM_UITRON_STACK_SIZE ), \   CYG_UIT_TASK( "t4", 4, task4, &stack4, CYGNUM_UITRON_STACK_SIZE ), \// Do we support create and delete?#define CYGPKG_UITRON_TASKS_CREATE_DELETE#ifdef  CYGPKG_UITRON_TASKS_CREATE_DELETE#define CYGNUM_UITRON_TASKS_INITIALLY 4#endif // CYGPKG_UITRON_TASKS_CREATE_DELETE// ------------------------------------------------------------------------// Memory Pools, both fixed and variable block://// Any such object must be initialized, so the number of them defined must// match the number of entries in the initializer much as for tasks.// Fixed block allocation memory pools:/* {{CFG_DATA   cdl_component CYGPKG_UITRON_MEMPOOLFIXED {       display "Fixed-size memorypools"       type    boolean       parent  CYGPKG_UITRON       description "uITRON supports memory pools for dynamic, task-safe                memory allocation.                Two kinds are supported, fixed-size and variable-size.                There may be multiple of each                type of pool, each with differing characteristics.                This option controls whether there are any fixed-size                memorypools in the system.                A fixed-size memorypool allocates blocks of memory of                its preset fixed size and none other."   }   cdl_option CYGNUM_UITRON_MEMPOOLFIXED {       display          "Number of fixed-size memorypools"       parent           CYGPKG_UITRON_MEMPOOLFIXED       type             count       legal_values     1 to 65535       description "The number of uITRON Fixed-Size                Memorypools present in the system.                Valid Fixed-Size Memorypool IDs will range                from 1 to this value."   }   cdl_component CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE {       display "Support create and delete"       parent  CYGPKG_UITRON_MEMPOOLFIXED       type    boolean       description "Support                fixed-size memory pool                create and delete operations                (cre_mpf, del_mpf).                Otherwise all fixed mempools are created,                up to the number specified above."   }   cdl_option CYGNUM_UITRON_MEMPOOLFIXED_INITIALLY {       display          "Number of fixed mempools created initially"       parent           CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE       type             count       legal_values     0 to 65535       description "The number of fixed mempools initially created.                This number should not be more than the number                of fixed mempools in the system, though setting                it to a large value to mean 'all' is acceptable.                Initially, only fixed mempools numbered from                1 to this number exist;                higher numbered ones must be created before use.                Whilst all mempools must be initialized to tell                the system what memory to use for each pool,                it is only useful to initialize the blocksize of                fixed mempools up to this number;                the blocksize for higher numbered ones                will be defined when they are created."   }   cdl_option CYGDAT_UITRON_MEMPOOLFIXED_EXTERNS {       display          "Externs for initialization"       parent           CYGPKG_UITRON_MEMPOOLFIXED       type             multiline       description "Fixed mempool initializers may refer to external                objects such as memory for the pool to manage.                Use this option to define or declare any external                objects needed by the pool's static initializer below.                Example: create some memory for a mempool using                 'static char fpool1[2000];'                to set up a chunk of memory of 2000 bytes.                Note: this option is invoked in the 'outermost' context                of C++ source, where global/static objects are created;                it should contain valid, self-contained, C++ source."   }   cdl_option CYGDAT_UITRON_MEMPOOLFIXED_INITIALIZERS {       display          "Static initializers"       parent           CYGPKG_UITRON_MEMPOOLFIXED       type             multiline       description "Fixed block memory pools should be statically                initialized: enter a list of initializers                separated by commas, one per line.                An initializer is                'CYG_UIT_MEMPOOLFIXED(ADDR,SIZE,BLOCK)'                where addr is the address of memory to manage,                size is the total size of that memory, and                block is the block size for allocation by the pool.                If create and delete operations are supported,                initializers of the form                'CYG_UIT_MEMPOOLFIXED_NOEXS(ADDR,SIZE)' should be                used for pools which are not initially created, to tell                the system what memory to use for each pool.                Note: this option is invoked in the context of a                C++ array initializer, between curly brackets.                Ensure that the number of initializers here exactly                matches the total number of fixed pools specified."   }   }}CFG_DATA */#define CYGPKG_UITRON_MEMPOOLFIXED#define CYGNUM_UITRON_MEMPOOLFIXED 3

⌨️ 快捷键说明

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