blob: 0c46c24d06526264c38187a4e6a9f1a6e9c9fb12 [file] [log] [blame]
wdenk012771d2002-03-08 21:31:05 +00001/* Memory.h - Memory mappings and remapping functions declarations */
2
3/* Copyright - Galileo technology. */
4
5#ifndef __INCmemoryh
6#define __INCmemoryh
7
8/* includes */
9
10#include "core.h"
11
12/* defines */
13
14#define DONT_MODIFY 0xffffffff
15#define PARITY_SUPPORT 0x40000000
16
17#define _8BIT 0x00000000
18#define _16BIT 0x00100000
19#define _32BIT 0x00200000
20#define _64BIT 0x00300000
21
22/* typedefs */
23
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 */
33} DEVICE_PARAM;
34
35typedef enum __memBank{BANK0,BANK1,BANK2,BANK3} MEMORY_BANK;
36typedef enum __memDevice{DEVICE0,DEVICE1,DEVICE2,DEVICE3,BOOT_DEVICE} DEVICE;
37
38typedef enum __memoryProtectRegion{MEM_REGION0,MEM_REGION1,MEM_REGION2, \
wdenk57b2d802003-06-27 21:31:46 +000039 MEM_REGION3,MEM_REGION4,MEM_REGION5, \
40 MEM_REGION6,MEM_REGION7} \
41 MEMORY_PROTECT_REGION;
wdenk012771d2002-03-08 21:31:05 +000042typedef enum __memoryAccess{MEM_ACCESS_ALLOWED,MEM_ACCESS_FORBIDEN} \
wdenk57b2d802003-06-27 21:31:46 +000043 MEMORY_ACCESS;
wdenk012771d2002-03-08 21:31:05 +000044typedef enum __memoryWrite{MEM_WRITE_ALLOWED,MEM_WRITE_FORBIDEN} \
wdenk57b2d802003-06-27 21:31:46 +000045 MEMORY_ACCESS_WRITE;
wdenk012771d2002-03-08 21:31:05 +000046typedef enum __memoryCacheProtect{MEM_CACHE_ALLOWED,MEM_CACHE_FORBIDEN} \
wdenk57b2d802003-06-27 21:31:46 +000047 MEMORY_CACHE_PROTECT;
wdenk012771d2002-03-08 21:31:05 +000048typedef enum __memorySnoopType{MEM_NO_SNOOP,MEM_SNOOP_WT,MEM_SNOOP_WB} \
wdenk57b2d802003-06-27 21:31:46 +000049 MEMORY_SNOOP_TYPE;
wdenk012771d2002-03-08 21:31:05 +000050typedef enum __memorySnoopRegion{MEM_SNOOP_REGION0,MEM_SNOOP_REGION1, \
wdenk57b2d802003-06-27 21:31:46 +000051 MEM_SNOOP_REGION2,MEM_SNOOP_REGION3} \
52 MEMORY_SNOOP_REGION;
wdenk012771d2002-03-08 21:31:05 +000053
54/* functions */
55unsigned int memoryGetBankBaseAddress(MEMORY_BANK bank);
56unsigned int memoryGetDeviceBaseAddress(DEVICE device);
57unsigned int memoryGetBankSize(MEMORY_BANK bank);
58unsigned int memoryGetDeviceSize(DEVICE device);
59unsigned int memoryGetDeviceWidth(DEVICE device);
60
61/* when given base Address and size Set new WINDOW for SCS_X. (X = 0,1,2 or 3*/
62bool memoryMapBank(MEMORY_BANK bank, unsigned int bankBase,unsigned int bankLength);
63bool memoryMapDeviceSpace(DEVICE device, unsigned int deviceBase,unsigned int deviceLength);
64
65/* Change the Internal Register Base Address to a new given Address. */
66bool memoryMapInternalRegistersSpace(unsigned int internalRegBase);
67/* returns internal Register Space Base Address. */
68unsigned int memoryGetInternalRegistersSpace(void);
69/* Configurate the protection feature to a given space. */
70bool memorySetProtectRegion(MEMORY_PROTECT_REGION region,
wdenk57b2d802003-06-27 21:31:46 +000071 MEMORY_ACCESS memoryAccess,
72 MEMORY_ACCESS_WRITE memoryWrite,
73 MEMORY_CACHE_PROTECT cacheProtection,
74 unsigned int baseAddress,
75 unsigned int regionLength);
wdenk012771d2002-03-08 21:31:05 +000076/* Configurate the snoop feature to a given space. */
77bool memorySetRegionSnoopMode(MEMORY_SNOOP_REGION region,
wdenk57b2d802003-06-27 21:31:46 +000078 MEMORY_SNOOP_TYPE snoopType,
79 unsigned int baseAddress,
80 unsigned int regionLength);
wdenk012771d2002-03-08 21:31:05 +000081
82bool memoryRemapAddress(unsigned int remapReg, unsigned int remapValue);
83bool memoryGetDeviceParam(DEVICE_PARAM *deviceParam, DEVICE deviceNum);
84bool memorySetDeviceParam(DEVICE_PARAM *deviceParam, DEVICE deviceNum);
85#endif /* __INCmemoryh */