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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。) ^: R* D  V8 I2 w
#include <linux/init.h>8 q6 q( O2 }9 l* n+ r
#include <linux/module.h>
6 c6 ^, A( W; l% K0 X: P- w#include <linux/kernel.h>5 P9 E* P( m5 y
#include <linux/types.h>! b+ {/ E. ]  h7 e& y
#include <linux/gpio.h># a! k0 k8 R9 k7 z3 U+ m
#include <linux/leds.h>
% f* y$ c4 ^2 z" K, J#include <linux/platform_device.h>9 J( P  W9 C+ ^: v+ l

  D8 Y, W" v: W) Z#include <asm/mach-types.h>2 Y1 Q5 h( z4 E: T
#include <asm/mach/arch.h>: m3 L$ m, r. h& @7 G
#include <mach/da8xx.h>$ M, p% I. e- S3 a7 D
#include <mach/mux.h>( f2 D7 s  @+ ~1 L- S

6 C( s6 \! `% f" S#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
6 K# D5 c$ H$ |7 v#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
7 o" T. w  _# R8 J" p3 n#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
: L; Z: s$ ^9 j. }6 `#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
* X; D6 m- y+ t8 r' h4 S7 }- J- H# {3 ?) L1 T
/* assign the tl som board LED-GPIOs*/; l6 }+ J. d; C0 a
static const short da850_evm_tl_user_led_pins[] = {7 u4 ~, T$ A+ b  A/ Q& {+ ~  @
        /* These pins are definition at <mach/mux.h> file */
" T# [: X5 k: o        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
9 B; B0 G& J, `2 L9 O# g        -1
  B& m& X: }9 |7 v};  R6 z& h; r$ i1 w
* d  e5 q2 i" u7 w
static struct gpio_led da850_evm_tl_leds[] = {
: R' D3 k/ q% ?- d0 F- ?( ]        {2 {/ T; A( s+ Y+ E4 Z
                .active_low = 0,
8 m. F% {% n  ]                .gpio = DA850_USER_LED0,
% P6 z: T# l& e" k; `, I! w                .name = "user_led0",
  v# A" Z' [& l( y6 P! P( ^: W8 @                .default_trigger = "default-on",3 x3 |0 k. n* k0 [4 ?' \& e
        },
3 ]- X, K: o+ g6 g# K7 V1 M        {
1 Z5 z6 d/ g3 p( {                .active_low = 0,, n) x  [. }# o% U7 a
                .gpio = DA850_USER_LED1,
" I' H  G, i& C7 h                .name = "user_led1",+ ^4 D5 n( _  Z5 ~# P
                .default_trigger = "default-on",
0 d* O3 X5 Q# ~6 ^% k, S        },' Y- O% T7 b: @; ?+ W0 A/ q4 ]
        {
/ }: _+ N) N: w4 g2 S. k! m                .active_low = 0,& K7 Q5 O& l; u; K/ y0 ^4 o6 F
                .gpio = DA850_USER_LED2,
: I1 Q, ?/ Z) d  Y- r8 J                .name = "user_led2",
) m( v, n1 V) f                .default_trigger = "default-on",/ i4 j: F$ {0 P% z( I; l; d
        },
/ K* P* _# g1 I$ M. W, p        {
1 j, e3 Z+ }8 T0 r                .active_low = 0,
5 d  D1 m. s# R$ `                .gpio = DA850_USER_LED3,
1 B$ m, Y8 ?$ |: }                .name = "user_led3",! k' v3 @: L8 Z! t
                .default_trigger = "default-on",
5 j- @' p0 s( T- g+ A        },
$ y) Z+ W4 P- n3 w};: `7 L8 S5 F% R  g/ ?

9 E. Q% P' A) |  C" Vstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
3 h) _& D8 b; \( q  M) f        .leds = da850_evm_tl_leds,
2 a+ z/ L& i2 u' `; u        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
6 Y4 @- P; t" n0 \" t- J  L. }};1 z4 {7 q3 b, ]0 u
# Z% \0 k, Y% j/ z  p* J, q
static void led_dev_release(struct device *dev)
6 M+ J  ^2 V" A{, t, d" \9 \7 G7 d
};
) Y" D8 D$ Y7 D0 D; G' l( d! G
  i7 t( C1 f. R4 v& e; Tstatic struct platform_device da850_evm_tl_leds_device = {% ~/ o& o$ a! Z. {
        .name                = "leds-gpio",
# a5 x" ]& X. v  Q        .id                = 1,
1 E6 p' B' z  p: u0 {5 J        .dev = {4 k' p$ q$ W' @5 ?% y
                .platform_data = &da850_evm_tl_leds_pdata,+ C1 k+ f2 [; ^" a
                .release = led_dev_release,. r9 a' ]% }) Z7 M8 _  f/ A
        }( I' C2 U5 H6 N; E7 W
};
8 w; o1 [! x5 F' \  m( ^% A3 \: R: @9 k; p' r9 Z& z
static int __init led_platform_init(void)0 [8 e* W# a, }; N8 T
{
' y. J2 |7 q. N( V8 E8 C        int ret;
# [9 M; }4 C0 ^#if 0
# \1 P" g! D" O+ b) ^        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);) G. H5 j/ Q2 b7 C6 f3 h5 M
        if (ret)) N1 W4 o8 A- r6 s" N) M; p, g
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
7 N6 P7 t" G, v& N* M% u% V3 Y, o                                "%d\n", ret);/ O) X- }: J9 p4 Z" M( `. Z
#endif
) D( f8 K$ w3 @" Y! P        ret = platform_device_register(&da850_evm_tl_leds_device);( B4 _' z$ D6 ~: O; p
        if (ret)
( I3 T) z4 K; x& P8 D, p                pr_warning("Could not register som GPIO expander LEDS");6 u( a4 y1 l% u7 Q+ v. \
        else$ S/ Q( Z4 g) P  a
                printk(KERN_INFO "LED register sucessful!\n");
. w( X$ ?9 {7 s6 |! u0 i0 a
8 i- m1 n0 }5 R/ m        return ret;
- {& }4 j9 @7 l% f" |& [  u+ h}! ^0 j, m7 m$ p9 R7 V

: I7 @# Y( T) C! h! v, estatic void __exit led_platform_exit(void)! `( v$ p! \2 H0 X: }5 a7 t# `% Q
{( R/ M' B, j; `8 Z
        platform_device_unregister(&da850_evm_tl_leds_device);
, u1 \3 p3 t, v1 U4 j" \6 J( ]
. }' j' ~$ T; r; ^* ]3 b! m4 V        printk(KERN_INFO "LED unregister!\n");  F/ p# g4 }0 d
}6 w+ ?! d% {6 t7 f
8 ^2 u/ D, l) x) c; g; [4 N& ]
module_init(led_platform_init);2 W# i5 C% m+ L5 F. ~* ?
module_exit(led_platform_exit);1 O" `* `( k) x: V6 O/ f" l1 {  {: s
5 Q4 `% W6 Y8 K1 P- g
MODULE_DESCRIPTION("Led platform driver");
+ ?1 a) C8 M5 e2 k- AMODULE_AUTHOR("Tronlong");
1 w( X% S: q: s8 K/ WMODULE_LICENSE("GPL");0 w/ {' A$ G- T

( i: \/ @. _& e! u+ K6 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 21:20 , Processed in 0.037373 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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