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

📄 tx_api.h

📁 该代码是在单片机MCU中实现多线程的嵌入式操作系统
💻 H
📖 第 1 页 / 共 3 页
字号:
       defined in the file tx_port.h.  */
    TX_THREAD_PORT_EXTENSION
  
    /***************************************************************/  
         
    /* Nothing after this point is referenced by the target-specific
       assembly language.  Hence, information after this point can 
       be added to the control block providing the complete system 
       is recompiled.  */
    CHAR_PTR    tx_thread_name;         /* Pointer to thread's name */
    UINT        tx_priority;            /* Priority of thread (0-31)*/
    UINT        tx_state;               /* Thread's execution state */
    UINT        tx_delayed_suspend;     /* Delayed suspend flag     */
    UINT        tx_suspending;          /* Thread suspending flag   */
    UINT        tx_preempt_threshold;   /* Preemption threshold     */
    ULONG       tx_priority_bit;        /* Priority ID bit          */

    /* Define the thread's entry point and input parameter.  */
    VOID        (*tx_thread_entry)(ULONG);
    ULONG       tx_entry_parameter;

    /* Define the thread's timer block.   This is used for thread 
       sleep and timeout requests.  */
    TX_INTERNAL_TIMER
                tx_thread_timer;

    /* Define the thread's cleanup function and associated data.  This
       is used to cleanup various data structures when a thread 
       suspension is lifted or terminated either by the user or 
       a timeout.  */
    VOID        (*tx_suspend_cleanup)(struct TX_THREAD_STRUCT *);
    VOID_PTR	tx_suspend_control_block;
    struct TX_THREAD_STRUCT
                *tx_suspended_next,
                *tx_suspended_previous;
    ULONG       tx_suspend_info;
    VOID_PTR    tx_additional_suspend_info;
    UINT        tx_suspend_option;
    UINT        tx_suspend_status;

    /* Define a pointer for Green Hills use.  */
    VOID_PTR    tx_eh_globals;

    /* Define pointers to the next and previous threads in the 
       created list.  */
    struct TX_THREAD_STRUCT 
                *tx_created_next,    
                *tx_created_previous;
} TX_THREAD;

typedef TX_THREAD *     TX_THREAD_PTR;


/* Define the semaphore structure utilized by the application.  */

typedef struct TX_SEMAPHORE_STRUCT
{

    /* Define the semaphore ID used for error checking.  */
    ULONG       tx_semaphore_id;

    /* Define the semaphore's name.  */
    CHAR_PTR    tx_semaphore_name;

    /* Define the actual semaphore count.  A zero means that no semaphore
       instance is available.  */
    ULONG       tx_semaphore_count;

    /* Define the semaphore suspension list head along with a count of
       how many threads are suspended.  */
    struct TX_THREAD_STRUCT  *tx_semaphore_suspension_list;
    ULONG                    tx_semaphore_suspended_count;

    /* Define the created list next and previous pointers.  */
    struct TX_SEMAPHORE_STRUCT 
                *tx_semaphore_created_next,    
                *tx_semaphore_created_previous;

} TX_SEMAPHORE;

typedef TX_SEMAPHORE *      TX_SEMAPHORE_PTR;


/* Define the queue structure utilized by the application.  */

typedef struct TX_QUEUE_STRUCT
{

    /* Define the queue ID used for error checking.  */
    ULONG       tx_queue_id;

    /* Define the queue's name.  */
    CHAR_PTR    tx_queue_name;

    /* Define the message size that was specified in queue creation.  */
    UINT        tx_queue_message_size;

    /* Define the total number of messages in the queue.  */
    ULONG       tx_queue_capacity;

    /* Define the current number of messages enqueue and the available
       queue storage space.  */
    ULONG       tx_queue_enqueued;
    ULONG       tx_queue_available_storage;

    /* Define pointers that represent the start and end for the queue's 
       message area.  */
    ULONG_PTR   tx_queue_start;
    ULONG_PTR   tx_queue_end;

    /* Define the queue read and write pointers.  Send requests use the write
       pointer while receive requests use the read pointer.  */
    ULONG_PTR   tx_queue_read;
    ULONG_PTR   tx_queue_write;

    /* Define the queue suspension list head along with a count of
       how many threads are suspended.  */
    struct TX_THREAD_STRUCT  *tx_queue_suspension_list;
    ULONG                    tx_queue_suspended_count;

    /* Define the created list next and previous pointers.  */
    struct TX_QUEUE_STRUCT 
                *tx_queue_created_next,    
                *tx_queue_created_previous;

} TX_QUEUE;

typedef TX_QUEUE *      TX_QUEUE_PTR;


