📄 tx_api.h
字号:
/**************************************************************************/
/* */
/* Copyright (c) 1996-2000 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. */
/* 11440 West Bernardo Court info@expresslogic.com */
/* Suite 366 http://www.expresslogic.com */
/* San Diego, CA 92127 */
/* */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Application Interface (API) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* tx_api.h PORTABLE C */
/* 3.0f */
/* 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-31-1996 William E. Lamie Initial Version 3.0 */
/* 07-04-1997 William E. Lamie Added port-specific extension */
/* define to thread control */
/* block for port-specific */
/* information, resulting in */
/* version 3.0a. */
/* 11-11-1997 William E. Lamie Modified several comments */
/* and added return value for */
/* lifting delayed suspend */
/* condition by the thread */
/* resume service, resulting */
/* in version 3.0b. */
/* 01-01-1999 William E. Lamie Modified comment(s), */
/* resulting in version 3.0e. */
/* 11-01-1999 William E. Lamie Modified comment(s), added */
/* logic to bring in the event */
/* logging include file, and */
/* added a member to thread */
/* control block for compiler */
/* usage, resulting in */
/* version 3.0f. */
/* */
/**************************************************************************/
#ifndef TX_API
#define TX_API
/* 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_MAX_PRIORITIES 32
#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_FOREVER 1
/* 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
/* 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 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_INTERNAL_TIMER_STRUCT
{
/* Define the remaining ticks and re-initialization tick value. */
ULONG tx_remaining_ticks;
ULONG tx_re_initialize_ticks;
/* Need to define remaining ticks, type, next and previous pointers, etc. */
VOID (*tx_timeout_function)(ULONG);
ULONG tx_timeout_param;
/* Define the next and previous internal link pointers for active
internal timers. */
struct TX_INTERNAL_TIMER_STRUCT
*tx_active_next,
*tx_active_previous;
/* Keep track of the pointer to the head of this list as well. */
struct TX_INTERNAL_TIMER_STRUCT
**tx_list_head;
} TX_INTERNAL_TIMER;
/* 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_PTR tx_timer_name;
/* Define the expiration routine, parameter, initial expiration, and
reschedule expiration. */
/* Define the actual contents of the timer. This is the block that
is used in the actual timer expiration processing. */
TX_INTERNAL_TIMER tx_timer_internal;
/* Define the pointers for the created list. */
struct TX_TIMER_STRUCT
*tx_timer_created_next,
*tx_timer_created_previous;
} TX_TIMER;
typedef TX_TIMER * TX_TIMER_PTR;
/* 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_run_count; /* Thread's run counter */
VOID_PTR tx_stack_ptr; /* Thread's stack pointer */
VOID_PTR tx_stack_start; /* Stack starting address */
VOID_PTR tx_stack_end; /* Stack ending address */
ULONG tx_stack_size; /* Stack size */
ULONG tx_time_slice; /* Current time-slice */
ULONG tx_new_time_slice; /* New time-slice */
/* Define pointers to the next and previous ready threads. */
struct TX_THREAD_STRUCT
*tx_ready_next,
*tx_ready_previous;
/* Define the port extension field. This typically is defined
to white space, but some ports of ThreadX may need to have
additional fields in the thread control block. This is
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -