3 * Copyright 2007,2008 Free Software Foundation, Inc.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "memory_map.h"
23 // First pass, no interrupts
25 // Replaced with divisors.py which generates best divisor
26 //#define CALC_DIVISOR(rate) (WISHBONE_CLK_RATE / ((rate) * 16))
32 divisor_table[MAX_WB_DIV+1][NSPEEDS] = {
33 { 2, 2, 2, 2, 2, 2}, // 0: can't happen
34 { 651, 326, 163, 109, 54, 27 }, // 1: 100 MHz
35 { 326, 163, 81, 54, 27, 14 }, // 2: 50 MHz
36 { 217, 109, 54, 36, 18, 9 }, // 3: 33.3333 MHz
37 { 163, 81, 41, 27, 14, 7 }, // 4: 25 MHz
45 u->clkdiv = 217; // 230400 bps
51 if (ch == '\n') // FIXME for now map \n -> \r\n
54 while (u->txlevel == 0) // wait for fifo to have space
61 hal_uart_putc_nowait(int ch)
63 if (ch == '\n') // FIXME for now map \n -> \r\n
66 if(u->txlevel) // If fifo has space
73 while ((u->rxlevel) == 0) // wait for data to be ready