6
* Copyright (C) Altera Corporation 1998-2001
7
* Copyright (C) 2010 NetUP Inc.
8
* Copyright (C) 2010 Igor M. Liplianin <liplianin@netup.ru>
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* You should have received a copy of the GNU General Public License
22
* along with this program; if not, write to the Free Software
23
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29
/* Function Prototypes */
30
enum altera_jtag_state {
31
ILLEGAL_JTAG_STATE = -1,
52
/* Global variable to store the current JTAG state */
53
enum altera_jtag_state jtag_state;
55
/* Store current stop-state for DR and IR scan commands */
56
enum altera_jtag_state drstop_state;
57
enum altera_jtag_state irstop_state;
59
/* Store current padding values */
74
#define ALTERA_STACK_SIZE 128
75
#define ALTERA_MESSAGE_LENGTH 1024
78
struct altera_config *config;
79
struct altera_jtag js;
80
char msg_buff[ALTERA_MESSAGE_LENGTH + 1];
81
long stack[ALTERA_STACK_SIZE];
84
int altera_jinit(struct altera_state *astate);
85
int altera_set_drstop(struct altera_jtag *js, enum altera_jtag_state state);
86
int altera_set_irstop(struct altera_jtag *js, enum altera_jtag_state state);
87
int altera_set_dr_pre(struct altera_jtag *js, u32 count, u32 start_index,
89
int altera_set_ir_pre(struct altera_jtag *js, u32 count, u32 start_index,
91
int altera_set_dr_post(struct altera_jtag *js, u32 count, u32 start_index,
93
int altera_set_ir_post(struct altera_jtag *js, u32 count, u32 start_index,
95
int altera_goto_jstate(struct altera_state *astate,
96
enum altera_jtag_state state);
97
int altera_wait_cycles(struct altera_state *astate, s32 cycles,
98
enum altera_jtag_state wait_state);
99
int altera_wait_msecs(struct altera_state *astate, s32 microseconds,
100
enum altera_jtag_state wait_state);
101
int altera_irscan(struct altera_state *astate, u32 count,
102
u8 *tdi_data, u32 start_index);
103
int altera_swap_ir(struct altera_state *astate,
104
u32 count, u8 *in_data,
105
u32 in_index, u8 *out_data,
107
int altera_drscan(struct altera_state *astate, u32 count,
108
u8 *tdi_data, u32 start_index);
109
int altera_swap_dr(struct altera_state *astate, u32 count,
110
u8 *in_data, u32 in_index,
111
u8 *out_data, u32 out_index);
112
void altera_free_buffers(struct altera_state *astate);
113
#endif /* ALTERA_JTAG_H */