📄 norti3.h
字号:
/* ref_cyc */
typedef struct t_rcyc
{ VP exinf; /* extended information */
CYCTIME lfttim; /* time left before next handler startup */
UINT cycact; /* cyclic handler activation */
} T_RCYC;
/* def_alm */
typedef struct t_dalm
{ VP exinf; /* extended information */
ATR almatr; /* alarm handler attributes */
FP almhdr; /* alarm handler address */
UINT tmmode; /* start time specification mode */
ALMTIME almtim; /* handler startup time */
} T_DALM;
/* ref_alm */
typedef struct t_ralm
{ VP exinf; /* extended information */
ALMTIME lfttim; /* time left before next handler startup */
} T_RALM;
/* get_ver */
typedef struct t_ver
{ UH maker; /* vendor */
UH id; /* format number */
UH spver; /* specification version */
UH prver; /* product version */
UH prno[4]; /* product control information */
UH cpu; /* CPU information */
UH var; /* variation descriptor */
} T_VER;
/* ref_sys */
typedef struct t_rsys
{ INT sysstat; /* system state */
} T_RSYS;
/* ref_cfg */
typedef struct t_rcfg
{ ID tskid_max;
ID semid_max;
ID flgid_max;
ID mbxid_max;
ID mbfid_max;
ID porid_max;
ID mplid_max;
ID mpfid_max;
HNO cycno_max;
HNO almno_max;
PRI tpri_max;
int tmrqsz;
int cycqsz;
int almqsz;
int istksz;
int tstksz;
size_t sysmsz;
size_t mplmsz;
size_t stkmsz;
} T_RCFG;
/* def_svc */
typedef struct t_dsvc
{ ATR svcatr; /* extended SVC handler attributes */
FP svchdr; /* extended SVC handler address */
} T_DSVC;
/* def_exc */
typedef struct t_dexc
{ ATR excatr; /* exception handler attributes */
FP exchdr; /* exception handler address */
} T_DEXC;
/************************************/
/* Common Constants */
/************************************/
/* overall */
#if (SIZEOF_PTR == 2)
#define NADR ((void*)(-1)) /* invalid address or pointer value */
#else
#define NADR ((void*)(-1L))
#endif
#ifndef TRUE
#define TRUE 1 /* true */
#endif
#ifndef FALSE
#define FALSE 0 /* false */
#endif
/* tskatr, intatr, cycatr, almatr, svcatr, excatr */
#define TA_HLNG 0x0001 /* high-level language (C language only) */
/* sematr, mbxatr, mbfatr, mplatr, mpfatr */
#define TA_TFIFO 0x0000 /* waiting tasks are handled by FIFO */
#define TA_TPRI 0x0001 /* waiting tasks are handled by priority */
/* tmout */
#define TMO_POL 0L /* polling */
#define TMO_FEVR (-1L) /* wait forever */
/* tskid */
#define TSK_SELF 0 /* task specifies itself */
/* tskpri */
#define TPRI_INI 0 /* the initial priority (chg_pri) */
#define TPRI_RUN 0 /* the highest priority (rot_rdq) */
/* tskstat */
#define TTS_RUN 0x0001 /* RUN */
#define TTS_RDY 0x0002 /* READY */
#define TTS_WAI 0x0004 /* WAIT */
#define TTS_SUS 0x0008 /* SUSPEND */
#define TTS_WAS 0x000c /* WAIT-SUSPEND */
#define TTS_DMT 0x0010 /* DORMANT */
/* tskwait */
#define TTW_SLP 0x0001 /* wait due to slp_tsk or tslp_tsk */
#define TTW_DLY 0x0002 /* wait due to dly_tsk */
#define TTW_FLG 0x0010 /* wait due to wai_flg or twai_flg */
#define TTW_SEM 0x0020 /* wait due to wai_sem or twai_sem */
#define TTW_MBX 0x0040 /* wait due to rcv_msg or trcv_msg */
#define TTW_SMBF 0x0080 /* wait due to snd_mbf or tsnd_mbf */
#define TTW_MBF 0x0100 /* wait due to rcv_mbf or trcv_mbf */
#define TTW_CAL 0x0200 /* wait for rendezvous call */
#define TTW_ACP 0x0400 /* wait for rendezvous accept */
#define TTW_RDV 0x0800 /* wait for rendezvous completion */
#define TTW_MPL 0x1000 /* wait due to get_blk or tget_blk */
#define TTW_MPF 0x2000 /* wait due to get_blf or tget_blf */
/* flgatr */
#define TA_WSGL 0x0000 /* wait single task */
#define TA_WMUL 0x0008 /* wait multiple task */
/* wfmode */
#define TWF_ANDW 0x0000 /* AND wait */
#define TWF_ORW 0x0002 /* OR wait */
#define TWF_CLR 0x0001 /* clear specification */
/* mbxatr */
#define TA_MFIFO 0x0000 /* messages are handled by FIFO */
#define TA_MPRI 0x0002 /* messages are handled by priority */
/* poratr */
#define TA_NULL 0 /* specifies no particular attributes */
/* cycact */
#define TCY_OFF 0x0000 /* do not invoke cyclic handler */
#define TCY_ON 0x0001 /* invoke cyclic handler */
#define TCY_INI 0x0002 /* initialize cycle count */
/* tmmode */
#define TTM_ABS 0x0000 /* specified as an absolute time */
#define TTM_REL 0x0001 /* specified as a relative time */
/* sysstat */
#define TSS_TSK 0 /* task portion (normal state) */
#define TSS_DDSP 1 /* task portion (dispatch disabled) */
#define TSS_LOC 3 /* task portion (interrupt and dispatch disabled)*/
#define TSS_INDP 4 /* task-independent portion */
/************************************/
/* Error Codes */
/************************************/
#define E_OK 0 /* normal completion */
#define E_SYS (-5) /* system error */
#define E_NOMEM (-10) /* insufficient memory */
#define E_NOSPT (-17) /* feature not supported */
#define E_INOSPT (-18) /* feature not supported by ITRON/FILE */
#define E_RSFN (-20) /* reserved function code number */
#define E_RSATR (-24) /* reserved attribute */
#define E_PAR (-33) /* parameter error */
#define E_ID (-35) /* invalid ID number */
#define E_NOEXS (-52) /* object does not exist */
#define E_OBJ (-63) /* invalid object state */
#define E_MACV (-65) /* memory access disabled or violation */
#define E_OACV (-66) /* object access violation */
#define E_CTX (-69) /* context error */
#define E_QOVR (-73) /* queuing or nesting overflow */
#define E_DLT (-81) /* object being waited for was deleted */
#define E_TMOUT (-85) /* polling failure or timeout exceeded */
#define E_RLWAI (-86) /* WAIT state was forcibly released */
/************************************/
/* Function Codes */
/************************************/
#define TFN_UNL_CPU (-7)
#define TFN_LOC_CPU (-8)
#define TFN_DEF_SVC (-9)
#define TFN_REF_SYS (-12)
#define TFN_REF_CFG (-14)
#define TFN_GET_VER (-16)
#define TFN_CRE_TSK (-17)
#define TFN_DEL_TSK (-18)
#define TFN_REF_TSK (-20)
#define TFN_EXT_TSK (-21)
#define TFN_EXD_TSK (-22)
#define TFN_STA_TSK (-23)
#define TFN_GET_TID (-24)
#define TFN_TER_TSK (-25)
#define TFN_CHG_PRI (-27)
#define TFN_ROT_RDQ (-28)
#define TFN_ENA_DSP (-29)
#define TFN_DIS_DSP (-30)
#define TFN_REL_WAI (-31)
#define TFN_SUS_TSK (-33)
#define TFN_RSM_TSK (-35)
#define TFN_FRSM_TSK (-36)
#define TFN_TSLP_TSK (-37)
#define TFN_SLP_TSK (-38)
#define TFN_WUP_TSK (-39)
#define TFN_CAN_WUP (-40)
#define TFN_CRE_FLG (-41)
#define TFN_DEL_FLG (-42)
#define TFN_REF_FLG (-44)
#define TFN_WAI_FLG (-46)
#define TFN_CLR_FLG (-47)
#define TFN_SET_FLG (-48)
#define TFN_CRE_SEM (-49)
#define TFN_DEL_SEM (-50)
#define TFN_REF_SEM (-52)
#define TFN_WAI_SEM (-53)
#define TFN_SIG_SEM (-55)
#define TFN_CRE_MBX (-57)
#define TFN_DEL_MBX (-58)
#define TFN_REF_MBX (-60)
#define TFN_RCV_MSG (-61)
#define TFN_SND_MSG (-63)
#define TFN_DEF_INT (-65)
#define TFN_CHG_IMS (-67)
#define TFN_REF_IMS (-68)
#define TFN_CRE_MPF (-73)
#define TFN_DEL_MPF (-74)
#define TFN_REF_MPF (-76)
#define TFN_GET_BLF (-77)
#define TFN_REL_BLF (-79)
#define TFN_SET_TIM (-83)
#define TFN_GET_TIM (-84)
#define TFN_DLY_TSK (-85)
#define TFN_DEF_ALM (-89)
#define TFN_DEF_CYC (-90)
#define TFN_REF_ALM (-91)
#define TFN_REF_CYC (-92)
#define TFN_ACT_CYC (-94)
#define TFN_PGET_BLF (-103)
#define TFN_PGET_BLK (-104)
#define TFN_POL_FLG (-106)
#define TFN_PREQ_SEM (-107)
#define TFN_PRCV_MSG (-108)
#define TFN_PSND_MBF (-109)
#define TFN_PRCV_MBF (-110)
#define TFN_PCAL_POR (-111)
#define TFN_PACP_POR (-112)
#define TFN_CRE_MPL (-137)
#define TFN_DEL_MPL (-138)
#define TFN_REF_MPL (-140)
#define TFN_GET_BLK (-141)
#define TFN_REL_BLK (-143)
#define TFN_CRE_POR (-145)
#define TFN_DEL_POR (-146)
#define TFN_REF_POR (-148)
#define TFN_CAL_POR (-149)
#define TFN_ACP_POR (-150)
#define TFN_RPL_RDV (-151)
#define TFN_FWD_POR (-152)
#define TFN_CRE_MBF (-153)
#define TFN_DEL_MBF (-154)
#define TFN_REF_MBF (-156)
#define TFN_SND_MBF (-157)
#define TFN_RCV_MBF (-158)
#define TFN_TGET_BLF (-167)
#define TFN_TGET_BLK (-168)
#define TFN_TWAI_FLG (-170)
#define TFN_TWAI_SEM (-171)
#define TFN_TRCV_MSG (-172)
#define TFN_TSND_MBF (-173)
#define TFN_TRCV_MBF (-174)
#define TFN_TCAL_POR (-175)
#define TFN_TACP_POR (-176)
#define TFN_VCRE_TSK (-241)
#define TFN_VCRE_SEM (-242)
#define TFN_VCRE_FLG (-243)
#define TFN_VCRE_MBX (-244)
#define TFN_VCRE_MBF (-245)
#define TFN_VCRE_POR (-246)
#define TFN_VCRE_MPL (-247)
#define TFN_VCRE_MPF (-248)
#define TFN_VDEF_CYC (-255)
#define TFN_VDEF_ALM (-256)
/************************************/
/* System Call */
/************************************/
/* startup */
ER pascal sysini(void);
ER pascal syssta(void);
/* task management */
ER pascal v3_cre_tsk(ID, const T_CTSK *);
ER pascal v3_vcre_tsk(const T_CTSK *);
ER pascal v2_cre_tsk(ID, TASKP, TPRI, UH);
ER pascal v2_xcre_tsk(ID, TASKP, TPRI, UH, void *);
ER pascal v3_del_tsk(ID);
ER pascal v3_sta_tsk(ID, int);
void pascal v3_ext_tsk(void);
void pascal v3_exd_tsk(void);
ER pascal v3_ter_tsk(ID);
ER pascal v3_dis_dsp(void);
ER pascal v3_ena_dsp(void);
ER pascal v3_chg_pri(ID, PRI);
ER pascal v3_rot_rdq(PRI);
ER pascal v3_rel_wai(ID);
ER pascal v3_get_tid(ID *);
ID pascal v3_vget_tid(void);
ER pascal v3_ref_tsk(T_RTSK *, ID);
ER pascal v2_tsk_sts(UINT *, TPRI *, ID);
#define v2_sta_tsk(i) v3_sta_tsk(i,0)
#define v2_ext_tsk() v3_ext_tsk()
#define v2_ter_tsk(i) v3_ter_tsk(i)
#define v2_chg_pri(i,t) v3_chg_pri(i,(PRI)t)
#define v2_rot_rdq(t) v3_rot_rdq((PRI)t)
#define v2_rel_wai(i) v3_rel_wai(i)
#define v2_get_tid(b) v3_get_tid(b)
#define v2_vget_tid() v3_vget_tid()
#define v2_ichg_pri(i,t) v2_chg_pri(i,t)
#define v2_irot_rdq(t) v2_rot_rdq(t)
#define v2_irel_wai(i) v2_rel_wai(i)
/* task-dependent synchronization */
ER pascal v3_sus_tsk(ID);
ER pascal v3_rsm_tsk(ID);
ER pascal v3_frsm_tsk(ID);
ER pascal v3_tslp_tsk(TMO);
ER pascal wup_tsk(ID);
ER pascal v3_can_wup(INT *, ID);
void v3_vcan_wup(void);
#define v2_sus_tsk(i) v3_sus_tsk(i)
#define v2_rsm_tsk(i) v3_rsm_tsk(i)
#define v2_frsm_tsk(i) v3_frsm_tsk(i)
#define v2_wai_tsk(t) v3_tslp_tsk(t)
#define v3_slp_tsk() v3_tslp_tsk(TMO_FEVR)
#define v2_slp_tsk() v3_tslp_tsk(TMO_FEVR)
#define v2_can_wup(b,i) v3_can_wup(b,i)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -