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

📄 wraptps.h

📁 epson usb2.0 控制芯片 S1R72V05 固件程序。
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
 *	description : System call wrap function for RTOS use
 *	Maker		: Michiru.Kagaya
 *	Copyright	: (C)2003,SEIKO EPSON Corp. All Rights Reserved.
 */

/*
 * Include guard
 */
#ifndef WRAP_TPS_H
#define WRAP_TPS_H

/*
 * Linkage specifying
 */
#ifdef __cplusplus
	extern "C" {
#endif /* __cplusplus */

#include "itron.h"
#include "kernel.h"
#include "t_services.h"

/*
 * Contants definition may be depend on target
 */

#ifndef TASK_PORTID
#define	TASK_PORTID	1		/* Serial port ID to input character */
#endif /* TASK_PORTID */

#ifndef STACK_SIZE
#define	STACK_SIZE	2048		/* Stack size of task */
#endif /* STACK_SIZE */


//=============================================//
// Service call                              //
//=============================================//

// Normal code
#define	OS_E_OK			E_OK		/* (  0) Normal finish */

// Error code
#define	OS_E_SYS		E_SYS		/* ( -5) System error */
#define	OS_E_NOSPT		E_NOSPT		/* ( -9) Unsupport function */
#define	OS_E_RSFN		E_RSFN		/* (-10) Reserved function code */
#define	OS_E_RSATR		E_RSATR		/* (-11) Reserved attribute */
#define	OS_E_PAR		E_PAR		/* (-17) Parameter error */
#define	OS_E_ID			E_ID		/* (-18) Wrong ID number */
#define	OS_E_CTX		E_CTX		/* (-25) Context error */
#define	OS_E_MACV		E_MACV		/* (-26) Memory access violation */
#define	OS_E_OACV		E_OACV		/* (-27) Object access violation */
#define	OS_E_ILUSE		E_ILUSE		/* (-28) Illegal use of service call */
#define	OS_E_NOMEM		E_NOMEM		/* (-33) Memory is not enough */
#define	OS_E_NOID		E_NOID		/* (-34) ID number is not enough */
#define	OS_E_OBJ		E_OBJ		/* (-41) Object state error */
#define	OS_E_NOEXS		E_NOEXS		/* (-42) Object has not been created */
#define	OS_E_QOVR		E_QOVR		/* (-43) Queue overflow */
#define	OS_E_RLWAI		E_RLWAI		/* (-49) Forced lifting for waiting state */
#define	OS_E_TMOUT		E_TMOUT		/* (-50) Polling fail or time out */
#define	OS_E_DLT		E_DLT		/* (-51) Deletion of waiting object */
#define	OS_E_CLS		E_CLS		/* (-52) State change of waiting object */
#define	OS_E_WBLK		E_WBLK		/* (-57) Non-blocking acceptance */
#define	OS_E_BOVR		E_BOVR		/* (-58) Buffer overflow */


//=============================================//
// Data type                                 //
//=============================================//
typedef B				OS_B;			//
typedef H				OS_H;			//
typedef W				OS_W;			//

typedef UB				OS_UB;			//
typedef UH				OS_UH;			//
typedef UW				OS_UW;			//

typedef VB				OS_VB;			//
typedef VH				OS_VH;			//
typedef VW				OS_VW;			//
	
typedef VP				OS_VP;			//
typedef FP				OS_FP;			//
	
typedef INT				OS_INT;			//
typedef UINT			OS_UINT;		//

typedef BOOL			OS_BOOL;
#define OS_TRUE			TRUE
#define OS_FALSE		FALSE

typedef FN				OS_FN;
typedef ER				OS_ER;
typedef ID				OS_ID;
typedef ATR				OS_ATR;
typedef STAT			OS_STAT;
typedef MODE			OS_MODE;
typedef PRI				OS_PRI;
typedef SIZE			OS_SIZE;

typedef TMO				OS_TMO;
typedef RELTIM			OS_RELTIM;
typedef SYSTIM			OS_SYSTIM;

typedef VP_INT			OS_VP_INT;

typedef ER_ID			OS_ER_ID;
typedef ER_UINT			OS_ER_UINT;

typedef TEXPTN			OS_TEXPTN;
typedef	FLGPTN			OS_FLGPTN;
typedef T_MSG			OS_T_MSG;
typedef T_MSG_PRI		OS_TMSG_PRI;

typedef INHNO			OS_INHNO;
typedef INTNO			OS_INTNO;

/* tskatr, inhatr, cycatr, almatr, svcatr, excatr */
#define OS_TA_HLNG		TA_HLNG			/* high-level language (C language only) */
#define OS_TA_ACT		TA_ACT			/* activate after task creation (4.0) */
#define OS_TA_FPU		TA_FPU			/* FPU activate */
/* sematr, mbxatr, mbfatr, mplatr, mpfatr */
#define OS_TA_TFIFO		TA_TFIFO		/* waiting tasks are handled by FIFO */
#define OS_TA_TPRI		TA_TPRI			/* waiting tasks are handled by priority */
/* tmout */
#define OS_TMO_POL		TMO_POL			/* polling */
#define OS_TMO_FEVR		TMO_FEVR		/* wait forever */
/* tskid */
#define OS_TSK_SELF		TSK_SELF		/* task specifies itself */
#define OS_TSK_NONE		TSK_NONE0       /* no task */
#define OS_ID_AUTO		ID_AUTO			/* auto id number assign */
/* tskpri */
#define OS_TPRI_INI		TPRI_INI        /* the initial priority (chg_pri) */
#define OS_TPRI_RUN		TPRI_RUN        /* the highest priority (rot_rdq) */
#define OS_TPRI_SELF	TPRI_SELF       /* (v4.0) */
#define OS_TMIN_TPRI	TMIN_TPRI       /* the higest task priority */
#define OS_TMAX_TPRI	TMAX_TPRI   
/* tskstat */
#define OS_TTS_RUN		TTS_RUN			/* RUNNING */
#define OS_TTS_RDY		TTS_RDY			/* READY */
#define OS_TTS_WAI		TTS_WAI			/* WAITING */
#define OS_TTS_SUS		TTS_SUS			/* SUSPENDED */
#define OS_TTS_WAS		TTS_WAS			/* WAITING-SUSPENDED */
#define OS_TTS_DMT		TTS_DMT			/* DORMANT */
/* task excwption routine */
#define OS_TTEX_ENA		TTEX_ENA		/* enable */
#define OS_TTEX_DIS		TTEX_DIS		/* disable */
/* tskwait */
#define OS_TTW_SLP		TTW_SLP			/* wait due to slp_tsk or tslp_tsk */
#define OS_TTW_DLY		TTW_DLY			/* wait due to dly_tsk */
#define OS_TTW_SEM		TTW_SEM			/* wait due to wai_sem or twai_sem */
#define OS_TTW_FLG		TTW_FLG			/* wait due to wai_flg or twai_flg */
#define OS_TTW_SDTQ		TTW_SDTQ		/* wait due to snd_dtq */
#define OS_TTW_RDTQ		TTW_RDTQ		/* wait due to rcv_dtq */
#define OS_TTW_MBX		TTW_MBX			/* wait due to rcv_msg or trcv_msg */
#define OS_TTW_MTX		TTW_MTX			/* wait due to loc_mtx */
#define OS_TTW_SMBF		TTW_SMBF		/* wait due to snd_mbf or tsnd_mbf */
#define OS_TTW_MBF		TTW_MBF			/* wait due to rcv_mbf or trcv_mbf */
#define OS_TTW_RMBF		TTW_RMBF		/* wait due to rcv_mbf or trcv_mbf */
#define OS_TTW_CAL		TTW_CAL			/* wait for rendezvous call */
#define OS_TTW_ACP		TTW_ACP			/* wait for rendezvous accept */
#define OS_TTW_RDV		TTW_RDV			/* wait for rendezvous completion */
#define OS_TTW_MPF		TTW_MPF			/* wait due to get_blf or tget_blf */
#define OS_TTW_MPL		TTW_MPL			/* wait due to get_blk or tget_blk */
/* flgatr */
#define OS_TA_WSGL		TA_WSGL			/* wait single task */
#define OS_TA_CLR		TA_CLR			/* clear all bits at ready time v4.0 */
#define OS_TA_WMUL		TA_WMUL			/* wait multiple task (0x08 for v3.0)*/
/* mbf.atr */
#define OS_TA_TPRIR		TA_TPRIR		/* recieve tasks are handled by priority */
/* wfmode */
#define OS_TWF_ANDW		TWF_ANDW		/* AND wait */
#define OS_TWF_ORW		TWF_ORW			/* OR wait (0x02 for v3.0) */
#define OS_TWF_CLR		TWF_CLR			/* clear specification (0x01 for v3.0) */
/* mbxatr */
#define OS_TA_MFIFO		TA_MFIFO		/* messages are handled by FIFO */
#define OS_TA_MPRI		TA_MPRI			/* messages are handled by priority */

#define OS_TMIN_MPRI	TMIN_MPRI		/* highest message priority */
/* mutex attr. */
#define OS_TA_INHERIT	TA_INHERIT
#define OS_TA_CEILING	TA_CEILING
/* poratr */
#define OS_TA_NULL		TA_NULL			/* specifies no particular attributes */
/* cycact */
#define OS_TCY_OFF		TCY_OFF			/* do not invoke cyclic handler */
#define OS_TCY_ON		TCY_ON		    /* invoke cyclic handler */
#define OS_TCY_INI		TCY_INI			/* initialize cycle count */
#define OS_TA_STA		TA_STA			/* invoke cyclic handler (v4.0) */
#define OS_TA_PHS		TA_PHS			/* keep phase (v4.0) */
#define OS_TCYC_STA		TCYC_STA    
#define OS_TCYC_STP		TCYC_STP    
/* tmmode */
#define OS_TTM_ABS		TTM_ABS			/* specified as an absolute time */
#define OS_TTM_REL		TTM_REL			/* specified as a relative time */
/* ref_alm */
#define OS_TALM_STP		TALM_STP
#define OS_TALM_STA		TALM_STA
/* ref_ovr */
#define OS_TOVR_STP		TOVR_STP
#define OS_TOVR_STPTOVR_STA	TOVR_STPTOVR_STA
/* ref_ver */
#define OS_TKERNEL_MAKER	TKERNEL_MAKER
#define OS_TKERNEL_PRID		TKERNEL_PRID
#define OS_TKERNEL_SPVER	TKERNEL_SPVER
#define OS_TKERNEL_PRVER	TKERNEL_PRVER
/* sysstat */
#define OS_TSS_TSK		TSS_TSK			/* task portion (normal state) */
#define OS_TSS_DDSP		TSS_DDSP		/* task portion (dispatch disabled) */
#define OS_TSS_LOC		TSS_LOC			/* task portion (interrupt and dispatch disabled)*/
#define OS_TSS_INDP		TSS_INDP		/* task-independent portion */
#define OS_TSS_IMS		TSS_IMS			
#define OS_TSS_V4_LOC	TSS_V4_LOC		
#define OS_TSS_V4_DDSP	TSS_V4_DDSP		
#define OS_TSS_LOC_DDSP	TSS_LOC_DDSP		

/* T_msg Size */
#define	OS_TMSG_SIZE			sizeof(T_MSG)//(4)

//=============================================//
// Packet format                             //
//=============================================//
typedef VP			OS_T_CTSK;
typedef VP			OS_T_RTSK;
typedef VP			OS_T_RTST;
typedef VP			OS_T_DTEX;
typedef VP			OS_T_RTEX;
typedef VP			OS_T_CSEM;
typedef VP			OS_T_RSEM;
typedef VP			OS_T_CFLG;
typedef VP			OS_T_RFLG;
typedef VP			OS_T_CDTQ;
typedef VP			OS_T_RDTQ;
typedef VP			OS_T_RMBX;
typedef VP			OS_T_RMTX;
typedef VP			OS_T_CMBF;
typedef VP			OS_T_RMBF;
typedef VP			OS_T_CPOR;
typedef VP			OS_T_RPOR;
typedef VP			OS_T_RRDV;
typedef VP			OS_T_CMPF;
typedef VP			OS_T_RMPF;
typedef VP			OS_T_CMPL;
typedef VP			OS_T_RMPL;
typedef VP			OS_T_CCYC;
typedef VP			OS_T_RCYC;
typedef VP			OS_T_CALM;
typedef VP			OS_T_RALM;
typedef VP			OS_T_DOVR;
typedef VP			OS_T_ROVR;
typedef VP			OS_T_RSYS;
typedef VP			OS_T_DINH;
typedef VP			OS_T_CISR;
typedef VP			OS_T_RISR;
typedef VP			OS_T_CMBX;


//------------------------------------//
//  Task management                 //
//------------------------------------//
// Task creation
Inline OS_ER OS_CreTsk( OS_ID tskid, OS_T_CTSK *pk_ctsk )
{
	return OS_E_NOSPT;
}
// Task deletion
Inline OS_ER OS_DelTsk( OS_ID tskid )
{
	return OS_E_NOSPT;
}
// Task starting      //
Inline OS_ER OS_ActTsk ( OS_ID tskid )
{
	return act_tsk( tskid );
}

// Task start ( handler ) //
Inline OS_ER OS_IActTsk ( OS_ID tskid )
{
	return iact_tsk( tskid );
}

// Cancel for request of task start //
Inline OS_ER_UINT OS_CanAct( OS_ID tskid )
{
	return can_act( tskid );
}

// Task self finishing      //
Inline void OS_ExtTsk()
{
	ext_tsk();
}

// Forced finish of task     //
Inline OS_ER OS_TerTsk( OS_ID tskid )
{
	return ter_tsk( tskid );
}

// Task priority change   //
Inline OS_ER OS_ChgPri( OS_ID tskid, OS_PRI tskpri )
{
	return chg_pri( tskid, tskpri );
}

// Task priority reference   //
Inline OS_ER OS_GetPri( OS_ID tskid, OS_PRI *p_tskpri )
{
	return get_pri( tskid, p_tskpri );
}

//------------------------------------//
// Synchronization function attached to the task                 //
//------------------------------------//

// Waiting for getting up             //
Inline OS_ER OS_SlpTsk()
{
	return slp_tsk();
}

// Waiting for getting up ( waiting for time out ) //
Inline OS_ER OS_TSlpTsk( OS_TMO tmout )
{
	return tslp_tsk( tmout );
}

// Task get up         //
Inline OS_ER OS_WupTsk( OS_ID tskid )
{
	return wup_tsk( tskid );
}

// Task get up ( handler ) //
Inline OS_ER OS_IWupTsk( OS_ID tskid )
{
	return iwup_tsk( tskid );
}

// Cancel for request of task getting up   //
Inline OS_ER_UINT OS_CanWup( OS_ID tskid )
{
	return can_wup( tskid );
}

// Forced lifting for waiting state   //
Inline OS_ER OS_RelWai( OS_ID tskid )
{
	return rel_wai( tskid );
}

// Forced lifting for waiting state ( handler )  //
Inline OS_ER OS_IRelWai( OS_ID tskid )
{
	return irel_wai( tskid );
}

// Turn to state of forced waiting   //
Inline OS_ER OS_SusTsk( OS_ID tskid )
{
	return sus_tsk( tskid );
}

// Resume from state of forced waiting //
Inline OS_ER OS_RsmTsk( OS_ID tskid )
{
	return rsm_tsk( tskid );
}

// Forced resume from state of forced waiting //
Inline OS_ER OS_FRsmTsk( OS_ID tskid )
{
	return frsm_tsk( tskid );
}

// Delay task self    //
Inline OS_ER OS_DlyTsk( OS_RELTIM dlytim )
{
	return dly_tsk( dlytim );
}

//------------------------------------//
// Task exception process function  //
//------------------------------------//

// Request of task exception process //
Inline OS_ER OS_RasTex( OS_ID tskid, OS_TEXPTN rasptn )
{
	return ras_tex( tskid, rasptn );
}

// Request of task exception process ( handler ) //
Inline OS_ER OS_IRasTex( OS_ID tskid, OS_TEXPTN rasptn )
{
	return iras_tex( tskid, rasptn );
}

// Prohibition of task exception process //
Inline OS_ER OS_DisTex()
{
	return dis_tex();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -