Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    tina中系统内核的驱动程序中如何使用 共享内存?

    MR Series
    1
    1
    1191
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      leomini5 LV 6 last edited by

      我在改那个tina的ledc驱动的时候想换中方式去发送数据

      现在这个系统里面的ledc是一个个单独的brightness设置
      就是用那个echo 去写单独的一个灯的 r g b ,这么搞一个灯就要写3次,每次写完以后都要单独发送,那么一个灯要发三次,80个灯要发240次,这么玩肯定不行

      所以我是想改成先把数据准备好,然后再发送,那么80个灯只需要发送一次就行了

      我测试了往最后那个灯发送数据去激活发送所有的灯,fps跑个100贞都是没什么问题的,那么现在就一个问题,如何把全部数据一次性高效的传输给驱动程序呢?

      我想用那个linux的内存共享,用户端很简单啊,直接写内存里面
      驱动去读也很快

      但是这个tina里面的驱动程序貌似不能直接用

      ftok()
      shmget()
      

      包括那个头文件也不太对

      #include <linux/mman.h>
      #include <linux/ipc.h>
      #include <linux/shm.h>
      

      这些文件都有,但是吧看起来内容不太对

      drivers/leds/leds-sunxi.c: In function 'sunxi_set_led_brightness':
      drivers/leds/leds-sunxi.c:1513:8: error: implicit declaration of function 'ftok' [-Werror=implicit-function-declaration]
        key = ftok("/dev/shm/ledc_shm", 0);
              ^~~~
      drivers/leds/leds-sunxi.c:1514:14: error: implicit declaration of function 'shmget' [-Werror=implicit-function-declaration]
           shm_id = shmget(key, sizeof(share_data), IPC_CREAT | 0666);
                    ^~~~~~
      drivers/leds/leds-sunxi.c:1515:37: error: implicit declaration of function 'shmat' [-Werror=implicit-function-declaration]
           share_data *shm = (share_data *)shmat(shm_id, NULL, 0);
                                           ^~~~~
      drivers/leds/leds-sunxi.c:1515:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
           share_data *shm = (share_data *)shmat(shm_id, NULL, 0);
           ^~~~~~~~~~
      drivers/leds/leds-sunxi.c:1442:19: warning: unused variable 'SIZE' [-Wunused-variable]
      

      反正一编译就出错啦

      各位大佬还,这tina的驱动程序里面怎么去使用共享内存呀

      如果没法用的话,有木有其他什么高效简单的方式,让用户app给驱动倒腾数据呀,谢谢啦

      1 Reply Last reply Reply Quote Share 0
      • 1 / 1
      • First post
        Last post

      Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

      行为准则 | 用户协议 | 隐私权政策