OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [stable_0_2_0_rc3/] [or1ksim/] [peripheral/] [16450.h] - Diff between revs 385 and 409

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 385 Rev 409
Line 21... Line 21...
void uart_reset();
void uart_reset();
void uart_clock();
void uart_clock();
 
 
/* Definitions */
/* Definitions */
#define UART_ADDR_SPACE   (8)         /* UART memory address space size in bytes */
#define UART_ADDR_SPACE   (8)         /* UART memory address space size in bytes */
#define UART_RX_BUF       (8192)      /* VAPI should not send more that this amout of char before requesting something back */
 
#define UART_MAX_FIFO_LEN (16)        /* rx FIFO for uart 16550 */
#define UART_MAX_FIFO_LEN (16)        /* rx FIFO for uart 16550 */
#define MAX_SKEW          (1)         /* max. clock skew in subclocks */
#define MAX_SKEW          (1)         /* max. clock skew in subclocks */
 
#define UART_VAPI_BUF_LEN 128         /* Size of VAPI command buffer - VAPI should not send more
 
                                         that this amout of char before requesting something back */
 
#define UART_CLOCK_DIVIDER 16         /* Uart clock divider */
 
 
/* Registers */
/* Registers */
 
 
struct dev_16450 {
struct dev_16450 {
  struct {
  struct {
Line 35... Line 37...
    unsigned char rxbuf[UART_MAX_FIFO_LEN];
    unsigned char rxbuf[UART_MAX_FIFO_LEN];
    unsigned char dll;
    unsigned char dll;
    unsigned char dlh;
    unsigned char dlh;
    unsigned char ier;
    unsigned char ier;
    unsigned char iir;
    unsigned char iir;
 
    unsigned char fcr;
    unsigned char lcr;
    unsigned char lcr;
    unsigned char mcr;
    unsigned char mcr;
    unsigned char lsr;
    unsigned char lsr;
    unsigned char msr;
    unsigned char msr;
    unsigned char scr;
    unsigned char scr;
Line 55... Line 58...
    int rxbuf_tail;
    int rxbuf_tail;
    unsigned int txser_full;
    unsigned int txser_full;
    unsigned int rxser_full;
    unsigned int rxser_full;
    unsigned int txbuf_full;
    unsigned int txbuf_full;
    unsigned int rxbuf_full;
    unsigned int rxbuf_full;
    unsigned char thre_int;
    unsigned thre_int;
 
    unsigned break_set;
    unsigned long txser_clks;
    unsigned long txser_clks;
    unsigned long rxser_clks;
    unsigned long rxser_clks;
 
    unsigned timeout_count;
  } istat;  /* Internal status */
  } istat;  /* Internal status */
 
 
  /* Clocks per char */
  /* Clocks per char */
  unsigned long char_clks;
  unsigned long char_clks;
 
 
Line 73... Line 78...
    int skew;
    int skew;
    int next_break;
    int next_break;
    int next_break_cnt;
    int next_break_cnt;
    int cur_break;
    int cur_break;
    int cur_break_cnt;
    int cur_break_cnt;
 
    int break_sent;
  } vapi;
  } vapi;
 
 
  /* Required by VAPI - circular buffer */
  /* Required by VAPI - circular buffer */
 unsigned long vapi_buf[UART_RX_BUF];  /* Buffer to store incoming characters to,
 unsigned long vapi_buf[UART_VAPI_BUF_LEN];  /* Buffer to store incoming characters to,
                                          since we cannot handle them so fast - we
                                          since we cannot handle them so fast - we
                                          are serial */
                                          are serial */
  int vapi_buf_head_ptr;               /* Where we write to */
  int vapi_buf_head_ptr;               /* Where we write to */
  int vapi_buf_tail_ptr;               /* Where we read from */
  int vapi_buf_tail_ptr;               /* Where we read from */
 
 
Line 100... Line 106...
#define UART_TXBUF  0 /* W: Tx buffer, DLAB=0 */
#define UART_TXBUF  0 /* W: Tx buffer, DLAB=0 */
#define UART_DLL  0 /* R/W: Divisor Latch Low, DLAB=1 */
#define UART_DLL  0 /* R/W: Divisor Latch Low, DLAB=1 */
#define UART_DLH  1 /* R/W: Divisor Latch High, DLAB=1 */
#define UART_DLH  1 /* R/W: Divisor Latch High, DLAB=1 */
#define UART_IER  1 /* R/W: Interrupt Enable Register */
#define UART_IER  1 /* R/W: Interrupt Enable Register */
#define UART_IIR  2 /* R: Interrupt ID Register */
#define UART_IIR  2 /* R: Interrupt ID Register */
 
