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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
* k3 ^6 R$ y) y# @! I4 G#include <linux/init.h>
0 w/ S8 v. m8 O$ s5 u: ^#include <linux/module.h>
$ `6 E- u' t# T, x#include <linux/kernel.h>  i* ?# S, I$ d  T& b* F' L  @
#include <linux/types.h>
: D+ @) M3 |6 v; I9 _9 i#include <linux/gpio.h>
, b1 u6 G' L: B' U: P+ |( I/ ~" q#include <linux/leds.h>* N" i/ ^. I* d$ D$ w( D
#include <linux/platform_device.h>. ?  k9 I# U8 e; L6 X$ w

& f5 _/ }% B9 d  m, C% ~#include <asm/mach-types.h>
- ^+ C$ I: o1 j#include <asm/mach/arch.h>6 Z( @1 A7 n# L/ }
#include <mach/da8xx.h>
6 @1 T8 N& l8 H, v* A+ r#include <mach/mux.h>
( F& Y1 j! A3 N) A- U) j5 u, B5 P% }  t, o
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
5 W! q" {$ b7 ~: z7 [; f" G#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
9 w' u5 g( V) Z( v, C) f#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)/ d6 c, x: a9 g* D- Q! s  q6 J5 Z
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)8 t/ F- a% Q$ H2 C5 m1 C) }1 U
" H; c/ i' Y8 A$ ~. \+ m
/* assign the tl som board LED-GPIOs*/
* g0 ]: x: {9 Zstatic const short da850_evm_tl_user_led_pins[] = {; k1 O0 s1 x9 U% w6 I) j! A
        /* These pins are definition at <mach/mux.h> file */. A& Q+ q* Y. A" T* v
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,& a  v. ]: A6 j
        -1
* D# d4 b% w  l& W: j};7 E9 P  x4 A, Q

) d3 x% i9 D9 V- j9 u+ Vstatic struct gpio_led da850_evm_tl_leds[] = {
7 x; y* [) M# ~$ t( Y        {
4 E4 V( I: w- X6 W- \                .active_low = 0,1 y# p  \, f- T/ k- Q& h' _: E7 ]
                .gpio = DA850_USER_LED0,+ P) v) N' i# g" K
                .name = "user_led0",
# \  \" D: ], m, }/ \                .default_trigger = "default-on",
' U0 J- e; o! p% u6 F- J5 m# q        },& ~+ @( z. Y4 T0 B( K
        {/ h0 g" A. G- C1 H/ B
                .active_low = 0,  Q" f- f# ^- g# k! Q# T
                .gpio = DA850_USER_LED1,
0 s: Z" ~& w7 {7 }5 D* }                .name = "user_led1",' N3 }0 @& p1 S9 W; {2 r$ O
                .default_trigger = "default-on",8 h7 P! z, @& y  [: Q, B. H
        },
! d* v( D& M" A' K5 h        {9 r, V& t( U9 o3 S6 d
                .active_low = 0,8 Y8 N! c6 S: j8 p7 t5 S
                .gpio = DA850_USER_LED2,: Y# o1 T' ~7 H* k* I
                .name = "user_led2",
: }2 {" W7 e/ u! ^3 [  M                .default_trigger = "default-on",# S: s. M8 z0 [( y' M
        },0 |/ N8 Z2 @7 O
        {
, g) M1 e7 V8 B5 A3 ^0 Y) U7 o                .active_low = 0,
  [; P2 r. Y+ P2 l" _+ `" c0 |                .gpio = DA850_USER_LED3,
& e7 v8 x3 y3 Q7 z9 _  C7 ?                .name = "user_led3",. ^  C6 M' |  U) Q: ^
                .default_trigger = "default-on",
. v+ a0 o; I. X1 u        },
) u$ p& R& m) k( k% Y};
  Z- J7 v  V5 v) |- l& |
: n9 n6 I# j6 H$ p7 u7 T! t. D( n$ K) [static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {- N1 A/ W0 n7 R( B( \7 j9 Q! E; a' y
        .leds = da850_evm_tl_leds,& }) L2 @/ Y& d  O8 v  n
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),( _: H4 j# M; r  \& Z5 P2 Z5 d" `
};: H$ A8 N- w0 m+ v5 \' z

+ y9 |, x; N7 R. A4 x5 G0 \static void led_dev_release(struct device *dev)
/ o$ J/ c6 O3 R- G. C) ?- E{
& {/ A1 r  f7 E8 C5 L};
3 `% K. f. b" J- ?0 O; U
* K4 Q6 [3 K$ K9 A, S* \static struct platform_device da850_evm_tl_leds_device = {
1 ]' R/ b/ Q- A  j3 D, l/ c        .name                = "leds-gpio",
1 X, B/ [' r; ?        .id                = 1,- |+ m; ^  b1 I5 n
        .dev = {
! d, C$ p0 ^( Y2 @' A                .platform_data = &da850_evm_tl_leds_pdata,
- l7 v' S" |, p6 e/ p. h                .release = led_dev_release,5 M+ y- Q- J* x  b% r: B. F$ u" ?
        }( d; `2 |4 b3 O0 N" A- ?9 }" K
};7 x3 `# j) y  `

% L' P0 r; R5 f& Bstatic int __init led_platform_init(void)
7 {0 h8 [( s) B' T$ j/ G, F{
$ C; b: n! I) A' N* X        int ret;. ?+ X# X' M' t. @: Q; N* {
#if 05 w  z3 b0 z( `9 |
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
$ r8 a6 J. b6 u6 }- B$ T        if (ret)
; d9 Q7 q; V1 Y                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
1 X8 p6 u' W1 N( o2 U                                "%d\n", ret);/ \( I$ U  ?- S9 w6 ]0 a
#endif
0 A4 n, j1 g& r: z) @% B4 ~        ret = platform_device_register(&da850_evm_tl_leds_device);
! B- K+ H# l  d. u0 d8 l        if (ret)6 Z8 ]- O) F% r) b. z9 A3 Y
                pr_warning("Could not register som GPIO expander LEDS");! f+ w. R- g8 `. i& d
        else
% ~! U, |. t" g: B9 ?. N                printk(KERN_INFO "LED register sucessful!\n");
. X) V5 g$ Q# A/ @2 T  f) n* y# k! P* o9 J; u- \
        return ret;) ~! [4 N3 Z  l4 t! d
}
7 Z  z) T- V$ [5 M; `& K: z
% V; T  J+ D( {6 Mstatic void __exit led_platform_exit(void)
2 w3 B& h4 v% r{
- r5 w& E6 V# s        platform_device_unregister(&da850_evm_tl_leds_device);
" Q4 L0 A; {4 c# m% ^3 J  B3 ]% u
% V$ O/ H7 k/ z. G2 j& E0 T        printk(KERN_INFO "LED unregister!\n");
6 v5 t, i+ p! S: V* j}
+ J: M" X% `/ D, X; q  [# P; Y; A* H( h" N* h9 |
module_init(led_platform_init);
1 t( _8 Q1 w5 _module_exit(led_platform_exit);
! i/ _' K3 }5 K8 N; t4 Q* N
/ ?( @1 K% v; C' xMODULE_DESCRIPTION("Led platform driver");6 \8 @, D& F8 F' n2 U4 H$ E0 t& @" S
MODULE_AUTHOR("Tronlong");
5 e$ m/ {" ^5 Z6 m- c& _' @MODULE_LICENSE("GPL");  P; c' w  x; I3 N& S  o
: A3 O1 t8 u( n7 e8 T& a5 g+ u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 16:16 , Processed in 0.039141 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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