/* Define the event flags group structure utilized by the application.  */

typedef struct TX_EVENT_FLAGS_GROUP_STRUCT
{

    /* Define the event flags group ID used for error checking.  */
    ULONG       tx_event_flags_id;

    /* Define the event flags group's name.  */
    CHAR_PTR    tx_event_flags_name;

    /* Define the actual current event flags in this group. A zero in a 
       particular bit indicates the event flag is not set.  */
    ULONG       tx_event_flags_current;

    /* Define the reset search flag that is set when an ISR sets flags during
       the search of the suspended threads list.  */
    UINT        tx_event_flags_reset_search;

    /* Define the event flags group suspension list head along with a count of
       how many threads are suspended.  */
    struct TX_THREAD_STRUCT  *tx_event_flags_suspension_list;
    ULONG                    tx_event_flags_suspended_count;

    /* Define the created list next and previous pointers.  */
    struct TX_EVENT_FLAGS_GROUP_STRUCT 
                *tx_event_flags_created_next,    
                *tx_event_flags_created_previous;

} TX_EVENT_FLAGS_GROUP;

typedef TX_EVENT_FLAGS_GROUP *      TX_EVENT_FLAGS_GROUP_PTR;


/* Define the block memory pool structure utilized by the application.  */

typedef struct TX_BLOCK_POOL_STRUCT
{

    /* Define the block pool ID used for error checking.  */
    ULONG       tx_block_pool_id;

    /* Define the block pool's name.  */
    CHAR_PTR    tx_block_pool_name;

    /* Define the number of available memory blocks in the pool.  */
    ULONG       tx_block_pool_available;

    /* Save the initial number of blocks.  */
    ULONG       tx_block_pool_total;

    /* Define the head pointer of the available block pool.  */
    CHAR_PTR    tx_block_pool_available_list;

    /* Save the start address of the block pool's memory area.  */
    CHAR_PTR    tx_block_pool_start;

    /* Save the block pool's size in bytes.  */
    ULONG       tx_block_pool_size;

    /* Save the individual memory block size - rounded for alignment.  */
    ULONG       tx_block_pool_block_size;

    /* Define the block pool suspension list head along with a count of
       how many threads are suspended.  */
    struct TX_THREAD_STRUCT  *tx_block_pool_suspension_list;
    ULONG                    tx_block_pool_suspended_count;

    /* Define the created list next and previous pointers.  */
    struct TX_BLOCK_POOL_STRUCT 
                *tx_block_pool_created_next,    
                *tx_block_pool_created_previous;

} TX_BLOCK_POOL;

typedef TX_BLOCK_POOL *      TX_BLOCK_POOL_PTR;


/* Define the byte memory pool structure utilized by the application.  */

typedef struct TX_BYTE_POOL_STRUCT
{

    /* Define the byte pool ID used for error checking.  */
    ULONG       tx_byte_pool_id;

    /* Define the byte pool's name.  */
    CHAR_PTR    tx_byte_pool_name;

    /* Define the number of available bytes in the pool.  */
    ULONG       tx_byte_pool_available;

    /* Define the number of fragments in the pool.  */
    ULONG       tx_byte_pool_fragments;

    /* Define the head pointer of byte pool.  */
    CHAR_PTR    tx_byte_pool_list;

    /* Define the search pointer used for initial searching for memory
       in a byte pool.  */
    CHAR_PTR    tx_byte_pool_search;

    /* Save the start address of the byte pool's memory area.  */
    CHAR_PTR    tx_byte_pool_start;

    /* Save the byte pool's size in bytes.  */
    ULONG       tx_byte_pool_size;

    /* This is used to mark the owner of the byte memory pool during
       a search.  If this value changes during the search, the local search
       pointer must be reset.  */
    struct TX_THREAD_STRUCT  *tx_byte_pool_owner;

    /* Define the byte pool suspension list head along with a count of
       how many threads are suspended.  */
    struct TX_THREAD_STRUCT  *tx_byte_pool_suspension_list;
    ULONG                    tx_byte_pool_suspended_count;

    /* Define the created list next and previous pointers.  */
    struct TX_BYTE_POOL_STRUCT 
                *tx_byte_pool_created_next,    
                *tx_byte_pool_created_previous;

} TX_BYTE_POOL;

typedef TX_BYTE_POOL *      TX_BYTE_POOL_PTR;


/* Define the system API mappings based on the error checking 
   selected by the user.  Note: this section is only applicable to 
   application source code, hence the conditional that turns off this
   stuff when the include file is processed by the ThreadX source. */

⌨️ 快捷键说明

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