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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
' A6 Q7 K0 e! j& z) C. p#include <linux/init.h>
/ i; U3 U( o; K& ^+ g#include <linux/module.h>
# k. @1 |) j4 l$ O3 p#include <linux/kernel.h>( n( I. q# g6 n: S% G. \
#include <linux/types.h>, b. p) e& _: g8 A
#include <linux/gpio.h>
$ \& k% M; n, A3 d( C2 P5 @#include <linux/leds.h>3 o! ^# Z1 M) j4 }  ^1 d; j( k
#include <linux/platform_device.h>% Z% f2 C/ \% [: X4 {7 z3 }

  f( Y, ^) M" L#include <asm/mach-types.h>1 I) {9 m: d4 e/ p6 u
#include <asm/mach/arch.h>
* F5 ^# T) x' n7 q/ I. A#include <mach/da8xx.h># K6 V  I1 H2 a7 u" {7 O
#include <mach/mux.h>' b0 {: V0 o& @5 X* ?1 x# t5 @
. V3 Z9 P+ F& d  w
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
. C& g/ X, @' K# v9 \& M& v#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
  X$ m0 I2 \/ u- H( n" {#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
; m: X. |% p; J" W  R#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)$ P0 w, p; R/ t* i# t

6 p! O' m$ ~7 m. O. ]+ ]: v. R/* assign the tl som board LED-GPIOs*/4 h2 ?# p; x! Q8 @
static const short da850_evm_tl_user_led_pins[] = {
& B$ G" v3 j2 U# E: L; ?        /* These pins are definition at <mach/mux.h> file */
8 \" M  i! B8 ?; u        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
# [& z# X* I( m        -1
8 L% A1 P2 }* `- l" J) r};
: V/ D7 c+ n( A, g9 l& F$ N; R! t8 K
8 v. B/ a/ ^* @% a5 hstatic struct gpio_led da850_evm_tl_leds[] = {
, q1 ^. t7 O& J, H5 Y9 J3 \7 b7 \        {$ V6 I  j2 J; l+ o
                .active_low = 0,
" B) {( L& ~2 t3 d/ c                .gpio = DA850_USER_LED0,8 W% D2 g. ?% ^% i" s
                .name = "user_led0",
! Y8 Q" ^* [& H; o' c                .default_trigger = "default-on",2 s. b4 U9 T0 ?7 W+ G0 |' b8 l
        },2 A! L# U( i: X
        {
8 Z; y6 x& ]3 h3 a/ l                .active_low = 0,
+ B. b. x, @3 x: J% a$ m. |                .gpio = DA850_USER_LED1,
/ d* H  x2 N9 g& \' ]                .name = "user_led1",0 E9 G" L; [  _, T6 C
                .default_trigger = "default-on",7 G, E9 a$ O8 g$ g7 C6 z$ y5 t
        },5 U" I. Y' t. ]0 l2 E. b
        {" J" Y( l, R0 v- ^
                .active_low = 0,- O! u" I! @" n5 {0 N# T
                .gpio = DA850_USER_LED2,! u/ V! ^3 m5 C, `4 a
                .name = "user_led2",
/ m5 Z: G& `* M                .default_trigger = "default-on",+ _$ {$ m5 c5 T: ~4 {
        },
' M6 g1 a( O. J; x1 e        {
. H8 U$ N/ \( E* W4 \) D                .active_low = 0,
' z: m" N* M6 E; h: Z$ O                .gpio = DA850_USER_LED3,
, K) Q  U2 T6 i+ i9 f8 C- }                .name = "user_led3",
+ E' N3 P. ?+ k  x6 U9 I                .default_trigger = "default-on",3 J9 T; T, ]7 F* ~4 f/ e
        },
- G' X; K8 E0 M2 \};
5 P; ^! p1 P; A: G% k( f4 o. t. }3 q
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {$ ?* t5 I0 m* _3 ]1 U) P: E" Y
        .leds = da850_evm_tl_leds,) Y: W" u8 L; U" i; |  x
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),7 X5 O1 P0 f3 d8 w' p3 z* m2 Q
};+ x! w" Z3 B: P
% w% I/ \  P: }; h/ {
static void led_dev_release(struct device *dev)
5 }. I, n3 D# t3 {{
9 P! I0 P/ s: z- v};
) _  r5 C1 U/ X: I
' b- j; ^" o; [* sstatic struct platform_device da850_evm_tl_leds_device = {
+ ~  C' b+ a5 T; Z2 q* D2 K+ S, }        .name                = "leds-gpio",
3 S/ `. b7 B8 T( f2 r; L( ^        .id                = 1,
; r; C0 ]  O, n: j. l& l; m        .dev = {
6 k) U( b' m+ z                .platform_data = &da850_evm_tl_leds_pdata,
( {5 a8 F. I' r7 Q% H                .release = led_dev_release,* h4 L5 p  @& Q1 c! X+ Z; e
        }
% S3 R7 h9 ]$ b; s};
- I4 F" d( V3 \7 M- J' B% G% l/ w1 X" Y4 K" G+ [* ~' `# q
static int __init led_platform_init(void)1 x. ^& S8 M& D# _+ ?4 W! f
{, {. m5 P8 r7 y  ~2 n% E# G( P4 l
        int ret;
3 e5 L8 N% _# Q/ k8 Z% A! @+ j#if 0
% b+ i6 h1 l* M! g. D' X- [        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);9 V0 n6 _2 P8 e% c; U: _
        if (ret)! N  y- G* f) O( m
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
; Y% ]/ V& w6 u; E- z% m                                "%d\n", ret);
4 @5 ^' ~2 N& b6 b#endif
% d$ l2 W# ]/ M- R; f        ret = platform_device_register(&da850_evm_tl_leds_device);7 W% w$ I8 O6 h9 N' W' y7 {, {8 v& O
        if (ret)
$ h; j1 v. {. r4 K* z4 X                pr_warning("Could not register som GPIO expander LEDS");
$ E1 ]0 x+ q  k) _( l9 X& R        else' v- p' |% Z' @5 j9 P" c
                printk(KERN_INFO "LED register sucessful!\n");; w+ a; \& y  k/ v( F% W

7 W3 o3 o. B0 U4 {. x        return ret;
4 {" `. J8 S- y. x! l+ c+ l}
' G9 R8 t* E4 w2 z- z& g" Q: U/ S0 b! [6 Y  v  y/ B) H
static void __exit led_platform_exit(void)% z9 c( d5 R- N( q4 E9 \
{* |6 [% F5 Z: _+ c/ H
        platform_device_unregister(&da850_evm_tl_leds_device);/ C& _8 o4 }4 v- A) l; R

: R# }9 m0 i, b        printk(KERN_INFO "LED unregister!\n");
8 t/ P9 o2 A1 o4 Y/ w) U}" `4 w/ `% P* o
/ c) y3 V. H% }& z6 R2 j" Z( E6 Z
module_init(led_platform_init);
, d' l7 A* h' |  h' Zmodule_exit(led_platform_exit);8 v% b5 J" `4 C
' N2 L9 d* I7 Q+ |, G- M7 ~
MODULE_DESCRIPTION("Led platform driver");5 k) z8 R! Y. z7 `
MODULE_AUTHOR("Tronlong");* n. E- N  I9 h2 c7 }! J* m; G
MODULE_LICENSE("GPL");
/ f$ k# u$ B3 W8 C6 c+ s6 _* u. @
2 |! Q( B9 {% M7 ?; S4 `  P& e/ U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-5 17:57 , Processed in 0.039040 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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