memory.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* sd2snes - SD card based universal cartridge for the SNES
  2. Copyright (C) 2009-2010 Maximilian Rehkopf <otakon@gmx.net>
  3. AVR firmware portion
  4. Inspired by and based on code from sd2iec, written by Ingo Korb et al.
  5. See sdcard.c|h, config.h.
  6. FAT file system access based on code by ChaN, Jim Brain, Ingo Korb,
  7. see ff.c|h.
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; version 2 of the License only.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. memory.h: RAM operations
  19. */
  20. #ifndef MEMORY_H
  21. #define MEMORY_H
  22. #define SRAM_ROM_ADDR (0x000000L)
  23. #define SRAM_SAVE_ADDR (0x600000L)
  24. #define SRAM_MENU_ADDR (0x600000L)
  25. #define SRAM_DB_ADDR (0x620000L)
  26. #define SRAM_DIR_ADDR (0x610000L)
  27. #define SRAM_CMD_ADDR (0x7F1004L)
  28. #define SRAM_FD_ADDR (0x7F1000L)
  29. #define SRAM_MENU_SAVE_ADDR (0x7F0000L)
  30. #define SRAM_SCRATCHPAD (0x7FFF00L)
  31. #define SRAM_DIRID (0x7FFFF0L)
  32. #define SRAM_RELIABILITY_SCORE (0x100)
  33. uint32_t load_rom(uint8_t* filename, uint32_t base_addr);
  34. uint32_t load_sram(uint8_t* filename, uint32_t base_addr);
  35. void sram_hexdump(uint32_t addr, uint32_t len);
  36. uint8_t sram_readbyte(uint32_t addr);
  37. uint16_t sram_readshort(uint32_t addr);
  38. uint32_t sram_readlong(uint32_t addr);
  39. void sram_writebyte(uint8_t val, uint32_t addr);
  40. void sram_writeshort(uint16_t val, uint32_t addr);
  41. void sram_writelong(uint32_t val, uint32_t addr);
  42. void sram_readblock(void* buf, uint32_t addr, uint16_t size);
  43. void sram_writeblock(void* buf, uint32_t addr, uint16_t size);
  44. void save_sram(uint8_t* filename, uint32_t sram_size, uint32_t base_addr);
  45. uint32_t calc_sram_crc(uint32_t base_addr, uint32_t size);
  46. uint8_t sram_reliable(void);
  47. #include "smc.h"
  48. snes_romprops_t romprops;
  49. #endif