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

📄 tx_api.h

📁 ThreadX Library for ARM RISC microprocessor. ThreadX is a high performance RTOS that is wildly used
💻 H
📖 第 1 页 / 共 2 页
字号:

    /* 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. */

#ifndef  TX_SOURCE_CODE


/* Determine if error checking is desired.  If so, map API functions 
   to the appropriate error checking front-ends.  Otherwise, map API
   functions to the core functions that actually perform the work. 
   Note: error checking is enabled by default.  */

#ifdef TX_DISABLE_ERROR_CHECKING

/* Services without error checking.  */

#define tx_kernel_enter             _tx_initialize_kernel_enter

#define tx_byte_allocate            _tx_byte_allocate
#define tx_byte_pool_create         _tx_byte_pool_create
#define tx_byte_pool_delete         _tx_byte_pool_delete
#define tx_byte_release             _tx_byte_release

#define tx_block_allocate           _tx_block_allocate
#define tx_block_pool_create        _tx_block_pool_create
#define tx_block_pool_delete        _tx_block_pool_delete
#define tx_block_release            _tx_block_release

#define tx_event_flags_create       _tx_event_flags_create
#define tx_event_flags_delete       _tx_event_flags_delete
#define tx_event_flags_get          _tx_event_flags_get
#define tx_event_flags_set          _tx_event_flags_set

#define tx_interrupt_control        _tx_thread_interrupt_control

#define tx_queue_create             _tx_queue_create
#define tx_queue_delete             _tx_queue_delete
#define tx_queue_flush              _tx_queue_flush
#define tx_queue_receive            _tx_queue_receive
#define tx_queue_send               _tx_queue_send

#define tx_semaphore_create         _tx_semaphore_create
#define tx_semaphore_delete         _tx_semaphore_delete
#define tx_semaphore_get            _tx_semaphore_get
#define tx_semaphore_put            _tx_semaphore_put

#define tx_thread_create            _tx_thread_create
#define tx_thread_delete            _tx_thread_delete
#define tx_thread_identify          _tx_thread_identify
#define tx_thread_preemption_change _tx_thread_preemption_change
#define tx_thread_priority_change   _tx_thread_priority_change
#define tx_thread_relinquish        _tx_thread_relinquish
#define tx_thread_resume            _tx_thread_resume_api
#define tx_thread_sleep             _tx_thread_sleep
#define tx_thread_suspend           _tx_thread_suspend_api
#define tx_thread_terminate         _tx_thread_terminate
#define tx_thread_time_slice_change _tx_thread_time_slice_change

#define tx_time_get                 _tx_time_get
#define tx_time_set                 _tx_time_set
#define tx_timer_activate           _tx_timer_activate_api
#define tx_timer_change             _tx_timer_change
#define tx_timer_create             _tx_timer_create
#define tx_timer_deactivate         _tx_timer_deactivate_api
#define tx_timer_delete             _tx_timer_delete

#else

/* Services with error checking.  */

#define tx_kernel_enter             _tx_initialize_kernel_enter

#define tx_byte_allocate            _txe_byte_allocate
#define tx_byte_pool_create         _txe_byte_pool_create
#define tx_byte_pool_delete         _txe_byte_pool_delete
#define tx_byte_release             _txe_byte_release

#define tx_block_allocate           _txe_block_allocate
#define tx_block_pool_create        _txe_block_pool_create
#define tx_block_pool_delete        _txe_block_pool_delete
#define tx_block_release            _txe_block_release

#define tx_event_flags_create       _txe_event_flags_create
#define tx_event_flags_delete       _txe_event_flags_delete
#define tx_event_flags_get          _txe_event_flags_get
#define tx_event_flags_set          _txe_event_flags_set

#define tx_interrupt_control        _tx_thread_interrupt_control

#define tx_queue_create             _txe_queue_create
#define tx_queue_delete             _txe_queue_delete
#define tx_queue_flush              _txe_queue_flush
#define tx_queue_receive            _txe_queue_receive
#define tx_queue_send               _txe_queue_send

#define tx_semaphore_create         _txe_semaphore_create
#define tx_semaphore_delete         _txe_semaphore_delete
#define tx_semaphore_get            _txe_semaphore_get
#define tx_semaphore_put            _txe_semaphore_put

