1 // am29.h - A specialisation of the generic uniform sector flash memory
2 // class which models the AMD 29xxx series of flash memory. -*- C++ -*-
4 // Copyright (C) 1999, 2000 Red Hat.
5 // This file is part of SID and is licensed under the GPL.
6 // See the file COPYING.SID for conditions for redistribution.
8 // More details on this component can be found on AMD's web site
9 // <http://www.amd.com/> in various data sheets.
23 using sid::host_int_1;
24 using sid::host_int_4;
25 using sid::little_int_1;
26 using sid::little_int_2;
27 using sid::little_int_4;
28 using sid::little_int_8;
34 struct am29_flash_memory_type
43 class am29_flash_memory: public flash_uniform_sector_memory
46 am29_flash_memory(size_t memory_size, size_t sector_size,
47 host_int_1 device_id);
49 static const am29_flash_memory_type types[];
52 void stream_state (ostream&) const;
53 void destream_state (istream&);
56 class am29_bus: public bus
59 am29_bus(am29_flash_memory* target):
62 bus::status write(host_int_4 address, big_int_1 data)
65 bus::status write(host_int_4 address, little_int_1 data)
68 bus::status read(host_int_4 address, big_int_1& data) throw ( );
69 bus::status read(host_int_4 address, little_int_1& data) throw ( );
71 #define NOPERM_WRITE(type) \
72 bus::status write(host_int_4 address, type data) throw () \
73 { return bus::unpermitted; }
75 #define NOPERM_READ(type) \
76 bus::status read(host_int_4 address, type& data) throw () \
77 { return bus::unpermitted; }
79 NOPERM_WRITE(big_int_2);
80 NOPERM_WRITE(little_int_2);
81 NOPERM_WRITE(big_int_4);
82 NOPERM_WRITE(little_int_4);
83 NOPERM_WRITE(big_int_8);
84 NOPERM_WRITE(little_int_8);
86 NOPERM_READ(big_int_2);
87 NOPERM_READ(little_int_2);
88 NOPERM_READ(big_int_4);
89 NOPERM_READ(little_int_4);
90 NOPERM_READ(big_int_8);
91 NOPERM_READ(little_int_8);
97 am29_flash_memory* target;
100 friend class am29_bus;
103 bool write_ok(host_int_4 address);
105 // Erase the entire chip.
108 // Erase a given sector.
109 void erase(unsigned sector);
111 host_int_1 manufacturerCode;
112 host_int_1 deviceIdCode;