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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
( T4 z8 u+ _* W#include <linux/init.h>
& e1 ~. g9 m0 B% c$ V( k( E' \#include <linux/module.h>
7 d+ J  y- n) l8 ~4 F  }#include <linux/kernel.h>0 x! R! f( Q( }* f9 \' g# Z
#include <linux/types.h>
7 ^! n3 o0 y" G9 K#include <linux/gpio.h>
; W3 L& k5 r6 u7 a! V6 t" d, y#include <linux/leds.h>
' F* z/ D# E/ K; c6 n#include <linux/platform_device.h>
+ f  V& \. o3 E3 F0 S* \; }9 D, Q& l8 f; w7 v4 A( T0 k
#include <asm/mach-types.h>
% i/ C  Z0 ]) Q8 ]. ^* F#include <asm/mach/arch.h>! A1 r, ]2 K# U3 f: G
#include <mach/da8xx.h>
5 L9 K4 c9 m4 |8 ^0 t#include <mach/mux.h>  X2 V% X, W$ o- }

; n: I. f: Q6 u! G4 J) c8 p#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)( J* H* J6 s) L1 O, p1 p
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)6 f+ Q" R" \1 q8 }0 ]
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
) x  g% r8 Q- Z! @#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
$ q1 @, z$ ?3 t& V: O" o# Q$ |8 k& r. U, I& c! _
/* assign the tl som board LED-GPIOs*/
" P5 y, s' w" J, ~# Z! tstatic const short da850_evm_tl_user_led_pins[] = {
0 Y% I  L, U  I  l9 s        /* These pins are definition at <mach/mux.h> file */
# d* S+ r* e$ u) E* n        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
4 E+ S0 D7 e- f- V        -1( p/ P1 x; n$ q; A* H* F
};/ x; A! h1 c) |7 K) N

0 Y0 Z" f1 h  D. R2 nstatic struct gpio_led da850_evm_tl_leds[] = {& z0 d% Z; P- k3 |5 l2 S6 J
        {
. t8 o8 u$ Q0 e) G# ]! x, u                .active_low = 0,
( t8 I; M& |& D8 d5 N                .gpio = DA850_USER_LED0,6 `+ f: Z5 i3 I' N# d: y
                .name = "user_led0",6 L5 t6 X2 e/ E5 d2 s# K
                .default_trigger = "default-on",
; ^" m! ]# {2 i        },1 x/ S& y- y, [' r0 |, K
        {
/ i' n/ U4 ~% X# D3 s                .active_low = 0,  y, _2 [4 ?) J. c
                .gpio = DA850_USER_LED1,/ V. L5 P' a7 ?6 \- V' ]
                .name = "user_led1",
; v( [7 t' n* }' Y" x$ r5 L+ p                .default_trigger = "default-on",
! e& _' |3 d  R5 g' E        },
0 i: x( {) h$ w# Q. q4 u) z, d        {+ w) p- R, }+ R5 w. n" l
                .active_low = 0,  ]9 l4 X2 U4 P8 t; z* c. r" F
                .gpio = DA850_USER_LED2,
: |7 Q( J& S& y' r+ _. v                .name = "user_led2",' a: Y! X) H; F! A3 s7 V  J, u2 }
                .default_trigger = "default-on",
$ Q3 }+ a8 T- t8 J/ J% e        },6 y4 C; M: N% q. w+ {+ S! r' W3 j1 X  i
        {0 z! ]1 w# O. n% x2 w
                .active_low = 0,* U# B! |  M/ f( e* l0 p# ?
                .gpio = DA850_USER_LED3,
& P/ [% ~0 K, M                .name = "user_led3",4 V- u3 r4 i, o9 Z- U: I
                .default_trigger = "default-on",
- _% ]' \# N" Y" ?0 W5 D        },
3 V% R* p( p* d% m};
0 y5 y6 s" j; b* x
- {7 r( b% e8 p5 Bstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
  a8 e- a' M1 D  t6 S$ d* v        .leds = da850_evm_tl_leds,1 O* Q6 c/ E/ t( j" N7 L+ E
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
( j. H" d5 b& s};7 {: {* w- P0 O# q' ]7 X5 r7 q+ r
% t+ B8 |/ I% Z2 ^
static void led_dev_release(struct device *dev)- W6 J8 c. Q% q
{
$ \: H- U  ~) F) h( n};/ [/ h; L/ ]6 J7 B$ N' e
5 U) c+ I- o5 Q: v+ R6 h9 Z0 J- r* T; t
static struct platform_device da850_evm_tl_leds_device = {
* _3 |! ?' {& L4 `  u% B+ }        .name                = "leds-gpio",. a* X) A( z6 a3 u; _
        .id                = 1,: J1 o, s/ H6 U) `# |% W! F
        .dev = {7 O! S( A2 P* Q
                .platform_data = &da850_evm_tl_leds_pdata,
  g9 ?  E: ~, m, s, F                .release = led_dev_release,
5 {& r9 n4 |3 O        }  B! N' o0 c' @
};
0 o' L. K" R6 f" y# _/ s
) q; M4 j7 r2 Lstatic int __init led_platform_init(void)
8 @5 I( f* ^' e3 r# Z$ o. E{
$ `1 z5 ~6 T  s4 L. i        int ret;
  J; @& ~- T+ b4 ?, K+ ~#if 02 k  K. u+ U; D/ A4 O, Y& \
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
  @+ g' J2 v5 V5 L# X/ `        if (ret); |8 x2 a1 `  x% q) m
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
$ G9 Q# d' O# h1 c+ j8 f0 M, V                                "%d\n", ret);5 s5 g1 ]; s) o4 [& A$ j7 q. t  m
#endif( W/ a/ x# k, r$ ^  w: p2 k; }
        ret = platform_device_register(&da850_evm_tl_leds_device);
& M5 i3 g$ s  E/ b6 o) x        if (ret)
& y# Q. Z6 N# v( r9 X                pr_warning("Could not register som GPIO expander LEDS");
5 e3 m# N: q! m: d5 m        else* P  l0 J& L6 g0 O% S, e! n
                printk(KERN_INFO "LED register sucessful!\n");
  J0 x  U; E" Q  Z( P3 B  r2 S0 _* z& G% F  ^& C, r* d2 a8 _
        return ret;
& C9 _; P# o0 p! f7 Q: ^: ~}
* w3 T4 _& `$ r5 X  S! b
( `' [0 j$ ]" F6 K- O; Istatic void __exit led_platform_exit(void)* J2 [3 |5 C  a! q% e2 P
{! b: E8 V, w: ]8 U; R- {
        platform_device_unregister(&da850_evm_tl_leds_device);
. l+ u3 l; k7 ~/ G) q' k; J) K# n8 A8 u7 V5 t4 M
        printk(KERN_INFO "LED unregister!\n");
& c3 P5 a! E( }$ A7 F4 |! E8 y}
# ]) g4 N% d* A* M
  p3 B! b( e8 e/ p/ }. B9 t, h, Hmodule_init(led_platform_init);5 N6 v0 Q. c% I! y' n' f, ?* A
module_exit(led_platform_exit);
; M' |- Y* o# r+ i" L6 c* I5 N4 s3 t# f1 |* H2 a
MODULE_DESCRIPTION("Led platform driver");) u7 D/ x8 H* K1 ]
MODULE_AUTHOR("Tronlong");: u  R/ t3 i7 `. ^' J$ s
MODULE_LICENSE("GPL");# G7 s. f( N( K/ ]& ^3 @& t0 @7 k  k
' {* Z9 }- p, j; m7 t' ?* P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 17:16 , Processed in 0.043275 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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