串口1、2、4
修改linux-4.9.y-smp/arch/arm/boot/dts/hi3516dv300.dtsi
aliases {
serial0 = &uart0;
serial1 = &uart1;
serial2 = &uart2;
serial4 = &uart4;
修改linux-4.9.y-smp/arch/arm/boot/dts/hi3516dv300-demb.dts
&uart0 {
status = "okay";
};
&uart1 {
status = "okay";
};
&uart2 {
status = "okay";
};
&uart4 {
status = "okay";
};
重新编译内核。
make clean
make ARCH=arm CROSS_COMPILE=arm-himix200-linux- uImage -j 20
ADC
修改linux-4.9.y-smp/arch/arm/boot/dts/hi3516dv300.dtsi
hisi_adc: hisi_adc@120e0000 {
compatible = "hisi_adc";
reg = <0x120e0000 0x1000>;
interrupts = <0 65 4>;
resets = <&clock 0x1bc 2>;
reset-names = "lsadc-crg";
status = "okay";
};
重新编译内核
make clean
make ARCH=arm CROSS_COMPILE=arm-himix200-linux- uImage -j 20
根据github上开源的代码做了修改
GitHub - Tvirus/hisi_adc_driver: hi3516dv300
将lsadc目录复制到SDK/mpp/sample/下
修改Makefile里linux根目录路径
编译生成hisi_adc.ko
复制hisi_adc.ko到板上
insmod hisi_adc.ko,可以看到加载到文件系统的信息。
ifeq ($(PARAM_FILE), )
PARAM_FILE:=../../Makefile.param
include $(PARAM_FILE)
endif
LINUX_ROOT=/home/zhujun/hi3516/Hi3516CV500_SDK_V2.0.2.0/osdrv/opensource/kernel/linux-4.9.y-smp
obj-m := hisi_adc.o
hisi_adc-objs = hisi_adc_api.o hisi_adc_module.o
EXTRA_CFLAGS+=-I$(PWD)/
default:
@echo -e "\e[0;32;1m--Compiling 'lsadc'... \e[0;36;1m"
@@echo -e "\e[0m"
@$(MAKE) -C $(LINUX_ROOT) M=$(PWD) modules
clean:
@make -C $(LINUX_ROOT) M=$(PWD) clean
@rm -rf *.ko
设置采样周期:
(单位ms,采样后上报input事件)
echo 100 > /sys/devices/virtual/input/input0/period_ms
使能通道0:
echo 1 > /sys/devices/virtual/input/input0/ch0_en
获取通道0的值:
cat /sys/devices/virtual/input/input0/ch0_value