Example #1
0
//
// initialize port
//
VOID CpInitialize(__in PCPPORT Port,__in PUCHAR Address,__in ULONG Rate)
{
	Port->Address										= Address;
	Port->Baud											= 0;

	CpSetBaud(Port,Rate);

	//
	// assert DTR, RTS.
	//
	WRITE_UCHAR(Port->Address + COM_MCR,MC_DTRRTS);

	//
	// disable interrupt
	//
	WRITE_UCHAR(Port->Address + COM_IEN,0);
}
Example #2
0
NTSTATUS
NTAPI
CpInitialize(IN PCPPORT Port,
             IN PUCHAR  Address,
             IN ULONG   BaudRate)
{
    /* Validity checks */
    if (Port == NULL || Address == NULL || BaudRate == 0)
        return STATUS_INVALID_PARAMETER;

    if (!CpDoesPortExist(Address))
        return STATUS_NOT_FOUND;

    /* Initialize port data */
    Port->Address  = Address;
    Port->BaudRate = 0;
    Port->Flags    = 0;

    /* Disable the interrupts */
    WRITE_PORT_UCHAR(Address + LINE_CONTROL_REGISTER, 0);
    WRITE_PORT_UCHAR(Address + INTERRUPT_ENABLE_REGISTER, 0);

    /* Turn on DTR, RTS and OUT2 */
    WRITE_PORT_UCHAR(Address + MODEM_CONTROL_REGISTER,
                     SERIAL_MCR_DTR | SERIAL_MCR_RTS | SERIAL_MCR_OUT2);

    /* Set the baud rate */
    CpSetBaud(Port, BaudRate);

    /* Set 8 data bits, 1 stop bit, no parity, no break */
    WRITE_PORT_UCHAR(Port->Address + LINE_CONTROL_REGISTER,
                     SERIAL_8_DATA | SERIAL_1_STOP | SERIAL_NONE_PARITY);

    /* Turn on FIFO */
    // TODO: Check whether FIFO exists and turn it on in that case.
    CpEnableFifo(Address, TRUE); // for 16550

    /* Read junk out of the RBR */
    (VOID)READ_PORT_UCHAR(Address + RECEIVE_BUFFER_REGISTER);

    return STATUS_SUCCESS;
}
Example #3
0
VOID
NTAPI
CpInitialize(IN PCPPORT Port,
			 IN PUCHAR Address,
			 IN ULONG Rate)
{
	/* Reset port data */
    Port->Address = Address;
    Port->Baud = 0;

	/* Set the baud rate */
    CpSetBaud(Port, Rate);

    /* Enable on DTR and RTS  */
    WRITE_PORT_UCHAR(Address + MODEM_CONTROL_REGISTER,
					 SERIAL_MCR_DTR | SERIAL_MCR_RTS);

    /* Disable interrupts */
    WRITE_PORT_UCHAR(Address + INTERRUPT_ENABLE_REGISTER, 0);
}