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