Compare commits
6 Commits
i2som-mort
...
odm-ieb
| Author | SHA1 | Date | |
|---|---|---|---|
| bc74613a65 | |||
| a285ab0286 | |||
| 616d941ccb | |||
| 0e313b7ae0 | |||
| bc12c36a14 | |||
| e6af62b498 |
@ -19,13 +19,15 @@ UBOOT_ENV_SIZE ?= "0x100000"
|
||||
UBOOT_ENV_RANGE ?= ""
|
||||
|
||||
KERNEL_DEVICETREE ?= " \
|
||||
i2c6ulxb-i2s6ull-nand.dtb \
|
||||
odm-ieb-i2s6uby2-nand.dtb \
|
||||
"
|
||||
|
||||
SERIAL_CONSOLE = "115200 ttymxc0"
|
||||
|
||||
# U-Boot script to be copied to the boot image
|
||||
BOOT_SCRIPTS = "boot.scr:boot.scr"
|
||||
MACHINE_EXTRA_RRECOMMENDS += "kernel-module-dht11"
|
||||
KERNEL_MODULE_AUTOLOAD += "dht11"
|
||||
|
||||
# Flash image types
|
||||
IMAGE_FSTYPES ?= "tar.bz2 ubifs boot.ubifs recovery.ubifs"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
setenv zimage zImage-i2c6ulxbn.bin
|
||||
setenv fdt_file zImage-i2c6ulxb-i2s6ull-nand.dtb
|
||||
setenv fdt_file zImage-odm-ieb-i2s6uby2-nand.dtb
|
||||
|
||||
if test "${mtdbootpart}" = "recovery"; then
|
||||
setenv initrd_file uramdisk-recovery.img
|
||||
|
||||
14
meta-i2som-nxp/recipes-kernel/kernel-module-dht11/files/Makefile
Executable file
14
meta-i2som-nxp/recipes-kernel/kernel-module-dht11/files/Makefile
Executable file
@ -0,0 +1,14 @@
|
||||
ARCH=arm
|
||||
KERN_DIR ?=
|
||||
|
||||
obj-m += dht11.o
|
||||
|
||||
all: modules
|
||||
modules:
|
||||
$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNEL_SRC) M=$(shell pwd) modules
|
||||
|
||||
modules_install:
|
||||
$(MAKE) ARCH=$(ARCH) -C $(KERNEL_SRC) M=$(shell pwd) modules_install
|
||||
clean:
|
||||
rm -f *.ko *.o *.mod.o *.mod.c *.symvers
|
||||
|
||||
217
meta-i2som-nxp/recipes-kernel/kernel-module-dht11/files/dht11.c
Executable file
217
meta-i2som-nxp/recipes-kernel/kernel-module-dht11/files/dht11.c
Executable file
@ -0,0 +1,217 @@
|
||||
#include <asm/cacheflush.h>
|
||||
#include <linux/fdtable.h>
|
||||
#include <linux/file.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/nsproxy.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include <linux/io.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#define DHT11_PIN 26
|
||||
//#define DHT11_PIN 116
|
||||
|
||||
static unsigned char check_flag;
|
||||
static unsigned char dht11_data_buf[6];
|
||||
|
||||
static int dht11_read_one_bit(void)
|
||||
{
|
||||
gpio_direction_input(DHT11_PIN);
|
||||
return gpio_get_value(DHT11_PIN);
|
||||
}
|
||||
|
||||
static void dht11_gpio_out(int value)
|
||||
{
|
||||
gpio_direction_output(DHT11_PIN, value);
|
||||
}
|
||||
|
||||
static unsigned char dht11_read_byte(void)
|
||||
{
|
||||
int i = 0;
|
||||
int num;
|
||||
unsigned char flag = 0;
|
||||
unsigned char data = 0;
|
||||
|
||||
for(num = 0; num < 8; num++)
|
||||
{
|
||||
i = 0;
|
||||
while(!gpio_get_value(DHT11_PIN))
|
||||
{
|
||||
udelay(10);
|
||||
i++;
|
||||
if(i > 10)
|
||||
break;
|
||||
}
|
||||
flag = 0x00;
|
||||
udelay(28);
|
||||
if(gpio_get_value(DHT11_PIN))
|
||||
{
|
||||
flag = 0x01;
|
||||
}
|
||||
i = 0;
|
||||
while(gpio_get_value(DHT11_PIN))
|
||||
{
|
||||
udelay(10);
|
||||
i++;
|
||||
if(i > 12)
|
||||
break;
|
||||
}
|
||||
data <<= 1;
|
||||
data |= flag;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/** read data format :
|
||||
* 8bit : humidity integer
|
||||
* 8bit : humidity decimal
|
||||
* 8bit : temperature integer
|
||||
* 8bit : temperature decimal
|
||||
* 8bit : check code
|
||||
* buf store data :
|
||||
* dht11_data_buf[0] : humidity integer
|
||||
* dht11_data_buf[1] : humidity decimal
|
||||
* dht11_data_buf[2] : temperature integer
|
||||
* dht11_data_buf[3] : temperature decimal
|
||||
* dht11_data_buf[4] : check code
|
||||
* dht11_data_buf[5] : self calculate check code
|
||||
*/
|
||||
static void dht11_read_data(void)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
dht11_gpio_out(0);
|
||||
mdelay(30);
|
||||
dht11_gpio_out(1);
|
||||
udelay(20);
|
||||
|
||||
if(dht11_read_one_bit() == 0)
|
||||
{
|
||||
while(!gpio_get_value(DHT11_PIN))
|
||||
{
|
||||
udelay(5);
|
||||
i++;
|
||||
if(i > 20)
|
||||
{
|
||||
printk("dht11_read_data %d err!\n", __LINE__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
while(gpio_get_value(DHT11_PIN))
|
||||
{
|
||||
udelay(5);
|
||||
i++;
|
||||
if(i > 20)
|
||||
{
|
||||
printk("dht11_read_data %d err!\n", __LINE__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(i = 0; i < 5; i++)
|
||||
dht11_data_buf[i] = dht11_read_byte();
|
||||
|
||||
dht11_data_buf[5] = dht11_data_buf[0]+dht11_data_buf[1]+dht11_data_buf[2]+dht11_data_buf[3];
|
||||
|
||||
if(dht11_data_buf[4] == dht11_data_buf[5])
|
||||
{
|
||||
check_flag = 0xff;
|
||||
}
|
||||
else if(dht11_data_buf[4] != dht11_data_buf[5])
|
||||
{
|
||||
check_flag = 0x00;
|
||||
printk("dht11 check fail\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int dht11_open (struct inode *inode, struct file *file)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t dht11_read (struct file *file, char __user *buffer, size_t size, loff_t *offset)
|
||||
{
|
||||
int ret, i;
|
||||
unsigned long flags;
|
||||
|
||||
for(i = 0; i < 6; i++) {
|
||||
*(dht11_data_buf+i) = 0;
|
||||
}
|
||||
|
||||
local_irq_save(flags);
|
||||
dht11_read_data();
|
||||
local_irq_restore(flags);
|
||||
|
||||
if(check_flag == 0xff)
|
||||
{
|
||||
ret = copy_to_user(buffer, dht11_data_buf, sizeof(dht11_data_buf));
|
||||
if(ret < 0)
|
||||
{
|
||||
printk("copy to user err\n");
|
||||
return -EAGAIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}else{
|
||||
return -EAGAIN;
|
||||
}
|
||||
}
|
||||
|
||||
static int dht11_release (struct inode *inode, struct file *file)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations dht11_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = dht11_open,
|
||||
.read = dht11_read,
|
||||
.release = dht11_release,
|
||||
};
|
||||
|
||||
static struct miscdevice dht11_miscdev = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = "dht11",
|
||||
.fops = &dht11_fops
|
||||
};
|
||||
|
||||
static int yl_dht11_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = gpio_request(DHT11_PIN , "dht11");
|
||||
if(ret)
|
||||
{
|
||||
printk("gpio_request for dht11 is failed!\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = misc_register(&dht11_miscdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void yl_dht11_exit(void)
|
||||
{
|
||||
misc_deregister(&dht11_miscdev);
|
||||
gpio_free(DHT11_PIN);
|
||||
}
|
||||
module_init(yl_dht11_init);
|
||||
module_exit(yl_dht11_exit);
|
||||
MODULE_LICENSE("GPL");
|
||||
@ -0,0 +1,19 @@
|
||||
# Copyright (C) 2017 i2SOM Team.
|
||||
|
||||
SUMMARY = "The driver for DHT11"
|
||||
DESCRIPTION = "DHT11"
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
|
||||
|
||||
#FILESEXTRAPATHS_prepend := "${THISDIR}/kernel-module-dht11:"
|
||||
inherit module
|
||||
|
||||
SRC_URI = "file://Makefile \
|
||||
file://dht11.c \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
EXTRA_OEMAKE += "KERNELDIR=${STAGING_KERNEL_DIR}"
|
||||
|
||||
COMPATIBLE_MACHINE = "(i2c6ulxbn|i2c6ulxbe)"
|
||||
@ -151,6 +151,7 @@ CONFIG_USB_RTL8150=m
|
||||
CONFIG_USB_RTL8152=m
|
||||
CONFIG_USB_USBNET=m
|
||||
CONFIG_USB_NET_CDC_EEM=m
|
||||
CONFIG_USB_NET_QMI_WWAN=m
|
||||
CONFIG_BCMDHD=y
|
||||
CONFIG_BCMDHD_SDIO=y
|
||||
CONFIG_BCMDHD_FW_PATH="/lib/firmware/bcm/ZP_BCM4339/fw_bcmdhd.bin"
|
||||
@ -241,11 +242,10 @@ CONFIG_FB_MXS=y
|
||||
CONFIG_FB_MXC_SYNC_PANEL=y
|
||||
# CONFIG_FB_MXC_EDID is not set
|
||||
CONFIG_HANNSTAR_CABC=y
|
||||
CONFIG_BACKLIGHT_LCD_SUPPORT=y
|
||||
CONFIG_FB_SSD1307=m
|
||||
CONFIG_LCD_CLASS_DEVICE=y
|
||||
CONFIG_LCD_L4F00242T03=y
|
||||
CONFIG_LCD_PLATFORM=y
|
||||
CONFIG_BACKLIGHT_CLASS_DEVICE=y
|
||||
# CONFIG_BACKLIGHT_GENERIC is not set
|
||||
CONFIG_BACKLIGHT_PWM=y
|
||||
CONFIG_BACKLIGHT_GPIO=y
|
||||
@ -282,6 +282,7 @@ CONFIG_USB_CHIPIDEA_HOST=y
|
||||
CONFIG_USB_SERIAL=m
|
||||
CONFIG_USB_SERIAL_GENERIC=y
|
||||
CONFIG_USB_SERIAL_FTDI_SIO=m
|
||||
CONFIG_USB_SERIAL_QUALCOMM=m
|
||||
CONFIG_USB_SERIAL_OPTION=m
|
||||
CONFIG_USB_EHSET_TEST_FIXTURE=y
|
||||
CONFIG_NOP_USB_XCEIV=y
|
||||
@ -335,10 +336,10 @@ CONFIG_MXS_DMA=y
|
||||
CONFIG_DMATEST=m
|
||||
CONFIG_STAGING=y
|
||||
CONFIG_STAGING_MEDIA=y
|
||||
CONFIG_FB_TFT=m
|
||||
# CONFIG_IOMMU_SUPPORT is not set
|
||||
CONFIG_IIO=y
|
||||
CONFIG_VF610_ADC=y
|
||||
CONFIG_PWM=y
|
||||
CONFIG_PWM_IMX=y
|
||||
CONFIG_EXT2_FS=y
|
||||
CONFIG_EXT2_FS_XATTR=y
|
||||
|
||||
@ -10,8 +10,8 @@ SRC_URI = "git:///${HOME}/i2SOM/i2SOM-iMX-Linux;protocol=file;branch=${SRCBRANCH
|
||||
KERNEL_MODULE_AUTOLOAD += "${@bb.utils.contains('COMBINED_FEATURES', 'usbgadget', ' libcomposite', '',d)}"
|
||||
|
||||
LOCALVERSION = "-v1.0"
|
||||
SRCBRANCH = "master"
|
||||
SRCREV = "36b55bb04a49d36876a10aee7e1a38ca598dea97"
|
||||
SRCBRANCH = "odm-ieb"
|
||||
SRCREV = "deeeacffbff77b7d23a828e3fe7c81e248f5894a"
|
||||
|
||||
DEPENDS += "lzop-native bc-native"
|
||||
COMPATIBLE_MACHINE = "(mx6|mx6ul|mx6ull|i2c6ulxbn|i2c6ulxbe)"
|
||||
|
||||
@ -23,7 +23,7 @@ IMAGE_INSTALL += " \
|
||||
packagegroup-core-ssh-openssh \
|
||||
openssh-sftp-server \
|
||||
vsftpd \
|
||||
confuse \
|
||||
ffmpeg \
|
||||
"
|
||||
|
||||
# SDK features (for toolchains generated from an image with populate_sdk)
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
auto eth0
|
||||
iface eth0 inet dhcp
|
||||
udhcpc_opts -t 1 -S
|
||||
iface eth0 inet static
|
||||
address 192.168.2.10
|
||||
netmask 255.255.255.0
|
||||
gateway 192.168.2.1
|
||||
#iface eth0 inet dhcp
|
||||
# udhcpc_opts -t 1 -S
|
||||
|
||||
@ -48,6 +48,7 @@ RDEPENDS_${PN} = "\
|
||||
${MACHINE_EXTRA_RDEPENDS} \
|
||||
i2som-rc-local \
|
||||
lua \
|
||||
lua-periphery \
|
||||
cryptsetup \
|
||||
rng-tools \
|
||||
u-boot-fw-utils \
|
||||
@ -59,3 +60,5 @@ RRECOMMENDS_${PN} = "\
|
||||
${MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS} \
|
||||
${MACHINE_EXTRA_RRECOMMENDS} \
|
||||
"
|
||||
|
||||
TOOLCHAIN_TARGET_TASK += " peripheryc"
|
||||
|
||||
@ -8,6 +8,8 @@ SRC_URI = "file://rc.local.etc \
|
||||
file://rc.local.init \
|
||||
file://LICENSE"
|
||||
|
||||
SRC_URI += "file://app.zip;unpack=0"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
inherit update-rc.d
|
||||
@ -19,5 +21,13 @@ do_install () {
|
||||
install -d ${D}/${sysconfdir}/init.d
|
||||
install -m 755 ${S}/rc.local.etc ${D}/${sysconfdir}/rc.local
|
||||
install -m 755 ${S}/rc.local.init ${D}/${sysconfdir}/init.d/rc.local
|
||||
install -d ${D}/${prefix}/local
|
||||
install -m 755 ${S}/app.zip ${D}/${prefix}/local/app.zip
|
||||
|
||||
}
|
||||
|
||||
FILES_${PN} = "${prefix}/local \
|
||||
/etc/rc.local \
|
||||
/etc/init.d \
|
||||
/etc/init.d/rc.local \
|
||||
"
|
||||
|
||||
BIN
meta-i2som-yocto/recipes-i2som/i2som-rc-local/i2som-rc-local/app.zip
Executable file
BIN
meta-i2som-yocto/recipes-i2som/i2som-rc-local/i2som-rc-local/app.zip
Executable file
Binary file not shown.
@ -10,4 +10,15 @@
|
||||
# bits.
|
||||
#
|
||||
# By default this script does nothing.
|
||||
if [ ! -f "/usr/local/app.zip" ]; then
|
||||
chmod 777 /home/root/app.zip
|
||||
cp /home/root/app.zip /tmp/ && unzip /tmp/app.zip -d /tmp/ > /dev/null
|
||||
else
|
||||
chmod 777 /usr/local/app.zip
|
||||
cp /usr/local/app.zip /tmp/ && unzip /tmp/app.zip -d /tmp/ > /dev/null
|
||||
fi
|
||||
chmod -R 777 /tmp/*
|
||||
/tmp/intelligent_app &
|
||||
/tmp/goahead/goahead --home /tmp/goahead &
|
||||
/tmp/monitor &
|
||||
exit 0
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
SUMMARY = "Periphery device operation API for Lua language"
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
|
||||
|
||||
DEPENDS = "lua"
|
||||
SRCBRANCH = "master"
|
||||
SRCREV = "d7df4d759c467edbbe1048a42c7f6d9ae39568aa"
|
||||
|
||||
SRC_URI = "gitsm://github.com/vsergeev/lua-periphery.git;protocol=git;branch=${SRCBRANCH}"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${libdir}
|
||||
install -m 755 periphery.so ${D}${libdir}
|
||||
}
|
||||
|
||||
FILES_${PN} = "${libdir}/periphery.so"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
COMPATIBLE_MACHINE = "(i2c6ulxbn|i2c6ulxbe)"
|
||||
19
meta-i2som-yocto/recipes-i2som/peripheryc/peripheryc_git.bb
Normal file
19
meta-i2som-yocto/recipes-i2som/peripheryc/peripheryc_git.bb
Normal file
@ -0,0 +1,19 @@
|
||||
SUMMARY = "Periphery device operation API"
|
||||
#SECTION = "libs"
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=1bdb3d01ea5c73ae00c8eccb00fa1d6e"
|
||||
|
||||
SRCBRANCH = "master"
|
||||
SRCREV = "64903e4e281a2ffa70f17000514f5eba42c8b02d"
|
||||
|
||||
SRC_URI = "git://github.com/vsergeev/c-periphery.git;protocol=git;branch=${SRCBRANCH}"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${libdir}
|
||||
install -m 0755 periphery.a ${D}${libdir}
|
||||
}
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
COMPATIBLE_MACHINE = "(i2c6ulxbn|i2c6ulxbe)"
|
||||
Reference in New Issue
Block a user