1N/A/* serial.h - serial device interface */
1N/A/*
1N/A * GRUB -- GRand Unified Bootloader
1N/A * Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
1N/A *
1N/A * This program is free software; you can redistribute it and/or modify
1N/A * it under the terms of the GNU General Public License as published by
1N/A * the Free Software Foundation; either version 2 of the License, or
1N/A * (at your option) any later version.
1N/A *
1N/A * This program is distributed in the hope that it will be useful,
1N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
1N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1N/A * GNU General Public License for more details.
1N/A *
1N/A * You should have received a copy of the GNU General Public License
1N/A * along with this program; if not, write to the Free Software
1N/A * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1N/A */
1N/A
1N/A#ifndef GRUB_SERIAL_HEADER
1N/A#define GRUB_SERIAL_HEADER 1
1N/A
1N/A/* Macros. */
1N/A
1N/A/* The offsets of UART registers. */
1N/A#define UART_TX 0
1N/A#define UART_RX 0
1N/A#define UART_DLL 0
1N/A#define UART_IER 1
1N/A#define UART_DLH 1
1N/A#define UART_IIR 2
1N/A#define UART_FCR 2
1N/A#define UART_LCR 3
1N/A#define UART_MCR 4
1N/A#define UART_LSR 5
1N/A#define UART_MSR 6
1N/A#define UART_SR 7
1N/A
1N/A/* For LSR bits. */
1N/A#define UART_DATA_READY 0x01
1N/A#define UART_EMPTY_TRANSMITTER 0x20
1N/A
1N/A/* The type of parity. */
1N/A#define UART_NO_PARITY 0x00
1N/A#define UART_ODD_PARITY 0x08
1N/A#define UART_EVEN_PARITY 0x18
1N/A
1N/A/* The type of word length. */
1N/A#define UART_5BITS_WORD 0x00
1N/A#define UART_6BITS_WORD 0x01
1N/A#define UART_7BITS_WORD 0x02
1N/A#define UART_8BITS_WORD 0x03
1N/A
1N/A/* The type of the length of stop bit. */
1N/A#define UART_1_STOP_BIT 0x00
1N/A#define UART_2_STOP_BITS 0x04
1N/A
1N/A/* the switch of DLAB. */
1N/A#define UART_DLAB 0x80
1N/A
1N/A/* Enable the FIFO. */
1N/A#define UART_ENABLE_FIFO 0xC7
1N/A
1N/A/* Turn on DTR, RTS, and OUT2. */
1N/A#define UART_ENABLE_MODEM 0x0B
1N/A
1N/A
1N/A/* Function prototypes. */
1N/A
1N/A/* Fetch a key. */
1N/Aint serial_hw_fetch (void);
1N/A
1N/A/* Put a character. */
1N/Avoid serial_hw_put (int c);
1N/A
1N/A/* Insert a delay. */
1N/Avoid serial_hw_delay (void);
1N/A
1N/A/* Return the port number for the UNITth serial device. */
1N/Aunsigned short serial_hw_get_port (int unit);
1N/A
1N/A/* Initialize a serial device. */
1N/Aint serial_hw_init (unsigned short port, unsigned int speed,
1N/A int word_len, int parity, int stop_bit_len);
1N/A
1N/A#ifdef GRUB_UTIL
1N/A/* Set the file name of a serial device (or a pty device). This is a
1N/A function specific to the grub shell. */
1N/Avoid serial_set_device (const char *device);
1N/A#endif /* GRUB_UTIL */
1N/A
1N/A#endif /* ! GRUB_SERIAL_HEADER */