1 /* SPDX-License-Identifier: GPL-2.0-or-later */
7 * Copyright (C) Altera Corporation 1998-2001
8 * Copyright (C) 2010 NetUP Inc.
15 /* Function Prototypes */
16 enum altera_jtag_state {
17 ILLEGAL_JTAG_STATE = -1,
38 /* Global variable to store the current JTAG state */
39 enum altera_jtag_state jtag_state;
41 /* Store current stop-state for DR and IR scan commands */
42 enum altera_jtag_state drstop_state;
43 enum altera_jtag_state irstop_state;
45 /* Store current padding values */
60 #define ALTERA_STACK_SIZE 128
61 #define ALTERA_MESSAGE_LENGTH 1024
64 struct altera_config *config;
65 struct altera_jtag js;
66 char msg_buff[ALTERA_MESSAGE_LENGTH + 1];
67 long stack[ALTERA_STACK_SIZE];
70 int altera_jinit(struct altera_state *astate);
71 int altera_set_drstop(struct altera_jtag *js, enum altera_jtag_state state);
72 int altera_set_irstop(struct altera_jtag *js, enum altera_jtag_state state);
73 int altera_set_dr_pre(struct altera_jtag *js, u32 count, u32 start_index,
75 int altera_set_ir_pre(struct altera_jtag *js, u32 count, u32 start_index,
77 int altera_set_dr_post(struct altera_jtag *js, u32 count, u32 start_index,
79 int altera_set_ir_post(struct altera_jtag *js, u32 count, u32 start_index,
81 int altera_goto_jstate(struct altera_state *astate,
82 enum altera_jtag_state state);
83 int altera_wait_cycles(struct altera_state *astate, s32 cycles,
84 enum altera_jtag_state wait_state);
85 int altera_wait_msecs(struct altera_state *astate, s32 microseconds,
86 enum altera_jtag_state wait_state);
87 int altera_irscan(struct altera_state *astate, u32 count,
88 u8 *tdi_data, u32 start_index);
89 int altera_swap_ir(struct altera_state *astate,
90 u32 count, u8 *in_data,
91 u32 in_index, u8 *out_data,
93 int altera_drscan(struct altera_state *astate, u32 count,
94 u8 *tdi_data, u32 start_index);
95 int altera_swap_dr(struct altera_state *astate, u32 count,
96 u8 *in_data, u32 in_index,
97 u8 *out_data, u32 out_index);
98 void altera_free_buffers(struct altera_state *astate);
99 #endif /* ALTERA_JTAG_H */