#define tx_thread_create            _txe_thread_create
#define tx_thread_delete            _txe_thread_delete
#define tx_thread_identify          _tx_thread_identify
#define tx_thread_preemption_change _txe_thread_preemption_change
#define tx_thread_priority_change   _txe_thread_priority_change
#define tx_thread_relinquish        _txe_thread_relinquish
#define tx_thread_resume            _txe_thread_resume_api
#define tx_thread_sleep             _tx_thread_sleep
#define tx_thread_suspend           _txe_thread_suspend_api
#define tx_thread_terminate         _txe_thread_terminate
#define tx_thread_time_slice_change _txe_thread_time_slice_change

#define tx_time_get                 _tx_time_get
#define tx_time_set                 _tx_time_set
#define tx_timer_activate           _txe_timer_activate_api
#define tx_timer_change             _txe_timer_change
#define tx_timer_create             _txe_timer_create
#define tx_timer_deactivate         _txe_timer_deactivate_api
#define tx_timer_delete             _txe_timer_delete

#endif


/* Define the function prototypes of the ThreadX API.  */

VOID        tx_kernel_enter(VOID);

UINT        tx_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size,
                    ULONG wait_option);
UINT        tx_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start,
                    ULONG pool_size);
UINT        tx_byte_pool_delete(TX_BYTE_POOL *pool_ptr);
UINT        tx_byte_release(VOID *memory_ptr);

UINT        tx_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_option);
UINT        tx_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size,
                    VOID *pool_start, ULONG pool_size);
UINT        tx_block_pool_delete(TX_BLOCK_POOL *pool_ptr);
UINT        tx_block_release(VOID *block_ptr);

UINT        tx_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr);
UINT        tx_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr);
UINT        tx_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags,
                    UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option);
UINT        tx_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, 
                    UINT set_option);

UINT        tx_interrupt_control(UINT new_posture);

UINT        tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, 
                        VOID *queue_start, ULONG queue_size);
UINT        tx_queue_delete(TX_QUEUE *queue_ptr);
UINT        tx_queue_flush(TX_QUEUE *queue_ptr);
UINT        tx_queue_receive(TX_QUEUE *queue_ptr, VOID *destination_ptr, ULONG wait_option);
UINT        tx_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option);

UINT        tx_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count);
UINT        tx_semaphore_delete(TX_SEMAPHORE *semaphore_ptr);
UINT        tx_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option);
UINT        tx_semaphore_put(TX_SEMAPHORE *semaphore_ptr);

UINT        tx_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, 
                VOID (*entry_function)(ULONG), ULONG entry_input,
                VOID *stack_start, ULONG stack_size, 
                UINT priority, UINT preempt_threshold, 
                ULONG time_slice, UINT auto_start);
UINT        tx_thread_delete(TX_THREAD *thread_ptr);
TX_THREAD  *tx_thread_identify(VOID);
UINT        tx_thread_preemption_change(TX_THREAD *thread_ptr, UINT new_threshold,
                        UINT *old_threshold);
UINT        tx_thread_priority_change(TX_THREAD *thread_ptr, UINT new_priority,
                        UINT *old_priority);
VOID        tx_thread_relinquish(VOID);
UINT        tx_thread_resume(TX_THREAD *thread_ptr);
UINT        tx_thread_sleep(ULONG timer_ticks);
UINT        tx_thread_suspend(TX_THREAD *thread_ptr);
UINT        tx_thread_terminate(TX_THREAD *thread_ptr);
UINT        tx_thread_time_slice_change(TX_THREAD *thread_ptr, ULONG new_time_slice, ULONG *old_time_slice);

ULONG       tx_time_get(VOID);
VOID        tx_time_set(ULONG new_time);

UINT        tx_timer_activate(TX_TIMER *timer_ptr);
UINT        tx_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks);
UINT        tx_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, 
                VOID (*expiration_function)(ULONG), ULONG expiration_input, ULONG initial_ticks,
                ULONG reschedule_ticks, UINT auto_activate);
UINT        tx_timer_deactivate(TX_TIMER *timer_ptr);
UINT        tx_timer_delete(TX_TIMER *timer_ptr);


#endif


/* Determine if a C++ compiler is being used.  If so, complete the standard
   C conditional started above.  */
#ifdef   __cplusplus
        }
#endif

#endif

⌨️ 快捷键说明

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