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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
; H* @1 N& M) @( ]5 b1 ]+ R#include <linux/init.h>
- f+ x; u. U% N0 N#include <linux/module.h>( R+ C' Z9 @  ^  V: ^
#include <linux/kernel.h>
, m! }/ t) Z/ t& t) H1 ~  Y#include <linux/types.h>
3 n! ~! ~& V% k, v#include <linux/gpio.h>  a% q" s( B6 B( ^2 D
#include <linux/leds.h>
! s& ~" @2 n7 |#include <linux/platform_device.h>
  A  d! \: t1 j8 s9 V! Y
% X# R8 U4 t" t: O; z  ]* r#include <asm/mach-types.h>
2 _3 @! c: Z+ b$ x* y% w#include <asm/mach/arch.h>
* T% B7 K0 k8 G1 U. R/ ]#include <mach/da8xx.h>
( m7 h9 R+ v9 U$ ~9 i0 H" U0 h#include <mach/mux.h>
5 a% [+ l; @1 H3 r: q& d
# e& S' o# I1 v9 T# y% ~#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)% O: ^! N2 e5 B. f9 j: U% a
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
+ A2 n4 w& c) a( F/ M$ t  U#define DA850_USER_LED2        GPIO_TO_PIN(0, 1); W) `" y" x7 @
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)6 F% _/ i! L3 V  P* D/ f$ O
8 V1 i/ q2 r2 n* H% @$ ]
/* assign the tl som board LED-GPIOs*/
, ^2 |. Z9 O5 \9 _1 f! s& Hstatic const short da850_evm_tl_user_led_pins[] = {& a- l7 B, g2 t6 b& ~5 A) ^9 v
        /* These pins are definition at <mach/mux.h> file */
+ ?, f- Y3 Z5 T        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,/ n- ^' c& |2 H+ j
        -1
0 ~" H* p. Y: J};
6 B8 W! g. x' _, z  ^% d: f0 R4 O
static struct gpio_led da850_evm_tl_leds[] = {$ N! l$ C4 P% O. I
        {
% q- d$ p5 h: U& o6 n                .active_low = 0,
/ C. K# @+ C* J* C# _' r0 g+ g5 n0 @                .gpio = DA850_USER_LED0,
! q9 v! h  E9 g8 y" ^4 |& C/ S                .name = "user_led0",2 y: L4 a& I. x- k( [) u* I
                .default_trigger = "default-on",
7 ?6 {8 q# S# z5 r        },6 w/ Q" z- V. w$ ^; H8 C
        {% y( C: x& n; X; h) V/ j
                .active_low = 0,
: ~0 K" a* X0 B8 R                .gpio = DA850_USER_LED1,3 W" J" Q  L( T% y1 h7 r" X
                .name = "user_led1",5 M8 b& e9 h/ f: D$ J( L
                .default_trigger = "default-on",  r/ n* U: _4 ~) @- F* |" Q
        },
/ G, f8 t. X7 U- Z/ G+ S        {
5 |+ g; |' F, D3 b                .active_low = 0,. G; ]6 v9 e% I6 N8 E7 L
                .gpio = DA850_USER_LED2,: P, I# h& i- A  P
                .name = "user_led2",! s1 a& C5 g1 P4 _% ]
                .default_trigger = "default-on",: |# o& N3 A$ v0 T5 H
        },
' a: M8 _% H( a/ L        {3 `# O( _: i0 e( W
                .active_low = 0,; a; |6 ~7 V% M2 y3 `9 V3 d) A- A
                .gpio = DA850_USER_LED3,' e# u/ t; Z- k' o6 j
                .name = "user_led3",1 Q# H2 j  n% @
                .default_trigger = "default-on",; v! g8 x, N3 G1 l2 ]
        },5 ^: T) d8 k* N  t, m! V
};
; U# s) W. ?/ I& s0 ~  T" [( A( i+ i% L) b5 p4 e0 o& F
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {' W- H/ R* x: p5 k! u" `
        .leds = da850_evm_tl_leds,) d8 Y0 {* o" `
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
3 c# a' C4 i4 z+ n7 K! r};
; ?- O4 C" u# T& L; c0 ~  _
, \5 E2 G' H1 Z( Rstatic void led_dev_release(struct device *dev)" m+ W- @9 f8 k3 U) y) ]3 d
{3 q  C, T2 c9 D' W5 v
};
) b3 H# P* t6 Z  V* x6 ?1 a
3 X2 \2 F1 n$ @) l: U3 c& ^( Kstatic struct platform_device da850_evm_tl_leds_device = {2 }! n) [5 G; U* C% k4 |6 c1 s+ q
        .name                = "leds-gpio",
& e" }! ^% ~3 a1 [8 ?5 Y" ]        .id                = 1,
5 ?2 _! k6 U% S  U. [$ l2 t: S        .dev = {
# t8 o6 s! w4 k+ V) g6 N                .platform_data = &da850_evm_tl_leds_pdata,7 m) Y2 ?- B! |+ D+ N
                .release = led_dev_release,
. y, e4 A/ ~  v- ^& x/ @0 @& r        }% x. Q8 I( {  @3 ~6 z0 g$ V) J
};
- Q- [7 Z1 ^) Z9 A8 @  C0 E7 P
, }% }- G: @5 w, \static int __init led_platform_init(void)
) \; U! ^# M( ?2 J{
) X' z6 l6 q6 k  {2 R        int ret;3 l: I( Z5 b7 n
#if 0
% `' w( B2 I! w        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
3 |% n  B$ }* n* m6 Z        if (ret)
! S' U" N$ l$ P                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"& e& u, @/ F5 H# x
                                "%d\n", ret);$ y1 b" z. }- S6 Y; G2 U
#endif
2 Q" g- j  j' `' s$ u        ret = platform_device_register(&da850_evm_tl_leds_device);
; s) p! J5 z" b2 |# |9 b        if (ret)
6 z; b$ N: Y$ f7 Y' b                pr_warning("Could not register som GPIO expander LEDS");/ D3 h6 c+ i7 q( U( J1 y( W8 o3 j1 Z
        else1 X4 T' l: x; c  S8 O/ U
                printk(KERN_INFO "LED register sucessful!\n");; S5 `0 y# u5 o, I$ U" _9 Q5 G: c
. i; J  \! Y# Z! K8 Z- Y6 \: m
        return ret;1 T& K1 D% D9 l9 A* x5 N) n
}" |1 j4 Q  U& N! o8 b9 r

1 i$ H) c  ]# ^# R7 r/ xstatic void __exit led_platform_exit(void)
; i, _2 b6 k% H& ^{8 `  p& m) ?3 N( g6 ?
        platform_device_unregister(&da850_evm_tl_leds_device);/ |, z8 `2 L) K; ]
: F' N- `3 x% }7 b7 S
        printk(KERN_INFO "LED unregister!\n");
, w4 ^9 f0 k! y! K- c}: Z) z! L5 c0 X3 K( B. f! d2 x/ u

, B& P$ i- s! jmodule_init(led_platform_init);. ^$ A) c! k5 z7 w2 @! o1 [
module_exit(led_platform_exit);
7 M* \+ C+ h1 r5 P/ x& ]
- [5 w( _; o7 X" F6 H6 FMODULE_DESCRIPTION("Led platform driver");# o1 F% c4 A8 v% A" i* |
MODULE_AUTHOR("Tronlong");% z8 x% V4 i& I, R
MODULE_LICENSE("GPL");
& \( Y; y0 B1 {9 `# Y7 r
# J& R& C4 {, E" T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 19:18 , Processed in 0.044630 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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