查看: 1582|回复: 0

友坚瑞芯微RK3399开发板点亮开发板的 LED方法

[复制链接]
  • TA的每日心情
    慵懒
    2017-10-13 15:34
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    发表于 2017-11-8 09:18:00 | 显示全部楼层 |阅读模式
    分享到:
    RK3399的CPU采用big.LITTLE大小核架构,双Cortex-A72大核+四Cortex-A53小核结构,对整数、浮点、内存等作了大幅优化,在整体性能、功耗及核心面积三个方面都具革命性提升。 RK3399的GPU采用四核ARM新一代高端图像处理器Mali-T860,集成更多带宽压缩技术:如智能迭加、ASTC、本地像素存储等,还支持更多的图形和计算接口,总体性能比上一代提升45%。
            友坚科技最新研发的RK3399开发板,搭建了最新android7.1 系统,4G DDR3内存,32G EMMC 存诸,搭配8.4寸高清IPS屏。RK3399开发板主板尺寸为:155*104mm,设计有非常丰富的接口,板载3路TTL UART,2路USB2.0接口,一路USB3.0接口,WIFI/BT二合一,HDMI OUT 、HDMI INT、Type C、4G、IR、以太网等;可扩展模块包括4G模块、Camera(1300万、500万)等应用类功能模块。

    点亮开发板的 LED
    1 LED 驱动
    1.1 LE D 驱动源程序清单
    #ifndef KERNEL
    #define KERNEL
    #endif
    #ifndef MODULE
    #define MODULE
    #endif
    #include <linux/module.h>
    #include <linux/kernel .h>
    #include <linux/version.h>
    #include <linux/fs.h>
    #include <linux/init.h>
    #include <asm-arm/arch-s3c2410/hardware.h>
    #define DEVICE_NAME "leds"
    #define LED_MAJOR 232
    static unsigned long led_table[]={GPIO_B7,GPIO_B8,GPIO_B9,GPIO_B10};
    static int leds_ioctl(struct inode *inode,struct file *file,unsigned int cmd,
    unsigned long arg){
    switch(cmd){
    case 0:
    case 1:
    if (arg > 4){
    return -EINVAL;
    }
    write_gpio_bit(led_table[arg],!cmd);
    default:
    return -EINVAL;
    }
    }
    static struct file_operations leds_fops={
    owner:THIS_MODULE,
    ioctl:leds_ioctl,
    };
    static int init leds_init(void){
    int ret;
    int i;
    ret = register_chrdev(LED_MAJOR,DEVICE_NAME,&leds_fops);
    if (ret < 0){
    printk(DEVICE_NAME "can't register major number");
    return ret;
    }
    for (i=0;i<4;i++){
    set_gpio_ctrl(led_table | GPIO_PULLUP_EN | GPIO_MODE _OUT);
    write_gpio_bit(led_table,1);
    }
    printk(DEVICE_NAME "initialized\n");
    return 0;
    }
    static void exit leds_exit(void){
    unregister_chrdev(LED_MAJOR,DEVICE_NAME);
    }
    module_init(leds_init);
    module_exit(leds_exit);
    1.2 Ma ke f ile
    CROSS=/opt/host/armv4l/bin/armv4l-unknown- linux-
    INC=/linuette/t arget/box/kernel/include/
    all : leds
    leds:
    $(CROSS)gcc -O2 -c -I$(INC) leds.c
    clean:
    rm – rf leds *.o
    1.3 驱动的动态装载
    装载模块
    #insmod leds.o
    如果装载成功,在/proc/devices 文件中可以看到 leds 和它的主设备号(232)。
    #cat /proc/devices
    创建设备文件
    #mknod /dev/leds c 243 0
    成功后在/dev 目录下将生成 leds 设备文件
    #ls /dev
    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /2 下一条

    手机版|小黑屋|与非网

    GMT+8, 2024-4-19 06:38 , Processed in 0.122272 second(s), 18 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.