程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
; b( L7 u! P$ g5 B4 [#include <linux/init.h>. z8 X" n  w; q2 W* |9 T! }# t
#include <linux/module.h>, ?5 T  K) K1 \9 G) u2 u( O, |
#include <linux/kernel.h>. `7 x, M/ q4 l* f
#include <linux/types.h>+ I- j7 L7 R$ O8 Q
#include <linux/gpio.h>+ _; W% G5 C5 O( p
#include <linux/leds.h>
6 K1 G9 L+ e, L9 t6 D7 [( ~( y, Y#include <linux/platform_device.h>
& m; x* \: D3 b  W1 @* m( b0 Z2 d; ]7 M, \0 X- b& P4 O4 I
#include <asm/mach-types.h>
1 @5 z: y8 Q. @' Y# U#include <asm/mach/arch.h>
1 W1 H# J" D1 V  {, \) T# Q#include <mach/da8xx.h>
# g- b) Q2 Q. i3 C6 d) u#include <mach/mux.h># H2 ?" U4 ~4 A# Z1 j+ r
# p6 H+ X  ]5 _5 x
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)! Y9 m9 f+ R. N4 `
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
  H( e$ y, ^* z* Q5 e# W( d#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)* }) V0 H# G0 B- b% K+ @7 ^. h
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
6 G3 y: s) K! P4 l0 f8 v/ R; w2 S* }; }0 a' e) q
/* assign the tl som board LED-GPIOs*/
# @# g7 V: T) T: H! y$ istatic const short da850_evm_tl_user_led_pins[] = {
+ C9 D/ [7 S3 ~- E; H6 g        /* These pins are definition at <mach/mux.h> file */
$ }  H1 _4 C! R+ S6 o2 b' r& d. X        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,/ p2 L$ g4 G6 ~
        -1
8 y& k. b& P& f1 o};
9 {5 o7 b  |- G* E4 ]8 u' J# w% X  e' O
static struct gpio_led da850_evm_tl_leds[] = {
) S# _3 R$ g5 m. |$ d4 v        {
/ _9 R; y, @1 o* b( ^* ^                .active_low = 0,: {; d: J+ o. R4 x5 h% H2 A' A, J
                .gpio = DA850_USER_LED0,& `7 u4 q+ ^/ j$ e. L
                .name = "user_led0",+ q9 J; j7 H9 a  s7 r/ X
                .default_trigger = "default-on",
* e/ D- q" P0 d) x/ G% Y" |        },
$ `5 Q# c" {7 a& k0 Y; }- P3 J        {
. M. \/ R, f# p2 d                .active_low = 0,
* f& a  T2 ^2 U% ?7 Z, V                .gpio = DA850_USER_LED1,
$ Z7 e  r0 Y0 ]4 O; F5 z. v                .name = "user_led1",
! ?$ ]% P: R3 h4 c                .default_trigger = "default-on",
* x# }6 I- L* H' M        },8 Q0 K* }# V) C( u! F
        {5 @4 S( a( Z* _8 Z
                .active_low = 0,
% @. A" ]* I. H2 h8 n                .gpio = DA850_USER_LED2,
1 M6 W7 U% [: A; j" c/ u" P                .name = "user_led2",
4 r' B, X' }) S7 \2 S& E                .default_trigger = "default-on",) L* b8 _' H6 {: L
        },
2 T' {  G% A8 k: y        {% q. y8 w6 i# T  H% Q
                .active_low = 0,
% U3 Y, H  S' b2 {, ]                .gpio = DA850_USER_LED3,
7 a5 o1 i8 F2 i, j. L1 n                .name = "user_led3",6 M* I2 N" w9 V
                .default_trigger = "default-on",
1 j, ]% ^0 I, R1 {! n* o" i        },# b0 s+ I( a/ i$ x' Z- @. m3 e8 c
};
+ v9 D% l5 p& w9 n" U2 l+ }
7 @/ @- q+ t8 @* H7 E) _static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {3 i% ^. g. F& c8 s: r
        .leds = da850_evm_tl_leds,5 l8 E% z" A) Q" u
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
# k& ?7 n& g% C+ Y4 J2 u};
/ E" C" ^% q( T3 f2 X) ~
) A. i# |' ~/ ]; _$ {" j( ~& mstatic void led_dev_release(struct device *dev)5 U" U- w  ]; q
{
+ e# ~: O0 O! i+ _4 y};, d5 n/ M$ j* i1 x
- ^% [2 d5 M# Z2 @/ a% c2 d, s7 b
static struct platform_device da850_evm_tl_leds_device = {' r. S4 T% s. g) s
        .name                = "leds-gpio",
2 d: r0 Y& {" ~1 z3 Q+ t( J, x# h        .id                = 1,/ }5 m, _; t) {2 A! |. X
        .dev = {
4 f* u* j3 u% ~( s                .platform_data = &da850_evm_tl_leds_pdata,
& {; C3 w/ C& V                .release = led_dev_release,
  @$ O' W; T1 \- [" s$ T        }9 x5 n4 D% D" q1 u
};
9 [+ r; S- I& L0 s: J% q, R+ U
0 }' S1 a, i: {' G9 _' t3 ]static int __init led_platform_init(void)/ U( D% T; t1 _5 u' c5 i
{0 a5 j# @4 T4 `: S! B8 _/ ]
        int ret;( U' l2 @. E$ q$ x& s
#if 0
/ \/ a% l2 X( z% h+ G        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);4 o2 y1 [: @7 h6 {& G9 x/ U
        if (ret): k( e: \2 `$ M4 d
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"! b! |( D" p4 O/ ]
                                "%d\n", ret);
6 @1 {/ X) p- ?/ o( K& m! }& M/ W#endif
5 O! [1 r! B5 H! ^; V. f        ret = platform_device_register(&da850_evm_tl_leds_device);
! `5 |' c7 Z  _8 J        if (ret)$ ^6 h% f) W5 k, c+ ^9 o
                pr_warning("Could not register som GPIO expander LEDS");' Y* C% C, I. u2 M" b1 ]4 y
        else4 B  U; W! ]8 E- V
                printk(KERN_INFO "LED register sucessful!\n");
, E4 t1 t( s* {  z) ]# }* }- J5 H  @2 A& j9 B; _
        return ret;
& |/ L3 X& G4 u, K7 @}4 a' s  K8 X  h( V( p2 ^  M2 ^

0 H9 b: A  s3 f) u/ k9 Lstatic void __exit led_platform_exit(void)
- I1 \$ \1 t8 f6 ]6 y{
9 T, p" Z' U6 f) l% y. O) I5 ]        platform_device_unregister(&da850_evm_tl_leds_device);
1 F( [6 X$ ~: b" @: Y* Z+ K
3 e& K/ P* h  B        printk(KERN_INFO "LED unregister!\n");; @# v$ p# T7 r& E
}
1 R2 b& n' [4 Z& M. [
" N6 X+ J3 {* X' d# R* L5 m6 lmodule_init(led_platform_init);
$ A* r6 {" h. U+ x  Imodule_exit(led_platform_exit);
$ h3 v+ B, s( W" K* h
' e' ?2 C+ q# i/ mMODULE_DESCRIPTION("Led platform driver");, K, T5 e8 M6 R- n
MODULE_AUTHOR("Tronlong");
4 \/ z. {  J% ~& rMODULE_LICENSE("GPL");
: {4 U! J/ n* l$ P, F0 O
8 W* z6 X. L6 r( ]4 f6 X$ f1 p4 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 11:54 , Processed in 0.042891 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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