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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [drivers/] [uart.c] - Diff between revs 246 and 467

Show entire file | Details | Blame | View Log

Rev 246 Rev 467
Line 31... Line 31...
{
{
        int divisor;
        int divisor;
        float float_divisor;
        float float_divisor;
 
 
        /* Reset receiver and transmiter */
        /* Reset receiver and transmiter */
        REG8(UART_BASE + UART_FCR) = UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT | UART_FCR_TRIGGER_4;
        REG8(UART_BASE + UART_FCR) = UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR
 
                | UART_FCR_CLEAR_XMIT | UART_FCR_TRIGGER_4;
 
 
        /* Disable all interrupts */
        /* Disable all interrupts */
        REG8(UART_BASE + UART_IER) = 0x00;
        REG8(UART_BASE + UART_IER) = 0x00;
 
 
        /* Set 8 bit char, 1 stop bit, no parity */
        /* Set 8 bit char, 1 stop bit, no parity */
        REG8(UART_BASE + UART_LCR) = UART_LCR_WLEN8 & ~(UART_LCR_STOP | UART_LCR_PARITY);
        REG8(UART_BASE + UART_LCR) = UART_LCR_WLEN8 & ~(UART_LCR_STOP |
 
                                                        UART_LCR_PARITY);
 
 
        /* Set baud rate */
        /* Set baud rate */
        float_divisor = (float) IN_CLK/(16 * UART_BAUD_RATE);
        float_divisor = (float) IN_CLK/(16 * UART_BAUD_RATE);
        float_divisor += 0.50f; // Ensure round up
        float_divisor += 0.50f; // Ensure round up
        divisor = (int) float_divisor;
        divisor = (int) float_divisor;

powered by: WebSVN 2.1.0

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