Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. #ifndef _DCACHE_H_
  2. #define _DCACHE_H_
  3.  
  4.  
  5. #include "types.h"
  6. #include "CPU.h"
  7.  
  8.  
  9. #define DCACHE_L                5UL     //line size is 2^L bytes
  10. #define DCACHE_S                6UL     //number of sets is 2^S
  11. #define DCACHE_A                4UL     //set associativity
  12.  
  13. #define DCACHE_LINE_SZ          (1UL << ICACHE_L)
  14. #define DCACHE_BUCKET_NUM       (1UL << ICACHE_S)
  15. #define DCACHE_BUCKET_SZ        (ICACHE_A)
  16.  
  17.  
  18. #define DCACHE_ADDR_MASK        ((UInt32)-ICACHE_LINE_SZ)
  19. #define DCACHE_USED_MASK        1
  20. #define DCACHE_PRIV_MASK        2
  21.  
  22. typedef struct{
  23.  
  24.         UInt32 info;    //addr, masks
  25.         UInt8 data[DCACHE_LINE_SZ];
  26.        
  27. }dcacheLine;
  28.  
  29. typedef struct{
  30.  
  31.         struct ArmCpu* cpu;
  32.         ArmCpuMemF memF;
  33.         dcacheLine lines[DCACHE_BUCKET_NUM][DCACHE_BUCKET_SZ];
  34.         UInt8 ptr[DCACHE_BUCKET_NUM];
  35.  
  36. }dcache;
  37.  
  38.  
  39. void dcacheInit(dcache* ic, struct ArmCpu* cpu, ArmCpuMemF memF);
  40. Boolean dcacheFetch(dcache* ic, UInt32 va, UInt8 sz, Boolean priviledged, UInt8* fsr, void* buf);
  41. Boolean dcacheWrite(dcache* ic, UInt32 va, UInt8 sz, Boolean priviledged, UInt8* fsr, void* buf);
  42. void dcacheFlush(dcache* ic);
  43. void dcacheFlushAddr(dcache* ic, UInt32 addr);
  44. void dcacheInval(dcache* ic);
  45. void dcacheInvalAddr(dcache* ic, UInt32 addr);
  46.  
  47.  
  48.  
  49. #endif
  50.