📄 tk_vtxsa.h
字号:
/*
* FILENAME: tk_vtxsa.h
*
* Copyright 2001 By InterNiche Technologies Inc. All rights reserved
*
* Definitions to map NicheTask "TK_" macros to Mentor Graphics VRTXsa RTOS
* and Interniche Wrapper functions in ..\misclib\tk_vtxsa.c
*
* MODULE: H
*
* PORTABLE: yes (within VRTXsa systems)
*
* 08/15/2001 - Aditya Kotha
*/
#ifndef TK_VTXSA_H
#define TK_VTXSA_H
#ifndef VRTX_SA
#error - must define VRTX_SA in ipport.h to use this file
#endif /* VRTX_SA */
/* Define the VRTXsa object control TK_ macros... */
/* define the default priority for all net related tasks */
#ifndef NET_PRIORITY
#define NET_PRIORITY 240 /* all net tasks get a fairly low priority */
#endif /* NET_PRIORITY */
/* macros for task type, entry, and name */
#define TK_ENTRY(name) void name(int parm)
#define TK_OBJECT(tid) int tid
#define TK_OBJECT_PTR(tid) int * tid
#define TK_OBJECT_REF TK_OBJECT
#define TK_ENTRY_PTR(name) void(*name)(int)
#define TK_THIS Sc_Tinquiry() /* wrapper for sc_tinquiry() */
#define TK_SLEEP(count) sc_delay(count * VRTX_SA_SLEEP_TIME)
#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.
* RTOS 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 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
#define tk_yield Sc_Delay /* Wrapper for sc_delay(0); */
/* declare tasks which need to be accessed by system code */
extern int to_pingcheck;
extern int to_netmain;
extern int to_emailer;
extern int to_ftpclnt;
/* map TK_ macros to VRTXsa: */
#define TK_BLOCK() Sc_Tsuspend() /* Wrapper to Suspend calling task */
/* (Id) is always of type TK_OBJECT_PTR */
#define TK_WAKE(Id) Sc_Wake(Id) /* Wrapper for VRTXsa's sc_tresume() */
/* (ev) is always of type TK_OBJECT_REF */
#define TK_WAKE_EVENT(ev) Sc_Tresume((int)ev)
/* define macros to wake net task on packet receipt, etc */
#define SignalPktDemux() Sc_Tresume(to_netmain)
#define SignalEmailTask() Sc_Tresume(to_emailer)
#define SignalFtpClient() Sc_Tresume(to_ftpclnt)
#endif /* TK_VTXSA_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -