📄 portkern.h
字号:
//
// portkern.h
//
// EBS - ERTFS
//
// Copyright EBS Inc , 1993,1994,1995
// All rights reserved.
// This code may not be redistributed in source or linkable object form
// without the consent of its author.
//
//
// Module description:
// This file contains macros and prototypes that are kernel specific.
// See also portkern.c
//
// This is for ERTFS_STAND_ALONE only. Not used in RTIP enviroment
#if (defined(PLUS))
#include <nucleus.h>
#define KS_TASK_HANDLE NU_TASK *
#endif
#define IS_386_PM 0
// ********************************************************************
/* BORLAND, MICROSOFT, WATCOM, and HIGHC */
// ********************************************************************
/* Simplify test of if we're using microsoft 8.0 + in protected mode */
#define IS_MS_PM 0
#ifdef _MSC_VER
#define IS_PC_ARCH 1
#undef IS_MS_PM
#define IS_MS_PM ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
#endif
/* Simplify test of if we're using Borland + in protected mode */
#define IS_BCC_PM 0
#if (defined(__BORLANDC__))
#ifdef __WIN32__
#undef IS_BCC_PM
#define IS_BCC_PM 1
#endif
#endif
/* Simplify test of if we're using Watcom in protected mode */
#define IS_WC_PM 0
#if (defined(__WATCOMC__))
#ifdef __386__
#undef IS_WC_PM
#define IS_WC_PM 1
#endif
#endif
#if (IS_MS_PM || IS_BCC_PM | IS_WC_PM)
#undef IS_386_PM
#define IS_386_PM 1
#endif
#if (defined(__BORLANDC__) || defined(_MSC_VER) || defined(__WATCOMC__))
#define IS_PC_ARCH 1
#define IS_NOT_PC_ARCH 0
#define KS_LITTLE_ENDIAN 1 /* 1 is an intel byte order 0 is motorolla */
#define SHORT_W_ALLIGN 0 /* If 1 shorts must be on 2 byte boundaries */
/* Set to 1 to use memory mapped io (peeks and pokes) set to zero to use
intel style in and out instructions */
#define USE_MEM_MAPPED_IO 0
#include <dos.h>
#if (IS_386_PM)
#define FLAT_ADDRESSING 1
#define KS_FAR
#else
#define FLAT_ADDRESSING 0
#define KS_FAR far
#endif
#if (!IS_386_PM)
#include <bios.h>
#endif
#include <conio.h>
#else // #if (defined(__BORLANDC__) || defined(_MSC_VER) || defined(__WATCOMC__))
#define IS_PC_ARCH 0
#define IS_NOT_PC_ARCH 1
#endif
#if (defined(CMXD860))
#define CMX 1
#define KS_LITTLE_ENDIAN 0 /* 1 is an intel byte order 0 is motorolla */
#define SHORT_W_ALLIGN 1 /* If 1 shorts must be on 2 byte boundaries */
#define FLAT_ADDRESSING 1
#define KS_FAR
/* Set to 1 to use memory mapped io (peeks and pokes) set to zero to use
intel style in and out instructions */
#define USE_MEM_MAPPED_IO 1
/* These are so we can coexist with init_ppc */
#define EBSMC860ETH 1
#define EBSMC860INIT 1
#define CMXNET 1
#define KS_ENTER_ISR()
#define KS_EXIT_ISR()
#define EthernetIntHandler(X)
/* END so we can coexist with init_ppc */
/* These are so we can coexist with eth860 for terminal IO */
#define INCLUDE_ETH860 1
#endif
#if (defined(CMXRM))
#define CMX 1
#endif
#if (defined(POLSD60) || defined(RTPXSD60) || defined(UCOSSD60))
#if (defined(POLSD60))
#define POLLOS 1
#endif
#if (defined(RTPXSD60))
#define RTPX 1
#endif
#if (defined(UCOSSD60))
#define UCOS 1
#endif
#define SDS 1
#define MC68360 1
#define MC68K 1
#define KS_LITTLE_ENDIAN 0 /* 1 is an intel byte order 0 is motorolla */
#define SHORT_W_ALLIGN 1 /* If 1 shorts must be on 2 byte boundaries */
#define FLAT_ADDRESSING 1
#define KS_FAR
/* Set to 1 to use memory mapped io (peeks and pokes) set to zero to use
intel style in and out instructions */
#define USE_MEM_MAPPED_IO 1
// To include the terminal code
#define EBSSMCTERM 1
#define INCLUDE_ETH360 1
#endif
#if (defined(__PSOS__))
#define KS_LITTLE_ENDIAN 0 /* 1 is an intel byte order 0 is motorolla */
#define SHORT_W_ALLIGN 0 /* If 1 shorts must be on 2 byte boundaries */
#define FLAT_ADDRESSING 1
#define KS_FAR
/* Set to 1 to use memory mapped io (peeks and pokes) set to zero to use
intel style in and out instructions */
#define USE_MEM_MAPPED_IO 1
#endif
// constant definition
// *******************************************************************
#define KS_CONSTANT const
///////Macro for ARM
////////////////////
#define KS_LITTLE_ENDIAN 1 /* 1 is an intel byte order 0 is motorolla */
#define SHORT_W_ALLIGN 1 /* If 1 shorts must be on 2 byte boundaries */
#define FLAT_ADDRESSING 1
#define KS_FAR
/* Set to 1 to use memory mapped io (peeks and pokes) set to zero to use
intel style in and out instructions */
#define USE_MEM_MAPPED_IO 1
////////////////////
///////Macro for ARM
/* =============CHECK PROCESSOR CONFIGURATION =============== */
#if (!defined(KS_LITTLE_ENDIAN) || !defined(KS_FAR)\
|| !defined(FLAT_ADDRESSING) || !defined(KS_CONSTANT)\
|| !defined(USE_MEM_MAPPED_IO) || !defined(SHORT_W_ALLIGN))
#error - Configuration values missing
#endif
// ********************************************************************
// TYPES
// ********************************************************************
/*
** ** Typedefs that wont need changing **
** byte - Unsigned char
** word - Unsigned short
** dword - Unsigned long
** BOOLEAN - int
*/
#define TRUE 1 // Don't change
#define FALSE 0 // Don't change
typedef unsigned char byte; // Don't change
typedef unsigned short word; // Don't change
typedef unsigned long dword; // Don't change
#if (!defined(UCOS))
typedef int BOOLEAN; // Don't change
#endif
// *******************************************************************
// ********************************************************************
// DERIVED TYPES
// *******************************************************************
// ********************************************************************
/* Derived types. These are derived from the values above and
should not be changed */
typedef byte KS_FAR * PFBYTE;
typedef int KS_FAR * PFINT;
typedef word KS_FAR * PFWORD;
typedef long KS_FAR * PFLONG;
typedef dword KS_FAR * PFDWORD;
typedef char KS_FAR * PFCHAR;
typedef void KS_FAR * PFVOID;
typedef KS_CONSTANT char KS_FAR * PFCCHAR;
typedef KS_CONSTANT byte KS_FAR * PFCBYTE;
#if (defined(RTPX))
#include <rtpx.h>
#define KS_TASK_HANDLE TASK
#endif
#if (defined(POLLOS))
#define KS_TASK_HANDLE int
#endif
#if (defined(UCOS))
#include "IX86L.H"
#include "OS_CFG.H"
#include "\software\ucos\source\UCOS.H"
#define KS_TASK_HANDLE byte
#endif
#if (defined(CMX))
#define KS_TASK_HANDLE byte
#if (defined(CMXRM))
// Use for dos real mode
#include "pxfuncs.h"
#include "pxextern.h"
#include "pxconfig.h"
#else
// use for others
#include "cxfuncs.h"
#include "cxextern.h"
#include "cxconfig.h"
#endif
#endif
#if (defined(__PSOS__))
#define UCHAR unsigned char
#define USHORT unsigned short
#define ULONG unsigned long
#define UINT unsigned int
#define KS_TASK_HANDLE ULONG
#endif
BOOLEAN ks_resource_init(void);
#if (!defined(POLLOS))
/* POLLED MODE DOESN'T NEED SEMAPHORES */
void ks_claim_logdrive(int driveno);
void ks_release_logdrive(int driveno);
void ks_claim_fscritical(void);
void ks_release_fscritical(void);
void ks_claim_drive_io(int driveno);
void ks_release_drive_io(int driveno);
#endif
void ks_clear_floppy_signal(void);
void ks_set_floppy_signal(void);
BOOLEAN ks_test_floppy_signal(word ticks);
void ks_clear_ide_signal(int controller);
void ks_set_ide_signal(int controller);
BOOLEAN ks_test_ide_signal(int controller, word timeout);
dword ks_get_ticks(void);
word ks_ticks_p_sec(void);
word ks_msec_p_tick(void);
void ks_sleep(word no_ticks);
int phys_to_virtual(PFBYTE * virt, unsigned long phys);
#if (defined(POLLOS))
/* POLLED MODE DOESN'T NEED SEMAPHORES */
#define OS_FS_ENTER()
#define OS_FS_EXIT()
#define OS_CLAIM_LOGDRIVE(X)
#define OS_RELEASE_LOGDRIVE(X)
#define OS_CLAIM_FSCRITICAL()
#define OS_RELEASE_FSCRITICAL()
#define OS_CLAIM_DRIVE_IO(X)
#define OS_RELEASE_DRIVE_IO(X)
#else
#define OS_FS_ENTER()
#define OS_FS_EXIT()
#define OS_CLAIM_LOGDRIVE(X) ks_claim_logdrive(X);
#define OS_RELEASE_LOGDRIVE(X) ks_release_logdrive(X);
#define OS_CLAIM_FSCRITICAL() ks_claim_fscritical();
#define OS_RELEASE_FSCRITICAL() ks_release_fscritical();
#define OS_CLAIM_DRIVE_IO(X) ks_claim_drive_io(X);
#define OS_RELEASE_DRIVE_IO(X) ks_release_drive_io(X);
#endif
/* Defined in portkern.c */
void ks_enable(void);
void ks_disable(void);
void aos_exit(void);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -