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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
. X7 k3 D. H' F#include <linux/init.h>( N# k- h6 A4 R1 i' }
#include <linux/module.h>9 r( u$ w5 T+ }8 E$ ^9 A
#include <linux/kernel.h>2 D  x  c- f& K7 h$ H
#include <linux/types.h>
5 O$ _2 p  a6 }, L#include <linux/gpio.h>
2 d2 T! x) H. j- T& {#include <linux/leds.h>% s* R& v$ t1 J5 s4 w  `/ ?# O
#include <linux/platform_device.h>
8 D4 V3 x- N) N: P) _$ w" d/ T1 N! x' p# i# U% x& h9 j
#include <asm/mach-types.h>
+ J. `/ m8 Y4 B2 G: P; X#include <asm/mach/arch.h>, f0 Y  _! N" c- X- ~
#include <mach/da8xx.h>
1 a# J$ u/ H% Y#include <mach/mux.h>
$ I: `; P7 z9 n1 `% v$ T5 D( V! ^6 Q1 P/ D# f6 |- l8 V0 w. E
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
* F0 ]6 ^/ Z, n; [/ P$ w#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)1 p; Z3 U3 Q7 q0 A8 V
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
. w* h( ~+ s1 Q6 T5 {#define DA850_USER_LED3        GPIO_TO_PIN(0, 2): W% T0 l3 B+ v' I! F* a
+ R1 x& D2 S" ]
/* assign the tl som board LED-GPIOs*/
) f4 Q8 N/ h3 V9 \' h6 T0 w- H. N0 Vstatic const short da850_evm_tl_user_led_pins[] = {
4 y# @: r: X2 h6 ]4 N: O        /* These pins are definition at <mach/mux.h> file */
4 n, I" ^+ c/ V8 B& C) o+ K        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
2 M/ O, D" N  o+ D2 X; p        -1, V5 t* p( f3 L* ^' [
};8 o# u# a2 Y8 G8 J
! }6 c: a& e* W3 o: I# `2 _
static struct gpio_led da850_evm_tl_leds[] = {
( I9 U) w2 w5 Q2 ~        {3 y* A! z. ?8 l) s) v; d; i
                .active_low = 0,# R! E$ b0 @- V: k
                .gpio = DA850_USER_LED0,2 X5 v+ J% E; a9 \
                .name = "user_led0",
0 A& V" x0 J: I3 ?% \1 t                .default_trigger = "default-on",
, Q9 Y3 g5 Y0 C        }," f' w4 a$ G; g6 t+ u2 w* R& u) `
        {# Q/ m5 |1 b* {$ G
                .active_low = 0,
; H4 G. ]: Q& F0 P! C8 }                .gpio = DA850_USER_LED1,
3 f# C* a! {: @: T' y8 y                .name = "user_led1",9 f3 k0 ]# d, @! P
                .default_trigger = "default-on",# P7 |  m. Y/ j4 U$ a  J& s$ v* q
        },
5 }/ G" N; z3 v/ g* }5 M& ?& w; {        {/ i2 q) W4 D7 Y- w  v! ]2 t
                .active_low = 0,
4 [1 B6 @! _6 p0 D& x+ I                .gpio = DA850_USER_LED2,
( g  O$ z6 F, o- V0 {! N                .name = "user_led2",
: d& W$ k; w3 c                .default_trigger = "default-on",
" v' ^) C  i( z( x        },! l$ m3 n# q& i+ R0 m/ I9 `
        {/ [5 Z4 z! k; c
                .active_low = 0,% @( q2 d- ~/ X1 J3 F
                .gpio = DA850_USER_LED3,( ?$ c0 v# U1 X) Y
                .name = "user_led3",3 w) T& j2 n+ S& e" X7 Z5 _" n
                .default_trigger = "default-on",! M0 n. t* M7 F& m( _9 Y9 x
        },
; I7 V; R4 G0 O: G1 |};1 j2 E' k+ u/ H9 N
% u) I6 {2 O0 v: ~
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
% y) O  l6 f" [8 c        .leds = da850_evm_tl_leds,8 S+ N' P- t) Q) `% a. N
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
% o5 T7 X8 G. x+ i- h* \};2 q+ v5 T. G: h. E! i. C- C

; y4 I2 j6 J% V2 d. Wstatic void led_dev_release(struct device *dev)2 _; z0 D; b) ]- c( e8 y5 [8 z
{
& q" h0 W) l% e6 Z};
) R6 [& O. ^: w; f8 l
3 e- B) G9 s- T7 b8 {9 Qstatic struct platform_device da850_evm_tl_leds_device = {
, U1 w) M% N# r" t+ t7 Z        .name                = "leds-gpio",2 z1 m# n3 p& w# i$ c( v4 i
        .id                = 1,
/ B4 {* V$ \; J        .dev = {) T9 O5 f- v2 `, I
                .platform_data = &da850_evm_tl_leds_pdata,
" y' b/ J$ \6 C" c1 Y) B5 }1 L                .release = led_dev_release,8 r* r, x5 E! N2 A: p7 z- c6 y
        }
/ T$ k) u9 d1 j3 a8 E7 x};- F0 j1 m* z3 L; h; C) p

, {, ?+ P6 h# r2 f3 z5 N; U  Istatic int __init led_platform_init(void)
8 B. s% o6 X6 q  M{
! m; B8 b5 U' q' t        int ret;
1 u( G6 @& L$ D: \# ^#if 0
+ k( r/ K3 D% P, J9 l) [        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
- g/ }4 ]- a( z8 I: y' q2 b/ v7 t        if (ret)' {8 Q/ [; L5 G- C( J" Z
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
3 r4 a4 F# d0 l: @% R' @3 F                                "%d\n", ret);* I; c) |/ b# X% u
#endif. C4 r% W& S4 X' w) B) S* J
        ret = platform_device_register(&da850_evm_tl_leds_device);8 F* T5 h& n" ~0 Y* @
        if (ret)
) ]: E+ b* I7 t' I. O                pr_warning("Could not register som GPIO expander LEDS");
) ?2 n) |( ^$ ~- u, ~) W        else
" k: E0 V% _& D$ b9 V                printk(KERN_INFO "LED register sucessful!\n");1 @" C# B' k& F  ?$ Z3 e+ E

! i3 O6 y6 H1 ]0 ^& W; o        return ret;) @& S1 Z7 N# v0 C; I+ a! d
}. i9 m" j4 k$ Z5 R4 s) \: X

$ _- a4 a; g' C; g" u% Ystatic void __exit led_platform_exit(void)) l; H) D  m4 o  |
{5 _2 K  s7 c& U  X0 k
        platform_device_unregister(&da850_evm_tl_leds_device);
! V# O2 R: i# C8 T% w
# Q- e! g- F) O( e5 [        printk(KERN_INFO "LED unregister!\n");3 B) w3 Q7 D% w. R6 L% z' |
}& l3 R- u8 A+ s* H
! ~9 |' ]" h" ?( p7 ^" f0 A
module_init(led_platform_init);2 G0 A" P! O  o$ J* r; M6 c
module_exit(led_platform_exit);" j. l3 {" r; x/ M, A8 S3 V2 U
3 e/ J  d: y" O4 ~& s8 n- m
MODULE_DESCRIPTION("Led platform driver");  z, @# r$ E1 s, o
MODULE_AUTHOR("Tronlong");
9 A* A& ]! |. f  L7 `& l8 oMODULE_LICENSE("GPL");
: O5 D1 ^* x; ?; w3 y1 M: w& `/ y# D) {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 18:40 , Processed in 0.038817 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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