📄 tk_thrdx.h
字号:
/*
* FILENAME: tk_thrdx.h
*
* Copyright 2000 By InterNiche Technologies Inc. All rights reserved
*
* Definitions to map NicheTask "TK_" macros to Express Logic Thread-X RTOS
*
* MODULE: MISCLIB
*
* PORTABLE: yes (within Thread-X systems)
*/
#ifndef TK_THRDX_H
#define TK_THRDX_H
#ifndef THREADX
#error - must define THREADX in ipport.h to use this file
#endif
/* the threadX API file must be in the include path */
#define TX_DISABLE_ERROR_CHECKING 1
#include "tx_api.h"
/* Define the ThreadX object control TK_ macros... */
/* define the default priority for all net related tasks */
#define NET_PRIORITY 24 /* all net tasks get a fairly low priority */
/* macros for task type, entry, and name */
#define TK_ENTRY(name) void name(ULONG parm)
#define TK_OBJECT(name) TX_THREAD name
#define TK_OBJECT_PTR(name) TX_THREAD * name
#define TK_OBJECT_REF TK_OBJECT_PTR
#define TK_ENTRY_PTR(name) void(*name)(ULONG)
#define TK_THIS tx_thread_identify()
#define TK_SLEEP(count) tx_thread_sleep(count)
#ifndef TK_RETURN_ERROR
#define TK_RETURN_ERROR() return
#endif
#ifndef TK_RETURN_OK
#define TK_RETURN_OK() return
#endif
/*
* synchronization primitives
*
* Need one or the other of LOCK_NET_RESOURCE/UNLOCK_NET_RESOURCE and
* ENTER_CRIT_SECTION/EXIT_CRIT_SECTION. These should be implementable
* as either functions or macros, so we allow e.g. ipport.h_h to
* override these definitions by defining the names as macros.
* ThreadX targets generally use LOCK_NET_RESOURCE/UNLOCK_NET_RESOURCE
* so we default to function declaractions for them.
*
*/
#ifndef LOCK_NET_RESOURCE
void LOCK_NET_RESOURCE(void * semaphore);
#endif
#ifndef UNLOCK_NET_RESOURCE
void UNLOCK_NET_RESOURCE(void * semaphore);
#endif
#ifndef ENTER_CRIT_SECTION
#define ENTER_CRIT_SECTION(p)
#endif
#ifndef EXIT_CRIT_SECTION
#define EXIT_CRIT_SECTION(p)
#endif
/* set up pointers to threadX semaphores as void * so we don't
* have to include tx_api.h in every file in the build...
*/
#ifndef NET_RESID
extern void * net_task_sem_ptr;
#define NET_RESID (net_task_sem_ptr)
#endif
#ifndef RXQ_RESID
extern void * receiveq_sem_ptr;
#define RXQ_RESID (receiveq_sem_ptr)
#endif
#ifndef FREEQ_RESID
extern void * freeq_sem_ptr;
#define FREEQ_RESID (freeq_sem_ptr)
#endif
/* map tk_yield to ThreadX */
#ifdef TX_DISABLE_ERROR_CHECKING
#define tk_yield _tx_thread_relinquish /* plain vanilla version */
#else
#define tk_yield _txe_thread_relinquish /* the error check version */
#endif
#define THREADX_SEMAPHORE 1
/* declare tasks which need to be accessed by system code */
extern TX_THREAD to_pingcheck;
extern TX_THREAD to_netmain;
extern TX_THREAD to_emailer;
extern TX_THREAD to_ftpclnt;
/* map TK_ macros to threadX: */
#define TK_BLOCK() tx_thread_suspend(tx_thread_identify())
/* (Id) is always of type TK_OBJECT_PTR */
#define TK_WAKE(Id) tx_thread_resume(Id)
/* (ev) is always of type TK_OBJECT_REF */
#define TK_WAKE_EVENT(ev) tx_thread_resume(ev)
/* define macros to wake net task on packet receipt, etc */
#define SignalPktDemux() tx_thread_resume(&to_netmain)
#define SignalEmailTask() tx_thread_resume(&to_emailer)
#define SignalFtpClient() tx_thread_resume(&to_ftpclnt)
#endif /* TK_THRDX_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -