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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
" G. M9 H  P% D+ N2 g1 l8 ?#include <linux/init.h>
6 e/ i6 b) N0 G0 _7 W! C2 I#include <linux/module.h>" g  f- d: d1 j+ B
#include <linux/kernel.h>
+ ^, k3 P( L+ W; M# s, h" ^6 u( A. Y#include <linux/types.h>0 [# F2 e# [2 o2 H/ R
#include <linux/gpio.h>
  g( \  w! g* w3 I5 Y& R0 c# _, x4 [#include <linux/leds.h>
- e- v# `1 a+ U  a#include <linux/platform_device.h>! `% y$ F6 v! e9 V
+ e; D5 ^/ @% D( ~
#include <asm/mach-types.h>
/ S$ a, {. V/ G* s- @; Z: ]2 g#include <asm/mach/arch.h>  F% F3 f# d  \5 V6 O" p& |0 H
#include <mach/da8xx.h>( G6 z2 q- }1 ^8 z# \! g
#include <mach/mux.h>  G3 S( ]% s+ B1 _1 V

" `+ ?3 ]" p) f, `#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
5 f- I, k4 g+ ?4 `$ w9 P2 n#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
0 d0 G+ |, S& q; v* |#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)( u" W/ m* P+ d& M3 O1 j! L
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
5 ^; ?. ~- f3 z* X" c9 \' ~$ I: f* p6 n+ t
/* assign the tl som board LED-GPIOs*/) z* g1 M! P6 r1 ~1 c
static const short da850_evm_tl_user_led_pins[] = {
  p4 i% V% ~1 F, c- B$ k- t% f        /* These pins are definition at <mach/mux.h> file */8 g& ?  G* ]  V: z$ b$ p5 d
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,4 S, V8 o* o9 A5 F1 L% b
        -13 p( V) l- A' ~4 T
};$ m* r' g; o6 s- |

  n3 [' |/ I' h( D- U0 Astatic struct gpio_led da850_evm_tl_leds[] = {0 h4 ?& x$ \8 T( O3 Y- G1 ?6 u9 k
        {4 d+ O8 ?% J5 i* {
                .active_low = 0,9 f) f( x$ c3 R6 Q, S9 e# R$ f4 z
                .gpio = DA850_USER_LED0,
2 h; T) ?- h% _" m1 W3 V3 \" U/ [                .name = "user_led0",
& f1 |7 o( u$ P% O* d) E+ x                .default_trigger = "default-on",- {* V) C* N# T5 k3 |8 ^
        },& {' K+ M  S( R
        {+ S9 f+ A. ]/ m: k& e8 S4 q
                .active_low = 0,
2 M8 Z! \* C* t& M3 l5 b) K# }                .gpio = DA850_USER_LED1,
) O, c6 k7 C) R                .name = "user_led1"," Z/ u) r  \6 {3 O( ]0 Z" Q
                .default_trigger = "default-on",
/ g7 z8 ^- `% S' E) M        },
0 @5 l& a  t0 ?        {" l1 J  A3 ~. @* V& L
                .active_low = 0,2 {, z% S$ z7 b; ?7 S0 l: ^4 I6 {
                .gpio = DA850_USER_LED2,6 b6 I7 Q1 X+ `2 M
                .name = "user_led2",: v) Q% f" m1 u% x
                .default_trigger = "default-on",
4 A* V6 O" E* }6 e$ G2 B        },) Q  U5 z( a" B
        {
' o+ M$ h( z( T6 N) ?                .active_low = 0,
3 L  m! V3 _8 Y5 ]4 s                .gpio = DA850_USER_LED3,
& g9 a5 ~5 }/ p7 C                .name = "user_led3",
: K' o7 U' Q  ~' s  t7 J                .default_trigger = "default-on",
5 h- x9 ~  u2 @" S3 n+ I' I" i        },3 q. ^# m! l5 D8 p
};# s1 }" ]! q: j4 @6 f5 \9 `
. {7 p% e( a% r2 n( n
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {& I$ t1 [5 _" ]% Z$ q
        .leds = da850_evm_tl_leds,
& \7 u1 Z+ o) [6 e" F6 K& Y        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
) e3 o+ k4 b* a# {/ b};
: F$ {- t. X1 o2 e( d9 Z4 z* n* M7 M- j& J3 U
static void led_dev_release(struct device *dev)
) m% S. f, B$ k0 p; A{$ z0 _! [2 E: Q4 U0 N2 m
};9 w, A9 x' F2 i. S8 ]
5 b( F! t6 O6 l6 ]* G; M5 |2 K
static struct platform_device da850_evm_tl_leds_device = {
2 G) `% A. h+ J# L3 D        .name                = "leds-gpio",: y2 a) m3 ?* ?' m
        .id                = 1,! m. V5 L# k. t
        .dev = {0 J5 v5 d. P, x2 }
                .platform_data = &da850_evm_tl_leds_pdata,
' Q- ?6 d, b# @5 U0 W; s1 z3 P                .release = led_dev_release,
9 @% Z& g9 H3 x        }
# ^; U( f) F- ^* E1 \};3 b! n  ?  B( d& x$ x
& D% ]8 p. {8 S" a$ N) f! v2 S
static int __init led_platform_init(void)
0 {0 B% t/ e& g( r  m7 V5 s{! c! N. F( x/ B7 r' b/ P
        int ret;
+ Z  T9 f& v+ k5 B- j#if 07 e, i) D( z' ^3 V; ~+ P& ?! j0 t
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);; o2 G  L6 i/ w, L5 Z, u% }* M
        if (ret)
0 H% w7 O. J( {# E/ b0 w* `' H                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"1 H  q8 `' i$ d  Y- L1 L0 v
                                "%d\n", ret);/ l7 i1 Q% q9 j& O( O8 D
#endif" Y* K5 E0 ^, I' w8 ^% g
        ret = platform_device_register(&da850_evm_tl_leds_device);
/ f9 J, C& o9 r9 w        if (ret)
* {& z3 J+ n. b6 T                pr_warning("Could not register som GPIO expander LEDS");
% ]' {! r" @' m& d$ ^+ S9 n! Y        else
; R% g0 E0 U9 M9 M% ~# k/ I9 |                printk(KERN_INFO "LED register sucessful!\n");
) q, H- p1 n0 L* V' U! J$ l2 z5 ]' R
9 M2 M/ L0 A2 r" M) h/ r        return ret;% Z' \, J: \6 y* ~1 T3 ?% i
}# ~6 d  e, O8 C$ s: c# h0 H
1 v2 K. P* P' o/ R8 Y
static void __exit led_platform_exit(void)7 S$ Q' j" ^$ m1 y- l
{* S: _; L+ N. }9 L1 W& n( K& Z
        platform_device_unregister(&da850_evm_tl_leds_device);
$ j( O1 b& B  m, }; X/ ]- k& v) F# C8 S% V- K# F
        printk(KERN_INFO "LED unregister!\n");
3 ?4 K- P/ p) e4 Z( @+ W}  B# A8 ?" m( P# a' _: M6 P  w" j

* ~4 U! x, M. ^" o: hmodule_init(led_platform_init);
+ h" E0 |/ Q. kmodule_exit(led_platform_exit);8 a$ |( [2 U8 Q/ Z6 v

9 P0 a! M% P7 W) o1 fMODULE_DESCRIPTION("Led platform driver");
) B8 J# ^/ a6 ~  LMODULE_AUTHOR("Tronlong");5 X  G# V* M3 w# J/ W
MODULE_LICENSE("GPL");9 t( F) Z  |7 ]( a

  g" U# j& a- N. b7 h+ J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 00:01 , Processed in 0.039922 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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