flash.h 2.0 KB

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