https://blog.csdn.net/weixin_43094346/article/details/87974003
1.写入单个寄存器
echo 寄存器值 > /sys/class/sunxi_dump/dump
cat /sys/class/sunxi_dump/dump //查看写进去的值
2.读出单个寄存器
echo 寄存器值 > /sys/class/sunxi_dumo/write
cat write //查看写进去的值
3.以DR_SDI_gpio(PL15)控制为例:
首先查询到PLx数据寄存器地址:0x0702 2000 + 0x0010
echo 0x07022010 > /sys/class/sunxi_dump/dump
cat /sys/class/sunxi_dump/dump
uranus-nansu:/ #0x000b8100 //输出数据,以DR_SDI_gpio为高
现在尝试修改DR_SDI为低电平
echo 0x07022010 0x000b0100 > /sys/class/sunxi_dump/write
cat /sys/class/sunxi_dump/write
输出结构如下,另外可以通过万用表/示波器可以查看板子GPIO实际电平情况是否跟设置一致:
reg to_write after_write
0x0000000007022010 0x000b0100 0x000b0100
echo 0x05096250 > /sys/class/sunxi_dump/dump
cat /sys/class/sunxi_dump/dump
4.以PA_ON_gpio(PL13)控制为例:
首先查询到PLx数据寄存器地址:0x0702 2000 + 0x0010
echo 0x07022010 > /sys/class/sunxi_dump/dump
cat /sys/class/sunxi_dump/dump
uranus-nansu:/ #0x000b8100 //输出数据,PA_ON_gpio为低
现在尝试修改PA_ON为高电平
echo 0x07022010 0x000ba100 > /sys/class/sunxi_dump/write
cat /sys/class/sunxi_dump/write
5.以PA_PDN_gpio(PB3)控制为例:
首先查询到PBx数据寄存器地址:0x0702 2000 + 0x0034
echo 0x07022034 > /sys/class/sunxi_dump/dump
cat /sys/class/sunxi_dump/dump
uranus-nansu:/ #0x00000015 //输出数据,PA_PDN_gpio为低
现在尝试修改PA_PDN_ON为高电平
echo 0x07022034 0x000001D > /sys/class/sunxi_dump/write
cat /sys/class/sunxi_dump/write
echo 0x05090004 > /sys/class/sunxi_dump/dump
cat /sys/class/sunxi_dump/dump
6.查看PLL_AUDIO寄存器值;
寄存器地址:0x0300 1000 + 0x0078 = 0x03001078
echo 0x03001078 > /sys/class/sunxi_dump/dump
cat /sys/class/sunxi_dump/dump
7.查看ADC_CTRL(0x0D)寄存器值.
这是一个模拟域寄存器,使用稍微麻烦一些,需要通过AC_PR_CFG_REG(0x07010280)中继;
寄存器地址:0x07010280
1.echo 0x07010280 0x110D0000 > /sys/class/sunxi_dump/write //WIRETE=1,+DATA,写入
2.echo 0x07010280 0x100D0000 > /sys/class/sunxi_dump/write //READ=1,读取;
echo 0x07010280 > /sys/class/sunxi_dump/dump
cat /sys/class/sunxi_dump/dump