aboutsummaryrefslogtreecommitdiff
path: root/src/jtag/drivers/rlink_init.m4
blob: 8ad2f51d81c66de3c4a6df911c8dc5aabd059ba1 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
m4_divert(`-1')
/***************************************************************************
 *   Copyright (C) 2008 Lou Deluxe                                         *
 *   lou.openocd012@fixit.nospammail.net                                   *
 *                                                                         *
 *   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, see <http://www.gnu.org/licenses/>. *
 ***************************************************************************/

m4_undefine(`CTRL_MPEG_L')
m4_undefine(`CTRL_CARD_L')

m4_ifelse(SHIFTER_PRESCALER, 1, `
	m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x0')')
')
m4_ifelse(SHIFTER_PRESCALER, 2, `
	m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x2')')
	m4_define(`CTRL_CARD_L', `m4_eval(`0x8 | 0x1')')
')
m4_ifelse(SHIFTER_PRESCALER, 8, `
	m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x3')')
')
m4_ifelse(SHIFTER_PRESCALER, 11, `
	m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x4')')
')
m4_ifelse(SHIFTER_PRESCALER, 64, `
	m4_define(`CTRL_MPEG_L', `m4_eval(`0x8 | 0x7')')
')

m4_ifdef(`CTRL_MPEG_L',,`
	m4_errprint(`SHIFTER_PRESCALER was not defined with a supported value
')	m4_m4exit(`1')
')

m4_divert(`0')m4_dnl

init:
	A.H = 0

	A.L = 0

	DR_MPEG = A	; TDI and TCK start out low
	DR_CARD = A	; TMS starts out low

	A.L = 0x6

	CTRL_FCI = A	; MPEG and CARD driven by FCI
	DDR_MPEG = A	; TDI and TCK are outputs

	A.L = 0x1

	X = A		; X == 1
	DDR_CARD = A	; TMS is output

	A.L = CTRL_MPEG_L
	CTRL_MPEG = A
m4_ifdef(`CTRL_CARD_L',
`	A.L = 'CTRL_CARD_L`
')m4_dnl
	CTRL_CARD = A

	STATUS STOP