#include <cflash.h>


Public Member Functions | |
| CFlash () | |
| CMachine::ubit32 | erase (CMachine::ubit32 sectors=0) |
| void | reset () |
| CMachine::ubit32 | status () |
| CMachine::ubit32 | writeDoubleWord (CMachine::ubit32 *address, CMachine::ubit32 *data) |
| write a double word to flash | |
| CMachine::ubit32 | writeWord (CMachine::ubit32 *address, CMachine::ubit32 data) |
| write a word to flash | |
| CMachine::bit32 | writeWords (CMachine::ubit32 *address, CMachine::ubit32 *data, CMachine::bit32 size) |
| write a block of data to flash | |
| virtual | ~CFlash () |
Private Member Functions | |
| FLASHR_TypeDef * | flash () |
Definition at line 31 of file cflash.h.
| PikeAero::CFlash::CFlash | ( | ) |
Definition at line 29 of file cflash.cpp.
References initializeFLASH(), and reset().
00030 : inherited() 00031 { 00032 flashOp = (CMachine::ubit32 (*)())initializeFLASH(); 00033 reset(); 00034 }

| PikeAero::CFlash::~CFlash | ( | ) | [virtual] |
Definition at line 36 of file cflash.cpp.
References reset().
00037 { 00038 reset(); 00039 }

| CMachine::ubit32 PikeAero::CFlash::erase | ( | CMachine::ubit32 | sectors = 0 |
) |
Definition at line 60 of file cflash.cpp.
References PikeAero::FLASHR_TypeDef::CR0, PikeAero::FLASHR_TypeDef::CR1, flash(), FLASH_SER, and reset().
Referenced by PikeAero::CConfiguration::initializeStorage().
00061 { 00062 if ( sectors ) 00063 { 00064 reset(); 00065 /* Set the sector erase bit */ 00066 flash()->CR0 |= FLASH_SER; 00067 /* Select the sectors to be erased */ 00068 flash()->CR1 |= sectors; 00069 /* Start the operation */ 00070 return flashOp(); 00071 } 00072 return 0; 00073 }


| FLASHR_TypeDef* PikeAero::CFlash::flash | ( | ) | [inline, private] |
Definition at line 46 of file cflash.h.
References FLASHR.
Referenced by erase(), reset(), status(), writeDoubleWord(), and writeWord().
00046 {return FLASHR;}

| void PikeAero::CFlash::reset | ( | ) |
Definition at line 43 of file cflash.cpp.
References PikeAero::FLASHR_TypeDef::AR, PikeAero::FLASHR_TypeDef::CR0, PikeAero::FLASHR_TypeDef::CR1, PikeAero::FLASHR_TypeDef::DR0, PikeAero::FLASHR_TypeDef::DR1, PikeAero::FLASHR_TypeDef::ER, and flash().
Referenced by CFlash(), erase(), writeDoubleWord(), writeWord(), and ~CFlash().
00044 { 00045 /* Reset the Flash control registers */ 00046 flash()->CR0 = 0x00000000; 00047 flash()->CR1 = 0x00000000; 00048 00049 /* Reset the Flash data registers */ 00050 flash()->DR0 = 0xFFFFFFFF; 00051 flash()->DR1 = 0xFFFFFFFF; 00052 00053 /* Reset the Flash address register */ 00054 flash()->AR = 0x00000000; 00055 00056 /* Reset the Flash error register */ 00057 flash()->ER = 0x00000000; 00058 }


| CMachine::ubit32 PikeAero::CFlash::status | ( | ) | [inline] |
Definition at line 38 of file cflash.h.
References PikeAero::FLASHR_TypeDef::ER, and flash().
00038 {return flash()->ER;}

| CMachine::ubit32 PikeAero::CFlash::writeDoubleWord | ( | CMachine::ubit32 * | address, | |
| CMachine::ubit32 * | data | |||
| ) |
write a double word to flash
Definition at line 94 of file cflash.cpp.
References PikeAero::FLASHR_TypeDef::AR, PikeAero::FLASHR_TypeDef::CR0, PikeAero::FLASHR_TypeDef::DR0, PikeAero::FLASHR_TypeDef::DR1, flash(), FLASH_DWPG, and reset().
00095 { 00096 reset(); 00097 /* Set the double word programming bit */ 00098 flash()->CR0 |= FLASH_DWPG; 00099 /* Load the destination address */ 00100 flash()->AR = (CMachine::ubit32)address; 00101 /* Load FLASH_Data_1 in the DR0 register */ 00102 flash()->DR0 = data[0]; 00103 /* Load FLASH_Data_2 in the DR1 register */ 00104 flash()->DR1 = data[1]; 00105 /* Start the operation */ 00106 return flashOp(); 00107 }

| CMachine::ubit32 PikeAero::CFlash::writeWord | ( | CMachine::ubit32 * | address, | |
| CMachine::ubit32 | data | |||
| ) |
write a word to flash
Definition at line 78 of file cflash.cpp.
References PikeAero::FLASHR_TypeDef::AR, PikeAero::FLASHR_TypeDef::CR0, PikeAero::FLASHR_TypeDef::DR0, flash(), FLASH_WPG, and reset().
Referenced by writeWords().
00079 { 00080 reset(); 00081 /* Set the word programming bit */ 00082 flash()->CR0 |= FLASH_WPG; 00083 /* Load the destination address */ 00084 flash()->AR = (CMachine::ubit32)address; 00085 /* Load DATA to be programmed */ 00086 flash()->DR0 = data; 00087 /* Start the operation */ 00088 return flashOp(); 00089 }


| CMachine::bit32 PikeAero::CFlash::writeWords | ( | CMachine::ubit32 * | address, | |
| CMachine::ubit32 * | data, | |||
| CMachine::bit32 | size | |||
| ) |
write a block of data to flash
| address | Specifies the target base assress in FLASH memory. | |
| data | Specifies the source base address of memory to write to FLASH. | |
| size | Specifies aize of source data in WORDS. |
Definition at line 116 of file cflash.cpp.
References writeWord().
00117 { 00118 CMachine::ubit32 rc = 0; 00119 /* check for word boundary... */ 00120 while ( size > 0 && rc == 0 ) 00121 { 00122 rc = writeWord( address++, *data++ ); 00123 --size; 00124 } 00125 return rc; 00126 }

1.5.8