portio.h

来自「ertfs文件系统里面既有完整ucos程序」· C头文件 代码 · 共 74 行

H
74
字号
//
// portio.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 defines associated with IO operations
//        such as inbyte, outbye etc

// This is for ERTFS_STAND_ALONE only. Not used in RTIP enviroment

/* Included to get prototype for outpw, inpw etc */
#if (defined(__BORLANDC__) || defined(_MSC_VER) )
#include <conio.h>
#if (defined(__BORLANDC__))
#include <dos.h>
#define _outp outp
#define _inp inp
#define _outpw outpw
#define _inpw inpw
#endif
#endif


/* Set to 1 to use memory mapped io (peeks and pokes) set to zero to use
   intel style in and out instructions */
#if (!defined(USE_MEM_MAPPED_IO))
#error config error
#endif


#if (USE_MEM_MAPPED_IO)
typedef volatile unsigned char * IOADDRESS; /* Memory mapped IO */
#else
typedef unsigned short IOADDRESS;   /* IO mapped IO */
#endif


// ********************************************************************
// I/O MACROS
// *******************************************************************
// ********************************************************************
/* Rep in and rep out routines. The code is in portio.c */

void insw(IOADDRESS ioaddr, unsigned short KS_FAR * dst, int n);
void outsw(IOADDRESS ioaddr, unsigned short KS_FAR * src, int n);


#if (USE_MEM_MAPPED_IO)

#define OUTBYTE(ADD, VAL) (*(volatile unsigned char *) (ADD)) = (unsigned char)(VAL)
#define OUTWORD(ADD, VAL) (*(volatile unsigned short *)(ADD)) = (unsigned short)(VAL)
#define INBYTE(ADD)       (*(volatile unsigned char *) (ADD))
#define INWORD(ADD)       (*(volatile unsigned short *)(ADD))

#else

#define OUTBYTE(ADD, VAL) _outp((unsigned short) (ADD), (int) (VAL) )
#define OUTWORD(ADD, VAL) _outpw((unsigned short) (ADD), (unsigned) (VAL) )
#define INBYTE(ADD)       (unsigned char)(_inp((unsigned short)(ADD))) 
#define INWORD(ADD)       (unsigned short)(_inpw((unsigned short)(ADD)))

#endif


void io_delay(void);
void shut_bios_timer_off(void);
void io_delay(void);

⌨️ 快捷键说明

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