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

📄 rdwr.c

📁 PXA27X_CAYMAN BSP from CAYMAN board
💻 C
字号:
/******************************************************************************
* FileName:  rdwr.c - readers/writers routines. HAL layer interface.
*
* SanDisk Host Developer's Toolkit
*
* Copyright (c) 1996-1998 SanDisk Corporation
* All rights reserved.
*
* Description:
*  These routines provide executive services for the run-time drivers
*  running on a PC with no executive kernel. Equivalent services should be
*  provided by the kernel environment, replacing these.
*
* This file contains two parts: one for x86 processors, other for PowerPC,
* Motorola, etc.  The switch X86 is the separator for different processors.
* It is invoked from the compiler command line.
* Please DO NOT USE this switch for processors that are NOT x86 compatible.
*
******************************************************************************/

#include "sdtypes.h"
#include <ceddk.h>
#include "oem.h"

#define inp(p)     READ_PORT_UCHAR((unsigned char *)p)
#define inpw(p)    READ_PORT_USHORT((unsigned short *) p)
#define outp(p, b) WRITE_PORT_UCHAR((unsigned char *)p, b)
#define outpw(p, w) WRITE_PORT_USHORT((unsigned short *) p, w)




#if (WORD_ACCESS_ONLY)

/*********************** COMPILER DEPENDENT CODE *****************************/
/* Those routines are provided to remove the complier dependent code
* from the core code such as conio.h or bios.h
******************************************************************************/

/*****************************************************************************
*  Name: inpword - Get a 16-bit data
*
* Processing:
*       Get a 16-bit data from the I/O port through the supported
*       compiler libraries.
*
*  Entries:
*       addr    I/O port address
*
*  Returns:
*       16-bit data
*
******************************************************************************/
UINT16 inpword(UINT32 addr) /* __fn__ */
{
        UINT16  myData;

        myData = (UINT16)inpw(addr);
        return myData;
}

/******************************************************************************
* Name: outpword - Write a 16-bit data to a specific port
*
* Processing:
*       Write a 16-bit data to a specific I/O port through the supported
*       compiler libraries.
*
*  Entries:
*       addr    I/O port address
*       dat     data to be sent
*
*  Returns:
*       None
*
******************************************************************************/
SDVOID outpword(UINT32 addr, UINT16 dat) /* __fn__ */
{
        outpw(addr, dat);
}

#endif  /* WORD_ACCESS_ONLY */


/******************************************************************************
*  Name: inpbyte - Get a 8-bit data
*
*  Processing:
*       Get a 8-bit data from the I/O port through the supported
*       compiler libraries.
*
*  Entries:
*       addr    I/O port address
*
*  Returns:
*       8-bit data
*
******************************************************************************/
UINT16 inpbyte(UINT32 addr) /* __fn__ */
{
    return((UINT16)(0xFF & inp(addr)));
}

/*****************************************************************************
*  Name: outpbyte - Write a 8-bit data to a specific port
*
*  Processing:
*       Write a 8-bit data to a specific I/O port through the supported
*       compiler libraries.
*
*  Entries:
*       addr    I/O port address
*       dat     data to be sent
*
*  Returns:
*       None
*
******************************************************************************/
SDVOID outpbyte(UINT32 addr, UINT16 dat) /* __fn__ */
{
    outp(addr, (UCHAR)dat);
}





/**************************** END OF X86 CPU *********************************/

⌨️ 快捷键说明

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