#define UART_FCR  2 /* W: FIFO Control Register */
#define UART_LCR  3 /* R/W: Line Control Register */
#define UART_LCR  3 /* R/W: Line Control Register */
#define UART_MCR  4 /* W: Modem Control Register */
#define UART_MCR  4 /* W: Modem Control Register */
#define UART_LSR  5 /* R: Line Status Register */
#define UART_LSR  5 /* R: Line Status Register */
#define UART_MSR  6 /* R: Modem Status Register */
#define UART_MSR  6 /* R: Modem Status Register */
#define UART_SCR  7 /* R/W: Scratch Register */
#define UART_SCR  7 /* R/W: Scratch Register */
Line 111... Line 118...
/*
/*
 * R/W masks for valid bits in 8250/16450 (mask out 16550 and later bits)
 * R/W masks for valid bits in 8250/16450 (mask out 16550 and later bits)
 *
 *
 */
 */
#define UART_VALID_LCR  0xff
#define UART_VALID_LCR  0xff
#define UART_VALID_LSR  0x7f
#define UART_VALID_LSR  0xff
#define UART_VALID_IIR  0x07
#define UART_VALID_IIR  0x0f
 
#define UART_VALID_FCR  0xc0
#define UART_VALID_IER  0x0f
#define UART_VALID_IER  0x0f
#define UART_VALID_MCR  0x1f
#define UART_VALID_MCR  0x1f
#define UART_VALID_MSR  0xff
#define UART_VALID_MSR  0xff
 
 
/*
/*
Line 135... Line 143...
#define UART_LCR_WLEN8  0x03  /* Wordlength: 8 bits */
#define UART_LCR_WLEN8  0x03  /* Wordlength: 8 bits */
#define UART_LCR_RESET  0x03
#define UART_LCR_RESET  0x03
/*
/*
 * Bit definitions for the Line Status Register
 * Bit definitions for the Line Status Register
 */
 */
 
#define UART_LSR_RXERR  0x80  /* Error in rx fifo */
#define UART_LSR_TXSERE 0x40  /* Transmitter serial register empty */
#define UART_LSR_TXSERE 0x40  /* Transmitter serial register empty */
#define UART_LSR_TXBUFE 0x20  /* Transmitter buffer register empty */
#define UART_LSR_TXBUFE 0x20  /* Transmitter buffer register empty */
#define UART_LSR_BREAK  0x10  /* Break interrupt indicator */
#define UART_LSR_BREAK  0x10  /* Break interrupt indicator */
#define UART_LSR_FRAME  0x08  /* Frame error indicator */
#define UART_LSR_FRAME  0x08  /* Frame error indicator */
#define UART_LSR_PARITY 0x04  /* Parity error indicator */
#define UART_LSR_PARITY 0x04  /* Parity error indicator */
Line 153... Line 162...
 
 
#define UART_IIR_MSI  0x00  /* Modem status interrupt (Low priority) */
#define UART_IIR_MSI  0x00  /* Modem status interrupt (Low priority) */
#define UART_IIR_THRI 0x02  /* Transmitter holding register empty */
#define UART_IIR_THRI 0x02  /* Transmitter holding register empty */
#define UART_IIR_RDI  0x04  /* Receiver data interrupt */
#define UART_IIR_RDI  0x04  /* Receiver data interrupt */
#define UART_IIR_RLSI 0x06  /* Receiver line status interrupt (High p.) */
#define UART_IIR_RLSI 0x06  /* Receiver line status interrupt (High p.) */
 
#define UART_IIR_CTI  0x0c  /* Character timeout */
 
 
 
/*
 
 * Bit Definitions for the FIFO Control Register
 
 */
 
#define UART_FCR_FIE  0x01  /* FIFO enable */
 
#define UART_FCR_RRXFI 0x02 /* Reset rx FIFO */
 
#define UART_FCR_RTXFI 0x02 /* Reset tx FIFO */
 
#define UART_FIFO_TRIGGER(x) /* Trigger values for indexes 0..3 */\
 
  ((x)==0?1\
 
  :(x)==1?4\
 
  :(x)==2?8\
 
  :(x)==3?14:0)
 
 
/*
/*
 * Bit definitions for the Interrupt Enable Register
 * Bit definitions for the Interrupt Enable Register
 */
 */
#define UART_IER_MSI  0x08  /* Enable Modem status interrupt */
#define UART_IER_MSI  0x08  /* Enable Modem status interrupt */
Line 186... Line 208...
#define UART_MSR_DCTS 0x01  /* Delta CTS */
#define UART_MSR_DCTS 0x01  /* Delta CTS */
 
 
/*
/*
 * Various definitions
 * Various definitions
 */
 */
#define MAX_BREAK_COUNT 12
#define UART_BREAK_COUNT  (4) /* # of chars to count when performing break */
 
#define UART_CHAR_TIMEOUT (4) /* # of chars to count when performing timeout int. */
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.