📄 norti3.h
字号:
/******************************************************************************
* NORTi3 Standard Common Definitions/Declarations *
* *
* Copyright (c) 1995-2000, MiSPO Co., Ltd. *
* All rights reserved. *
* *
* 03/Apr/2000 *
* 30/Oct/2001 The semicolon of extern "C" { ... }; is deleted. *
******************************************************************************/
#ifndef NORTI3_H
#define NORTI3_H
#ifdef __cplusplus
extern "C" {
#endif
#include <string.h>
/************************************/
/* Processors */
/************************************/
#define CPU_ARM
/* size of integer and pointer */
#ifndef SIZEOF_INT
#if (defined(CPU_Z80)||defined(CPU_KC160)||defined(CPU_78K0))
#define SIZEOF_INT 1
#elif (defined(CPU_86)||defined(CPU_H83)||defined(CPU_H8S)||defined(CPU_H85))
#define SIZEOF_INT 2
#else
#define SIZEOF_INT 4
#endif
#endif
#if (defined(CPU_Z80)||defined(CPU_78K0))
#define SIZEOF_PTR 2
#elif (defined(M_I86SM)||defined(M_I86MM)||defined(__SMALL__)||defined(__MEDIUM__)||defined(H85_MINIMUM))
#define SIZEOF_PTR 2
#elif (defined(CPU_KC160))
#define SIZEOF_PTR 3
#else
#define SIZEOF_PTR 4
#endif
/* 8086 key words */
#ifdef CPU_86
#define FAR far
#define NEAR near
#else
#ifdef CPU_KC160
#define FAR far
#else
#define FAR /**/
#endif
#define NEAR /**/
#define cdecl /**/
#define pascal /**/
#define _fastcall /**/
#endif
/************************************/
/* Default Constants */
/************************************/
#ifndef MSGS
#define MSGS 16 /* default length of message (bytes count) */
#endif
#ifndef MSEC
#define MSEC 10 /* default peroid time of system clock */
#endif /* ex. tspl_tsk(100/MSEC); */
/************************************/
/* Data Types */
/************************************/
/* general-purpose data types */
#if defined(LSI_C80)
typedef unsigned char B; /* unsigned 8-bit integer */
#else
typedef signed char B; /* signed 8-bit integer */
#endif
typedef long W; /* signed 32-bit integer */
typedef unsigned char UB; /* unsigned 8-bit integer */
typedef unsigned long UW; /* unsigned 32-bit integer */
typedef char VB; /* unpredictable data type (8-bit size) */
typedef long VW; /* unpredictable data type (32-bit size) */
typedef void *VP; /* pointer to an unpredictable data type */
typedef void (FAR *FP)(); /* program start address */
/* V2.0 */
#define TASKP FP
#define TPRI PRI
typedef void (FAR *INTHDRP)(void); /* interrupt handler start address */
typedef void (FAR *TMRHDRP)(void); /* timer handler start address */
#if (SIZEOF_INT <= 2) /* 16-bit,8-bit CPU */
typedef int H; /* signed 16-bit integer */
typedef unsigned int UH; /* unsigned 16-bit integer */
typedef int VH; /* unpredictable data type (16-bit size) */
#else /* 32-bit CPU */
typedef short H; /* signed 16-bit integer */
typedef unsigned short UH; /* unsigned 16-bit integer */
typedef short VH; /* unpredictable data type (16-bit size) */
#endif
/* data types dependent on ITRON */
#if (SIZEOF_INT == 1) /* 8-bit CPU */
#if defined(LSI_C80)
typedef unsigned char INT; /* unsigned integer (bit width of processor) */
#else
typedef signed char INT; /* signed integer (bit width of processor) */
#endif
typedef unsigned char UINT; /* unsigned integer (bit width of processor) */
#elif defined(OLD_ICC_H83) /* old ICC H8/300H */
typedef short INT;
typedef unsigned short UINT;
#else /* 16-bit,32-bit CPU */
typedef int INT;
typedef unsigned int UINT;
#endif
typedef INT BOOL; /* boolean value TRUE(1) or FALSE(0) */
typedef INT FN; /* function code */
typedef INT ID; /* object ID number */
typedef INT BOOL_ID; /* boolean value or ID number */
typedef INT HNO; /* handler number */
typedef INT RNO; /* rendezvous number */
typedef UINT ATR; /* object or handler attribute */
typedef INT ER; /* error code */
typedef INT PRI; /* task priority */
typedef struct t_msg
{ struct t_msg *next; /* used by OS (pointer to next message) */
INT msgpri; /* message priority */
VB msgcont[MSGS]; /* message container */
} T_MSG;
#if (SIZEOF_INT == 1) /* 8-bit CPU */
typedef H TMO; /* timeout value */
typedef struct t_systime /* time of system clock */
{ H utime; /* upper 16 bits */
UH ltime; /* lower 16 bits */
} SYSTIME;
typedef SYSTIME CYCTIME; /* time of cyclic handler */
typedef SYSTIME ALMTIME; /* time of alarm handler */
typedef H DLYTIME; /* time of task delay */
#else /* 16-bit,32-bit CPU */
typedef W TMO; /* timeout value */
typedef struct t_systime /* time of system clock */
{ H utime; /* upper 16 bits */
UW ltime; /* lower 32 bits */
} SYSTIME;
typedef SYSTIME CYCTIME; /* time of cyclic handler */
typedef SYSTIME ALMTIME; /* time of alarm handler */
typedef W DLYTIME; /* time of task delay */
#endif
typedef struct t_time
{ UH ltime;
UH mtime;
UH utime;
} T_TIME;
/************************************/
/* Function Types */
/************************************/
/* task type */
#if defined(__TID__) /* ICC */
#define TASK C_task void
#else
#define TASK void FAR
#endif
/* timer handler type */
#define TMRHDR void FAR
/* interrupt handler type */
#if (defined(__SH7000)||defined(__V850)) /* Green Hills */
#define INTHDR __interrupt void
#elif defined(_MCC68K) /* MCC68K */
#define INTHDR interrupt void
#elif defined(__TID__) /* ICC */
#define INTHDR C_task void
#else
#define INTHDR void FAR
#endif
/************************************/
/* Data Structure Packet Formats */
/************************************/
/* cre_tsk */
typedef struct t_ctsk
{ VP exinf; /* extended information */
ATR tskatr; /* task attributes */
FP task; /* task start address */
PRI itskpri; /* initial task priority */
int stksz; /* stack size */
} T_CTSK;
/* ref_tsk */
typedef struct t_rtsk
{ VP exinf; /* extended information */
PRI tskpri; /* current priority */
UINT tskstat; /* task state */
#if (SIZEOF_INT == 1)
UH tskwait; /* cause of wait */
#else
UINT tskwait; /* cause of wait */
#endif
ID wid; /* ID of object being waited for */
INT wupcnt; /* wakeup request count */
INT suscnt; /* SUSPEND request count */
ATR tskatr; /* task attributes */
FP task; /* task start address */
PRI itskpri; /* initial task priority */
int stksz; /* stack size */
} T_RTSK;
/* cre_sem */
typedef struct t_csem
{ VP exinf; /* extended information */
ATR sematr; /* semaphore attributes */
INT isemcnt; /* initial semaphore count */
INT maxsem; /* maximum semaphore count */
} T_CSEM;
/* ref_sem */
typedef struct t_rsem
{ VP exinf; /* extended information */
BOOL_ID wtsk; /* waiting task ID (FALSE:no task) */
INT semcnt; /* current semaphore count */
} T_RSEM;
/* cre_flg */
typedef struct t_cflg
{ VP exinf; /* extended information */
ATR flgatr; /* eventflag attribute */
UINT iflgptn; /* initial eventflag */
} T_CFLG;
/* ref_flg */
typedef struct t_rflg
{ VP exinf; /* extended information */
BOOL_ID wtsk; /* waiting task ID (FALSE:no task) */
UINT flgptn; /* eventflag bit pattern */
} T_RFLG;
/* cre_mbx */
typedef struct t_cmbx
{ VP exinf; /* extended information */
ATR mbxatr; /* mailbox attributes */
} T_CMBX;
/* ref_mbx */
typedef struct t_rmbx
{ VP exinf; /* extended information */
BOOL_ID wtsk; /* waiting task ID (FALSE:no task) */
T_MSG *pk_msg; /* message to be sent next */
} T_RMBX;
/* cre_mbf */
typedef struct t_cmbf
{ VP exinf; /* extended information */
ATR mbfatr; /* messagebuffer attributes */
int bufsz; /* messagebuffer size */
int maxmsz; /* maximum size of messages */
} T_CMBF;
/* ref_mbf */
typedef struct t_rmbf
{ VP exinf; /* extended information */
BOOL_ID wtsk; /* waiting receiver task ID (FALSE:no task) */
BOOL_ID stsk; /* waiting sender task ID (FALSE:no task) */
int msgsz; /* size of message to be sent next */
int frbufsz; /* size of free buffer */
} T_RMBF;
/* cre_por */
typedef struct t_cpor
{ VP exinf; /* extended information */
ATR poratr; /* port attributes */
int maxcmsz; /* maximum call message size */
int maxrmsz; /* maximum reply message size */
} T_CPOR;
/* ref_por */
typedef struct t_rpor
{ VP exinf; /* extended information */
BOOL_ID wtsk; /* waiting caller task ID (FALSE:no task) */
BOOL_ID atsk; /* waiting accepter task ID (FALSE:no task) */
} T_RPOR;
/* def_int */
typedef struct t_dint
{ ATR intatr; /* interrupt handler attributes */
FP inthdr; /* interrupt handler address */
#if (defined(SH3)||defined(SH3E)||defined(SH4)||defined(CPU_ARM)||defined(CPU_THUMB))
UINT imask; /* interrupt mask, interrupt priority level */
#endif
} T_DINT;
/* cre_mpl */
typedef struct t_cmpl
{ VP exinf; /* extended information */
ATR mplatr; /* memorypool attributes */
int mplsz; /* memorypool size */
} T_CMPL;
/* ref_mpl */
typedef struct t_rmpl
{ VP exinf; /* extended information */
BOOL_ID wtsk; /* waiting task ID (FALSE:no task) */
int frsz; /* total size of free memory */
int maxsz; /* size of largest contiguous memory */
} T_RMPL;
/* cre_mpf */
typedef struct t_cmpf
{ VP exinf; /* extended information */
ATR mpfatr; /* memorypool attributes */
int mpfcnt; /* block count for entire memorypool */
int blfsz; /* fixed-size memory block size */
} T_CMPF;
/* ref_mpf */
typedef struct t_rmpf
{ VP exinf; /* extended information */
BOOL_ID wtsk; /* waiting task ID (FALSE:no task) */
int frbcnt; /* free block count */
} T_RMPF;
/* def_cyc */
typedef struct t_dcyc
{ VP exinf; /* extended information */
ATR cycatr; /* cyclic handler attributes */
FP cychdr; /* cyclic handler address */
UINT cycact; /* cyclic handler activation */
CYCTIME cyctim; /* cyclic startup period */
} T_DCYC;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -