rswdp.h (2009B)
1 /* rswdp.h 2 * 3 * Copyright 2011 Brian Swetland <swetland@frotz.net> 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 #ifndef _RSWDP_H__ 19 #define _RSWDP_H__ 20 21 int swdp_ahb_read(u32 addr, u32 *value); 22 int swdp_ahb_write(u32 addr, u32 value); 23 24 /* bulk reads/writes (more efficient after ~3-4 words */ 25 int swdp_ahb_read32(u32 addr, u32 *out, int count); 26 int swdp_ahb_write32(u32 addr, u32 *out, int count); 27 28 /* return 0 when *addr != oldval, -1 on error, -2 on interrupt */ 29 int swdp_ahb_wait_for_change(u32 addr, u32 oldval); 30 31 int swdp_core_halt(void); 32 int swdp_core_step(void); 33 int swdp_core_resume(void); 34 35 /* return 0 when CPU halts, -1 if an error occurs, or -2 if interrupted */ 36 int swdp_core_wait_for_halt(void); 37 void swdp_interrupt(void); 38 39 /* access to CPU registers */ 40 int swdp_core_read(u32 n, u32 *v); 41 int swdp_core_read_all(u32 *v); 42 int swdp_core_write(u32 n, u32 v); 43 44 int swdp_watchpoint_pc(unsigned n, u32 addr); 45 int swdp_watchpoint_rd(unsigned n, u32 addr); 46 int swdp_watchpoint_wr(unsigned n, u32 addr); 47 int swdp_watchpoint_rw(unsigned n, u32 addr); 48 int swdp_watchpoint_disable(unsigned n); 49 50 /* attempt to clear any error state from previous transactions */ 51 /* return 0 if successful (or no error state existed) */ 52 int swdp_clear_error(void); 53 int swdp_error(void); 54 55 int swdp_reset(void); 56 57 int swdp_open(void); 58 59 void swdp_enable_tracing(int yes); 60 61 void swdp_target_reset(int enable); 62 63 int swdp_bootloader(void); 64 int swdp_set_clock(unsigned khz); 65 int swo_set_clock(unsigned khz); 66 67 #endif 68