程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。5 _' M; v& \( [) c, W! O9 _
#include <linux/init.h>& _, y2 L% _+ }# `5 f
#include <linux/module.h>
; t& `- H3 V6 |0 i#include <linux/kernel.h>2 |+ r4 U) n! U) ~3 v( x+ t5 z$ @( ^
#include <linux/types.h>
* d3 m5 j. Y$ B6 ^3 K' K" x#include <linux/gpio.h>
$ i. H0 _" L; n$ [* V+ k& I/ x9 K#include <linux/leds.h>
+ w% E4 w1 a: V- U$ K: r#include <linux/platform_device.h>3 Y4 x$ [5 x. W$ j8 R, q* J
. L. L/ g# E' ?0 j; k: `# r
#include <asm/mach-types.h>, |( m$ c0 a7 N' H$ g0 Y5 W5 W
#include <asm/mach/arch.h>
! u: M+ v  z9 j- I) y8 o: p#include <mach/da8xx.h>1 J% _7 Z/ x4 s1 k% L
#include <mach/mux.h>2 x" b! V; B. [0 t8 U! t  O7 M
. l( {; L) D, s9 @& T. T+ ?  K
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
* K  Y# W4 K7 }+ s3 `& z! O; o#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
7 ?% ]2 P/ l4 ]& e2 p* g8 P# S#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)/ T' y; u: r% t1 y2 |
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)0 E. W3 x  F' V( {" T8 e; x# b
( z2 F- f6 M* g! L
/* assign the tl som board LED-GPIOs*/! [  h! x2 ]- @8 H0 |* q2 n  k
static const short da850_evm_tl_user_led_pins[] = {
4 u( `; l6 Z0 |7 ?        /* These pins are definition at <mach/mux.h> file */  W4 }5 {+ c3 }7 {
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,3 v0 Y3 |6 q1 {" S
        -1
. ?+ G9 O4 ~! N6 \- K};
! W! x8 {- M; t5 N: G0 p: V% ~/ i8 Q; L# q: j' M- ?
static struct gpio_led da850_evm_tl_leds[] = {
8 H8 V2 J- a. S9 Y2 D( O        {
1 I$ \- |, M5 Z# ]. I                .active_low = 0,9 F& H) N9 C+ f! T" ^% s
                .gpio = DA850_USER_LED0,
; W3 a' f! n8 {/ _8 k                .name = "user_led0",
( ^3 ?  ^% z( x9 _  T- r                .default_trigger = "default-on",
0 h5 |9 J" i7 Z        },
) q% e/ q) Q5 D' w. W( k7 x        {6 c* ]  t5 \/ A  `
                .active_low = 0,- a5 K* O6 R: `9 J
                .gpio = DA850_USER_LED1,
3 f2 D; G/ M$ z  R                .name = "user_led1",$ f8 c& h  [( `
                .default_trigger = "default-on",; M4 F* b% d$ w+ i5 h6 Z& Q& u1 ?- c2 C
        },$ `, z2 A8 }- j8 o
        {
2 {  l4 i8 U4 B7 n/ c1 {9 L                .active_low = 0,
- j6 Z9 Z2 ?( m, X" v1 G  S5 [                .gpio = DA850_USER_LED2,; @1 H* m7 t* \6 ~$ G
                .name = "user_led2",
" S7 C' [# A4 b7 g& t                .default_trigger = "default-on",
  l$ l7 i# Y: j+ m0 T* F        },: @5 R9 `# r$ D. G
        {
; \5 g1 @' y$ Q* [1 I" T                .active_low = 0,
. S+ \: M8 D' `+ }& n9 y! t+ ?6 p                .gpio = DA850_USER_LED3,0 f, _' X4 W: D* `6 J4 n5 e: @
                .name = "user_led3",
# q- c- k& U/ A                .default_trigger = "default-on",
: z3 G- Z( e6 w        },* }& v" O; T- v% _7 j
};5 M0 G$ j2 n: m* e" F! n% j
: K! j. ~3 D# ?3 ]6 f( a, x3 O
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
& ~: u( c; z+ x! P( A/ u        .leds = da850_evm_tl_leds,! `3 ]% m' }; m6 f6 _
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),. q4 B" O/ q: ]) f+ M* [0 N
};  `% G1 Z$ I! O0 A% X
5 h( J0 F- k0 j, @; {# Y
static void led_dev_release(struct device *dev)) G/ V0 O4 q& I+ l% p
{( x0 ?. a7 V3 o
};
% M1 `9 n1 z) z1 a+ q4 o2 p# a) E* p0 K5 z
static struct platform_device da850_evm_tl_leds_device = {
5 R3 Q2 Z, q  a5 T0 O        .name                = "leds-gpio",; V1 y, P) D) l' n, A( q5 g' T
        .id                = 1,  b- S! |, \8 |8 a  S# x0 F
        .dev = {
! W+ x* k% r* J$ [4 [/ t0 ?5 i3 _8 e                .platform_data = &da850_evm_tl_leds_pdata,) o& V1 _6 P" ]" U/ x, K$ S/ B
                .release = led_dev_release,& U( e8 E4 n0 S0 }
        }2 g6 Y# e* M1 X" p) L
};
5 \- m! `2 Q" i: m
$ [9 K6 O; }7 h3 dstatic int __init led_platform_init(void)
& ]$ y- |. ?9 @{0 {" y" V% o3 U0 j9 m# e
        int ret;
+ z7 U- k; s4 O6 ^#if 0/ r- m6 q5 ^3 v9 U
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
  }1 [$ u9 S& [        if (ret)
( H9 m, L6 D0 g' V1 Y0 ^                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
: ?2 D, h* L+ N" ?/ _. W                                "%d\n", ret);
/ g  q# J) B! i0 X$ _" \#endif( L  q; t& d$ B; `* @/ D7 }
        ret = platform_device_register(&da850_evm_tl_leds_device);/ s+ ^9 K% I* |( `& Y6 t
        if (ret)  {$ N& D1 @. d5 O; P& D
                pr_warning("Could not register som GPIO expander LEDS");( H! K, {2 d" g* @
        else
# b+ A( j3 }& t$ q/ A                printk(KERN_INFO "LED register sucessful!\n");
3 Z, |  {0 U2 C! m% V5 a( r2 A
8 ]  {/ h+ p4 ^+ m+ U$ ~8 I        return ret;1 W/ F$ w7 w# f( u) v& m  f
}
# x$ m5 Q) x) _) |1 w& M' ?  v$ m% ?) y# H# Y. K! n" f; C
static void __exit led_platform_exit(void)6 t! t" O( W! |# C
{- C3 C3 N% [% L# G
        platform_device_unregister(&da850_evm_tl_leds_device);/ E" ?- l/ Z) @

" Z6 \" s' v- p& n9 \        printk(KERN_INFO "LED unregister!\n");  g3 [9 w$ a: _* P+ k1 ^! A2 T- J
}: }. A4 k3 u3 j( P. Y" o9 s0 W7 H" T
0 c( ]$ T1 D; i1 E0 u; ~
module_init(led_platform_init);
; U5 z5 H/ C+ |6 I0 {module_exit(led_platform_exit);
' J6 P4 C6 Y, C3 Y, }- q3 `  L  k* W
MODULE_DESCRIPTION("Led platform driver");
6 t: c% q) M4 jMODULE_AUTHOR("Tronlong");+ @! a$ ~& c4 c5 G; V; W/ v
MODULE_LICENSE("GPL");
/ V% v4 Y: U/ H0 a# V+ t" A: n# `- q  V% L: g: j; W: y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 14:27 , Processed in 0.036858 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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