void Afe_Set_Reg(uint32 offset, uint32 value, uint32 mask) { extern void *AFE_BASE_ADDRESS; volatile long address; volatile uint32 *AFE_Register; volatile uint32 val_tmp; if (CheckOffset(offset) == false) { return; } #ifdef AUDIO_MEM_IOREMAP PRINTK_AUDDRV("Afe_Set_Reg AUDIO_MEM_IOREMAP AFE_BASE_ADDRESS = %p\n",AFE_BASE_ADDRESS); address = (long)((char *)AFE_BASE_ADDRESS + offset); #else printk("%s check \n", __func__); address = (long)(AFE_BASE + offset); #endif AFE_Register = (volatile uint32 *)address; PRINTK_AFE_REG("Afe_Set_Reg offset=%x, value=%x, mask=%x \n",offset,value,mask); val_tmp = Afe_Get_Reg(offset); val_tmp &= (~mask); val_tmp |= (value & mask); mt_reg_sync_writel(val_tmp, AFE_Register); }
kal_uint32 Afe_Get_Reg(kal_uint32 offset) { volatile kal_uint32 address = (AFE_BASE+offset); volatile kal_uint32 *Analog_Register = (volatile kal_uint32 *)address; volatile kal_uint32 val_tmp; val_tmp = READ_REGISTER_UINT32(Analog_Register); PRINTK_AFE_REG("Afe_Get_Reg offset=%x, value=%d \n",offset,*value); return val_tmp; }
kal_uint32 Afe_Get_Reg(kal_uint32 offset) { volatile kal_uint32 *value; volatile kal_uint32 address = (AFE_BASE+offset); value = (volatile kal_uint32 *)(address); PRINTK_AFE_REG("Afe_Get_Reg offset=%x, value=%d \n",offset,*value); return *value; }
void Afe_Set_Reg(kal_uint32 offset, kal_uint32 value , kal_uint32 mask) { volatile kal_uint32 address = (AFE_BASE+offset); volatile kal_uint32 *AFE_Register = (volatile kal_uint32*)address; volatile kal_uint32 val_tmp; PRINTK_AFE_REG("Afe_Set_Reg offset=%x, value=%x, mask=%x \n",offset,value,mask); val_tmp = READ_REGISTER_UINT32(AFE_Register); val_tmp &= (~mask); mt65xx_reg_sync_writel(val_tmp,AFE_Register); val_tmp = READ_REGISTER_UINT32(AFE_Register); val_tmp |= (value&mask); mt65xx_reg_sync_writel(val_tmp,AFE_Register); }