uboot/include/galileo/memory.h
<<
>>
Prefs
   1/* 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,       \
  39                                   MEM_REGION3,MEM_REGION4,MEM_REGION5,       \
  40                                   MEM_REGION6,MEM_REGION7}                   \
  41                                   MEMORY_PROTECT_REGION;
  42typedef enum __memoryAccess{MEM_ACCESS_ALLOWED,MEM_ACCESS_FORBIDEN}           \
  43                            MEMORY_ACCESS;
  44typedef enum __memoryWrite{MEM_WRITE_ALLOWED,MEM_WRITE_FORBIDEN}              \
  45                           MEMORY_ACCESS_WRITE;
  46typedef enum __memoryCacheProtect{MEM_CACHE_ALLOWED,MEM_CACHE_FORBIDEN}       \
  47                                  MEMORY_CACHE_PROTECT;
  48typedef enum __memorySnoopType{MEM_NO_SNOOP,MEM_SNOOP_WT,MEM_SNOOP_WB}        \
  49                               MEMORY_SNOOP_TYPE;
  50typedef enum __memorySnoopRegion{MEM_SNOOP_REGION0,MEM_SNOOP_REGION1,         \
  51                                 MEM_SNOOP_REGION2,MEM_SNOOP_REGION3}         \
  52                                 MEMORY_SNOOP_REGION;
  53
  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,
  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. */
  77bool memorySetRegionSnoopMode(MEMORY_SNOOP_REGION region,
  78                              MEMORY_SNOOP_TYPE snoopType,
  79                              unsigned int baseAddress,
  80                              unsigned int regionLength);
  81
  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 */
  86