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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
* M7 Y0 F6 N% }; P. g0 z, m& |0 ^#include <linux/init.h>
) O- c$ R, L4 Q#include <linux/module.h>
9 ?) r4 y$ h  e$ z9 Z#include <linux/kernel.h>: k4 k6 D' r; h4 y" G
#include <linux/types.h>
0 w$ ~8 B/ N% h#include <linux/gpio.h>$ n8 m, e8 s) A, M- b3 T
#include <linux/leds.h>( Z2 A' v5 X* G# s% C% l/ ?+ q
#include <linux/platform_device.h>
3 C: X, g: w9 Y# {" l1 D$ `  `1 L, \! z0 h
#include <asm/mach-types.h>
0 J" o; }+ O7 e: W- j#include <asm/mach/arch.h>
% I' d0 H# v# ]/ [4 X: Z, p#include <mach/da8xx.h>
6 s/ a: ^! F3 t  K. Q7 T! d" }& U3 A: b#include <mach/mux.h>( }4 e) T9 r4 r4 u8 E+ n) N
+ Q+ W) M" j% y: }: Z- E( e2 [
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0). b, I1 g# k# I+ Z# U% O  q3 z" m9 w
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
6 T: a: L1 D& @/ }* x9 H#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)  q, [5 l! K$ O# L1 @
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)/ y; n; P1 U; k/ m+ E9 t9 ]

