Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
altera-jtag.h
Go to the documentation of this file.
1 /*
2  * altera-jtag.h
3  *
4  * altera FPGA driver
5  *
6  * Copyright (C) Altera Corporation 1998-2001
7  * Copyright (C) 2010 NetUP Inc.
8  * Copyright (C) 2010 Igor M. Liplianin <[email protected]>
9  *
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.
14  *
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
18  *
19  * GNU General Public License for more details.
20  *
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.
24  */
25 
26 #ifndef ALTERA_JTAG_H
27 #define ALTERA_JTAG_H
28 
29 /* Function Prototypes */
32  RESET = 0,
33  IDLE = 1,
34  DRSELECT = 2,
35  DRCAPTURE = 3,
36  DRSHIFT = 4,
37  DREXIT1 = 5,
38  DRPAUSE = 6,
39  DREXIT2 = 7,
40  DRUPDATE = 8,
41  IRSELECT = 9,
42  IRCAPTURE = 10,
43  IRSHIFT = 11,
44  IREXIT1 = 12,
45  IRPAUSE = 13,
46  IREXIT2 = 14,
47  IRUPDATE = 15
48 
49 };
50 
51 struct altera_jtag {
52  /* Global variable to store the current JTAG state */
54 
55  /* Store current stop-state for DR and IR scan commands */
58 
59  /* Store current padding values */
72 };
73 
74 #define ALTERA_STACK_SIZE 128
75 #define ALTERA_MESSAGE_LENGTH 1024
76 
77 struct altera_state {
79  struct altera_jtag js;
82 };
83 
84 int altera_jinit(struct altera_state *astate);
87 int altera_set_dr_pre(struct altera_jtag *js, u32 count, u32 start_index,
88  u8 *preamble_data);
89 int altera_set_ir_pre(struct altera_jtag *js, u32 count, u32 start_index,
90  u8 *preamble_data);
91 int altera_set_dr_post(struct altera_jtag *js, u32 count, u32 start_index,
92  u8 *postamble_data);
93 int altera_set_ir_post(struct altera_jtag *js, u32 count, u32 start_index,
94  u8 *postamble_data);
95 int altera_goto_jstate(struct altera_state *astate,
97 int altera_wait_cycles(struct altera_state *astate, s32 cycles,
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,
106  u32 out_index);
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 */