天嵌 ARM开发社区

 找回密码
 注册
查看: 1933|回复: 1

TQ210开发板中LED驱动的疑问???

[复制链接]
linxiaonansdu 发表于 2014-3-19 15:43:44 | 显示全部楼层 |阅读模式
1.TQ210开发板中,自带的led驱动,也就是/driver/char/tq210_leds.c中的第118行,将函数s3c_gpio_setpin(gpio_table[i], 0);注释掉了,请问不能直接用这个函数吗?为什么要改成 gpio_direction_output(gpio_table[arg], cmd)?
2.为什么我在自己写的led驱动中,使用了s3c_gpio_setpin(gpio_table[i], 0)这个函数后,控制台报错呢?

报错信息:
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = f3764000
[00000000] *pgd=5377e031, *pte=00000000, *ppte=00000000
Internal error: Oops: 80000007 [#1] PREEMPT
last sysfs file: /sys/devices/virtual/MY_LEDS/MY_LEDS/dev
Modules linked in: myled rt5370sta ds18b20 s5pv210_hdmi wm8960
CPU: 0    Not tainted  (2.6.35.7-EmbedSky #2)
PC is at 0x0
LR is at s3c_gpio_setpin+0x4c/0x60
pc : [<00000000>]    lr : [<c004dde8>]    psr: a0000093
sp : f361dec0  ip : f361ded8  fp : f361ded4
r10: 00000000  r9 : f361c000  r8 : 00000000
r7 : 00000001  r6 : 00000001  r5 : 00000001  r4 : a0000013
r3 : 00000000  r2 : fffffff0  r1 : 00000004  r0 : c09eccb0
Flags: NzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c5387d  Table: 53764019  DAC: 00000015

LR: 0xc004dd68:
dd68  e121f000 e1a0200d e3c23d7f e3c3303f e5932004 e2422001 e5832004 e5933000
dd88  e3130002 0a000000 eb1aa558 e3a00000 e89da800 e1a0c00d e92dd830 e24cb004


Backtrace:
[<c004dd9c>] (s3c_gpio_setpin+0x0/0x60) from [<bf0ad07c>] (led_ioctl+0x44/0x8c [myled])
r5:00000001 r4:00000001
[<bf0ad038>] (led_ioctl+0x0/0x8c [myled]) from [<c0100dac>] (vfs_ioctl+0x84/0xb4)
r5:00000000 r4:f3780700
[<c0100d28>] (vfs_ioctl+0x0/0xb4) from [<c0101404>] (do_vfs_ioctl+0x52c/0x57c)
r7:00000003 r6:00000001 r5:f3780700 r4:00000001
[<c0100ed8>] (do_vfs_ioctl+0x0/0x57c) from [<c01014ac>] (sys_ioctl+0x58/0x7c)
r9:f361c000 r8:00000000 r7:00000003 r6:00000001 r5:00000001
r4:f3780700
[<c0101454>] (sys_ioctl+0x0/0x7c) from [<c003bfc0>] (ret_fast_syscall+0x0/0x30)
r8:c003c168 r7:00000036 r6:00000000 r5:00000000 r4:00000000
Code: bad PC value
---[ end trace 9e6030fb6e663a2e ]---
Segmentation fault


wbz073 发表于 2014-3-19 17:31:59 | 显示全部楼层
1,。gpio_direction_output(gpio_table[arg], cmd)是方便hal层调用。
2.存在空指针错误。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号 )

GMT+8, 2024-4-29 10:14 , Processed in 1.046882 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表