From 32f507ce5f66dd9c89a45854688f46bde33c5e3d Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 10 Nov 2010 09:20:50 +0100 Subject: Initial import of nios2sim (http://nios2sim.googlecode.com/svn/trunk/ r16) --- jtag_uart.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 jtag_uart.h (limited to 'jtag_uart.h') diff --git a/jtag_uart.h b/jtag_uart.h new file mode 100644 index 0000000..d855e39 --- /dev/null +++ b/jtag_uart.h @@ -0,0 +1,56 @@ +/* + Nios-sim - one simple NIOSII simulator only for personal interest and fun. + Copyright (C) 2010 chysun2000@gmail.com + + This program 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 2 of the License, or + (at your option) any later version. + + This program 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 __JTAG_UART_H__ +#define __JTAG_UART_H__ + +#include "io_device.h" +#define JTAG_UART_REG_COUNT (2) +#define JTAG_UART_CTRL_REG (0) +#define JTAG_UART_DATA_REG (1) +#define JTAG_UART_BASE_ADDR (0x806810F0) +#define JTAG_IRQ_MASK (1 << 1) +#define JTAG_UART_FIFO_SIZE (1) + +struct fifo { + uint8_t data; + uint8_t is_write; +}; + +struct jtag_uart_priv{ + struct io_reg regs[JTAG_UART_REG_COUNT]; + struct fifo tx_fifo; +}; + +#define ALTERA_JTAGUART_DATA_DATA_MSK (0x000000FF) +#define ALTERA_JTAGUART_DATA_RVALID_MSK (0x00008000) +#define ALTERA_JTAGUART_DATA_RAVAIL_MSK (0xFFFF0000) +#define ALTERA_JTAGUART_DATA_RAVAIL_OFST (16) + +#define ALTERA_JTAGUART_CONTROL_RE_MSK (0x00000001) +#define ALTERA_JTAGUART_CONTROL_WE_MSK (0x00000002) +#define ALTERA_JTAGUART_CONTROL_RI_MSK (0x00000100) +#define ALTERA_JTAGUART_CONTROL_RI_OFST (8) +#define ALTERA_JTAGUART_CONTROL_WI_MSK (0x00000200) +#define ALTERA_JTAGUART_CONTROL_AC_MSK (0x00000400) +#define ALTERA_JTAGUART_CONTROL_WSPACE_MSK (0xFFFF0000) +#define ALTERA_JTAGUART_CONTROL_WSPACE_OFST (16) + +extern struct io_device jtag_uart_io_device; +#endif /* __JTAG_UART_H__*/ -- cgit v1.2.3-54-g00ecf