1 #ifndef CACHEBIT_H 2 #define CACHEBIT_H 3 4 /* 5 Macros used to manipulate the uncached bit on addresses 6 may be used in core or module code 7 8 An uncached view of camera ram is available at a high address range 9 typically 0x10000000 or 0x40000000. 10 Sometimes it is desriable to convert from one to the other 11 NOTE the user is responsible for cleaning and/or flushing the caches 12 to ensure the data is coherent, if required. 13 These macro's only manipulate the bit on the address 14 */ 15 16 // get CAM_UNCACHED_BIT from camera_info, if camera.h define is not available (module code) 17 #ifndef CAM_UNCACHED_BIT 18 #define CAM_UNCACHED_BIT (camera_info.cam_uncached_bit) 19 #endif 20 21 // typeof is a gcc extension, used to ensure returned pointer is the same type 22 #define ADR_TO_UNCACHED(adr) ((typeof(adr))((unsigned)(adr)|CAM_UNCACHED_BIT)) 23 #define ADR_TO_CACHED(adr) ((typeof(adr))((unsigned)(adr)&(~CAM_UNCACHED_BIT))) 24 #define ADR_IS_CACHED(adr) (!((unsigned)(adr)&(CAM_UNCACHED_BIT))) 25 26 #endif