OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [libgloss/] [or32/] [uart.c] - Diff between revs 399 and 507

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

Rev 399 Rev 507
Line 27... Line 27...
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* This program is commented throughout in a fashion suitable for processing
/* This program is commented throughout in a fashion suitable for processing
   with Doxygen.                                                              */
   with Doxygen.                                                              */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
 
 
#include "or1ksim-board.h"
#include "or1k-support.h"
#include "uart.h"
#include "uart.h"
 
 
 
 
/*! Macro to access a UART register */
/*! Macro to access a UART register */
#define UREG8(reg) REG8 (UART_BASE + reg)
#define UREG8(reg) REG8 (_board_uart_base + reg)
 
 
/*! Macro to check if transmit and transmit holding registers are both empty. */
/*! Macro to check if transmit and transmit holding registers are both empty. */
#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
 
 
/*! Macro to wait until a char has been transmitted */
/*! Macro to wait until a char has been transmitted */
Line 84... Line 83...
 
 
        /* Set 8 bit char, 1 stop bit, no parity */
        /* Set 8 bit char, 1 stop bit, no parity */
        UREG8 (UART_LCR) = UART_LCR_WLEN8 & ~(UART_LCR_STOP | UART_LCR_PARITY);
        UREG8 (UART_LCR) = UART_LCR_WLEN8 & ~(UART_LCR_STOP | UART_LCR_PARITY);
 
 
        /* Set baud rate */
        /* Set baud rate */
        divisor = IN_CLK / (16 * UART_BAUD_RATE);
        divisor = _board_clk_freq / (16 * _board_uart_baud);
 
 
        UREG8 (UART_LCR) |= UART_LCR_DLAB;
        UREG8 (UART_LCR) |= UART_LCR_DLAB;
        UREG8 (UART_DLL)  = divisor & 0x000000ff;
        UREG8 (UART_DLL)  = divisor & 0x000000ff;
        UREG8 (UART_DLM)  = (divisor >> 8) & 0x000000ff;
        UREG8 (UART_DLM)  = (divisor >> 8) & 0x000000ff;
        UREG8 (UART_LCR) &= ~(UART_LCR_DLAB);
        UREG8 (UART_LCR) &= ~(UART_LCR_DLAB);

powered by: WebSVN 2.1.0

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