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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
1 D9 Y4 g5 a- W: F#include <linux/init.h>+ Y% V9 b6 M8 W# f
#include <linux/module.h>
9 c3 J7 T! [: L% T+ v#include <linux/kernel.h>3 F+ O9 O. h" N  D* s. M
#include <linux/types.h>$ A! C+ A. b2 e2 Y4 t
#include <linux/gpio.h>
3 I/ X/ B" A' I2 F% w#include <linux/leds.h>4 X( J0 j. p$ i$ P
#include <linux/platform_device.h>
, h  [7 o5 e/ ^* C2 q6 m
. T6 w: ?$ {) N" V( Q# H#include <asm/mach-types.h>6 E8 e+ T1 T3 k5 h$ e' D
#include <asm/mach/arch.h>
2 r( X2 x9 L6 i$ ^8 W#include <mach/da8xx.h>/ a/ @) ~8 E$ w
#include <mach/mux.h>
" J/ {, W" Z: M6 _
1 ]) J4 E) r- g% b+ p, J#define DA850_USER_LED0        GPIO_TO_PIN(0, 0). J/ K& A, J1 l9 O
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)! T$ ?! U! Y( i7 p0 U4 e, S
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
2 y/ S- i8 `  O% O#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
0 l3 p4 `# M% B5 B* H3 V; y6 r6 E  j9 c0 p6 E8 t: L* B& @6 x, v
/* assign the tl som board LED-GPIOs*/, R( U: _7 H4 o, }. s8 b, s
static const short da850_evm_tl_user_led_pins[] = {. w9 x+ q! G. G
        /* These pins are definition at <mach/mux.h> file */# E( }' w" m0 F0 n; S% _
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
5 G9 q. Z9 S8 L% N& p+ j2 U        -1! B, B- k3 ^6 ?1 y
};
" \- L4 t7 r9 m; s2 ~, L% c" ~
( |$ e5 G0 `  o0 t/ _  w2 A* Z, p: vstatic struct gpio_led da850_evm_tl_leds[] = {
6 [, _" S' h$ H# J        {5 s5 s% \0 `# M2 F' X+ Y* a
                .active_low = 0,
( x, W/ i! ^# i: D& G- F                .gpio = DA850_USER_LED0,$ T4 ]! k4 w2 f* A& U
                .name = "user_led0",$ Z  v% w  i% J8 L
                .default_trigger = "default-on",
& F4 t9 U& A) Z# I4 X        },$ @; l  Z& ]  g3 A- i
        {) g8 B+ r1 }; t3 s6 A0 R
                .active_low = 0,
7 b  p3 {, |# Y. m/ f9 `                .gpio = DA850_USER_LED1,' F4 d1 T: e9 N; R% o" T
                .name = "user_led1",
6 m8 q/ D% A! s1 k" ^$ g" |- ~4 p                .default_trigger = "default-on",/ K3 R, e/ e, P9 K! h
        },  N  `6 T$ ]3 Y7 j
        {
3 l, [9 s. v0 T" ?$ ?                .active_low = 0,& x: ~) z6 W, P: {5 z
                .gpio = DA850_USER_LED2,
( E6 H  q; K4 M5 f                .name = "user_led2",
- F5 }6 z8 p% ^4 J% L* u- ~" x, t2 q- f                .default_trigger = "default-on",
; a& R; s5 B: H& V( g/ B, _        },
9 @, s8 f$ w( ]5 d4 m  A        {
2 d: g1 W' }, q5 y, o$ Y                .active_low = 0,
! B6 F* a9 G: F7 U                .gpio = DA850_USER_LED3,
* U; a$ k. V+ }$ C' X* J                .name = "user_led3",
/ [+ E% p& m. W1 x9 C                .default_trigger = "default-on",
4 `8 ^) D! H2 @        },
4 {) Y# `1 C2 T& e' |; M$ N};6 u1 x" B% ?9 I
: X, v, n9 i0 P+ g' }: d
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {: [8 U7 f  u2 x% E# @9 V7 A
        .leds = da850_evm_tl_leds,4 s6 E5 z/ }0 q8 ?2 S; d* D
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),, r" e, [/ X9 _! w
};* I! `" S+ F& ~! ^
* R$ ~$ r! P8 A0 y2 w3 N2 K# c
static void led_dev_release(struct device *dev). J4 A9 g8 b" Q6 {5 b' t$ `
{
/ K/ m- i! t, B1 ]! [5 K4 D: V0 O};  t% W% v3 y& k. o2 J9 N4 e
. V# g& s, H( |3 K# ^' R
static struct platform_device da850_evm_tl_leds_device = {" C3 ]+ w6 T  D. `1 t3 _. o- @! d
        .name                = "leds-gpio",% @6 U% k) s0 H0 L
        .id                = 1,9 x# s# u& }* [! ~+ l
        .dev = {
8 g% E' V7 `/ k# K                .platform_data = &da850_evm_tl_leds_pdata,
. o7 @4 e: s9 ~8 @  P  P; c                .release = led_dev_release,5 b: B2 l. r% Q  W
        }6 s. x# K( k0 X" J
};
1 \) G; Z% j- d4 q1 ~1 x6 }" o" W& ]% n1 d$ {* H: [" u3 D
static int __init led_platform_init(void)
/ h. _9 C1 E& K$ C/ W{( E, h( J  @$ w& W3 M) ^
        int ret;
: D3 Y4 f& o1 B! h  W  f( `#if 0
, c! ~. S! N8 S2 z; P- m5 u        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);1 o' B5 s& B+ X+ a0 w8 @/ V
        if (ret)
" W. Q7 ?0 q% M" Y( a/ [' F                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"6 G2 v! F1 |1 H* O
                                "%d\n", ret);/ p  a# z: R) [8 ]6 H) v$ y' p
#endif# n) Z) d9 x, S' W2 J; B
        ret = platform_device_register(&da850_evm_tl_leds_device);4 ^8 J3 \- n8 ^2 F$ W
        if (ret)' c6 B5 ^) b/ P+ T- P  z" D* k
                pr_warning("Could not register som GPIO expander LEDS");: c# G2 \; U- @7 o7 N
        else/ A9 U+ M7 P& ?! h" k
                printk(KERN_INFO "LED register sucessful!\n");8 t( d( ?  ]5 ~, p, o

& u8 Q+ ?4 H0 Q7 m6 F        return ret;" @" W5 t5 n# `$ N0 u
}0 W6 T; S; m$ g$ M: P8 L- K

3 Y4 m" n) k3 L: Fstatic void __exit led_platform_exit(void)
2 X! r5 P9 k# ~/ C9 `& L{
- K1 @# G* k- k( I7 l  X5 z% b: r        platform_device_unregister(&da850_evm_tl_leds_device);
' T9 P7 O% p/ l6 |! f1 M  U% G( E/ E' a! k) t
        printk(KERN_INFO "LED unregister!\n");+ K0 }# Q# s5 N/ E- {7 c4 {
}0 z& U! ]' _' E

( @% j8 v7 I& W: b& l0 S/ Tmodule_init(led_platform_init);
$ O  V! ?$ y: P/ l! C6 Qmodule_exit(led_platform_exit);
* M5 D0 c% x; W1 T. H5 e* f9 q; j% }1 O- {- ^' c4 ^  H
MODULE_DESCRIPTION("Led platform driver");
" e+ P' t9 }  R$ wMODULE_AUTHOR("Tronlong");9 n4 P. g" C0 z+ y# t3 _
MODULE_LICENSE("GPL");
, v8 |& Z$ I; k4 ^) t; S" R! \* E( F, j( w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-11 17:15 , Processed in 0.043793 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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