全志平台Tina系统对寄存器进行读写的方法

cd sys/class/sunxi_dump

把要读写的地址写到dump里

root@TinaLinux:/sys/class/sunxi_dump# echo 0x07010310 > dump

读出来看一下

root@TinaLinux:/sys/class/sunxi_dump# cat dump
0x00330000

改一个数写进去

root@TinaLinux:/sys/class/sunxi_dump# echo 0x07010310 0x00330001 > write

读出来看一下

root@TinaLinux:/sys/class/sunxi_dump# cat dump
0x00330001

修改引发的变动

root@TinaLinux:/sys/class/sunxi_dump# echo 0x0701031c > dump
root@TinaLinux:/sys/class/sunxi_dump# cat dump
0x0000003f

传一张眼图

全志平台Tina系统对寄存器进行读写的方法_第1张图片

 

记一个有趣的修改

static void set_circuits_analog(void)
{
	/* calibration circuits analog enable */
	/* sunxi_clear_bit(RES_CAL_CTRL_REG, BIT(1)); */
	//setbits_le32(VDD_SYS_PWROFF_GATING_REG, 1 << 9);
	//clrbits_le32(RES_CAL_CTRL_REG, 0<<0);

	//读出默认值
	u32 value_0x310;
	u32 value_0x31c;
	printf("RES_CAL_CTRL:%x\n",RES_CAL_CTRL_REG);
	value_0x310 = readl(RES_CAL_CTRL_REG);
	printf("value_0x310 default:%x\n",value_0x310);
	value_0x31c = readl((RES_CAL_CTRL_REG+0xc));
	printf("value_0x31c default:%x\n",value_0x31c);

	//bit0清0后读出值
	value_0x310 &= ~(0x1 << 0);
	//writel(value_0x310, RES_CAL_CTRL_REG);
	clrbits_le32(RES_CAL_CTRL_REG, 1 << 0);
	value_0x310 = readl(RES_CAL_CTRL_REG);
	printf("value_0x310 after clean:%x\n",value_0x310);
	value_0x31c = readl((RES_CAL_CTRL_REG+0xc));
	printf("value_0x31c after clean:%x\n",value_0x31c);

	//延迟20us后置1
	udelay(20);
	value_0x310 |= (0x1 << 0);
	//writel(value_0x310, RES_CAL_CTRL_REG);
	setbits_le32(VDD_SYS_PWROFF_GATING_REG, 1 << 0);
	value_0x310 = readl(RES_CAL_CTRL_REG);
	printf("value_0x310 value  after set1:%x\n",value_0x310);
	value_0x31c = readl((RES_CAL_CTRL_REG+0xc));
	printf("value_0x31c after set1:%x\n",value_0x31c);
}

 

你可能感兴趣的:(全志-Tina,全志-FAQ,全志-工具&测试)