mdebug

cortex m series debugger
git clone http://frotz.net/git/mdebug.git
Log | Files | Refs | README | LICENSE

rswdp.h (2369B)


      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_open(void);
     22 
     23 void swdp_enable_tracing(int yes);
     24 
     25 void swdp_target_reset(int enable);
     26 
     27 int swdp_bootloader(void);
     28 int swdp_set_clock(unsigned khz);
     29 int swo_set_clock(unsigned khz);
     30 
     31 int jtag_io(unsigned count, u32 *tms, u32 *tdi, u32 *tdo);
     32 
     33 void swdp_interrupt(void);
     34 
     35 /* these are now above the transport layer and should be renamed... */
     36 
     37 /* return 0 when *addr != oldval, -1 on error, -2 on interrupt */
     38 int swdp_ahb_wait_for_change(u32 addr, u32 oldval);
     39 
     40 int swdp_core_halt(void);
     41 int swdp_core_step(void);
     42 int swdp_core_resume(void);
     43 
     44 /* return 0 when CPU halts, -1 if an error occurs, or -2 if interrupted */
     45 int swdp_core_wait_for_halt(void);
     46 
     47 /* access to CPU registers */
     48 int swdp_core_read(u32 n, u32 *v);
     49 int swdp_core_read_all(u32 *v);
     50 int swdp_core_write(u32 n, u32 v);
     51 
     52 int swdp_watchpoint_pc(unsigned n, u32 addr);
     53 int swdp_watchpoint_rd(unsigned n, u32 addr);
     54 int swdp_watchpoint_wr(unsigned n, u32 addr);
     55 int swdp_watchpoint_rw(unsigned n, u32 addr);
     56 int swdp_watchpoint_disable(unsigned n);
     57 
     58 void swdp_targetsel(u32 val, unsigned on);
     59 
     60 /* these are now provided by the transport layer */
     61 //int swdp_reset(void);
     62 //int swdp_error(void);
     63 //int swdp_clear_error(void);
     64 //int swdp_ahb_read(u32 addr, u32 *value);
     65 //int swdp_ahb_write(u32 addr, u32 value);
     66 // bulk reads/writes (more efficient after ~3-4 words
     67 // int swdp_ahb_read32(u32 addr, u32 *out, int count);
     68 // int swdp_ahb_write32(u32 addr, u32 *out, int count);
     69 #define swdp_reset debug_attach
     70 #define swdp_error debug_error
     71 #define swdp_clear_error debug_clear_error
     72 #define swdp_ahb_read mem_rd_32
     73 #define swdp_ahb_write mem_wr_32
     74 #define swdp_ahb_read32 mem_rd_32_c
     75 #define swdp_ahb_write32 mem_wr_32_c
     76 
     77 #endif
     78