[ISAPNP] Use the correct types for helper functions

This commit is contained in:
Dmitry Borisov 2021-03-20 20:49:57 +06:00
parent c4b6330b14
commit 7c897dfbd1

View file

@ -15,7 +15,7 @@ static
inline inline
VOID VOID
WriteAddress( WriteAddress(
_In_ USHORT Address) _In_ UCHAR Address)
{ {
WRITE_PORT_UCHAR((PUCHAR)ISAPNP_ADDRESS, Address); WRITE_PORT_UCHAR((PUCHAR)ISAPNP_ADDRESS, Address);
} }
@ -24,7 +24,7 @@ static
inline inline
VOID VOID
WriteData( WriteData(
_In_ USHORT Data) _In_ UCHAR Data)
{ {
WRITE_PORT_UCHAR((PUCHAR)ISAPNP_WRITE_DATA, Data); WRITE_PORT_UCHAR((PUCHAR)ISAPNP_WRITE_DATA, Data);
} }
@ -42,8 +42,8 @@ static
inline inline
VOID VOID
WriteByte( WriteByte(
_In_ USHORT Address, _In_ UCHAR Address,
_In_ USHORT Value) _In_ UCHAR Value)
{ {
WriteAddress(Address); WriteAddress(Address);
WriteData(Value); WriteData(Value);
@ -54,7 +54,7 @@ inline
UCHAR UCHAR
ReadByte( ReadByte(
_In_ PUCHAR ReadDataPort, _In_ PUCHAR ReadDataPort,
_In_ USHORT Address) _In_ UCHAR Address)
{ {
WriteAddress(Address); WriteAddress(Address);
return ReadData(ReadDataPort); return ReadData(ReadDataPort);
@ -65,7 +65,7 @@ inline
USHORT USHORT
ReadWord( ReadWord(
_In_ PUCHAR ReadDataPort, _In_ PUCHAR ReadDataPort,
_In_ USHORT Address) _In_ UCHAR Address)
{ {
return ((ReadByte(ReadDataPort, Address) << 8) | return ((ReadByte(ReadDataPort, Address) << 8) |
(ReadByte(ReadDataPort, Address + 1))); (ReadByte(ReadDataPort, Address + 1)));
@ -77,7 +77,7 @@ VOID
SetReadDataPort( SetReadDataPort(
_In_ PUCHAR ReadDataPort) _In_ PUCHAR ReadDataPort)
{ {
WriteByte(ISAPNP_READPORT, ((ULONG_PTR)ReadDataPort >> 2)); WriteByte(ISAPNP_READPORT, (UCHAR)((ULONG_PTR)ReadDataPort >> 2));
} }
static static
@ -108,14 +108,14 @@ static
inline inline
VOID VOID
Wake( Wake(
_In_ USHORT Csn) _In_ UCHAR Csn)
{ {
WriteByte(ISAPNP_WAKE, Csn); WriteByte(ISAPNP_WAKE, Csn);
} }
static static
inline inline
USHORT UCHAR
ReadResourceData( ReadResourceData(
_In_ PUCHAR ReadDataPort) _In_ PUCHAR ReadDataPort)
{ {
@ -124,7 +124,7 @@ ReadResourceData(
static static
inline inline
USHORT UCHAR
ReadStatus( ReadStatus(
_In_ PUCHAR ReadDataPort) _In_ PUCHAR ReadDataPort)
{ {
@ -135,7 +135,7 @@ static
inline inline
VOID VOID
WriteCsn( WriteCsn(
_In_ USHORT Csn) _In_ UCHAR Csn)
{ {
WriteByte(ISAPNP_CARDSELECTNUMBER, Csn); WriteByte(ISAPNP_CARDSELECTNUMBER, Csn);
} }
@ -144,7 +144,7 @@ static
inline inline
VOID VOID
WriteLogicalDeviceNumber( WriteLogicalDeviceNumber(
_In_ USHORT LogDev) _In_ UCHAR LogDev)
{ {
WriteByte(ISAPNP_LOGICALDEVICENUMBER, LogDev); WriteByte(ISAPNP_LOGICALDEVICENUMBER, LogDev);
} }
@ -153,7 +153,7 @@ static
inline inline
VOID VOID
ActivateDevice( ActivateDevice(
_In_ USHORT LogDev) _In_ UCHAR LogDev)
{ {
WriteLogicalDeviceNumber(LogDev); WriteLogicalDeviceNumber(LogDev);
WriteByte(ISAPNP_ACTIVATE, 1); WriteByte(ISAPNP_ACTIVATE, 1);
@ -163,7 +163,7 @@ static
inline inline
VOID VOID
DeactivateDevice( DeactivateDevice(
_In_ USHORT LogDev) _In_ UCHAR LogDev)
{ {
WriteLogicalDeviceNumber(LogDev); WriteLogicalDeviceNumber(LogDev);
WriteByte(ISAPNP_ACTIVATE, 0); WriteByte(ISAPNP_ACTIVATE, 0);
@ -174,37 +174,37 @@ inline
USHORT USHORT
ReadIoBase( ReadIoBase(
_In_ PUCHAR ReadDataPort, _In_ PUCHAR ReadDataPort,
_In_ USHORT Index) _In_ UCHAR Index)
{ {
return ReadWord(ReadDataPort, ISAPNP_IOBASE(Index)); return ReadWord(ReadDataPort, ISAPNP_IOBASE(Index));
} }
static static
inline inline
USHORT UCHAR
ReadIrqNo( ReadIrqNo(
_In_ PUCHAR ReadDataPort, _In_ PUCHAR ReadDataPort,
_In_ USHORT Index) _In_ UCHAR Index)
{ {
return ReadByte(ReadDataPort, ISAPNP_IRQNO(Index)); return ReadByte(ReadDataPort, ISAPNP_IRQNO(Index));
} }
static static
inline inline
USHORT UCHAR
ReadIrqType( ReadIrqType(
_In_ PUCHAR ReadDataPort, _In_ PUCHAR ReadDataPort,
_In_ USHORT Index) _In_ UCHAR Index)
{ {
return ReadByte(ReadDataPort, ISAPNP_IRQTYPE(Index)); return ReadByte(ReadDataPort, ISAPNP_IRQTYPE(Index));
} }
static static
inline inline
USHORT UCHAR
ReadDmaChannel( ReadDmaChannel(
_In_ PUCHAR ReadDataPort, _In_ PUCHAR ReadDataPort,
_In_ USHORT Index) _In_ UCHAR Index)
{ {
return ReadByte(ReadDataPort, ISAPNP_DMACHANNEL(Index)); return ReadByte(ReadDataPort, ISAPNP_DMACHANNEL(Index));
} }
@ -251,11 +251,11 @@ SendKey(VOID)
static static
CODE_SEG("PAGE") CODE_SEG("PAGE")
USHORT UCHAR
PeekByte( PeekByte(
_In_ PUCHAR ReadDataPort) _In_ PUCHAR ReadDataPort)
{ {
USHORT i; UCHAR i;
PAGED_CODE(); PAGED_CODE();
@ -276,15 +276,16 @@ VOID
Peek( Peek(
_In_ PUCHAR ReadDataPort, _In_ PUCHAR ReadDataPort,
_Out_writes_bytes_all_opt_(Length) PVOID Buffer, _Out_writes_bytes_all_opt_(Length) PVOID Buffer,
_In_ ULONG Length) _In_ USHORT Length)
{ {
USHORT i, Byte; USHORT i;
PAGED_CODE(); PAGED_CODE();
for (i = 0; i < Length; i++) for (i = 0; i < Length; i++)
{ {
Byte = PeekByte(ReadDataPort); UCHAR Byte = PeekByte(ReadDataPort);
if (Buffer) if (Buffer)
((PUCHAR)Buffer)[i] = Byte; ((PUCHAR)Buffer)[i] = Byte;
} }
@ -292,7 +293,7 @@ Peek(
static static
CODE_SEG("PAGE") CODE_SEG("PAGE")
USHORT UCHAR
IsaPnpChecksum( IsaPnpChecksum(
_In_ PISAPNP_IDENTIFIER Identifier) _In_ PISAPNP_IDENTIFIER Identifier)
{ {