[NTOSKRNL]

Code formatting only

svn path=/trunk/; revision=57763
This commit is contained in:
Hermès Bélusca-Maïto 2012-11-24 19:50:31 +00:00
parent afd01007a5
commit fad4fbd259

View file

@ -15,107 +15,103 @@
CPPORT Port[4] = CPPORT Port[4] =
{ {
{NULL, 0, TRUE}, {NULL, 0, TRUE},
{NULL, 0, TRUE}, {NULL, 0, TRUE},
{NULL, 0, TRUE}, {NULL, 0, TRUE},
{NULL, 0, TRUE} {NULL, 0, TRUE}
}; };
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID VOID
NTAPI NTAPI
InbvPortEnableFifo( InbvPortEnableFifo(IN ULONG PortId,
IN ULONG PortId, IN BOOLEAN Enable)
IN BOOLEAN Enable
)
{ {
/* Set FIFO as requested */ /* Set FIFO as requested */
CpEnableFifo(Port[PortId].Address, Enable); CpEnableFifo(Port[PortId].Address, Enable);
} }
VOID VOID
NTAPI NTAPI
InbvPortPutByte( InbvPortPutByte(IN ULONG PortId,
IN ULONG PortId, IN BOOLEAN Output)
IN BOOLEAN Output
)
{ {
/* Send the byte */ /* Send the byte */
CpPutByte(&Port[PortId], Output); CpPutByte(&Port[PortId], Output);
} }
VOID VOID
NTAPI NTAPI
InbvPortTerminate( InbvPortTerminate(IN ULONG PortId)
IN ULONG PortId
)
{ {
/* The port is now available */ /* The port is now available */
Port[PortId].Address = NULL; Port[PortId].Address = NULL;
} }
BOOLEAN BOOLEAN
NTAPI NTAPI
InbvPortInitialize( InbvPortInitialize(IN ULONG BaudRate,
IN ULONG BaudRate, IN ULONG PortNumber,
IN ULONG PortNumber, IN PUCHAR PortAddress,
IN PUCHAR PortAddress, OUT PULONG PortId,
OUT PULONG PortId, IN BOOLEAN IsMMIODevice)
IN BOOLEAN IsMMIODevice
)
{ {
/* Not yet supported */ /* Not yet supported */
ASSERT(IsMMIODevice == FALSE); ASSERT(IsMMIODevice == FALSE);
/* Set default baud rate */ /* Set default baud rate */
if (BaudRate == 0) BaudRate = 19200; if (BaudRate == 0) BaudRate = 19200;
/* Check if port or address given */ /* Check if port or address given */
if (PortNumber) if (PortNumber)
{ {
/* Pick correct address for port */ /* Pick correct address for port */
if (!PortAddress) if (!PortAddress)
{ {
switch (PortNumber) switch (PortNumber)
{ {
case 1: case 1:
PortAddress = (PUCHAR)0x3F8; PortAddress = (PUCHAR)0x3F8;
break; break;
case 2: case 2:
PortAddress = (PUCHAR)0x2F8; PortAddress = (PUCHAR)0x2F8;
break; break;
case 3: case 3:
PortAddress = (PUCHAR)0x3E8; PortAddress = (PUCHAR)0x3E8;
break; break;
default: default:
PortNumber = 4; PortNumber = 4;
PortAddress = (PUCHAR)0x2E8; PortAddress = (PUCHAR)0x2E8;
} }
}
}
else
{
/* Pick correct port for address */
PortAddress = (PUCHAR)0x2F8;
if (CpDoesPortExist(PortAddress))
{
PortNumber = 2;
} }
else }
{ else
PortAddress = (PUCHAR)0x3F8; {
if (!CpDoesPortExist(PortAddress)) return FALSE; /* Pick correct port for address */
PortNumber = 1; PortAddress = (PUCHAR)0x2F8;
} if (CpDoesPortExist(PortAddress))
} {
PortNumber = 2;
}
else
{
PortAddress = (PUCHAR)0x3F8;
if (!CpDoesPortExist(PortAddress)) return FALSE;
PortNumber = 1;
}
}
/* Initialize the port unless it's already up, and then return it */ /* Initialize the port unless it's already up, and then return it */
if (Port[PortNumber - 1].Address) return FALSE; if (Port[PortNumber - 1].Address) return FALSE;
CpInitialize(&Port[PortNumber - 1], PortAddress, BaudRate);
*PortId = PortNumber - 1; CpInitialize(&Port[PortNumber - 1], PortAddress, BaudRate);
return TRUE; *PortId = PortNumber - 1;
return TRUE;
} }
/* EOF */