📄 tx_api.h
字号:
/**************************************************************************/
/* */
/* Copyright (c) 1996-2006 by Express Logic Inc. */
/* */
/* This software is copyrighted by and is the sole property of Express */
/* Logic, Inc. All rights, title, ownership, or other interests */
/* in the software remain the property of Express Logic, Inc. This */
/* software may only be used in accordance with the corresponding */
/* license agreement. Any unauthorized use, duplication, transmission, */
/* distribution, or disclosure of this software is expressly forbidden. */
/* */
/* This Copyright notice may not be removed or modified without prior */
/* written consent of Express Logic, Inc. */
/* */
/* Express Logic, Inc. reserves the right to modify this software */
/* without notice. */
/* */
/* Express Logic, Inc. info@expresslogic.com */
/* 11423 West Bernardo Court http://www.expresslogic.com */
/* San Diego, CA 92127 */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Application Interface (API) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* tx_api.h PORTABLE C */
/* 5.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Express Logic, Inc. */
/* */
/* DESCRIPTION */
/* */
/* This file defines the basic Application Interface (API) to the */
/* high-performance ThreadX real-time kernel. All service prototypes */
/* and data structure definitions are defined in this file. */
/* Please note that basic data type definitions and other architecture-*/
/* specific information is contained in the file tx_port.h. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 12-12-2005 William E. Lamie Initial Version 5.0 */
/* */
/**************************************************************************/
#ifndef TX_API_H
#define TX_API_H
/* Determine if a C++ compiler is being used. If so, ensure that standard
C is used to process the API information. */
#ifdef __cplusplus
/* Yes, C++ compiler is present. Use standard C. */
extern "C" {
#endif
/* Include the port-specific data type file. */
#include "tx_port.h"
/* Define basic constants for the ThreadX kernel. */
/* API input parameters and general constants. */
#define TX_NO_WAIT 0
#define TX_WAIT_FOREVER 0xFFFFFFFFUL
#define TX_AND 2
#define TX_AND_CLEAR 3
#define TX_OR 0
#define TX_OR_CLEAR 1
#define TX_1_ULONG 1
#define TX_2_ULONG 2
#define TX_4_ULONG 4
#define TX_8_ULONG 8
#define TX_16_ULONG 16
#define TX_NO_TIME_SLICE 0
#define TX_AUTO_START 1
#define TX_DONT_START 0
#define TX_AUTO_ACTIVATE 1
#define TX_NO_ACTIVATE 0
#define TX_TRUE 1
#define TX_FALSE 0
#define TX_NULL 0
#define TX_LOOP_FOREVER 1
#define TX_INHERIT 1
#define TX_NO_INHERIT 0
#define TX_THREAD_ENTRY 0
#define TX_THREAD_EXIT 1
#define TX_STACK_FILL 0xEFEFEFEFUL
/* Thread execution state values. */
#define TX_READY 0
#define TX_COMPLETED 1
#define TX_TERMINATED 2
#define TX_SUSPENDED 3
#define TX_SLEEP 4
#define TX_QUEUE_SUSP 5
#define TX_SEMAPHORE_SUSP 6
#define TX_EVENT_FLAG 7
#define TX_BLOCK_MEMORY 8
#define TX_BYTE_MEMORY 9
#define TX_IO_DRIVER 10
#define TX_FILE 11
#define TX_TCP_IP 12
#define TX_MUTEX_SUSP 13
/* API return values. */
#define TX_SUCCESS 0x00
#define TX_DELETED 0x01
#define TX_NO_MEMORY 0x10
#define TX_POOL_ERROR 0x02
#define TX_PTR_ERROR 0x03
#define TX_WAIT_ERROR 0x04
#define TX_SIZE_ERROR 0x05
#define TX_GROUP_ERROR 0x06
#define TX_NO_EVENTS 0x07
#define TX_OPTION_ERROR 0x08
#define TX_QUEUE_ERROR 0x09
#define TX_QUEUE_EMPTY 0x0A
#define TX_QUEUE_FULL 0x0B
#define TX_SEMAPHORE_ERROR 0x0C
#define TX_NO_INSTANCE 0x0D
#define TX_THREAD_ERROR 0x0E
#define TX_PRIORITY_ERROR 0x0F
#define TX_START_ERROR 0x10
#define TX_DELETE_ERROR 0x11
#define TX_RESUME_ERROR 0x12
#define TX_CALLER_ERROR 0x13
#define TX_SUSPEND_ERROR 0x14
#define TX_TIMER_ERROR 0x15
#define TX_TICK_ERROR 0x16
#define TX_ACTIVATE_ERROR 0x17
#define TX_THRESH_ERROR 0x18
#define TX_SUSPEND_LIFTED 0x19
#define TX_WAIT_ABORTED 0x1A
#define TX_WAIT_ABORT_ERROR 0x1B
#define TX_MUTEX_ERROR 0x1C
#define TX_NOT_AVAILABLE 0x1D
#define TX_NOT_OWNED 0x1E
#define TX_INHERIT_ERROR 0x1F
#define TX_NOT_DONE 0x20
#define TX_CEILING_EXCEEDED 0x21
#define TX_INVALID_CEILING 0x22
#define TX_FEATURE_NOT_ENABLED 0xFF
/* Define the control block definitions for all system objects. */
/* Define the basic timer management structures. These are the structures
used to manage thread sleep, timeout, and user timer requests. */
/* Define the common internal timer control block. */
typedef struct TX_TIMER_INTERNAL_STRUCT
{
/* Define the remaining ticks and re-initialization tick value. */
ULONG tx_timer_internal_remaining_ticks;
ULONG tx_timer_internal_re_initialize_ticks;
/* Define the timeout function and timeout function parameter. */
VOID (*tx_timer_internal_timeout_function)(ULONG);
ULONG tx_timer_internal_timeout_param;
/* Define the next and previous internal link pointers for active
internal timers. */
struct TX_TIMER_INTERNAL_STRUCT
*tx_timer_internal_active_next,
*tx_timer_internal_active_previous;
/* Keep track of the pointer to the head of this list as well. */
struct TX_TIMER_INTERNAL_STRUCT
**tx_timer_internal_list_head;
} TX_TIMER_INTERNAL;
/* Define the timer structure utilized by the application. */
typedef struct TX_TIMER_STRUCT
{
/* Define the timer ID used for error checking. */
ULONG tx_timer_id;
/* Define the timer's name. */
CHAR *tx_timer_name;
/* Define the actual contents of the timer. This is the block that
is used in the actual timer expiration processing. */
TX_TIMER_INTERNAL tx_timer_internal;
/* Define the pointers for the created list. */
struct TX_TIMER_STRUCT
*tx_timer_created_next,
*tx_timer_created_previous;
#ifdef TX_TIMER_ENABLE_PERFORMANCE_INFO
/* Define the number of timer activations. */
ULONG tx_timer_performance_activate_count;
/* Define the number of timer reactivations. */
ULONG tx_timer_performance_reactivate_count;
/* Define the number of timer deactivations. */
ULONG tx_timer_performance_deactivate_count;
/* Define the number of timer expirations. */
ULONG tx_timer_performance_expiration_count;
/* Define the total number of timer expiration adjustments. */
ULONG tx_timer_performance_expiration_adjust_count;
#endif
} TX_TIMER;
/* ThreadX thread control block structure follows. Additional fields
can be added providing they are added after the information that is
referenced in the port-specific assembly code. */
typedef struct TX_THREAD_STRUCT
{
/* The first section of the control block contains critical
information that is referenced by the port-specific
assembly language code. Any changes in this section could
necessitate changes in the assembly language. */
ULONG tx_thread_id; /* Control block ID */
ULONG tx_thread_run_count; /* Thread's run counter */
VOID *tx_thread_stack_ptr; /* Thread's stack pointer */
VOID *tx_thread_stack_start; /* Stack starting address */
VOID *tx_thread_stack_end; /* Stack ending address */
ULONG tx_thread_stack_size; /* Stack size */
ULONG tx_thread_time_slice; /* Current time-slice */
ULONG tx_thread_new_time_slice; /* New time-slice */
/* Define pointers to the next and previous ready threads. */
struct TX_THREAD_STRUCT
*tx_thread_ready_next,
*tx_thread_ready_previous;
/***************************************************************/
/* Define the first port extension in the thread control block. This
is typically defined to whitespace or a pointer type in tx_port.h. */
TX_THREAD_EXTENSION_0
/* 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 *tx_thread_name; /* Pointer to thread's name */
UINT tx_thread_priority; /* Priority of thread (0-1023) */
UINT tx_thread_state; /* Thread's execution state */
UINT tx_thread_delayed_suspend; /* Delayed suspend flag */
UINT tx_thread_suspending; /* Thread suspending flag */
UINT tx_thread_preempt_threshold; /* Preemption threshold */
VOID *tx_thread_stack_highest_ptr; /* Stack highest usage pointer */
/* Define the thread's entry point and input parameter. */
VOID (*tx_thread_entry)(ULONG);
ULONG tx_thread_entry_parameter;
/* Define the thread's timer block. This is used for thread
sleep and timeout requests. */
TX_TIMER_INTERNAL 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_thread_suspend_cleanup)(struct TX_THREAD_STRUCT *);
VOID *tx_thread_suspend_control_block;
struct TX_THREAD_STRUCT
*tx_thread_suspended_next,
*tx_thread_suspended_previous;
ULONG tx_thread_suspend_info;
VOID *tx_thread_additional_suspend_info;
UINT tx_thread_suspend_option;
UINT tx_thread_suspend_status;
/* Define the second port extension in the thread control block. This
is typically defined to whitespace or a pointer type in tx_port.h. */
TX_THREAD_EXTENSION_1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -