linux dm3730下写一个gpio驱动是需要以下几个函数吗?
omap_cfg_reg();配置成gpio
gpio_request() 申请gpio
gpio_is_valid()判断gpio是否占用
gpio_direction_input()
gpio_direction_output()
这些函数调用与平台无关吗?调用这些函数,驱动程序要包含的头文件有哪几个呢?一直找不到。
请求专家帮忙解惑,感激不尽!!!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
linux dm3730下写一个gpio驱动是需要以下几个函数吗?
omap_cfg_reg();配置成gpio
gpio_request() 申请gpio
gpio_is_valid()判断gpio是否占用
gpio_direction_input()
gpio_direction_output()
这些函数调用与平台无关吗?调用这些函数,驱动程序要包含的头文件有哪几个呢?一直找不到。
请求专家帮忙解惑,感激不尽!!!
一下是我拷贝的内核消息,不知道哪错了怎么分析,恳请指点一下,感激不尽!
root@beagleboard:/home/lxq# insmod omap3_gpio_drv.ko
[ 89.994445] ------------[ cut here ]------------
[ 89.999114] WARNING: at drivers/gpio/gpiolib.c:101 gpio_ensure_requested+0x50/0x118()
[ 90.006988] autorequest GPIO-15
[ 90.010131] Modules linked in: omap3_gpio_drv(+) omaplfb pvrsrvkm
[ 90.016296] [<c003d988>] (unwind_backtrace+0x0/0xdc) from [<c0065448>] (warn_slowpath_common+0x48/0x60)
[ 90.025756] [<c0065448>] (warn_slowpath_common+0x48/0x60) from [<c0065498>] (warn_slowpath_fmt+0x24/0x30)
[ 90.035369] [<c0065498>] (warn_slowpath_fmt+0x24/0x30) from [<c01f978c>] (gpio_ensure_requested+0x50/0x118)
[ 90.045166] [<c01f978c>] (gpio_ensure_requested+0x50/0x118) from [<c01f98cc>] (gpio_direction_output+0x78/0x138)
[ 90.055389] [<c01f98cc>] (gpio_direction_output+0x78/0x138) from [<bf038140>] (omap3_gpio_init+0x10/0x98 [omap3_gpio_drv])
[ 90.066497] [<bf038140>] (omap3_gpio_init+0x10/0x98 [omap3_gpio_drv]) from [<c00373b4>] (do_one_initcall+0x5c/0x1b4)
[ 90.077087] [<c00373b4>] (do_one_initcall+0x5c/0x1b4) from [<c008d684>] (sys_init_module+0xb0/0x1dc)
[ 90.086273] [<c008d684>] (sys_init_module+0xb0/0x1dc) from [<c0037f80>] (ret_fast_syscall+0x0/0x2c)
[ 90.095367] ---[ end trace abd06b7e97215090 ]---
[ 90.104553] gpio register_chrdev success, major = 251
[ 90.109649] mux: Broken omap_cfg_reg(15) entry
[ 90.114562] ------------[ cut here ]------------
[ 90.119232] WARNING: at arch/arm/plat-omap/mux.c:60 omap_cfg_reg+0x1c/0x2c()
[ 90.126586] Modules linked in: omap3_gpio_drv(+) omaplfb pvrsrvkm
[ 90.133056] [<c003d988>] (unwind_backtrace+0x0/0xdc) from [<c0065448>] (warn_slowpath_common+0x48/0x60)
[ 90.142761] [<c0065448>] (warn_slowpath_common+0x48/0x60) from [<c004ed70>] (omap_cfg_reg+0x1c/0x2c)
[ 90.152130] [<c004ed70>] (omap_cfg_reg+0x1c/0x2c) from [<bf03817c>] (omap3_gpio_init+0x4c/0x98 [omap3_gpio_drv])
[ 90.162567] [<bf03817c>] (omap3_gpio_init+0x4c/0x98 [omap3_gpio_drv]) from [<c00373b4>] (do_one_initcall+0x5c/0x1b4)
[ 90.173339] [<c00373b4>] (do_one_initcall+0x5c/0x1b4) from [<c008d684>] (sys_init_module+0xb0/0x1dc)
[ 90.182678] [<c008d684>] (sys_init_module+0xb0/0x1dc) from [<c0037f80>] (ret_fast_syscall+0x0/0x2c)
[ 90.192077] ---[ end trace abd06b7e97215091 ]---
[ 90.196716] failed to request GPIO gpio_pin
gpio_request()我是用这个函数申请gpio的。恳请指导··········