Save some RAM space.
authorbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 21 Jun 2010 10:25:51 +0000 (10:25 +0000)
committerbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 21 Jun 2010 10:25:51 +0000 (10:25 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3926 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/cpu/arm/drv/flash_at91.c

index 09f64eff87d624d014f8445f0afc3462f4f61d6f..f46c48812e8cedcde9f322515a228fed63b6980b 100644 (file)
 #define FLASH_START_ADDR (FLASH_START_PAGE * FLASH_PAGE_SIZE_BYTES)
 
 /**
- * Send write command.
- *
- * After WR command cpu write bufferd page into flash memory.
+ * Really send the flash write command.
  * 
  * \note This function has to be placed in RAM because 
- *       executing code from Flash while a writing process
+ *       executing code from flash while a writing process
  *       is in progress is forbidden.
- */
-RAM_FUNC NOINLINE static void flash_at91_sendWRcmd(uint32_t page)
+ */ 
+RAM_FUNC NOINLINE static void write_page(uint32_t page)
 {
-       cpu_flags_t flags;
-
-       LOG_INFO("Writing page %ld...\n", page);
-
-       IRQ_SAVE_DISABLE(flags);
-
        // Send the 'write page' command
        MC_FCR = MC_KEY | MC_FCMD_WP | (MC_PAGEN_MASK & (page << 8));
 
-       // Wait for end of command
+       // Wait for the end of command
        while(!(MC_FSR & BV(MC_FRDY)))
        {
                //NOP;
        }
+}
+
+
+/**
+ * Send write command.
+ *
+ * After WR command cpu write bufferd page into flash memory.
+ * 
+ */
+INLINE void flash_at91_sendWRcmd(uint32_t page)
+{
+       cpu_flags_t flags;
+
+       LOG_INFO("Writing page %ld...\n", page);
+
+       IRQ_SAVE_DISABLE(flags);
+       write_page(page);
 
        IRQ_RESTORE(flags);
        LOG_INFO("Done\n");