memory.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* Memory.h - Memory mappings and remapping functions declarations */
  2. /* Copyright - Galileo technology. */
  3. #ifndef __INCmemoryh
  4. #define __INCmemoryh
  5. /* includes */
  6. #include "core.h"
  7. /* defines */
  8. #define DONT_MODIFY 0xffffffff
  9. #define PARITY_SUPPORT 0x40000000
  10. #define _8BIT 0x00000000
  11. #define _16BIT 0x00100000
  12. #define _32BIT 0x00200000
  13. #define _64BIT 0x00300000
  14. /* typedefs */
  15. typedef struct deviceParam
  16. { /* boundary values */
  17. unsigned int turnOff; /* 0x0 - 0xf */
  18. unsigned int acc2First; /* 0x0 - 0x1f */
  19. unsigned int acc2Next; /* 0x0 - 0x1f */
  20. unsigned int ale2Wr; /* 0x0 - 0xf */
  21. unsigned int wrLow; /* 0x0 - 0xf */
  22. unsigned int wrHigh; /* 0x0 - 0xf */
  23. unsigned int deviceWidth; /* in Bytes */
  24. } DEVICE_PARAM;
  25. typedef enum __memBank{BANK0,BANK1,BANK2,BANK3} MEMORY_BANK;
  26. typedef enum __memDevice{DEVICE0,DEVICE1,DEVICE2,DEVICE3,BOOT_DEVICE} DEVICE;
  27. typedef enum __memoryProtectRegion{MEM_REGION0,MEM_REGION1,MEM_REGION2, \
  28. MEM_REGION3,MEM_REGION4,MEM_REGION5, \
  29. MEM_REGION6,MEM_REGION7} \
  30. MEMORY_PROTECT_REGION;
  31. typedef enum __memoryAccess{MEM_ACCESS_ALLOWED,MEM_ACCESS_FORBIDEN} \
  32. MEMORY_ACCESS;
  33. typedef enum __memoryWrite{MEM_WRITE_ALLOWED,MEM_WRITE_FORBIDEN} \
  34. MEMORY_ACCESS_WRITE;
  35. typedef enum __memoryCacheProtect{MEM_CACHE_ALLOWED,MEM_CACHE_FORBIDEN} \
  36. MEMORY_CACHE_PROTECT;
  37. typedef enum __memorySnoopType{MEM_NO_SNOOP,MEM_SNOOP_WT,MEM_SNOOP_WB} \
  38. MEMORY_SNOOP_TYPE;
  39. typedef enum __memorySnoopRegion{MEM_SNOOP_REGION0,MEM_SNOOP_REGION1, \
  40. MEM_SNOOP_REGION2,MEM_SNOOP_REGION3} \
  41. MEMORY_SNOOP_REGION;
  42. /* functions */
  43. unsigned int memoryGetBankBaseAddress(MEMORY_BANK bank);
  44. unsigned int memoryGetDeviceBaseAddress(DEVICE device);
  45. unsigned int memoryGetBankSize(MEMORY_BANK bank);
  46. unsigned int memoryGetDeviceSize(DEVICE device);
  47. unsigned int memoryGetDeviceWidth(DEVICE device);
  48. /* when given base Address and size Set new WINDOW for SCS_X. (X = 0,1,2 or 3*/
  49. bool memoryMapBank(MEMORY_BANK bank, unsigned int bankBase,unsigned int bankLength);
  50. bool memoryMapDeviceSpace(DEVICE device, unsigned int deviceBase,unsigned int deviceLength);
  51. /* Change the Internal Register Base Address to a new given Address. */
  52. bool memoryMapInternalRegistersSpace(unsigned int internalRegBase);
  53. /* returns internal Register Space Base Address. */
  54. unsigned int memoryGetInternalRegistersSpace(void);
  55. /* Configurate the protection feature to a given space. */
  56. bool memorySetProtectRegion(MEMORY_PROTECT_REGION region,
  57. MEMORY_ACCESS memoryAccess,
  58. MEMORY_ACCESS_WRITE memoryWrite,
  59. MEMORY_CACHE_PROTECT cacheProtection,
  60. unsigned int baseAddress,
  61. unsigned int regionLength);
  62. /* Configurate the snoop feature to a given space. */
  63. bool memorySetRegionSnoopMode(MEMORY_SNOOP_REGION region,
  64. MEMORY_SNOOP_TYPE snoopType,
  65. unsigned int baseAddress,
  66. unsigned int regionLength);
  67. bool memoryRemapAddress(unsigned int remapReg, unsigned int remapValue);
  68. bool memoryGetDeviceParam(DEVICE_PARAM *deviceParam, DEVICE deviceNum);
  69. bool memorySetDeviceParam(DEVICE_PARAM *deviceParam, DEVICE deviceNum);
  70. #endif /* __INCmemoryh */