From: batt Date: Mon, 21 Jun 2010 10:25:51 +0000 (+0000) Subject: Save some RAM space. X-Git-Tag: 2.6.0~381 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=0cd323b49018066aee36ccd684f7f38785a010a6;p=bertos.git Save some RAM space. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3926 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cpu/arm/drv/flash_at91.c b/bertos/cpu/arm/drv/flash_at91.c index 09f64eff..f46c4881 100644 --- a/bertos/cpu/arm/drv/flash_at91.c +++ b/bertos/cpu/arm/drv/flash_at91.c @@ -67,30 +67,39 @@ #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");