ReactOS  0.4.14-dev-317-g96040ec
portio.c File Reference
#include <hal.h>
#include <debug.h>
Include dependency graph for portio.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define SLOW_DOWN_IO   __SLOW_DOWN_IO
 

Functions

int GetPhysByte (int Addr)
 
void SetPhysByte (int Addr, int Val)
 
int GetPhysWord (int Addr)
 
void SetPhysWord (int Addr, int Val)
 
int GetPhys (int Addr)
 
void SetPhys (int Addr, int Val)
 
 __asm__ ("\t.globl GetPhys\n" "GetPhys:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lwz 3,0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")
 
 __asm__ ("\t.globl GetPhysWord\n" "GetPhysWord:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lhz 3,0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")
 
 __asm__ ("\t.globl GetPhysByte\n" "GetPhysByte:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lbz 3,0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")
 
 __asm__ ("\t.globl SetPhys\n" "SetPhys:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "sync\n\t" "eieio\n\t" "stw 4,0(3)\n\t" "dcbst 0,3\n\t" "mtmsr 5\n\t" "sync\n\t" "eieio\n\t" "mr 3,4\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")
 
 __asm__ ("\t.globl SetPhysWord\n" "SetPhysWord:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "sync\n\t" "eieio\n\t" "sth 4,0(3)\n\t" "dcbst 0,3\n\t" "mtmsr 5\n\t" "sync\n\t" "eieio\n\t" "mr 3,4\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")
 
 __asm__ ("\t.globl SetPhysByte\n" "SetPhysByte:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "sync\n\t" "eieio\n\t" "stb 4,0(3)\n\t" "dcbst 0,3\n\t" "mtmsr 5\n\t" "sync\n\t" "eieio\n\t" "mr 3,4\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")
 
VOID NTAPI READ_PORT_BUFFER_UCHAR (PUCHAR Port, PUCHAR Buffer, ULONG Count)
 
VOID NTAPI READ_PORT_BUFFER_USHORT (PUSHORT Port, PUSHORT Buffer, ULONG Count)
 
VOID NTAPI READ_PORT_BUFFER_ULONG (PULONG Port, PULONG Buffer, ULONG Count)
 
UCHAR NTAPI READ_PORT_UCHAR (PUCHAR Port)
 
USHORT NTAPI READ_PORT_USHORT (PUSHORT Port)
 
ULONG NTAPI READ_PORT_ULONG (PULONG Port)
 
VOID NTAPI WRITE_PORT_BUFFER_UCHAR (PUCHAR Port, PUCHAR Buffer, ULONG Count)
 
VOID NTAPI WRITE_PORT_BUFFER_USHORT (PUSHORT Port, PUSHORT Buffer, ULONG Count)
 
VOID NTAPI WRITE_PORT_BUFFER_ULONG (PULONG Port, PULONG Buffer, ULONG Count)
 
VOID NTAPI WRITE_PORT_UCHAR (PUCHAR Port, UCHAR Value)
 
VOID NTAPI WRITE_PORT_USHORT (PUSHORT Port, USHORT Value)
 
VOID NTAPI WRITE_PORT_ULONG (PULONG Port, ULONG Value)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file portio.c.

◆ SLOW_DOWN_IO

#define SLOW_DOWN_IO   __SLOW_DOWN_IO

Definition at line 65 of file portio.c.

Function Documentation

◆ __asm__() [1/6]

__asm__ ( "\t.globl GetPhys\n" "GetPhys:\t\n" "mflr 0\n\t" "stwu  0,
-16(1)\n\t" "mfmsr 5\n\t" "andi.  6,
,
0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lwz  3,
0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz  0,
0(1)\n\t" "addi  1,
,
16\n\t" "mtlr 0\n\t" "blr"   
)

◆ __asm__() [2/6]

__asm__ ( "\t.globl GetPhysWord\n" "GetPhysWord:\t\n" "mflr 0\n\t" "stwu  0,
-16(1)\n\t" "mfmsr 5\n\t" "andi.  6,
,
0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lhz  3,
0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz  0,
0(1)\n\t" "addi  1,
,
16\n\t" "mtlr 0\n\t" "blr"   
)

◆ __asm__() [3/6]

__asm__ ( "\t.globl GetPhysByte\n" "GetPhysByte:\t\n" "mflr 0\n\t" "stwu  0,
-16(1)\n\t" "mfmsr 5\n\t" "andi.  6,
,
0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lbz  3,
0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz  0,
0(1)\n\t" "addi  1,
,
16\n\t" "mtlr 0\n\t" "blr"   
)

◆ __asm__() [4/6]

__asm__ ( "\t.globl SetPhys\n" "SetPhys:\t\n" "mflr 0\n\t" "stwu  0,
-16(1)\n\t" "mfmsr 5\n\t" "andi.  6,
,
0xffef\n\t" "mtmsr 6\n\t" "sync\n\t" "eieio\n\t" "stw  4,
0(3)\n\t" "dcbst  0,
3\n\t" "mtmsr 5\n\t" "sync\n\t" "eieio\n\t" "mr  3,
4\n\t" "lwz  0,
0(1)\n\t" "addi  1,
,
16\n\t" "mtlr 0\n\t" "blr"   
)

◆ __asm__() [5/6]

__asm__ ( "\t.globl SetPhysWord\n" "SetPhysWord:\t\n" "mflr 0\n\t" "stwu  0,
-16(1)\n\t" "mfmsr 5\n\t" "andi.  6,
,
0xffef\n\t" "mtmsr 6\n\t" "sync\n\t" "eieio\n\t" "sth  4,
0(3)\n\t" "dcbst  0,
3\n\t" "mtmsr 5\n\t" "sync\n\t" "eieio\n\t" "mr  3,
4\n\t" "lwz  0,
0(1)\n\t" "addi  1,
,
16\n\t" "mtlr 0\n\t" "blr"   
)

◆ __asm__() [6/6]

__asm__ ( "\t.globl SetPhysByte\n" "SetPhysByte:\t\n" "mflr 0\n\t" "stwu  0,
-16(1)\n\t" "mfmsr 5\n\t" "andi.  6,
,
0xffef\n\t" "mtmsr 6\n\t" "sync\n\t" "eieio\n\t" "stb  4,
0(3)\n\t" "dcbst  0,
3\n\t" "mtmsr 5\n\t" "sync\n\t" "eieio\n\t" "mr  3,
4\n\t" "lwz  0,
0(1)\n\t" "addi  1,
,
16\n\t" "mtlr 0\n\t" "blr"   
)

◆ GetPhys()

int GetPhys ( int  Addr)

◆ GetPhysByte()

◆ GetPhysWord()

int GetPhysWord ( int  Addr)

◆ READ_PORT_BUFFER_UCHAR()

VOID NTAPI READ_PORT_BUFFER_UCHAR ( PUCHAR  Port,
PUCHAR  Buffer,
ULONG  Count 
)

Definition at line 196 of file portio.c.

199 {
200  while(Count--) { *Buffer++ = GetPhysByte((ULONG)Port); }
201 }
CPPORT Port[4]
Definition: headless.c:34
int GetPhysByte(int Addr)
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
Definition: bufpool.h:45
unsigned int ULONG
Definition: retypes.h:1

◆ READ_PORT_BUFFER_ULONG()

VOID NTAPI READ_PORT_BUFFER_ULONG ( PULONG  Port,
PULONG  Buffer,
ULONG  Count 
)

Definition at line 212 of file portio.c.

215 {
216  while(Count--) { *Buffer++ = GetPhys((ULONG)Port); }
217 }
int GetPhys(int Addr)
CPPORT Port[4]
Definition: headless.c:34
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
Definition: bufpool.h:45
unsigned int ULONG
Definition: retypes.h:1

◆ READ_PORT_BUFFER_USHORT()

VOID NTAPI READ_PORT_BUFFER_USHORT ( PUSHORT  Port,
PUSHORT  Buffer,
ULONG  Count 
)

Definition at line 204 of file portio.c.

207 {
208  while(Count--) { *Buffer++ = GetPhysWord((ULONG)Port); }
209 }
CPPORT Port[4]
Definition: headless.c:34
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
int GetPhysWord(int Addr)
Definition: bufpool.h:45
unsigned int ULONG
Definition: retypes.h:1

◆ READ_PORT_UCHAR()

UCHAR NTAPI READ_PORT_UCHAR ( PUCHAR  Port)

Definition at line 220 of file portio.c.

221 {
222  return GetPhys((ULONG)Port);
223 }
int GetPhys(int Addr)
CPPORT Port[4]
Definition: headless.c:34
unsigned int ULONG
Definition: retypes.h:1

◆ READ_PORT_ULONG()

ULONG NTAPI READ_PORT_ULONG ( PULONG  Port)

Definition at line 232 of file portio.c.

233 {
234  return GetPhys((ULONG)Port);
235 }
int GetPhys(int Addr)
CPPORT Port[4]
Definition: headless.c:34
unsigned int ULONG
Definition: retypes.h:1

◆ READ_PORT_USHORT()

USHORT NTAPI READ_PORT_USHORT ( PUSHORT  Port)

Definition at line 226 of file portio.c.

227 {
228  return GetPhysWord((ULONG)Port);
229 }
CPPORT Port[4]
Definition: headless.c:34
int GetPhysWord(int Addr)
unsigned int ULONG
Definition: retypes.h:1

◆ SetPhys()

void SetPhys ( int  Addr,
int  Val 
)

◆ SetPhysByte()

void SetPhysByte ( int  Addr,
int  Val 
)

◆ SetPhysWord()

void SetPhysWord ( int  Addr,
int  Val 
)

◆ WRITE_PORT_BUFFER_UCHAR()

VOID NTAPI WRITE_PORT_BUFFER_UCHAR ( PUCHAR  Port,
PUCHAR  Buffer,
ULONG  Count 
)

Definition at line 238 of file portio.c.

241 {
242  while(Count--) { SetPhysByte((ULONG)Port, *Buffer++); }
243 }
CPPORT Port[4]
Definition: headless.c:34
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
Definition: bufpool.h:45
unsigned int ULONG
Definition: retypes.h:1
void SetPhysByte(int Addr, int Val)

◆ WRITE_PORT_BUFFER_ULONG()

VOID NTAPI WRITE_PORT_BUFFER_ULONG ( PULONG  Port,
PULONG  Buffer,
ULONG  Count 
)

Definition at line 254 of file portio.c.

257 {
258  while(Count--) { SetPhys((ULONG)Port, *Buffer++); }
259 }
CPPORT Port[4]
Definition: headless.c:34
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
Definition: bufpool.h:45
void SetPhys(int Addr, int Val)
unsigned int ULONG
Definition: retypes.h:1

◆ WRITE_PORT_BUFFER_USHORT()

VOID NTAPI WRITE_PORT_BUFFER_USHORT ( PUSHORT  Port,
PUSHORT  Buffer,
ULONG  Count 
)

Definition at line 246 of file portio.c.

249 {
250  while(Count--) { SetPhysWord((ULONG)Port, *Buffer++); }
251 }
CPPORT Port[4]
Definition: headless.c:34
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
void SetPhysWord(int Addr, int Val)
Definition: bufpool.h:45
unsigned int ULONG
Definition: retypes.h:1

◆ WRITE_PORT_UCHAR()

VOID NTAPI WRITE_PORT_UCHAR ( PUCHAR  Port,
UCHAR  Value 
)

Definition at line 262 of file portio.c.

264 {
266 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
CPPORT Port[4]
Definition: headless.c:34
unsigned int ULONG
Definition: retypes.h:1
void SetPhysByte(int Addr, int Val)

◆ WRITE_PORT_ULONG()

VOID NTAPI WRITE_PORT_ULONG ( PULONG  Port,
ULONG  Value 
)

Definition at line 276 of file portio.c.

278 {
279  SetPhys((ULONG)Port, Value);
280 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
CPPORT Port[4]
Definition: headless.c:34
void SetPhys(int Addr, int Val)
unsigned int ULONG
Definition: retypes.h:1

◆ WRITE_PORT_USHORT()

VOID NTAPI WRITE_PORT_USHORT ( PUSHORT  Port,
USHORT  Value 
)

Definition at line 269 of file portio.c.

271 {
273 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
CPPORT Port[4]
Definition: headless.c:34
void SetPhysWord(int Addr, int Val)
unsigned int ULONG
Definition: retypes.h:1