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

📄 tx_api.h

📁 该代码是在单片机MCU中实现多线程的嵌入式操作系统
💻 H
📖 第 1 页 / 共 3 页
字号:

#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

#ifdef  TX_ENABLE_EVENT_LOGGING
UINT    _tx_el_interrupt_control(UINT new_posture);
#define tx_interrupt_control    _tx_el_interrupt_control
#else
#define tx_interrupt_control    _tx_thread_interrupt_control
#endif

#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

#ifdef  TX_ENABLE_EVENT_LOGGING
UINT    _tx_el_interrupt_control(UINT new_posture);
#define tx_interrupt_control    _tx_el_interrupt_control
#else
#define tx_interrupt_control    _tx_thread_interrupt_control
#endif

#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


/* Bring in the event logging constants and prototypes.  Note that
   TX_ENABLE_EVENT_LOGGING must be defined when building the ThreadX
   library components in order to enable event logging.  */

#ifdef  TX_ENABLE_EVENT_LOGGING
#include "tx_el.h"
#else
#define TX_EL_INITIALIZE
#define TX_EL_THREAD_REGISTER(a)
#define TX_EL_THREAD_STATUS_CHANGE_INSERT(a, b)
#define TX_EL_BYTE_ALLOCATE_INSERT
#define TX_EL_BYTE_POOL_CREATE_INSERT
#define TX_EL_BYTE_POOL_DELETE_INSERT
#define TX_EL_BYTE_RELEASE_INSERT
#define TX_EL_BLOCK_ALLOCATE_INSERT
#define TX_EL_BLOCK_POOL_CREATE_INSERT
#define TX_EL_BLOCK_POOL_DELETE_INSERT
#define TX_EL_BLOCK_RELEASE_INSERT
#define TX_EL_EVENT_FLAGS_CREATE_INSERT
#define TX_EL_EVENT_FLAGS_DELETE_INSERT
#define TX_EL_EVENT_FLAGS_GET_INSERT
#define TX_EL_EVENT_FLAGS_SET_INSERT
#define TX_EL_INTERRUPT_CONTROL_INSERT
#define TX_EL_QUEUE_CREATE_INSERT
#define TX_EL_QUEUE_DELETE_INSERT
#define TX_EL_QUEUE_FLUSH_INSERT
#define TX_EL_QUEUE_RECEIVE_INSERT
#define TX_EL_QUEUE_SEND_INSERT
#define TX_EL_SEMAPHORE_CREATE_INSERT
#define TX_EL_SEMAPHORE_DELETE_INSERT
#define TX_EL_SEMAPHORE_GET_INSERT
#define TX_EL_SEMAPHORE_PUT_INSERT
#define TX_EL_THREAD_CREATE_INSERT
#define TX_EL_THREAD_DELETE_INSERT
#define TX_EL_THREAD_IDENTIFY_INSERT
#define TX_EL_THREAD_PREEMPTION_CHANGE_INSERT
#define TX_EL_THREAD_PRIORITY_CHANGE_INSERT
#define TX_EL_THREAD_RELINQUISH_INSERT
#define TX_EL_THREAD_RESUME_INSERT
#define TX_EL_THREAD_SLEEP_INSERT
#define TX_EL_THREAD_SUSPEND_INSERT
#define TX_EL_THREAD_TERMINATE_INSERT
#define TX_EL_THREAD_TIME_SLICE_CHANGE_INSERT
#define TX_EL_TIME_GET_INSERT
#define TX_EL_TIME_SET_INSERT
#define TX_EL_TIMER_ACTIVATE_INSERT
#define TX_EL_TIMER_CHANGE_INSERT
#define TX_EL_TIMER_CREATE_INSERT
#define TX_EL_TIMER_DEACTIVATE_INSERT
#define TX_EL_TIMER_DELETE_INSERT
#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 + -