about cache

来源:互联网 发布:mac桌面文件放哪里 编辑:程序博客网 时间:2024/05/16 15:32

当cpu往内存里写数据时,首先会写到Cache里,这样就造成了内存和cache中数据的不一致问题,当存此数据的cache要被新的数据取代时,需要把刚才更改的数据回写到内存中。dirty bit就是标记要回写到内存中的cache数据的位.


 /* if set, only the cache is modified not the HW */
 u32 cache_only;
 /* if set, only the HW is modified not the cache */
 u32 cache_bypass;
 /* if set, remember to free reg_defaults_raw */
 bool cache_free;


//如果是volatile的,就使用regmap_write。

没标记cache_bypass的用snd_soc_cache_write。

标记cache_only的,sync一下。

#ifdef CONFIG_REGMAP
static int hw_write(struct snd_soc_codec *codec, unsigned int reg,
      unsigned int value)
{
 int ret;

 if (!snd_soc_codec_volatile_register(codec, reg) &&
     reg < codec->driver->reg_cache_size &&
     !codec->cache_bypass) {
  ret = snd_soc_cache_write(codec, reg, value);
  if (ret < 0)
   return -1;
 }

 if (codec->cache_only) {
  codec->cache_sync = 1;
  return 0;
 }

 return regmap_write(codec->control_data, reg, value);
}


0 0
原创粉丝点击