$ ~5 J5 \9 {/ f( E! y/* assign the tl som board LED-GPIOs*/9 A, Q, g8 H& m6 g# s; }, }
static const short da850_evm_tl_user_led_pins[] = {/ H5 o6 _1 u. a4 M$ n  B
        /* These pins are definition at <mach/mux.h> file */0 r/ H% o2 R; i
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,1 u. s: V, j2 Z
        -1* s: \: g! Z) d
};
7 H5 }' j4 s7 u4 I% q8 [9 H
, d( T% t  X* a' Nstatic struct gpio_led da850_evm_tl_leds[] = {4 }, U1 K5 _( ^  }' @$ J" O3 ^' m  X  a
        {
5 e1 {% @+ B$ Y( _# S0 c: |                .active_low = 0,
) T. I& G+ v7 b  J8 t1 n                .gpio = DA850_USER_LED0,+ y8 i2 F4 s9 ~% g1 |. K* v
                .name = "user_led0",
6 w/ g6 n1 p( [; H/ f4 j                .default_trigger = "default-on",( L1 E! O  B% j! ?; _) G
        },
/ n$ V8 y2 d' ?1 k4 X" @        {
" W+ t  M7 }* c' \! l                .active_low = 0,
; g7 ?* O- R' k% y                .gpio = DA850_USER_LED1,4 v  @& u' u3 ]+ ]% i% k6 l' j
                .name = "user_led1",
# k7 l5 M- M2 w' B( r+ V                .default_trigger = "default-on",
( M. i3 Q* B3 K$ V/ Z1 V1 K1 Z        },
4 V& k  \4 `9 u/ h, j$ c" N  I        {5 y% j- {0 D( M# T9 b1 _1 ?
                .active_low = 0,! P( X( r" R1 n8 r
                .gpio = DA850_USER_LED2,
; Y- r1 C% X3 `  P                .name = "user_led2",
9 C  J0 ^! _" Z7 a                .default_trigger = "default-on",3 Q8 U# M4 L+ i6 M, m8 p6 U0 q
        },
4 w6 ?  N' U- y% r# S; s        {
' i) W1 z4 m1 d4 e% h( z                .active_low = 0,
" n# j+ G6 d& F                .gpio = DA850_USER_LED3,5 ^2 T5 o) }9 Q9 e
                .name = "user_led3",- t/ S& q! ?- J7 [( J& `
                .default_trigger = "default-on",
/ T  M. J. B8 w5 R        },
2 x+ E* W; M$ T% }6 G};* ~1 F6 }  c) g; b

6 I: S: }3 _! X( p7 ~static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
9 M0 ^9 p. `3 R9 e" a& @1 b- \        .leds = da850_evm_tl_leds,
8 r1 r5 U9 @- G" k        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
8 `" H& E+ _1 e: ^};
1 O6 n$ h( D5 x2 }! m* ?: I5 b$ v' Y" S) O8 y% K* r
static void led_dev_release(struct device *dev)
/ r+ `7 B+ h; a  o/ a; l: ?{
, \5 d5 A# X- O0 j. g};% `: V" @$ o7 W
9 W* Y" [$ u& W( S
static struct platform_device da850_evm_tl_leds_device = {1 A. k- v8 F5 S- A& R
        .name                = "leds-gpio",
% M4 R0 W! @0 T$ I. R& p        .id                = 1,
# ]+ g  K! w9 B, a% E* q" ]        .dev = {2 j9 A: k. w0 R+ x+ [
                .platform_data = &da850_evm_tl_leds_pdata,+ e' y8 ]- h0 Q4 ]7 e0 O: p9 R7 g
                .release = led_dev_release,$ W+ q* F# \* m/ ^+ n# }
        }- h0 g" K- h4 I# T$ z9 @1 d
};
7 F+ X4 V9 s& C2 ^* N# b/ e- x, k( u! z; `6 J; w3 R0 I2 D
static int __init led_platform_init(void)$ x2 X1 y/ Y; U" [5 z/ G+ j" r# ~8 X
{
! P+ i$ D4 A: j$ p/ Y' a        int ret;1 e7 O6 @* j& F1 N
#if 0
9 z# l* S; M( U8 E& K        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
; V" |* m6 @/ P% B        if (ret)% I, g& v( j! P" o+ _0 F6 D
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"/ n0 X' o' q  i) c* \
                                "%d\n", ret);
- i; s* i8 V# _/ o7 z# g#endif6 L/ I/ t# S$ C8 ?8 F& Y, D8 w' X6 ^9 L
        ret = platform_device_register(&da850_evm_tl_leds_device);
" G- }. a( ]* {, E; J" @        if (ret)
3 ?0 |. _2 d( h( m6 D! a                pr_warning("Could not register som GPIO expander LEDS");
6 W. V! j9 J' `3 T# V4 `" U        else* v& N7 L+ e% P( Z7 i% l% l
                printk(KERN_INFO "LED register sucessful!\n");9 u- z& o9 E0 N" t7 p! k6 O

% T# T  o& i" t4 [+ q( f7 j# d        return ret;0 d* H1 c! D3 S6 t1 u
}
8 K4 X6 n$ o/ }( w. q) ?5 d$ S3 c; H5 M6 R) s$ e. |
static void __exit led_platform_exit(void)
- u' W% Z0 ?& y1 u6 E{
6 @5 A/ c) M- r        platform_device_unregister(&da850_evm_tl_leds_device);+ ^3 [2 l2 P- P7 Y4 D7 B
/ y) S, \- b4 _; b% {
        printk(KERN_INFO "LED unregister!\n");
& A+ J+ E0 w1 ^( y8 Q}$ V* [! k# k4 C4 q/ f+ a$ F

* J4 [( a% r  M( V. J, wmodule_init(led_platform_init);
' h6 ?  x" j0 ?# y4 q5 ]module_exit(led_platform_exit);$ w* C) s/ T# {  J+ A  M
$ n9 y. t3 S- u1 M0 n- {
MODULE_DESCRIPTION("Led platform driver");
7 N1 e' R! }6 ~' ]; Q& O  B% }MODULE_AUTHOR("Tronlong");: P  [: M0 f% x4 X
MODULE_LICENSE("GPL");9 Y+ P6 V' j& Q
7 I& A6 ~0 ~% D0 E3 E# t: R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-11 15:52 , Processed in 0.046174 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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