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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
8 Z+ k' O) L2 i! r#include <linux/init.h>
* ^# u' j6 y9 l; y0 D, Q  K! c+ g#include <linux/module.h>
9 Q2 X" J+ g& f% W2 x* u#include <linux/kernel.h>6 W# V& c% g. I; C: ^* v
#include <linux/types.h>* e& f7 B; q" H0 W
#include <linux/gpio.h>
( i  ^$ B& p3 P#include <linux/leds.h>
& u5 G& [8 u- r4 j+ l5 A6 c. n#include <linux/platform_device.h>1 }7 l; c) O# b( k" h
% N7 C0 X" D7 a) @5 I/ A
#include <asm/mach-types.h>
) w9 U( W/ U2 g$ ~1 F#include <asm/mach/arch.h>
' H3 {% o! u0 G#include <mach/da8xx.h>5 P, U5 P' L$ o) [) F2 o
#include <mach/mux.h>
+ v3 ?2 t4 F* b% n* Y3 m0 x8 O
) m* Z, }% L/ O% @#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
4 \, N. s- v9 `( F! J  }, S6 ?#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
( W: u) J( [4 ]# r7 D#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)5 E. o! v( |# s( D0 f6 v
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
+ W8 p+ Q% Y8 M# j: a8 E8 f$ A. K
' x3 u/ W6 p+ F; l/* assign the tl som board LED-GPIOs*/( H: Y* l  d1 `8 [; e& C
static const short da850_evm_tl_user_led_pins[] = {: V6 `8 ~5 l" o( G! i* Y- g( k
        /* These pins are definition at <mach/mux.h> file */8 p2 X2 Q7 N% F
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
/ M1 x, V' K; c& G2 ]) |# x        -1
% V$ d: l4 s2 u* \+ p) ^};
$ o) i$ X+ C; q
$ Q  {* l! I8 Vstatic struct gpio_led da850_evm_tl_leds[] = {0 L# N/ q% A. G2 |% L
        {) p/ g4 B: h$ S- e! z
                .active_low = 0,
1 \# Z. a4 x( L# ]7 i                .gpio = DA850_USER_LED0,& x, b8 B/ F2 N' g, s( u/ C& u4 @
                .name = "user_led0",
' N) m& h8 _; k7 ~7 o                .default_trigger = "default-on",
( h$ b* x6 b* C1 d) z4 j        },) d# p: l# M0 ^% D! E) u3 G
        {
8 R' w& R  t' B! P3 u( w" U                .active_low = 0,
; [1 ^/ P6 v3 ~! C- f                .gpio = DA850_USER_LED1,
6 R/ m0 W7 Z/ l( d+ }+ a                .name = "user_led1",% D3 f: |, w& U* a8 a
                .default_trigger = "default-on",
* Y$ g2 l0 S: h1 l& a        },
* a( H- m# p  |: \5 |- W& S+ f        {1 S5 i6 V: M. f8 K- R/ l  p
                .active_low = 0,2 c; h" Z3 F, k( t; P
                .gpio = DA850_USER_LED2,8 @8 J. W/ r( b  j4 `9 l! n6 I9 g
                .name = "user_led2",# x0 h# R. ~& B9 A) V
                .default_trigger = "default-on",
! ]1 ?5 `: \3 ~$ U1 t% E        },
- e" x1 A6 Z: {* y, Z        {. ^/ D$ m4 z& L* o
                .active_low = 0,
  M$ I3 r% _9 y2 I- ~: h! i                .gpio = DA850_USER_LED3,
2 t- s0 H0 ]* c6 R* k. H# Y                .name = "user_led3",
- Q( C$ a$ V& L* E                .default_trigger = "default-on",! Q- a5 L$ w" ], M" u
        },
  r4 f* x6 y" w' S) R8 w( ]};8 l4 ?$ i6 r6 f8 J# f

0 w7 k* u4 P5 i( h  s$ N% ]( @( zstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {+ J* n0 s" s' N: P  H
        .leds = da850_evm_tl_leds,2 Y' a2 s- E6 ^) r
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),: U$ ]" F* d6 ?# o% _
};3 R# `0 _1 K4 V; k$ y7 `
) u& R/ G* d: I' |" p
static void led_dev_release(struct device *dev)
2 d4 z  C0 @5 e6 l# f( k- ?{9 B+ m1 P6 j" \9 `& S, ?) O( \( A2 p8 {
};  Z! e% _/ h. k# w$ h6 P
2 v4 H8 [; ?, T/ R7 N  G% k: j' z
static struct platform_device da850_evm_tl_leds_device = {
& b, {2 E% P* u# {; y        .name                = "leds-gpio",* H. u. N/ W- [+ G+ \8 R3 c2 q
        .id                = 1,
+ X: P" N$ b( W0 d9 z) e        .dev = {, u, x; l- d) I3 `3 k: G
                .platform_data = &da850_evm_tl_leds_pdata,, E* x/ s3 b$ f7 D/ H
                .release = led_dev_release,9 f* \9 N6 x4 L- O
        }
% v- q; o5 T# K4 y; ~+ B4 T};) r% w7 w0 _! R* `. h& j' H; K9 x
0 g) f8 G' M9 O# m
static int __init led_platform_init(void)+ p0 S3 m$ g7 U. A0 _+ h
{
4 F2 T# x* N$ ?* [1 p! J  V6 i        int ret;! x7 [0 x/ m" T# Y
#if 0) l5 m0 H; H/ W; z7 `" S6 m
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
. ^& i$ L1 B0 K1 {0 l2 Q! X        if (ret)
1 B; g0 _( m! _7 x7 B                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"/ l4 q4 J- t: R2 N- E* D
                                "%d\n", ret);
. ]5 i$ L2 M4 j#endif
1 o6 \) R2 e2 X8 S1 ~1 H) S        ret = platform_device_register(&da850_evm_tl_leds_device);" b7 v$ @6 u; H- I
        if (ret)
% X4 Q1 b# o( I3 F0 O" R' z$ Z                pr_warning("Could not register som GPIO expander LEDS");) H/ m) J* I$ `& t
        else
3 `# A! }9 F: h+ i, l' X* _                printk(KERN_INFO "LED register sucessful!\n");0 `$ [6 S+ W& v' J) c& c3 f1 z* U

; ~4 i- Y& T; y3 z* M        return ret;
' Q; z/ H2 f6 U( [# G}
( t3 J/ x) F) S6 I" t% o5 p* P: j% h9 m! [
static void __exit led_platform_exit(void). R  Z8 u, Z/ }# H
{) x) q  _6 R5 m- V( b
        platform_device_unregister(&da850_evm_tl_leds_device);8 R/ J* t. y$ c: l- s

6 s$ }' E* n8 S6 g% @        printk(KERN_INFO "LED unregister!\n");  u- _$ K- L+ \, j7 s3 P& {3 ?7 m
}
: _4 s2 w7 U% A% k/ O3 J' V
9 G0 x9 O- @# F* Smodule_init(led_platform_init);  b/ i: @$ x  F) j+ X7 Y" E) a
module_exit(led_platform_exit);. C( ]' v+ {& j7 b
" }3 E; H6 I* F- I3 d* F+ r
MODULE_DESCRIPTION("Led platform driver");
# S+ j" {( \! L- K, X# M2 v" {MODULE_AUTHOR("Tronlong");
0 }2 T8 e& I* N# E( ]( m& j. TMODULE_LICENSE("GPL");
* k5 P; @( t% ^% ~7 c" {/ Q
0 D* k6 z- O% T, z( \+ Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 13:41 , Processed in 0.041806 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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