forked from Imagelibrary/rtems
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:
@@ -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>
|
2010-04-28 Joel Sherrill <joel.sherrilL@OARcorp.com>
|
||||||
|
|
||||||
* shared/bootloader/em86.c, shared/bootloader/mm.c,
|
* shared/bootloader/em86.c, shared/bootloader/mm.c,
|
||||||
|
|||||||
@@ -57,15 +57,19 @@
|
|||||||
#ifdef TESTING
|
#ifdef TESTING
|
||||||
|
|
||||||
#define TIMEOUT_US 100000
|
#define TIMEOUT_US 100000
|
||||||
#define rtems_task_wake_after(args...) do {} while (0)
|
#define rtems_task_wake_after(t) sleep(t)
|
||||||
|
#define CLOCKRATE_GET(p) (*(p)=1)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <rtems.h>
|
#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
|
#endif
|
||||||
|
|
||||||
|
#define ERASE_TIMEOUT_S 2
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -323,12 +327,17 @@ flash_erase_block_intel(struct bankdesc *b, uint32_t addr)
|
|||||||
{
|
{
|
||||||
uint32_t sta;
|
uint32_t sta;
|
||||||
int i;
|
int i;
|
||||||
|
rtems_interval p;
|
||||||
|
|
||||||
if ( (sta = flash_check_ready_intel(b, addr)) )
|
if ( (sta = flash_check_ready_intel(b, addr)) )
|
||||||
return sta;
|
return sta;
|
||||||
|
|
||||||
(void)BSP_flashReadRaw(F_CMD_WR_ERA, addr);
|
(void)BSP_flashReadRaw(F_CMD_WR_ERA, addr);
|
||||||
(void)BSP_flashReadRaw(F_CMD_WR_CMD, 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 ) {
|
while ( STA_RDYRDY != (STA_RDYRDY & (sta = BSP_flashReadRaw(F_CMD_RD_STA, addr))) && --i > 0 ) {
|
||||||
rtems_task_wake_after(1);
|
rtems_task_wake_after(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user