diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2009-12-02 22:57:08 -0800 |
---|---|---|
committer | David Brownell <dbrownell@users.sourceforge.net> | 2009-12-02 23:08:43 -0800 |
commit | f0c3e7011f9a829b518770247d143b1ac612f0f1 (patch) | |
tree | 3f150050455d13588b6e58a09905be31d66bf8a3 /src/target/arm11_dbgtap.c | |
parent | 62dd15d78f57d56310bb3cb1bfc9b8995cb69668 (diff) | |
download | openocd+libswd-f0c3e7011f9a829b518770247d143b1ac612f0f1.tar.gz openocd+libswd-f0c3e7011f9a829b518770247d143b1ac612f0f1.tar.bz2 openocd+libswd-f0c3e7011f9a829b518770247d143b1ac612f0f1.tar.xz openocd+libswd-f0c3e7011f9a829b518770247d143b1ac612f0f1.zip |
ARM11: store a clean copy of DSCR
Just store a clean copy of DSCR in the per-CPU struct, so we
trivially pass a pointer to a recent copy. This replaces the
previous "last_dscr" and cleans up most of the related calling
conventions ... but it doesn't remove the other DSCR copy.
Diffstat (limited to 'src/target/arm11_dbgtap.c')
-rw-r--r-- | src/target/arm11_dbgtap.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c index 7fd5e3a1..7e1e9cba 100644 --- a/src/target/arm11_dbgtap.c +++ b/src/target/arm11_dbgtap.c @@ -214,19 +214,20 @@ static void arm11_add_debug_INST(struct arm11_common * arm11, arm11_add_dr_scan_vc(ARRAY_SIZE(itr), itr, state == ARM11_TAP_DEFAULT ? TAP_IDLE : state); } -/** Read the Debug Status and Control Register (DSCR) - * - * same as CP14 c1 +/** + * Read and save the Debug Status and Control Register (DSCR). * * \param arm11 Target state variable. - * \param value DSCR content - * \return Error status + * \return Error status; arm11->dscr is updated on success. * - * \remarks This is a stand-alone function that executes the JTAG command queue. + * \remarks This is a stand-alone function that executes the JTAG + * command queue. It does not require the ARM11 debug TAP to be + * in any particular state. */ -int arm11_read_DSCR(struct arm11_common * arm11, uint32_t *value) +int arm11_read_DSCR(struct arm11_common *arm11) { int retval; + retval = arm11_add_debug_SCAN_N(arm11, 0x01, ARM11_TAP_DEFAULT); if (retval != ERROR_OK) return retval; @@ -242,14 +243,12 @@ int arm11_read_DSCR(struct arm11_common * arm11, uint32_t *value) CHECK_RETVAL(jtag_execute_queue()); - if (arm11->last_dscr != dscr) + if (arm11->dscr != dscr) JTAG_DEBUG("DSCR = %08x (OLD %08x)", (unsigned) dscr, - (unsigned) arm11->last_dscr); - - arm11->last_dscr = dscr; + (unsigned) arm11->dscr); - *value = dscr; + arm11->dscr = dscr; return ERROR_OK; } @@ -282,9 +281,9 @@ int arm11_write_DSCR(struct arm11_common * arm11, uint32_t dscr) JTAG_DEBUG("DSCR <= %08x (OLD %08x)", (unsigned) dscr, - (unsigned) arm11->last_dscr); + (unsigned) arm11->dscr); - arm11->last_dscr = dscr; + arm11->dscr = dscr; return ERROR_OK; } |