CFlash Class Reference

#include <Flash.h>

Inheritance diagram for CFlash:

Inheritance graph
[legend]
Collaboration diagram for CFlash:

Collaboration graph
[legend]

Detailed Description

Emulated flash memory.

Flash memory is only used for storing configuration data (such as SRM console variables), it is not used for firmware.

Definition at line 79 of file Flash.h.


Public Member Functions

virtual void WriteMem (int index, u64 address, int dsize, u64 data)
 Write command or programming data to flash-rom.
virtual u64 ReadMem (int index, u64 address, int dsize)
 Read a byte from flashmemory.
 CFlash (CConfigurator *cfg, class CSystem *c)
 Constructor.
virtual ~CFlash ()
 Destructor.
virtual int SaveState (FILE *f)
 Save state to a Virtual Machine State file.
virtual int RestoreState (FILE *f)
 Restore state from a Virtual Machine State file.
void SaveStateF ()
 Save state to the default flash rom file.
void RestoreStateF ()
 Restore state from the default flash rom file.
void SaveStateF (char *fn)
 Save state to a flash rom file.
void RestoreStateF (char *fn)
 Restore state from a flash rom file.

Protected Attributes

struct CFlash::SFlash_state state

Data Structures

struct  SFlash_state
 The state structure contains all elements that need to be saved to the statefile. More...

Constructor & Destructor Documentation

CFlash::CFlash ( CConfigurator cfg,
class CSystem c 
)

CFlash::~CFlash (  )  [virtual]

Destructor.

Definition at line 131 of file Flash.cpp.


Member Function Documentation

void CFlash::WriteMem ( int  index,
u64  address,
int  dsize,
u64  data 
) [virtual]

Write command or programming data to flash-rom.

The state machine for this looks like this:

         |
         v
     MODE_READ <---------------------------+
         | write 0x5555:0xaa               |
         v                                 |
     MODE_STEP1 ---------------------------+
         | write 0x2aaa:0x55               |
         v                                 |
     ==MODE_STEP2= ------------------------+
 0x80| 0xa0| 0x90| write 0x5555            | 
     |     |     v                         |
     |     | MODE_AUTOSEL (read device id)-+
     |     v                               |
     | MODE_PROGRAM                        |
     |     | write data byte               |
     |     +-------------------------------+
     v                                     |
  MODE_ERASE_STEP3 ------------------------+
     | write 0x5555:0xaa                   |
     v                                     |
  MODE_ERASE_STEP4 ------------------------+
     | write 0x2aaa:0x55                   |
     v                                     |
  MODE_ERASE_STEP4 ------------------------+
   | write 0x30  | write 0x5555:0x10       |
   | anywhere    v                         |
   v           ERASE ENTIRE FLASH          |
 ERASE BLOCK     |                         |
       |         |                         |
       v         v                         |
      MODE_CONFIRM1                        |
          | read 0x80                      |
          v                                |
      MODE_CONFIRM2                        |
          | read 0x80                      |
          +--------------------------------+

Reimplemented from CSystemComponent.

Definition at line 217 of file Flash.cpp.

References CFlash::SFlash_state::Flash, CFlash::SFlash_state::mode, MODE_AUTOSEL, MODE_CONFIRM_1, MODE_ERASE_STEP3, MODE_ERASE_STEP4, MODE_ERASE_STEP5, MODE_PROGRAM, MODE_READ, MODE_STEP1, MODE_STEP2, and state.

u64 CFlash::ReadMem ( int  index,
u64  address,
int  dsize 
) [virtual]

Read a byte from flashmemory.

Normally, this returns one byte from flash, however, after some commands sent to the flash-rom, this returns identification or status information.

Reimplemented from CSystemComponent.

Definition at line 139 of file Flash.cpp.

References CFlash::SFlash_state::Flash, CFlash::SFlash_state::mode, MODE_AUTOSEL, MODE_CONFIRM_0, MODE_CONFIRM_1, MODE_READ, and state.

int CFlash::SaveState ( FILE *  f  )  [virtual]

Save state to a Virtual Machine State file.

Implements CSystemComponent.

Definition at line 365 of file Flash.cpp.

References flash_magic1, flash_magic2, and state.

Referenced by SaveStateF().

int CFlash::RestoreState ( FILE *  f  )  [virtual]

Restore state from a Virtual Machine State file.

Implements CSystemComponent.

Definition at line 379 of file Flash.cpp.

References flash_magic1, flash_magic2, and state.

Referenced by RestoreStateF().

void CFlash::SaveStateF (  ) 

Save state to the default flash rom file.

Definition at line 327 of file Flash.cpp.

References CConfigurator::get_text_value(), and CSystemComponent::myCfg.

Referenced by main(), and CTraceEngine::parse().

void CFlash::RestoreStateF (  ) 

Restore state from the default flash rom file.

Definition at line 354 of file Flash.cpp.

References CConfigurator::get_text_value(), and CSystemComponent::myCfg.

Referenced by CFlash(), and CTraceEngine::parse().

void CFlash::SaveStateF ( char *  fn  ) 

Save state to a flash rom file.

Definition at line 308 of file Flash.cpp.

References SaveState().

void CFlash::RestoreStateF ( char *  fn  ) 

Restore state from a flash rom file.

Definition at line 335 of file Flash.cpp.

References RestoreState().


Field Documentation

struct CFlash::SFlash_state CFlash::state [protected]


The documentation for this class was generated from the following files:

SourceForge.net Logo
Project space on SourceForge.net