change dcd_dcache_*() API return type from void to bool
This commit is contained in:
		@@ -83,22 +83,19 @@ CFG_TUD_MEM_SECTION static struct {
 | 
			
		||||
// DMA
 | 
			
		||||
//--------------------------------------------------------------------
 | 
			
		||||
#if CFG_TUD_MEM_DCACHE_ENABLE
 | 
			
		||||
void dcd_dcache_clean(const void* addr, uint32_t data_size) {
 | 
			
		||||
  if (addr && data_size) {
 | 
			
		||||
    dwc2_dcache_clean(addr, data_size);
 | 
			
		||||
  }
 | 
			
		||||
bool dcd_dcache_clean(const void* addr, uint32_t data_size) {
 | 
			
		||||
  TU_VERIFY(addr && data_size);
 | 
			
		||||
  return dwc2_dcache_clean(addr, data_size);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void dcd_dcache_invalidate(const void* addr, uint32_t data_size) {
 | 
			
		||||
  if (addr && data_size) {
 | 
			
		||||
    dwc2_dcache_invalidate(addr, data_size);
 | 
			
		||||
  }
 | 
			
		||||
bool dcd_dcache_invalidate(const void* addr, uint32_t data_size) {
 | 
			
		||||
  TU_VERIFY(addr && data_size);
 | 
			
		||||
  return dwc2_dcache_invalidate(addr, data_size);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void dcd_dcache_clean_invalidate(const void* addr, uint32_t data_size) {
 | 
			
		||||
  if (addr && data_size) {
 | 
			
		||||
    dwc2_dcache_clean_invalidate(addr, data_size);
 | 
			
		||||
  }
 | 
			
		||||
bool dcd_dcache_clean_invalidate(const void* addr, uint32_t data_size) {
 | 
			
		||||
  TU_VERIFY(addr && data_size);
 | 
			
		||||
  return dwc2_dcache_clean_invalidate(addr, data_size);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -130,22 +130,22 @@ TU_ATTR_ALWAYS_INLINE static inline uint32_t round_up_to_cache_line_size(uint32_
 | 
			
		||||
  return size;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TU_ATTR_ALWAYS_INLINE static inline void dwc2_dcache_clean(const void* addr, uint32_t data_size) {
 | 
			
		||||
TU_ATTR_ALWAYS_INLINE static inline bool dwc2_dcache_clean(const void* addr, uint32_t data_size) {
 | 
			
		||||
  const int flag = ESP_CACHE_MSYNC_FLAG_TYPE_DATA | ESP_CACHE_MSYNC_FLAG_DIR_C2M;
 | 
			
		||||
  data_size = round_up_to_cache_line_size(data_size);
 | 
			
		||||
  assert(ESP_OK == esp_cache_msync((void*)addr, data_size, flag));
 | 
			
		||||
  return ESP_OK == esp_cache_msync((void*)addr, data_size, flag);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TU_ATTR_ALWAYS_INLINE static inline void dwc2_dcache_invalidate(const void* addr, uint32_t data_size) {
 | 
			
		||||
TU_ATTR_ALWAYS_INLINE static inline bool dwc2_dcache_invalidate(const void* addr, uint32_t data_size) {
 | 
			
		||||
  const int flag = ESP_CACHE_MSYNC_FLAG_TYPE_DATA | ESP_CACHE_MSYNC_FLAG_DIR_M2C;
 | 
			
		||||
  data_size = round_up_to_cache_line_size(data_size);
 | 
			
		||||
  assert(ESP_OK == esp_cache_msync((void*)addr, data_size, flag));
 | 
			
		||||
  return ESP_OK == esp_cache_msync((void*)addr, data_size, flag);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TU_ATTR_ALWAYS_INLINE static inline void dwc2_dcache_clean_invalidate(const void* addr, uint32_t data_size) {
 | 
			
		||||
TU_ATTR_ALWAYS_INLINE static inline bool dwc2_dcache_clean_invalidate(const void* addr, uint32_t data_size) {
 | 
			
		||||
  const int flag = ESP_CACHE_MSYNC_FLAG_TYPE_DATA | ESP_CACHE_MSYNC_FLAG_DIR_C2M | ESP_CACHE_MSYNC_FLAG_DIR_M2C;
 | 
			
		||||
  data_size = round_up_to_cache_line_size(data_size);
 | 
			
		||||
  assert(ESP_OK == esp_cache_msync((void*)addr, data_size, flag));
 | 
			
		||||
  return ESP_OK == esp_cache_msync((void*)addr, data_size, flag);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user