1 /***************************************************************************
2 * Copyright (C) 2013 Franck Jullien *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 ***************************************************************************/
19 #ifndef OPENOCD_TARGET_OPENRISC_OR1K_DU_H
20 #define OPENOCD_TARGET_OPENRISC_OR1K_DU_H
30 #define CPU_NOT_RESET 1
32 int or1k_du_adv_register(void);
34 /* Linear list over all available or1k debug unit */
35 extern struct list_head du_list
;
39 struct list_head list
;
42 int (*or1k_jtag_init
)(struct or1k_jtag
*jtag_info
);
44 int (*or1k_is_cpu_running
)(struct or1k_jtag
*jtag_info
, int *running
);
46 int (*or1k_cpu_stall
)(struct or1k_jtag
*jtag_info
, int action
);
48 int (*or1k_cpu_reset
)(struct or1k_jtag
*jtag_info
, int action
);
50 int (*or1k_jtag_read_cpu
)(struct or1k_jtag
*jtag_info
,
51 uint32_t addr
, int count
, uint32_t *value
);
53 int (*or1k_jtag_write_cpu
)(struct or1k_jtag
*jtag_info
,
54 uint32_t addr
, int count
, const uint32_t *value
);
56 int (*or1k_jtag_read_memory
)(struct or1k_jtag
*jtag_info
, uint32_t addr
, uint32_t size
,
57 int count
, uint8_t *buffer
);
59 int (*or1k_jtag_write_memory
)(struct or1k_jtag
*jtag_info
, uint32_t addr
, uint32_t size
,
60 int count
, const uint8_t *buffer
);
63 static inline struct or1k_du
*or1k_jtag_to_du(struct or1k_jtag
*jtag_info
)
65 return (struct or1k_du
*)jtag_info
->du_core
;
68 static inline struct or1k_du
*or1k_to_du(struct or1k_common
*or1k
)
70 struct or1k_jtag
*jtag
= &or1k
->jtag
;
71 return (struct or1k_du
*)jtag
->du_core
;
74 int or1k_adv_jtag_jsp_xfer(struct or1k_jtag
*jtag_info
,
75 int *out_len
, unsigned char *out_buffer
,
76 int *in_len
, unsigned char *in_buffer
);
78 #endif /* OPENOCD_TARGET_OPENRISC_OR1K_DU_H */