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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
& Y" {6 X; z, A8 O1 c#include <linux/init.h>7 L* L6 V! P+ A: f9 @$ }
#include <linux/module.h>* X4 G0 d) U7 ]) N; x  I! |  f
#include <linux/kernel.h>9 E) M3 R3 J. o2 J8 s
#include <linux/types.h>
8 k/ N3 W: T+ s' k2 q% O3 ^4 m#include <linux/gpio.h>" p4 x# P8 V$ y- h, {
#include <linux/leds.h>( ^  x& R* E( K1 w
#include <linux/platform_device.h>
4 f/ {  \9 G* P) y/ [5 |
4 t2 P' s1 _# n4 E  M#include <asm/mach-types.h>& ~( c7 S: R4 {& G  _0 x- S! M9 p
#include <asm/mach/arch.h>
+ m; _# U/ e4 ~- l1 }, u, w#include <mach/da8xx.h>' S& M" v* U( T+ e. b6 E0 ]
#include <mach/mux.h>3 A& \* B! J" l6 v. T8 \
  ?0 A7 C" e9 S4 b
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)" m  f$ i9 N# A8 A& A1 u: y
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
% N2 A# b% Z- K3 _7 i+ \#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
1 Y: r5 p/ M( a1 s#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
; I8 L& C8 N6 J5 z* H$ L; K- ~# }9 L' Q+ @
/* assign the tl som board LED-GPIOs*/
" B! \0 d8 @% V3 h3 ]% }3 }static const short da850_evm_tl_user_led_pins[] = {- l/ d/ u- V! n8 x7 }6 t
        /* These pins are definition at <mach/mux.h> file */  D0 p2 G% D. w, A; I# K* e' |
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,4 n( P4 a+ H) Q3 @: K
        -16 ^* m$ {6 Z. ]' i, I* B" j; e0 ?
};9 h6 K7 n$ d3 a

8 s: I' k' l4 [$ }9 ~: Sstatic struct gpio_led da850_evm_tl_leds[] = {
, s- a3 N+ j2 V" A8 x/ V        {
) ^' e* ?+ S$ k+ R6 n# H                .active_low = 0,
) n4 o7 s: w7 _$ s& k                .gpio = DA850_USER_LED0,! ]& q$ d- v$ ~( _* ?# a; K# t' w9 V
                .name = "user_led0",
, L9 _; j- n. I4 v* o" g                .default_trigger = "default-on",
9 B' @* l( C% m* R& p        },  }/ m+ V6 \* b6 Q" I
        {
4 P/ B* a' \  i                .active_low = 0,
# W  b) x6 U) j" n                .gpio = DA850_USER_LED1,
9 }: k$ V9 p; X7 o+ |  f9 L5 d                .name = "user_led1",
. N8 V! Y/ K# h$ t6 M+ f" R                .default_trigger = "default-on",+ L! ]1 Z- d6 M" y5 K/ F, L
        },- \3 i+ |- V& U* p2 z: C* f  f
        {
  }7 H: ]: s$ C                .active_low = 0,8 N0 F8 {& U: m* N; E
                .gpio = DA850_USER_LED2,
- Z5 \, M! E! v3 N5 v                .name = "user_led2",
& b5 w8 \1 T" z( ^: _+ \                .default_trigger = "default-on",, C0 r/ b# Y- P& [% v
        },
1 g; l% ]: L7 I% n* f: i        {
6 k) C& Y5 E( F( a# T                .active_low = 0,
: l% b2 ^/ a! ^2 y2 I                .gpio = DA850_USER_LED3,
4 n) L' ?5 z2 Z- |  B* w                .name = "user_led3",
6 |7 y# Z5 T' G+ K; E" p                .default_trigger = "default-on",
& u  M3 u4 ?; C4 R        },
" U  X" G$ ^3 U};
' I: |( m9 @* T7 V$ C/ B' l5 b" `8 M1 ^5 w. S! h
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {1 Q6 e1 r0 k9 |" o
        .leds = da850_evm_tl_leds,
! }+ S8 o) ?. {7 Z5 M* j8 g) e, J        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),- a; f' \  U' e  w5 X% M' g
};
2 i9 J, ~0 g+ e) J$ F% m: W
  |/ d+ ^. T; b# Y; ^5 R0 K9 a; Astatic void led_dev_release(struct device *dev)
