2
0

flash.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef HW_FLASH_H
  2. #define HW_FLASH_H 1
  3. /* NOR flash devices */
  4. #include "exec/memory.h"
  5. typedef struct pflash_t pflash_t;
  6. /* pflash_cfi01.c */
  7. pflash_t *pflash_cfi01_register(hwaddr base,
  8. DeviceState *qdev, const char *name,
  9. hwaddr size,
  10. BlockDriverState *bs,
  11. uint32_t sector_len, int nb_blocs, int width,
  12. uint16_t id0, uint16_t id1,
  13. uint16_t id2, uint16_t id3, int be);
  14. /* pflash_cfi02.c */
  15. pflash_t *pflash_cfi02_register(hwaddr base,
  16. DeviceState *qdev, const char *name,
  17. hwaddr size,
  18. BlockDriverState *bs, uint32_t sector_len,
  19. int nb_blocs, int nb_mappings, int width,
  20. uint16_t id0, uint16_t id1,
  21. uint16_t id2, uint16_t id3,
  22. uint16_t unlock_addr0, uint16_t unlock_addr1,
  23. int be);
  24. MemoryRegion *pflash_cfi01_get_memory(pflash_t *fl);
  25. /* nand.c */
  26. DeviceState *nand_init(BlockDriverState *bdrv, int manf_id, int chip_id);
  27. void nand_setpins(DeviceState *dev, uint8_t cle, uint8_t ale,
  28. uint8_t ce, uint8_t wp, uint8_t gnd);
  29. void nand_getpins(DeviceState *dev, int *rb);
  30. void nand_setio(DeviceState *dev, uint32_t value);
  31. uint32_t nand_getio(DeviceState *dev);
  32. uint32_t nand_getbuswidth(DeviceState *dev);
  33. #define NAND_MFR_TOSHIBA 0x98
  34. #define NAND_MFR_SAMSUNG 0xec
  35. #define NAND_MFR_FUJITSU 0x04
  36. #define NAND_MFR_NATIONAL 0x8f
  37. #define NAND_MFR_RENESAS 0x07
  38. #define NAND_MFR_STMICRO 0x20
  39. #define NAND_MFR_HYNIX 0xad
  40. #define NAND_MFR_MICRON 0x2c
  41. /* onenand.c */
  42. void *onenand_raw_otp(DeviceState *onenand_device);
  43. /* ecc.c */
  44. typedef struct {
  45. uint8_t cp; /* Column parity */
  46. uint16_t lp[2]; /* Line parity */
  47. uint16_t count;
  48. } ECCState;
  49. uint8_t ecc_digest(ECCState *s, uint8_t sample);
  50. void ecc_reset(ECCState *s);
  51. extern VMStateDescription vmstate_ecc_state;
  52. #endif