Add-in development tools for fx-9860G and fx-CG 50, to use with GCC and gint.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2KB

  1. #include <fxos.h>
  2. /* Shared by all platforms (though ROM is 4M on most) */
  3. static struct region ROM = { 0x80000000, 0x807fffff, "ROM", MPU_GUESS };
  4. static struct region RAM = { 0x88000000, 0x88040000, "RAM", MPU_GUESS };
  5. static struct region P2_ROM = { 0xa0000000, 0xa07fffff, "P2 ROM", MPU_GUESS };
  6. static struct region P2_RAM = { 0xa8000000, 0xa8040000, "P2 RAM", MPU_GUESS };
  7. /* SH7305 only */
  8. static struct region RS = { 0xfd800000, 0xfd8007ff, "RS", MPU_SH7305 };
  9. static struct region IL = { 0xe5200000, 0xe5203fff, "IL", MPU_SH7305 };
  10. static struct region XRAM = { 0xe5007000, 0xe5008fff, "XRAM", MPU_SH7305 };
  11. static struct region YRAM = { 0xe5017000, 0xe5018fff, "YRAM", MPU_SH7305 };
  12. /* A summary */
  13. static struct region *regions[] = {
  14. &ROM, &RAM, &P2_ROM, &P2_RAM, &IL, &RS, NULL,
  15. };
  16. /* memory_in(): Check if an address if inside a given region */
  17. static int memory_in(uint32_t address, struct region const *reg)
  18. {
  19. return reg && address >= reg->start && address <= reg->end;
  20. }
  21. /* memory_region(): Find the region where an address is located */
  22. struct region const *memory_region(uint32_t address)
  23. {
  24. for(int i = 0; regions[i]; i++)
  25. {
  26. if(memory_in(address, regions[i])) return regions[i];
  27. }
  28. return NULL;
  29. }