7 h- ?" I1 }4 D0 [- U7 V{
# }# L1 G" {8 Y$ e};
" G0 h2 D( F3 ^- @. D. D0 M( t9 c. g1 \2 f9 q: \. A
static struct platform_device da850_evm_tl_leds_device = {" t. s# C6 m7 ?5 i1 H
        .name                = "leds-gpio",
; L( ^) V" G% L        .id                = 1,
, _2 `5 V4 w8 s5 _- A8 _' W. g        .dev = {
, d5 \- w7 e2 k. K6 ^7 Q" J                .platform_data = &da850_evm_tl_leds_pdata,
; H$ |4 ~' ^$ g1 J3 p/ J. I                .release = led_dev_release,6 j% \7 S1 C2 p" h! m
        }9 ^, m" M( H0 Z) y3 \$ `
};
1 Z/ i' R6 c. T' q# t" e8 v& s1 F
# z: u$ N# Q  L& [: P  U+ p  ]static int __init led_platform_init(void)
8 E# e2 p" S8 Y2 j* E4 V8 V  L{$ D7 N  H4 R! p% C
        int ret;! b. ^3 p5 ~" \
#if 0
% `2 d8 t/ x4 V$ ?- j        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);7 f+ V+ w6 o& x8 b0 r4 ?0 {
        if (ret)6 y/ [! v1 X, T* t5 I
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
  u, V% w% |! R& U, e8 ~' Y                                "%d\n", ret);+ I$ H$ e. M! o" @: S0 l7 {
#endif9 j! u, r; |& q$ c# V
        ret = platform_device_register(&da850_evm_tl_leds_device);
# s5 S/ R3 Z2 w: d        if (ret)
% z7 H" a  X3 `' p  l2 G                pr_warning("Could not register som GPIO expander LEDS");
! M! a& F2 l" y, U6 S; j        else/ S  P9 I7 s+ k' s% J7 T  z$ s! T
                printk(KERN_INFO "LED register sucessful!\n");
7 M' v0 u  u+ d$ x* V  a' C
5 S* [. c) [! ^: \6 {        return ret;3 p( {; ^. Q% O; y0 i6 A4 u1 \
}# z  M& C" _8 P2 E( ?& G* r

. x; \! X/ q! F+ Dstatic void __exit led_platform_exit(void)
$ c9 u: E: z1 q{( j# R6 r+ }5 c
        platform_device_unregister(&da850_evm_tl_leds_device);) e( P; \" _  V6 O1 X  D
8 S: s% h' `( i4 A& M/ E. P
        printk(KERN_INFO "LED unregister!\n");
3 W0 R5 x. j6 {9 c7 y" b) g, B4 Y}
! G4 ?$ ^7 j0 W8 r
7 L$ _) i( t0 t  ^$ D+ G8 kmodule_init(led_platform_init);8 m, h# g8 T0 K2 y; h! W6 M% _
module_exit(led_platform_exit);6 {- _" A0 A( @) F* {' D
4 B* ~5 C. h& j% \4 Q1 s
MODULE_DESCRIPTION("Led platform driver");
5 }0 s% w8 _: n1 H1 q: kMODULE_AUTHOR("Tronlong");
+ m  d" J8 m2 n$ Y% c+ I2 ^MODULE_LICENSE("GPL");. X9 I* W" S1 W4 m" g* V& c
2 M9 q& s0 r( Q3 {) W% ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 07:36 , Processed in 0.040128 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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