2010-08-25 Till Straumann <strauman@slac.stanford.edu>

PR 1689/bsps
	* shared/flash/intelFlash.c: Scale erase timeout by actual
	system clock rate rather than assuming a fixed value.
This commit is contained in:
Till Straumann
2010-08-25 22:24:01 +00:00
parent d1f662eb23
commit 8ced0f5651
2 changed files with 21 additions and 6 deletions

View File

@@ -1,3 +1,9 @@
2010-08-25 Till Straumann <strauman@slac.stanford.edu>
PR 1689/bsps
* shared/flash/intelFlash.c: Scale erase timeout by actual
system clock rate rather than assuming a fixed value.
2010-04-28 Joel Sherrill <joel.sherrilL@OARcorp.com>
* shared/bootloader/em86.c, shared/bootloader/mm.c,

View File

@@ -56,16 +56,20 @@
*/
#ifdef TESTING
#define TIMEOUT_US 100000
#define rtems_task_wake_after(args...) do {} while (0)
#define TIMEOUT_US 100000
#define rtems_task_wake_after(t) sleep(t)
#define CLOCKRATE_GET(p) (*(p)=1)
#else
#include <rtems.h>
#define TIMEOUT_US 1000
#define TIMEOUT_US 1000
#define CLOCKRATE_GET(p) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, p )
#endif
#define ERASE_TIMEOUT_S 2
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
@@ -321,14 +325,19 @@ uint32_t sta;
STATIC int
flash_erase_block_intel(struct bankdesc *b, uint32_t addr)
{
uint32_t sta;
int i;
uint32_t sta;
int i;
rtems_interval p;
if ( (sta = flash_check_ready_intel(b, addr)) )
return sta;
(void)BSP_flashReadRaw(F_CMD_WR_ERA, addr);
(void)BSP_flashReadRaw(F_CMD_WR_CMD, addr);
i = 50;
CLOCKRATE_GET( &p );
i = p * ERASE_TIMEOUT_S;
while ( STA_RDYRDY != (STA_RDYRDY & (sta = BSP_flashReadRaw(F_CMD_RD_STA, addr))) && --i > 0 ) {
rtems_task_wake_after(1);
}