Merge branch 'upstream-merge'
[qemu-kvm/markmc.git] / hw / flash.h
blob69aef8ce29463bac282e08b0a13196ed4866ede6
1 /* NOR flash devices */
2 typedef struct pflash_t pflash_t;
4 /* pflash_cfi01.c */
5 pflash_t *pflash_cfi01_register(target_phys_addr_t base, ram_addr_t off,
6 BlockDriverState *bs,
7 uint32_t sector_len, int nb_blocs, int width,
8 uint16_t id0, uint16_t id1,
9 uint16_t id2, uint16_t id3);
11 /* pflash_cfi02.c */
12 pflash_t *pflash_cfi02_register(target_phys_addr_t base, ram_addr_t off,
13 BlockDriverState *bs, uint32_t sector_len,
14 int nb_blocs, int nb_mappings, int width,
15 uint16_t id0, uint16_t id1,
16 uint16_t id2, uint16_t id3,
17 uint16_t unlock_addr0, uint16_t unlock_addr1);
19 /* nand.c */
20 typedef struct NANDFlashState NANDFlashState;
21 NANDFlashState *nand_init(int manf_id, int chip_id);
22 void nand_done(NANDFlashState *s);
23 void nand_setpins(NANDFlashState *s,
24 int cle, int ale, int ce, int wp, int gnd);
25 void nand_getpins(NANDFlashState *s, int *rb);
26 void nand_setio(NANDFlashState *s, uint8_t value);
27 uint8_t nand_getio(NANDFlashState *s);
29 #define NAND_MFR_TOSHIBA 0x98
30 #define NAND_MFR_SAMSUNG 0xec
31 #define NAND_MFR_FUJITSU 0x04
32 #define NAND_MFR_NATIONAL 0x8f
33 #define NAND_MFR_RENESAS 0x07
34 #define NAND_MFR_STMICRO 0x20
35 #define NAND_MFR_HYNIX 0xad
36 #define NAND_MFR_MICRON 0x2c
38 /* onenand.c */
39 void onenand_base_update(void *opaque, target_phys_addr_t new);
40 void onenand_base_unmap(void *opaque);
41 void *onenand_init(uint32_t id, int regshift, qemu_irq irq);
42 void *onenand_raw_otp(void *opaque);
44 /* ecc.c */
45 typedef struct {
46 uint8_t cp; /* Column parity */
47 uint16_t lp[2]; /* Line parity */
48 uint16_t count;
49 } ECCState;
51 uint8_t ecc_digest(ECCState *s, uint8_t sample);
52 void ecc_reset(ECCState *s);
53 void ecc_put(QEMUFile *f, ECCState *s);
54 void ecc_get(QEMUFile *f, ECCState *s);