summaryrefslogtreecommitdiff
path: root/src/ao_flash.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-01-09 20:42:57 -0800
committerKeith Packard <keithp@keithp.com>2010-01-09 20:42:57 -0800
commit05bb953830604721c9a49dd56256b86f3666b5ff (patch)
treeacb7f320195d5bef3b034ab742e9f6a1bf2e3cbb /src/ao_flash.c
parent327e5e782958e516a7b7a786ab6c176b0decb8b8 (diff)
Don't set ao_flash_setup_done until we're actually done.
Because we're accessing this variable outside of the mutex, we need to make sure it isn't set until the data it covers has been initialized. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_flash.c')
-rw-r--r--src/ao_flash.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ao_flash.c b/src/ao_flash.c
index 0120382d..3ea3e40b 100644
--- a/src/ao_flash.c
+++ b/src/ao_flash.c
@@ -169,6 +169,7 @@ static __pdata uint8_t ao_flash_write_pending;
static __pdata uint8_t ao_flash_setup_done;
static __data uint32_t ao_flash_device_size;
static __data uint8_t ao_flash_block_shift;
+static __data uint16_t ao_flash_block_size;
static void
ao_flash_setup(void)
@@ -183,7 +184,6 @@ ao_flash_setup(void)
ao_mutex_put(&ao_flash_mutex);
return;
}
- ao_flash_setup_done = 1;
/* On first use, check to see if the flash chip has
* been programmed to use 512 byte pages. If not, do so.
@@ -238,6 +238,8 @@ ao_flash_setup(void)
default:
ao_panic(AO_PANIC_FLASH);
}
+ ao_flash_block_size = 1 << ao_flash_block_shift;
+ ao_flash_setup_done = 1;
ao_mutex_put(&ao_flash_mutex);
}