1 /*
2  * $Id$
3  *
4  * Copyright (C) 2002 ETC s.r.o.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19  * 02111-1307, USA.
20  *
21  * Written by Marcel Telka <marcel@telka.sk>, 2002.
22  *
23  */
24 
25 #ifndef URJ_TAP_STATE_H
26 #define URJ_TAP_STATE_H
27 
28 #include "bitmask.h"
29 
30 #include "types.h"
31 
32 #define URJ_TAP_STATE_DR        URJ_BIT (0)
33 #define URJ_TAP_STATE_IR        URJ_BIT (1)
34 #define URJ_TAP_STATE_SHIFT     URJ_BIT (2)     /* register shift with TMS = 0 */
35 #define URJ_TAP_STATE_IDLE      URJ_BIT (3)     /* to Run-Test/Idle with TMS = 0 */
36 #define URJ_TAP_STATE_CAPTURE   URJ_BIT (4)     /* Capture state */
37 #define URJ_TAP_STATE_UPDATE    URJ_BIT (5)     /* to Update with TMS = 1 */
38 #define URJ_TAP_STATE_PAUSE     URJ_BIT (6)     /* to Pause with TMS = 0 */
39 #define URJ_TAP_STATE_RESET     URJ_BIT (7)     /* Test-Logic-Reset or unknown state */
40 
41 #define URJ_TAP_STATE_UNKNOWN_STATE     URJ_TAP_STATE_RESET
42 #define URJ_TAP_STATE_TEST_LOGIC_RESET  (URJ_TAP_STATE_RESET | URJ_TAP_STATE_IDLE)
43 #define URJ_TAP_STATE_RUN_TEST_IDLE     URJ_TAP_STATE_IDLE
44 #define URJ_TAP_STATE_SELECT_DR_SCAN    URJ_TAP_STATE_DR
45 #define URJ_TAP_STATE_CAPTURE_DR        (URJ_TAP_STATE_DR | URJ_TAP_STATE_SHIFT | URJ_TAP_STATE_CAPTURE)
46 #define URJ_TAP_STATE_SHIFT_DR          (URJ_TAP_STATE_DR | URJ_TAP_STATE_SHIFT)
47 #define URJ_TAP_STATE_EXIT1_DR          (URJ_TAP_STATE_DR | URJ_TAP_STATE_UPDATE | URJ_TAP_STATE_PAUSE)
48 #define URJ_TAP_STATE_PAUSE_DR          (URJ_TAP_STATE_DR | URJ_TAP_STATE_PAUSE)
49 #define URJ_TAP_STATE_EXIT2_DR          (URJ_TAP_STATE_DR | URJ_TAP_STATE_SHIFT | URJ_TAP_STATE_UPDATE)
50 #define URJ_TAP_STATE_UPDATE_DR         (URJ_TAP_STATE_DR | URJ_TAP_STATE_IDLE)
51 #define URJ_TAP_STATE_SELECT_IR_SCAN    URJ_TAP_STATE_IR
52 #define URJ_TAP_STATE_CAPTURE_IR        (URJ_TAP_STATE_IR | URJ_TAP_STATE_SHIFT | URJ_TAP_STATE_CAPTURE)
53 #define URJ_TAP_STATE_SHIFT_IR          (URJ_TAP_STATE_IR | URJ_TAP_STATE_SHIFT)
54 #define URJ_TAP_STATE_EXIT1_IR          (URJ_TAP_STATE_IR | URJ_TAP_STATE_UPDATE | URJ_TAP_STATE_PAUSE)
55 #define URJ_TAP_STATE_PAUSE_IR          (URJ_TAP_STATE_IR | URJ_TAP_STATE_PAUSE)
56 #define URJ_TAP_STATE_EXIT2_IR          (URJ_TAP_STATE_IR | URJ_TAP_STATE_SHIFT | URJ_TAP_STATE_UPDATE)
57 #define URJ_TAP_STATE_UPDATE_IR         (URJ_TAP_STATE_IR | URJ_TAP_STATE_IDLE)
58 
59 int urj_tap_state (urj_chain_t *chain);
60 int urj_tap_state_init (urj_chain_t *chain);
61 int urj_tap_state_done (urj_chain_t *chain);
62 int urj_tap_state_reset (urj_chain_t *chain);
63 int urj_tap_state_set_trst (urj_chain_t *chain, int old_trst, int new_trst);
64 int urj_tap_state_clock (urj_chain_t *chain, int tms);
65 
66 #endif /* URJ_TAP_STATE_H */
67