Committed.
Add a timeout check(10ms) for read/write cp15.
--
Øyvind Harboe
Embedded software and hardware consulting services
http://www.zylin.com
### Eclipse Workspace Patch 1.0
#P openocd
Index: src/target/arm926ejs.c
===================================================================
--- src/target/arm926ejs.c (revision 2460)
+++ src/target/arm926ejs.c (working copy)
@@ -159,8 +159,9 @@
jtag_add_dr_scan(4, fields, jtag_get_end_state());
- /*TODO: add timeout*/
- do
+ long long then = timeval_ms();
+
+ for (;;)
{
/* rescan with NOP, to wait for the access to complete */
access = 0;
@@ -173,7 +174,19 @@
{
return retval;
}
- } while (buf_get_u32(&access, 0, 1) != 1);
+
+ if (buf_get_u32(&access, 0, 1) == 1)
+ {
+ break;
+ }
+
+ /* 10ms timeout */
+ if ((timeval_ms()-then)>10)
+ {
+ LOG_ERROR("cp15 read operation timed out");
+ return ERROR_FAIL;
+ }
+ }
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
LOG_DEBUG("addr: 0x%x value: %8.8x", address, *value);
@@ -228,8 +241,10 @@
fields[3].in_value = NULL;
jtag_add_dr_scan(4, fields, jtag_get_end_state());
- /*TODO: add timeout*/
- do
+
+ long long then = timeval_ms();
+
+ for (;;)
{
/* rescan with NOP, to wait for the access to complete */
access = 0;
@@ -239,7 +254,19 @@
{
return retval;
}
- } while (buf_get_u32(&access, 0, 1) != 1);
+
+ if (buf_get_u32(&access, 0, 1) == 1)
+ {
+ break;
+ }
+
+ /* 10ms timeout */
+ if ((timeval_ms()-then)>10)
+ {
+ LOG_ERROR("cp15 write operation timed out");
+ return ERROR_FAIL;
+ }
+ }
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
LOG_DEBUG("addr: 0x%x value: %8.8x", address, value);
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development