Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. #ifndef _MEM_H_
  2. #define _MEM_H_
  3.  
  4. #include "types.h"
  5.  
  6. #define MAX_MEM_REGIONS         16
  7.  
  8. #define errPhysMemNoSuchRegion  (errPhysMem + 1)                //this physical address is not claimed by any region
  9. #define errPhysMemInvalidAdr    (errPhysMem + 2)                //address is IN a region but access to it is not allowed (it doesn't exist really)
  10. #define errPhysMemInvalidSize   (errPhysMem + 3)                //access that is not 1, 2 or 4-byte big
  11.  
  12. typedef Boolean (*ArmMemAccessF)(void* userData, UInt32 pa, UInt8 size, Boolean write, void* buf);
  13.  
  14. typedef struct{
  15.  
  16.         UInt32 pa;
  17.         UInt32 sz;
  18.         ArmMemAccessF aF;
  19.         void* uD;
  20.  
  21. }ArmMemRegion;
  22.  
  23. typedef struct{
  24.  
  25.         ArmMemRegion regions[MAX_MEM_REGIONS];
  26.  
  27. }ArmMem;
  28.  
  29.  
  30. void memInit(ArmMem* mem);
  31. void memDeinit(ArmMem* mem);
  32.  
  33. Boolean memRegionAdd(ArmMem* mem, UInt32 pa, UInt32 sz, ArmMemAccessF af, void* uD);
  34. Boolean memRegionDel(ArmMem* mem, UInt32 pa, UInt32 sz);
  35.  
  36. Boolean memAccess(ArmMem* mem, UInt32 addr, UInt8 size, Boolean write, void* buf);
  37.  
  38. #endif
  39.