edkiiglueiolib.h
来自「EFI BIOS是Intel提出的下一代的BIOS标准。这里上传的Edk源代码是」· C头文件 代码 · 共 1,846 行 · 第 1/5 页
H
1,846 行
/*++
Copyright (c) 2004 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
EdkIIGlueIoLib.h
Abstract:
Public header file for IO Lib
--*/
#ifndef __EDKII_GLUE_IO_LIB_H__
#define __EDKII_GLUE_IO_LIB_H__
#define IoRead8(_PORT) GlueIoRead8(_PORT)
#define IoWrite8(_PORT,_VALUE) GlueIoWrite8(_PORT,_VALUE)
#define IoRead16(_PORT) GlueIoRead16(_PORT)
#define IoWrite16(_PORT,_VALUE) GlueIoWrite16(_PORT,_VALUE)
#define IoRead32(_PORT) GlueIoRead32(_PORT)
#define IoWrite32(_PORT,_VALUE) GlueIoWrite32(_PORT,_VALUE)
#define IO_LIB_ADDRESS(Segment,Port) \
( ((Port) & 0xffff) | (((Segment) & 0xffff) << 16) )
/**
Reads an 8-bit I/O port.
Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
This function must guarantee that all I/O read and write operations are
serialized.
If 8-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to read.
@return The value read.
**/
UINT8
EFIAPI
GlueIoRead8 (
IN UINTN Port
);
/**
Writes an 8-bit I/O port.
Writes the 8-bit I/O port specified by Port with the value specified by Value
and returns Value. This function must guarantee that all I/O read and write
operations are serialized.
If 8-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@return The value written the I/O port.
**/
UINT8
EFIAPI
GlueIoWrite8 (
IN UINTN Port,
IN UINT8 Value
);
/**
Reads an 8-bit I/O port, performs a bitwise inclusive OR, and writes the
result back to the 8-bit I/O port.
Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
between the read result and the value specified by OrData, and writes the
result to the 8-bit I/O port specified by Port. The value written to the I/O
port is returned. This function must guarantee that all I/O read and write
operations are serialized.
If 8-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to write.
@param OrData The value to OR with the read value from the I/O port.
@return The value written back to the I/O port.
**/
UINT8
EFIAPI
IoOr8 (
IN UINTN Port,
IN UINT8 OrData
);
/**
Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
to the 8-bit I/O port.
Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
the read result and the value specified by AndData, and writes the result to
the 8-bit I/O port specified by Port. The value written to the I/O port is
returned. This function must guarantee that all I/O read and write operations
are serialized.
If 8-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to write.
@param AndData The value to AND with the read value from the I/O port.
@return The value written back to the I/O port.
**/
UINT8
EFIAPI
IoAnd8 (
IN UINTN Port,
IN UINT8 AndData
);
/**
Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
inclusive OR, and writes the result back to the 8-bit I/O port.
Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
the read result and the value specified by AndData, performs a bitwise OR
between the result of the AND operation and the value specified by OrData,
and writes the result to the 8-bit I/O port specified by Port. The value
written to the I/O port is returned. This function must guarantee that all
I/O read and write operations are serialized.
If 8-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to write.
@param AndData The value to AND with the read value from the I/O port.
@param OrData The value to OR with the result of the AND operation.
@return The value written back to the I/O port.
**/
UINT8
EFIAPI
IoAndThenOr8 (
IN UINTN Port,
IN UINT8 AndData,
IN UINT8 OrData
);
/**
Reads a bit field of an I/O register.
Reads the bit field in an 8-bit I/O register. The bit field is specified by
the StartBit and the EndBit. The value of the bit field is returned.
If 8-bit I/O port operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Port The I/O port to read.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..7.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..7.
@return The value read.
**/
UINT8
EFIAPI
IoBitFieldRead8 (
IN UINTN Port,
IN UINTN StartBit,
IN UINTN EndBit
);
/**
Writes a bit field to an I/O register.
Writes Value to the bit field of the I/O register. The bit field is specified
by the StartBit and the EndBit. All other bits in the destination I/O
register are preserved. The value written to the I/O port is returned. Extra
left bits in Value are stripped.
If 8-bit I/O port operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Port The I/O port to write.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..7.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..7.
@param Value New value of the bit field.
@return The value written back to the I/O port.
**/
UINT8
EFIAPI
IoBitFieldWrite8 (
IN UINTN Port,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT8 Value
);
/**
Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
result back to the bit field in the 8-bit port.
Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
between the read result and the value specified by OrData, and writes the
result to the 8-bit I/O port specified by Port. The value written to the I/O
port is returned. This function must guarantee that all I/O read and write
operations are serialized. Extra left bits in OrData are stripped.
If 8-bit I/O port operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Port The I/O port to write.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..7.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..7.
@param OrData The value to OR with the read value from the I/O port.
@return The value written back to the I/O port.
**/
UINT8
EFIAPI
IoBitFieldOr8 (
IN UINTN Port,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT8 OrData
);
/**
Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
result back to the bit field in the 8-bit port.
Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
the read result and the value specified by AndData, and writes the result to
the 8-bit I/O port specified by Port. The value written to the I/O port is
returned. This function must guarantee that all I/O read and write operations
are serialized. Extra left bits in AndData are stripped.
If 8-bit I/O port operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Port The I/O port to write.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..7.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..7.
@param AndData The value to AND with the read value from the I/O port.
@return The value written back to the I/O port.
**/
UINT8
EFIAPI
IoBitFieldAnd8 (
IN UINTN Port,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT8 AndData
);
/**
Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
bitwise inclusive OR, and writes the result back to the bit field in the
8-bit port.
Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
by a bitwise inclusive OR between the read result and the value specified by
AndData, and writes the result to the 8-bit I/O port specified by Port. The
value written to the I/O port is returned. This function must guarantee that
all I/O read and write operations are serialized. Extra left bits in both
AndData and OrData are stripped.
If 8-bit I/O port operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Port The I/O port to write.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..7.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..7.
@param AndData The value to AND with the read value from the I/O port.
@param OrData The value to OR with the result of the AND operation.
@return The value written back to the I/O port.
**/
UINT8
EFIAPI
IoBitFieldAndThenOr8 (
IN UINTN Port,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT8 AndData,
IN UINT8 OrData
);
/**
Reads a 16-bit I/O port.
Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
This function must guarantee that all I/O read and write operations are
serialized.
If 16-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to read.
@return The value read.
**/
UINT16
EFIAPI
GlueIoRead16 (
IN UINTN Port
);
/**
Writes a 16-bit I/O port.
Writes the 16-bit I/O port specified by Port with the value specified by Value
and returns Value. This function must guarantee that all I/O read and write
operations are serialized.
If 16-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@return The value written the I/O port.
**/
UINT16
EFIAPI
GlueIoWrite16 (
IN UINTN Port,
IN UINT16 Value
);
/**
Reads a 16-bit I/O port, performs a bitwise inclusive OR, and writes the
result back to the 16-bit I/O port.
Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?