From 05e674a9f236bdef3bcebeb4fc9dc763930e23df Mon Sep 17 00:00:00 2001 From: asterix Date: Mon, 11 Jun 2007 15:29:16 +0000 Subject: [PATCH] Add delete page fuction. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@803 38d2e660-2303-0410-9eaa-f027e97ec537 --- mware/prog_avr.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mware/prog_avr.c b/mware/prog_avr.c index f2eac38f..70dd1741 100755 --- a/mware/prog_avr.c +++ b/mware/prog_avr.c @@ -98,6 +98,18 @@ static void prog_pagewrite(uint16_t addr) } +/** + * Delete a page in program memory. + */ +static void prog_pagedelete(uint16_t addr) +{ + /* Page erase */ + write_page(addr, BV(PGERS) + BV(SPMEN)); + + /* Re-enable the RWW section */ + write_page(addr, BV(REENABLE_RWW_BIT) + BV(SPMEN)); +} + /** * Flush temporary buffer into flash memory. */ @@ -111,6 +123,9 @@ static void prog_flush(void) wdt_reset(); + /* Page delete */ + prog_pagedelete(curr_page_num * PAGEBUF); + /* Page write */ prog_pagewrite(curr_page_num * PAGEBUF); } -- 2.25.1