Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
card10
openocd
Commits
e5181df1
Commit
e5181df1
authored
Aug 26, 2008
by
oharboe
Browse files
added 1000ms timeout
git-svn-id:
svn://svn.berlios.de/openocd/trunk@970
b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent
f5507d89
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/flash/str9x.c
View file @
e5181df1
...
...
@@ -305,8 +305,9 @@ int str9x_erase(struct flash_bank_s *bank, int first, int last)
{
return
retval
;
}
while
(
1
)
{
int
i
;
for
(
i
=
0
;
i
<
1000
;
i
++
)
{
if
((
retval
=
target_read_u8
(
target
,
adr
,
&
status
))
!=
ERROR_OK
)
{
return
retval
;
...
...
@@ -315,6 +316,11 @@ int str9x_erase(struct flash_bank_s *bank, int first, int last)
break
;
alive_sleep
(
1
);
}
if
(
i
==
1000
)
{
LOG_ERROR
(
"erase timed out"
);
return
ERROR_FAIL
;
}
/* clear status, also clear read array */
if
((
retval
=
target_write_u16
(
target
,
adr
,
0x50
))
!=
ERROR_OK
)
...
...
@@ -571,13 +577,20 @@ int str9x_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
/* get status command */
target_write_u16
(
target
,
bank_adr
,
0x70
);
while
(
1
)
{
int
i
;
for
(
i
=
0
;
i
<
1000
;
i
++
)
{
target_read_u8
(
target
,
bank_adr
,
&
status
);
if
(
status
&
0x80
)
break
;
alive_sleep
(
1
);
}
if
(
i
==
1000
)
{
LOG_ERROR
(
"write timed out"
);
return
ERROR_FAIL
;
}
/* clear status reg and read array */
target_write_u16
(
target
,
bank_adr
,
0x50
);
...
...
@@ -614,12 +627,19 @@ int str9x_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
/* query status command */
target_write_u16
(
target
,
bank_adr
,
0x70
);
while
(
1
)
{
int
i
;
for
(
i
=
0
;
i
<
1000
;
i
++
)
{
target_read_u8
(
target
,
bank_adr
,
&
status
);
if
(
status
&
0x80
)
break
;
alive_sleep
(
1
);
}
if
(
i
==
1000
)
{
LOG_ERROR
(
"write timed out"
);
return
ERROR_FAIL
;
}
/* clear status reg and read array */
target_write_u16
(
target
,
bank_adr
,
0x50
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment