mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-23 19:30:26 +08:00
Added a comment and cleaned up spacing
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* This file contains the TTY driver for the NS16550
|
||||
* This file contains the TTY driver for the National Semiconductor NS16550.
|
||||
*
|
||||
* This part is widely cloned and second sourced. It is found in a number
|
||||
* of "Super IO" controllers.
|
||||
*
|
||||
* COPYRIGHT (c) 1998 by Radstone Technology
|
||||
*
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* and disclaimer, appears in all copies. Radstone Technology will provide
|
||||
* no support for this code.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _NS16550_P_H_
|
||||
@@ -20,6 +21,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define serial port read registers structure.
|
||||
*/
|
||||
@@ -44,6 +46,7 @@ typedef volatile struct _SP_READ_REGISTERS {
|
||||
#define NS16550_LINE_STATUS 5
|
||||
#define NS16550_MODEM_STATUS 6
|
||||
#define NS16550_SCRATCH_PAD 7
|
||||
|
||||
/*
|
||||
* Define serial port write registers structure.
|
||||
*/
|
||||
@@ -66,10 +69,10 @@ typedef volatile struct _SP_WRITE_REGISTERS {
|
||||
* Define serial port interrupt enable register structure.
|
||||
*/
|
||||
|
||||
#define SP_INT_RX_ENABLE 0x01
|
||||
#define SP_INT_TX_ENABLE 0x02
|
||||
#define SP_INT_LS_ENABLE 0x04
|
||||
#define SP_INT_MS_ENABLE 0x08
|
||||
#define SP_INT_RX_ENABLE 0x01
|
||||
#define SP_INT_TX_ENABLE 0x02
|
||||
#define SP_INT_LS_ENABLE 0x04
|
||||
#define SP_INT_MS_ENABLE 0x08
|
||||
|
||||
/*
|
||||
* Define serial port interrupt id register structure.
|
||||
@@ -85,26 +88,29 @@ typedef struct _SP_INTERRUPT_ID {
|
||||
/*
|
||||
* Define serial port fifo control register structure.
|
||||
*/
|
||||
#define SP_FIFO_ENABLE 0x01
|
||||
#define SP_FIFO_RXRST 0x02
|
||||
#define SP_FIFO_TXRST 0x04
|
||||
#define SP_FIFO_DMA 0x08
|
||||
#define SP_FIFO_RXLEVEL 0xc0
|
||||
|
||||
#define SP_FIFO_ENABLE 0x01
|
||||
#define SP_FIFO_RXRST 0x02
|
||||
#define SP_FIFO_TXRST 0x04
|
||||
#define SP_FIFO_DMA 0x08
|
||||
#define SP_FIFO_RXLEVEL 0xc0
|
||||
|
||||
/*
|
||||
* Define serial port line control register structure.
|
||||
*/
|
||||
#define SP_LINE_SIZE 0x03
|
||||
#define SP_LINE_STOP 0x04
|
||||
#define SP_LINE_PAR 0x08
|
||||
#define SP_LINE_ODD 0x10
|
||||
#define SP_LINE_STICK 0x20
|
||||
#define SP_LINE_BREAK 0x40
|
||||
#define SP_LINE_DLAB 0x80
|
||||
|
||||
#define SP_LINE_SIZE 0x03
|
||||
#define SP_LINE_STOP 0x04
|
||||
#define SP_LINE_PAR 0x08
|
||||
#define SP_LINE_ODD 0x10
|
||||
#define SP_LINE_STICK 0x20
|
||||
#define SP_LINE_BREAK 0x40
|
||||
#define SP_LINE_DLAB 0x80
|
||||
|
||||
/*
|
||||
* Line status register character size definitions.
|
||||
*/
|
||||
|
||||
#define FIVE_BITS 0x0 /* five bits per character */
|
||||
#define SIX_BITS 0x1 /* six bits per character */
|
||||
#define SEVEN_BITS 0x2 /* seven bits per character */
|
||||
@@ -113,28 +119,31 @@ typedef struct _SP_INTERRUPT_ID {
|
||||
/*
|
||||
* Line speed divisor definition.
|
||||
*/
|
||||
|
||||
#define NS16550_Baud(baud_rate) (115200/baud_rate)
|
||||
|
||||
/*
|
||||
* Define serial port modem control register structure.
|
||||
*/
|
||||
#define SP_MODEM_DTR 0x01
|
||||
#define SP_MODEM_RTS 0x02
|
||||
#define SP_MODEM_IRQ 0x08
|
||||
#define SP_MODEM_LOOP 0x10
|
||||
#define SP_MODEM_DIV4 0x80
|
||||
|
||||
#define SP_MODEM_DTR 0x01
|
||||
#define SP_MODEM_RTS 0x02
|
||||
#define SP_MODEM_IRQ 0x08
|
||||
#define SP_MODEM_LOOP 0x10
|
||||
#define SP_MODEM_DIV4 0x80
|
||||
|
||||
/*
|
||||
* Define serial port line status register structure.
|
||||
*/
|
||||
#define SP_LSR_RDY 0x01
|
||||
#define SP_LSR_EOVRUN 0x02
|
||||
#define SP_LSR_EPAR 0x04
|
||||
#define SP_LSR_EFRAME 0x08
|
||||
#define SP_LSR_BREAK 0x10
|
||||
#define SP_LSR_THOLD 0x20
|
||||
#define SP_LSR_TX 0x40
|
||||
#define SP_LSR_EFIFO 0x80
|
||||
|
||||
#define SP_LSR_RDY 0x01
|
||||
#define SP_LSR_EOVRUN 0x02
|
||||
#define SP_LSR_EPAR 0x04
|
||||
#define SP_LSR_EFRAME 0x08
|
||||
#define SP_LSR_BREAK 0x10
|
||||
#define SP_LSR_THOLD 0x20
|
||||
#define SP_LSR_TX 0x40
|
||||
#define SP_LSR_EFIFO 0x80
|
||||
|
||||
typedef struct _ns16550_context
|
||||
{
|
||||
@@ -144,41 +153,42 @@ typedef struct _ns16550_context
|
||||
/*
|
||||
* Driver functions
|
||||
*/
|
||||
|
||||
static boolean ns16550_probe(int minor);
|
||||
|
||||
static void ns16550_init(int minor);
|
||||
|
||||
static int ns16550_open(
|
||||
int major,
|
||||
int minor,
|
||||
void * arg
|
||||
int major,
|
||||
int minor,
|
||||
void * arg
|
||||
);
|
||||
|
||||
static int ns16550_close(
|
||||
int major,
|
||||
int minor,
|
||||
void * arg
|
||||
int major,
|
||||
int minor,
|
||||
void * arg
|
||||
);
|
||||
|
||||
static void ns16550_write_polled(
|
||||
int minor,
|
||||
char cChar
|
||||
int minor,
|
||||
char cChar
|
||||
);
|
||||
|
||||
static int ns16550_assert_RTS(
|
||||
int minor
|
||||
int minor
|
||||
);
|
||||
|
||||
static int ns16550_negate_RTS(
|
||||
int minor
|
||||
int minor
|
||||
);
|
||||
|
||||
static int ns16550_assert_DTR(
|
||||
int minor
|
||||
int minor
|
||||
);
|
||||
|
||||
static int ns16550_negate_DTR(
|
||||
int minor
|
||||
int minor
|
||||
);
|
||||
|
||||
static void ns16550_initialize_interrupts(int minor);
|
||||
@@ -186,19 +196,19 @@ static void ns16550_initialize_interrupts(int minor);
|
||||
static int ns16550_flush(int major, int minor, void *arg);
|
||||
|
||||
static int ns16550_write_support_int(
|
||||
int minor,
|
||||
const char *buf,
|
||||
int len
|
||||
int minor,
|
||||
const char *buf,
|
||||
int len
|
||||
);
|
||||
|
||||
static int ns16550_write_support_polled(
|
||||
int minor,
|
||||
const char *buf,
|
||||
int len
|
||||
);
|
||||
int minor,
|
||||
const char *buf,
|
||||
int len
|
||||
);
|
||||
|
||||
static int ns16550_inbyte_nonblocking_polled(
|
||||
int minor
|
||||
int minor
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* This file contains the TTY driver for the NS16550
|
||||
* This file contains the TTY driver for the National Semiconductor NS16550.
|
||||
*
|
||||
* This part is widely cloned and second sourced. It is found in a number
|
||||
* of "Super IO" controllers.
|
||||
*
|
||||
* COPYRIGHT (c) 1998 by Radstone Technology
|
||||
*
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* and disclaimer, appears in all copies. Radstone Technology will provide
|
||||
* no support for this code.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _NS16550_P_H_
|
||||
@@ -20,6 +21,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define serial port read registers structure.
|
||||
*/
|
||||
@@ -44,6 +46,7 @@ typedef volatile struct _SP_READ_REGISTERS {
|
||||
#define NS16550_LINE_STATUS 5
|
||||
#define NS16550_MODEM_STATUS 6
|
||||
#define NS16550_SCRATCH_PAD 7
|
||||
|
||||
/*
|
||||
* Define serial port write registers structure.
|
||||
*/
|
||||
@@ -66,10 +69,10 @@ typedef volatile struct _SP_WRITE_REGISTERS {
|
||||
* Define serial port interrupt enable register structure.
|
||||
*/
|
||||
|
||||
#define SP_INT_RX_ENABLE 0x01
|
||||
#define SP_INT_TX_ENABLE 0x02
|
||||
#define SP_INT_LS_ENABLE 0x04
|
||||
#define SP_INT_MS_ENABLE 0x08
|
||||
#define SP_INT_RX_ENABLE 0x01
|
||||
#define SP_INT_TX_ENABLE 0x02
|
||||
#define SP_INT_LS_ENABLE 0x04
|
||||
#define SP_INT_MS_ENABLE 0x08
|
||||
|
||||
/*
|
||||
* Define serial port interrupt id register structure.
|
||||
@@ -85,26 +88,29 @@ typedef struct _SP_INTERRUPT_ID {
|
||||
/*
|
||||
* Define serial port fifo control register structure.
|
||||
*/
|
||||
#define SP_FIFO_ENABLE 0x01
|
||||
#define SP_FIFO_RXRST 0x02
|
||||
#define SP_FIFO_TXRST 0x04
|
||||
#define SP_FIFO_DMA 0x08
|
||||
#define SP_FIFO_RXLEVEL 0xc0
|
||||
|
||||
#define SP_FIFO_ENABLE 0x01
|
||||
#define SP_FIFO_RXRST 0x02
|
||||
#define SP_FIFO_TXRST 0x04
|
||||
#define SP_FIFO_DMA 0x08
|
||||
#define SP_FIFO_RXLEVEL 0xc0
|
||||
|
||||
/*
|
||||
* Define serial port line control register structure.
|
||||
*/
|
||||
#define SP_LINE_SIZE 0x03
|
||||
#define SP_LINE_STOP 0x04
|
||||
#define SP_LINE_PAR 0x08
|
||||
#define SP_LINE_ODD 0x10
|
||||
#define SP_LINE_STICK 0x20
|
||||
#define SP_LINE_BREAK 0x40
|
||||
#define SP_LINE_DLAB 0x80
|
||||
|
||||
#define SP_LINE_SIZE 0x03
|
||||
#define SP_LINE_STOP 0x04
|
||||
#define SP_LINE_PAR 0x08
|
||||
#define SP_LINE_ODD 0x10
|
||||
#define SP_LINE_STICK 0x20
|
||||
#define SP_LINE_BREAK 0x40
|
||||
#define SP_LINE_DLAB 0x80
|
||||
|
||||
/*
|
||||
* Line status register character size definitions.
|
||||
*/
|
||||
|
||||
#define FIVE_BITS 0x0 /* five bits per character */
|
||||
#define SIX_BITS 0x1 /* six bits per character */
|
||||
#define SEVEN_BITS 0x2 /* seven bits per character */
|
||||
@@ -113,28 +119,31 @@ typedef struct _SP_INTERRUPT_ID {
|
||||
/*
|
||||
* Line speed divisor definition.
|
||||
*/
|
||||
|
||||
#define NS16550_Baud(baud_rate) (115200/baud_rate)
|
||||
|
||||
/*
|
||||
* Define serial port modem control register structure.
|
||||
*/
|
||||
#define SP_MODEM_DTR 0x01
|
||||
#define SP_MODEM_RTS 0x02
|
||||
#define SP_MODEM_IRQ 0x08
|
||||
#define SP_MODEM_LOOP 0x10
|
||||
#define SP_MODEM_DIV4 0x80
|
||||
|
||||
#define SP_MODEM_DTR 0x01
|
||||
#define SP_MODEM_RTS 0x02
|
||||
#define SP_MODEM_IRQ 0x08
|
||||
#define SP_MODEM_LOOP 0x10
|
||||
#define SP_MODEM_DIV4 0x80
|
||||
|
||||
/*
|
||||
* Define serial port line status register structure.
|
||||
*/
|
||||
#define SP_LSR_RDY 0x01
|
||||
#define SP_LSR_EOVRUN 0x02
|
||||
#define SP_LSR_EPAR 0x04
|
||||
#define SP_LSR_EFRAME 0x08
|
||||
#define SP_LSR_BREAK 0x10
|
||||
#define SP_LSR_THOLD 0x20
|
||||
#define SP_LSR_TX 0x40
|
||||
#define SP_LSR_EFIFO 0x80
|
||||
|
||||
#define SP_LSR_RDY 0x01
|
||||
#define SP_LSR_EOVRUN 0x02
|
||||
#define SP_LSR_EPAR 0x04
|
||||
#define SP_LSR_EFRAME 0x08
|
||||
#define SP_LSR_BREAK 0x10
|
||||
#define SP_LSR_THOLD 0x20
|
||||
#define SP_LSR_TX 0x40
|
||||
#define SP_LSR_EFIFO 0x80
|
||||
|
||||
typedef struct _ns16550_context
|
||||
{
|
||||
@@ -144,41 +153,42 @@ typedef struct _ns16550_context
|
||||
/*
|
||||
* Driver functions
|
||||
*/
|
||||
|
||||
static boolean ns16550_probe(int minor);
|
||||
|
||||
static void ns16550_init(int minor);
|
||||
|
||||
static int ns16550_open(
|
||||
int major,
|
||||
int minor,
|
||||
void * arg
|
||||
int major,
|
||||
int minor,
|
||||
void * arg
|
||||
);
|
||||
|
||||
static int ns16550_close(
|
||||
int major,
|
||||
int minor,
|
||||
void * arg
|
||||
int major,
|
||||
int minor,
|
||||
void * arg
|
||||
);
|
||||
|
||||
static void ns16550_write_polled(
|
||||
int minor,
|
||||
char cChar
|
||||
int minor,
|
||||
char cChar
|
||||
);
|
||||
|
||||
static int ns16550_assert_RTS(
|
||||
int minor
|
||||
int minor
|
||||
);
|
||||
|
||||
static int ns16550_negate_RTS(
|
||||
int minor
|
||||
int minor
|
||||
);
|
||||
|
||||
static int ns16550_assert_DTR(
|
||||
int minor
|
||||
int minor
|
||||
);
|
||||
|
||||
static int ns16550_negate_DTR(
|
||||
int minor
|
||||
int minor
|
||||
);
|
||||
|
||||
static void ns16550_initialize_interrupts(int minor);
|
||||
@@ -186,19 +196,19 @@ static void ns16550_initialize_interrupts(int minor);
|
||||
static int ns16550_flush(int major, int minor, void *arg);
|
||||
|
||||
static int ns16550_write_support_int(
|
||||
int minor,
|
||||
const char *buf,
|
||||
int len
|
||||
int minor,
|
||||
const char *buf,
|
||||
int len
|
||||
);
|
||||
|
||||
static int ns16550_write_support_polled(
|
||||
int minor,
|
||||
const char *buf,
|
||||
int len
|
||||
);
|
||||
int minor,
|
||||
const char *buf,
|
||||
int len
|
||||
);
|
||||
|
||||
static int ns16550_inbyte_nonblocking_polled(
|
||||
int minor
|
||||
int minor
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user