程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10605|回复: 0
打印 上一主题 下一主题

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
; A3 O/ v2 s" T#include <linux/init.h>$ p1 A" Z2 ]6 r4 e
#include <linux/module.h>3 ^% W8 f. }# z; O; N# n4 r$ K4 c, q# J
#include <linux/kernel.h>
! f* V# D. e6 V% h& @6 [- `0 |% O, d#include <linux/types.h>
7 D" b1 C+ ^( s6 R7 {#include <linux/gpio.h>
# B3 [" @4 Y! t" G#include <linux/leds.h>; B8 ~. L0 v" J: ^1 c, I, t) {
#include <linux/platform_device.h>. T4 W/ Z0 }) [" w; Z. R0 T: D

. s- ^) [# C* V, E#include <asm/mach-types.h>: Z0 b& w3 i# Y8 h; }0 p# H9 z' f
#include <asm/mach/arch.h>
2 G  K# K1 J/ E0 C7 ]#include <mach/da8xx.h>1 [& U; n+ d" ?$ [3 o( o6 j
#include <mach/mux.h>  @( @. i/ [3 B. M3 g

' O. |' E8 \  ~  u/ M0 s#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)# f7 E2 I' D3 k  f  ?. ]# n* h3 k
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
% D/ D0 H/ P7 {#define DA850_USER_LED2        GPIO_TO_PIN(0, 1). L1 E6 @* ?# M& @
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)! n( g; g, o& E/ v, T

0 V: G) R6 y7 j; ?$ A5 u3 s) C/* assign the tl som board LED-GPIOs*/
& i$ B4 t( l. N5 ]8 }6 t; A' kstatic const short da850_evm_tl_user_led_pins[] = {' e- C  S) b) [; S* m. U
        /* These pins are definition at <mach/mux.h> file */% v/ j: n+ @5 B% w! u+ W
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
1 x0 k' d# q: y8 `        -1
+ S' O# r8 D% f1 T};
  ~# ^! o" m8 K5 I
4 Y+ G" G. [- j1 E% Wstatic struct gpio_led da850_evm_tl_leds[] = {
: K0 [; E* K  c  j: f  Q% h) o        {
$ a3 H. S6 U/ @. \% s$ x                .active_low = 0,
7 k+ V# C/ Z5 S, m7 {, ]& X+ b2 J                .gpio = DA850_USER_LED0,
3 }% Z" L* R4 ^) W                .name = "user_led0",8 P/ D* i, d5 ~6 m. w$ p
                .default_trigger = "default-on",
9 T, d, G; f& O2 O+ R% X6 @. q        },
6 [* ^0 i& W4 r7 U+ O3 I        {
- J1 |' I' L1 w3 u; ^$ I: V5 o                .active_low = 0,
! @' ]3 y/ r6 u& Z! t  _                .gpio = DA850_USER_LED1,, r( X: ~  b' J! z# ~+ d
                .name = "user_led1",
$ s7 z& o2 _' y+ u1 U                .default_trigger = "default-on",
* {* x: |9 C* m, r% ]        },* L+ y+ [0 e, t9 `7 z
        {
! H, Z, J2 b& o3 X- O& w                .active_low = 0,- w- A- W+ g/ h, @
                .gpio = DA850_USER_LED2,3 y5 H) V$ T3 e. F) s
                .name = "user_led2",% ?4 O! P7 S$ W: k4 M7 d( A, w
                .default_trigger = "default-on",! y( h0 @2 K1 \% P. M
        },
+ U' Y5 @5 B5 E* ~7 N* N4 Q1 j) h        {
# h# j- Y+ p/ O% N                .active_low = 0,
' c; V3 z$ l2 f% X; J# X                .gpio = DA850_USER_LED3,
7 m  y/ i- t) L) A* ~( ?                .name = "user_led3",( Z& Q! @- j! q2 L" d
                .default_trigger = "default-on",
# `1 h* w$ z' q        },
$ V' K. s3 f7 H1 `};
* b; [( `6 @/ |+ g3 @+ o+ W6 i" [1 R! d% C9 t
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
/ a. y6 G0 h- V3 h        .leds = da850_evm_tl_leds,
) a9 m; g( l5 u% c9 A% O6 W        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
% k4 {3 W: C2 [& o};
  v: p! t4 k- o& ~$ w/ N2 q% [9 n" `8 S; X7 M, ^2 T
static void led_dev_release(struct device *dev)
+ A' h0 u- }) Y; {3 B{1 \9 K  {& k% h2 {0 k
};
% G& ^& m$ J4 I  @& q3 g7 \0 E2 E+ P$ r6 P# J9 U
static struct platform_device da850_evm_tl_leds_device = {
" ^, M* K( ~* I        .name                = "leds-gpio",
5 k2 T6 R& y0 f7 F2 A        .id                = 1,
4 i3 k$ ~4 N, {# k) C: |        .dev = {
) j/ a2 d9 f0 M8 `6 u' `3 K# |' g                .platform_data = &da850_evm_tl_leds_pdata,2 w+ z' l# P! |. X( q% K
                .release = led_dev_release,. o! v+ ^- l# i/ Z/ h% _1 W
        }
- K9 J. \4 t' g. u4 p% v};
4 @2 E% [7 _2 ]7 q: E- @! w9 W
9 d+ |2 D8 x2 _7 v% A7 H, Qstatic int __init led_platform_init(void)
' \+ P( f' e! A1 V- e1 J4 J{
% ]" @1 v% K! m$ c8 X        int ret;/ n, ~8 A: u2 Q5 Q/ d
#if 0
, Z- f& c2 s1 K9 l        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);0 N. f3 |4 {6 l8 [6 @7 v- b
        if (ret)4 j  f1 W% K5 T
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
& G2 l% U2 u" v) M1 @3 z" `                                "%d\n", ret);6 H3 G# \& t, X" n0 J, {% j
#endif
# Q. L! {6 _. y( t6 f& o        ret = platform_device_register(&da850_evm_tl_leds_device);
6 O/ P+ c" j% |, O% `        if (ret)4 y0 I& y( B, _% h) C5 m/ _6 `
                pr_warning("Could not register som GPIO expander LEDS");# P- K# F4 O/ R% v& t' @# N
        else3 D! S$ y1 }: _% e
                printk(KERN_INFO "LED register sucessful!\n");9 Z7 j0 q4 [2 X) f( l: N7 ^, w
/ \5 Z1 b. U# Z8 R3 C. N" G
        return ret;2 M; Z7 n. U" @# w/ ?4 v
}1 s$ U  G/ i1 A: F0 V

: `4 W6 h3 U: s+ y$ a+ }( f! K+ Gstatic void __exit led_platform_exit(void); B- t' s. v: d, ^# I& i
{
+ ?3 a$ Y' Q9 Z4 O" ^+ A# p3 W2 c* w        platform_device_unregister(&da850_evm_tl_leds_device);
# Q) y9 U, S% x. Z7 Y) H5 a6 z0 i8 m  U6 T3 |
        printk(KERN_INFO "LED unregister!\n");2 c3 |: x; n* [+ w
}  C# q! [- y7 L4 n# x3 X2 {+ ^

! K5 a1 n! \; k1 kmodule_init(led_platform_init);
/ B% O% A  \0 ?. ]module_exit(led_platform_exit);
( h$ r* ]0 M4 b- t+ B* x% p" P, p$ z1 {' S9 K: r
MODULE_DESCRIPTION("Led platform driver");" I7 B8 b$ O& a# n2 H% y
MODULE_AUTHOR("Tronlong");- P+ X8 I/ z3 X, T4 [4 t! x
MODULE_LICENSE("GPL");
9 T! u2 K( p7 x) Q6 t: c9 f
; ?5 G" @$ F0 H& d8 P# Z, e+ W0 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-3-20 23:38 , Processed in 0.044009 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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