OSDN Git Service

* public snapshot of sid simulator
[pf3gnuchains/pf3gnuchains3x.git] / sid / component / memory / flash.h
1 // flash.h - Class declaration for a generic flash memory component.
2 // The generic part is modelled on the assumption that a flash memory
3 // is like a conventional memory, only it has restrictions on how you
4 // can write to it.  The memory is divided into "sectors" or "zones".
5 // -*- C++ -*-
6
7 // Copyright (C) 1999, 2000 Red Hat.
8 // This file is part of SID and is licensed under the GPL.
9 // See the file COPYING.SID for conditions for redistribution.
10
11 #ifndef FLASH_H
12 #define FLASH_H
13
14 #include "generic.h"
15
16 class flash_memory: public generic_memory
17 {
18 protected:
19   // Returns true if a write is allowed to proceed. Some flash
20   // memories have a data protection mechanism to prevent garbage
21   // being written to the memory when the memory is in a transient
22   // state.
23   virtual bool write_ok(host_int_4 address) = 0;
24 };
25
26
27 class flash_uniform_sector_memory: public flash_memory
28 {
29 public:
30   flash_uniform_sector_memory();
31
32 protected:
33   host_int_4 sector_size;
34   string get_sector_size_attr();
35   component::status set_sector_size_attr(const string& s);
36
37   void stream_state (ostream&) const;
38   void destream_state (istream&);
39 };
40
41 #endif // FLASH_H