[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6879 - gnuradio/branches/developers/eb/eb_u2f/firmwar
From: |
eb |
Subject: |
[Commit-gnuradio] r6879 - gnuradio/branches/developers/eb/eb_u2f/firmware |
Date: |
Tue, 13 Nov 2007 10:31:31 -0700 (MST) |
Author: eb
Date: 2007-11-13 10:31:30 -0700 (Tue, 13 Nov 2007)
New Revision: 6879
Added:
gnuradio/branches/developers/eb/eb_u2f/firmware/hal_uart.h
gnuradio/branches/developers/eb/eb_u2f/firmware/wb16550.h
Modified:
gnuradio/branches/developers/eb/eb_u2f/firmware/memory_map.h
Log:
work-in-progress on uart driver
Added: gnuradio/branches/developers/eb/eb_u2f/firmware/hal_uart.h
===================================================================
--- gnuradio/branches/developers/eb/eb_u2f/firmware/hal_uart.h
(rev 0)
+++ gnuradio/branches/developers/eb/eb_u2f/firmware/hal_uart.h 2007-11-13
17:31:30 UTC (rev 6879)
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_HAL_UART_H
+#define INCLUDED_HAL_UART_H
+
+
+typedef enum {
+ US_9600,
+ US_19200,
+ US_38400,
+ US_57600,
+ US_115200,
+} hal_uart_speed_t;
+
+typedef struct {
+ hal_uart_speed_t speed;
+} hal_uart_config_t;
+
+/*!
+ * \brief Set uart parameters
+ * Default is 57,600 bps, 8N1.
+ */
+void hal_uart_set_config(const hal_uart_config_t *c);
+
+/*!
+ * \brief Get uart configuation.
+ */
+void hal_uart_get_config(hal_uart_config_t *c);
+
+/*!
+ * \brief Enqueue \p ch for output over serial port
+ */
+void hal_uart_putc(int ch);
+
+/*
+ * \brief Blocking read of next char from serial port
+ */
+int hal_uart_getc(void);
+
+
+#endif /* INCLUDED_HAL_UART_H */
Property changes on: gnuradio/branches/developers/eb/eb_u2f/firmware/hal_uart.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: gnuradio/branches/developers/eb/eb_u2f/firmware/memory_map.h
===================================================================
--- gnuradio/branches/developers/eb/eb_u2f/firmware/memory_map.h
2007-11-13 15:18:10 UTC (rev 6878)
+++ gnuradio/branches/developers/eb/eb_u2f/firmware/memory_map.h
2007-11-13 17:31:30 UTC (rev 6879)
@@ -312,7 +312,7 @@
#define IRQ_PHY 4 // ethernet PHY
#define IRQ_UNDERRUN 5
#define IRQ_OVERRUN 6
-#define IRQ_RSRVD_7 7
+#define IRQ_UART 7
#define IRQ_TO_MASK(x) (1 << (x))
@@ -323,6 +323,7 @@
#define PIC_PHY_INT IRQ_TO_MASK(IRQ_PHY)
#define PIC_UNDERRUN_INT IRQ_TO_MASK(IRQ_UNDERRUN)
#define PIC_OVERRUN_INT IRQ_TO_MASK(IRQ_OVERRUN)
+#define PIC_UART_INT IRQ_TO_MASK(IRQ_UART)
typedef struct {
@@ -345,4 +346,12 @@
#define timer_regs ((timer_regs_t *) TIMER_BASE)
+///////////////////////////////////////////////////
+// UART, Slave 10
+// include "wb16650.h for registers
+
+#define UART_BASE 0xF000
+
+#define uart_regs ((wb16550_reg_t *) UART_BASE)
+
#endif
Added: gnuradio/branches/developers/eb/eb_u2f/firmware/wb16550.h
===================================================================
--- gnuradio/branches/developers/eb/eb_u2f/firmware/wb16550.h
(rev 0)
+++ gnuradio/branches/developers/eb/eb_u2f/firmware/wb16550.h 2007-11-13
17:31:30 UTC (rev 6879)
@@ -0,0 +1,100 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+// Wishbone National Semiconductor 16550A compatible UART
+
+#ifndef INCLUDED_WB16550_H
+#define INCLUDED_WB16550_H
+
+#include <stdint.h>
+
+typedef struct {
+ volatile uint8_t data; // 0 r/w: r: rx fifo, w: tx fifo (if DLAB: LSB of
divisor)
+ volatile uint8_t ier; // 1 r/w: Interrupt Enable Register (if DLAB: MSB
of divisor)
+ volatile uint8_t iir_fcr; // 2 r/w: r: Interrupt ID Register,
+ // w: Fifo Control Register
+ volatile uint8_t lcr; // 3 r/w: Line Control Register
+ volatile uint8_t mcr; // 4 w: Modem Control Register
+ volatile uint8_t lsr; // 5 r: Line Status Register
+ volatile uint8_t msr; // 6 r: Modem Status Register
+
+} wb16550_reg_t;
+
+#define UART_IER_RDI 0x01 // Enable received data interrupt
+#define UART_IER_THRI 0x02 // Enable transmitter holding reg empty
int.
+#define UART_IER_RLSI 0x04 // Enable receiver line status
interrupt
+#define UART_IER_MSI 0x08 // Enable modem status interrupt
+
+#define UART_IIR_NO_INT 0x01 // No interrupts pending
+#define UART_IIR_ID_MASK 0x06 // Mask for interrupt ID
+#define UART_IIR_MSI 0x00 // Modem status interrupt
+#define UART_IIR_THRI 0x02 // Tx holding register empty int
+#define UART_IIR_RDI 0x04 // Rx data available int
+#define UART_IIR_RLSI 0x06 // Receiver line status int
+
+#define UART_FCR_ENABLE_FIFO 0x01 // ignore, always enabled
+#define UART_FCR_CLEAR_RCVR 0x02 // Clear the RCVR FIFO
+#define UART_FCR_CLEAR_XMIT 0x04 // Clear the XMIT FIFO
+#define UART_FCR_TRIGGER_MASK 0xC0 // Mask for FIFO trigger range
+#define UART_FCR_TRIGGER_1 0x00 // Rx fifo trigger level: 1 byte
+#define UART_FCR_TRIGGER_4 0x40 // Rx fifo trigger level: 4 bytes
+#define UART_FCR_TRIGGER_8 0x80 // Rx fifo trigger level: 8 bytes
+#define UART_FCR_TRIGGER_14 0xC0 // Rx fifo trigger level: 14 bytes
+
+#define UART_LCR_DLAB 0x80 // Divisor latch access bit
+#define UART_LCR_SBC 0x40 // Set break control
+#define UART_LCR_SPAR 0x20 // Stick parity
+#define UART_LCR_EPAR 0x10 // Even parity select
+#define UART_LCR_PARITY 0x08 // Parity Enable
+#define UART_LCR_STOP 0x04 // Stop bits: 0=1 bit, 1=2 bits
+#define UART_LCR_WLEN5 0x00 // Wordlength: 5 bits
+#define UART_LCR_WLEN6 0x01 // Wordlength: 6 bits
+#define UART_LCR_WLEN7 0x02 // Wordlength: 7 bits
+#define UART_LCR_WLEN8 0x03 // Wordlength: 8 bits
+
+#define UART_MCR_LOOP 0x10 // Enable loopback test mode
+#define UART_MCR_OUT2n 0x08 // Out2 complement (loopback mode)
+#define UART_MCR_OUT1n 0x04 // Out1 complement (loopback mode)
+#define UART_MCR_RTSn 0x02 // RTS complement
+#define UART_MCR_DTRn 0x01 // DTR complement
+
+#define UART_LSR_TEMT 0x40 // Transmitter empty
+#define UART_LSR_THRE 0x20 // Transmit-hold-register empty
+#define UART_LSR_BI 0x10 // Break interrupt indicator
+#define UART_LSR_FE 0x08 // Frame error indicator
+#define UART_LSR_PE 0x04 // Parity error indicator
+#define UART_LSR_OE 0x02 // Overrun error indicator
+#define UART_LSR_DR 0x01 // Receiver data ready
+#define UART_LSR_BRK_ERROR_BITS 0x1E // BI, FE, PE, OE bits
+#define UART_LSR_ERROR 0x80 // At least 1 PE, FE or BI are in the fifo
+
+#define UART_MSR_DCD 0x80 // Data Carrier Detect
+#define UART_MSR_RI 0x40 // Ring Indicator
+#define UART_MSR_DSR 0x20 // Data Set Ready
+#define UART_MSR_CTS 0x10 // Clear to Send
+#define UART_MSR_DDCD 0x08 // Delta DCD
+#define UART_MSR_TERI 0x04 // Trailing edge ring indicator
+#define UART_MSR_DDSR 0x02 // Delta DSR
+#define UART_MSR_DCTS 0x01 // Delta CTS
+#define UART_MSR_ANY_DELTA 0x0F // Any of the delta bits!
+
+
+#endif // INCLUDED_WB16550_H
Property changes on: gnuradio/branches/developers/eb/eb_u2f/firmware/wb16550.h
___________________________________________________________________
Name: svn:eol-style
+ native
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6879 - gnuradio/branches/developers/eb/eb_u2f/firmware,
eb <=