summaryrefslogtreecommitdiff
path: root/jtag_uart.h
blob: 4328be7a408d1f676373a8095db3d69d4a43e4a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
 * Copyright (C) 2010 chysun2000@gmail.com
 *
 * This file is part of nios2sim-ng.
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License. See the file "COPYING" in the main directory of this archive
 * for more details.
 */

#ifndef _JTAG_UART_H_
#define _JTAG_UART_H_

#include "device.h"

#define JTAG_UART_BASE		0x806810F0
#define JTAG_UART_SIZE		8

#define JTAG_UART_DATA_REG	0
#define JTAG_UART_CTRL_REG	1

extern struct device jtag_uart_core;

#if 0
#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

#endif /* _JTAG_UART_H_ */