资源简介

ThreadX是优秀的硬实时操作系统(RTOS),适用于深嵌入式应用中,具有规模小、实时性强、可靠性高、无产品版权费、易于使用等特点,并且支持大量的处理器和SoC,包括ARM、PowerPC、SH 4、MIPS、ADI DSP、TI DPS、Nios II等,因此广泛应用于消费电子、汽车电子、工业自动化、网络解决方案、军事与航空航天等领域中。

资源截图

代码片段和文件信息

/* 02_sample_system.c

   Create two threads one byte pool and one mutex.
   The threads cooperate with each other via the mutex.  */


/****************************************************/
/*    Declarations Definitions and Prototypes     */
/****************************************************/

#include   “tx_api.h“
#include   

#define     DEMO_STACK_SIZE         1024
#define     DEMO_BYTE_POOL_SIZE     9120


/* Define the ThreadX object control blocks...  */

TX_THREAD               speedy_thread;
TX_THREAD               slow_thread;

TX_MUTEX                my_mutex;

TX_BYTE_POOL            my_byte_pool;


/* Define thread prototypes.  */

void    speedy_thread_entry(ULONG thread_input);
void    slow_thread_entry(ULONG thread_input);


/****************************************************/
/*               Main Entry Point                   */
/****************************************************/

/* Define main entry point.  */

int main()
{

    /* Enter the ThreadX kernel.  */
    tx_kernel_enter();
}



/****************************************************/
/*             Application Definitions              */
/****************************************************/


/* Define what the initial system looks like.  */

void    tx_application_define(void *first_unused_memory)
{

CHAR    *pool_pointer;


    /* Create a byte memory pool from which to allocate
       the thread stacks.  */
    tx_byte_pool_create(&my_byte_pool “my_byte_pool“
                        first_unused_memory
                        DEMO_BYTE_POOL_SIZE);

    /* Put system definition stuff in here e.g. thread
       creates and other assorted create information.  */

    /* Allocate the stack for the speedy thread.  */
    tx_byte_allocate(&my_byte_pool (VOID **) &pool_pointer
                     DEMO_STACK_SIZE TX_NO_WAIT);

    /* Create the speedy_thread.  */
    tx_thread_create(&speedy_thread “speedy_thread“
                     speedy_thread_entry 0  
                     pool_pointer DEMO_STACK_SIZE 5 5
                     TX_NO_TIME_SLICE TX_AUTO_START);

    /* Allocate the stack for the slow thread.  */
    tx_byte_allocate(&my_byte_pool (VOID **) &pool_pointer
                     DEMO_STACK_SIZE TX_NO_WAIT);

    /* Create the slow thread */
    tx_thread_create(&slow_thread “slow_thread“
                     slow_thread_entry 1 pool_pointer 
                     DEMO_STACK_SIZE 15 15
                     TX_NO_TIME_SLICE TX_AUTO_START);

    /* Create the mutex used by both threads  */
    tx_mutex_create(&my_mutex “my_mutex“ TX_NO_INHERIT);

 
}


/****************************************************/
/*              Function Definitions                */
/****************************************************/


/* Entry function definition of the “speedy thread“
   it has a higher priority than the “sl

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4984  2004-08-02 07:12  ThreadX_Win32_demo\02_sample_system.c

     文件       4714  2004-08-02 07:13  ThreadX_Win32_demo\07_sample_system.c

     文件       6655  2004-08-02 07:14  ThreadX_Win32_demo\09_sample_system.c

     文件       6950  2004-08-02 07:14  ThreadX_Win32_demo\10a_sample_system.c

     文件       6462  2004-08-02 07:15  ThreadX_Win32_demo\10b_sample_system.c

     文件       7562  2004-08-02 07:16  ThreadX_Win32_demo\11_sample_system.c

     文件       6977  2004-08-02 07:26  ThreadX_Win32_demo\12_sample_system.c

     文件      15814  2004-08-02 07:17  ThreadX_Win32_demo\14_sample_system.c

     文件      14149  2004-08-02 07:30  ThreadX_Win32_demo\demo\Debug\02_sample_system.obj

     文件      13959  2004-08-02 07:30  ThreadX_Win32_demo\demo\Debug\07_sample_system.obj

     文件      17132  2004-08-02 07:29  ThreadX_Win32_demo\demo\Debug\09_sample_system.obj

     文件      17167  2004-08-02 07:28  ThreadX_Win32_demo\demo\Debug\10a_sample_system.obj

     文件      17010  2004-08-02 07:27  ThreadX_Win32_demo\demo\Debug\10b_sample_system.obj

     文件      17889  2004-08-02 07:26  ThreadX_Win32_demo\demo\Debug\11_sample_system.obj

     文件      17787  2004-08-02 07:24  ThreadX_Win32_demo\demo\Debug\12_sample_system.obj

     文件      29376  2004-08-02 07:22  ThreadX_Win32_demo\demo\Debug\14_sample_system.obj

     文件      29224  2004-08-02 06:33  ThreadX_Win32_demo\demo\Debug\case_study.obj

     文件     176186  2004-08-02 07:30  ThreadX_Win32_demo\demo\Debug\demo.exe

     文件     210804  2004-08-02 07:30  ThreadX_Win32_demo\demo\Debug\demo.ilk

     文件      23989  2004-08-02 06:32  ThreadX_Win32_demo\demo\Debug\demo.obj

     文件    2828448  2004-08-02 07:24  ThreadX_Win32_demo\demo\Debug\demo.pch

     文件     771072  2004-08-02 07:30  ThreadX_Win32_demo\demo\Debug\demo.pdb

     文件      14065  2004-08-02 06:34  ThreadX_Win32_demo\demo\Debug\project1.obj

     文件      58368  2008-12-08 21:18  ThreadX_Win32_demo\demo\Debug\vc60.idb

     文件      69632  2004-08-02 07:30  ThreadX_Win32_demo\demo\Debug\vc60.pdb

     文件       4461  2004-08-02 07:30  ThreadX_Win32_demo\demo\demo.dsp

     文件        863  2004-08-02 07:30  ThreadX_Win32_demo\demo\demo.plg

     文件      12121  2004-07-28 06:36  ThreadX_Win32_demo\demo.c

     文件       1261  2004-08-03 12:34  ThreadX_Win32_demo\readme.txt

     文件        536  2004-07-27 04:08  ThreadX_Win32_demo\ThreadX.dsw

............此处省略12个文件信息

评论

共有 条评论