Skip to content
Snippets Groups Projects
Commit e48e7000 authored by oharboe's avatar oharboe
Browse files

10ms timeout check on cp15 read/write

git-svn-id: svn://svn.berlios.de/openocd/trunk@2470 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent 83655bf4
Branches
No related tags found
No related merge requests found
...@@ -159,8 +159,9 @@ int arm926ejs_cp15_read(target_t *target, uint32_t op1, uint32_t op2, uint32_t C ...@@ -159,8 +159,9 @@ int arm926ejs_cp15_read(target_t *target, uint32_t op1, uint32_t op2, uint32_t C
jtag_add_dr_scan(4, fields, jtag_get_end_state()); jtag_add_dr_scan(4, fields, jtag_get_end_state());
/*TODO: add timeout*/ long long then = timeval_ms();
do
for (;;)
{ {
/* rescan with NOP, to wait for the access to complete */ /* rescan with NOP, to wait for the access to complete */
access = 0; access = 0;
...@@ -173,7 +174,19 @@ int arm926ejs_cp15_read(target_t *target, uint32_t op1, uint32_t op2, uint32_t C ...@@ -173,7 +174,19 @@ int arm926ejs_cp15_read(target_t *target, uint32_t op1, uint32_t op2, uint32_t C
{ {
return retval; 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_ #ifdef _DEBUG_INSTRUCTION_EXECUTION_
LOG_DEBUG("addr: 0x%x value: %8.8x", address, *value); LOG_DEBUG("addr: 0x%x value: %8.8x", address, *value);
...@@ -228,8 +241,10 @@ int arm926ejs_cp15_write(target_t *target, uint32_t op1, uint32_t op2, uint32_t ...@@ -228,8 +241,10 @@ int arm926ejs_cp15_write(target_t *target, uint32_t op1, uint32_t op2, uint32_t
fields[3].in_value = NULL; fields[3].in_value = NULL;
jtag_add_dr_scan(4, fields, jtag_get_end_state()); 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 */ /* rescan with NOP, to wait for the access to complete */
access = 0; access = 0;
...@@ -239,7 +254,19 @@ int arm926ejs_cp15_write(target_t *target, uint32_t op1, uint32_t op2, uint32_t ...@@ -239,7 +254,19 @@ int arm926ejs_cp15_write(target_t *target, uint32_t op1, uint32_t op2, uint32_t
{ {
return retval; 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_ #ifdef _DEBUG_INSTRUCTION_EXECUTION_
LOG_DEBUG("addr: 0x%x value: %8.8x", address, value); LOG_DEBUG("addr: 0x%x value: %8.8x", address, value);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment