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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
% H& k. H' j$ h% T) f/ H: I#include <linux/init.h>9 t% g( N* K: b  Z. A* |
#include <linux/module.h>
6 _: A, Y+ q/ N#include <linux/kernel.h>+ P8 p% C' E. K. V. q
#include <linux/types.h>6 G0 |( L9 N6 D" j
#include <linux/gpio.h>
; B, @) I. F+ S* X0 ~( w, \7 c4 ~' I#include <linux/leds.h>+ \& N: C/ W4 L* Q0 \& E* v/ r; B9 `
#include <linux/platform_device.h>
! h! ?2 U/ i* i# q; `" p! i+ [
#include <asm/mach-types.h>
/ a, ~$ O' C" V- n#include <asm/mach/arch.h>' j! q2 }- z3 V5 ?8 w" h! f
#include <mach/da8xx.h>5 C" N9 K& e/ g. G
#include <mach/mux.h>1 C$ W  x7 M, d/ M% ?

3 a7 P/ h$ H% C% ]. ~#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
5 ^$ f& r, I, {#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
8 p( }' E% F" K! ~3 Z#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)1 {0 k3 X! i8 A% a
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
2 r2 I) o/ r7 p0 q& I8 Q
1 o8 c, P2 L! |; r/* assign the tl som board LED-GPIOs*/
5 h% `! Z# x# R0 R. l  \8 E* bstatic const short da850_evm_tl_user_led_pins[] = {
( Z2 w7 L9 E) W        /* These pins are definition at <mach/mux.h> file */
9 B! u* D. T4 R8 C+ U7 K5 n7 u' i/ e        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
( H+ l# u0 q! `4 \2 |6 Z& E- c        -1
/ l( w3 ^& j% O8 }+ Q3 G, d& L};1 Q2 T  C% A! B6 J

. Q1 F* x0 |3 x; vstatic struct gpio_led da850_evm_tl_leds[] = {
+ z# I7 t7 l4 V7 m8 G        {8 E( B2 ]3 Q7 K5 b, R0 z
                .active_low = 0,
4 |3 Z) E# k2 J  a. m$ g7 A                .gpio = DA850_USER_LED0,$ i% K; e6 m2 \0 r% T8 R- n
                .name = "user_led0",
, m) y" q4 ~1 |                .default_trigger = "default-on",
6 Z& p4 [1 s! J) z; a, ~& p2 f        }," ~! F9 y& W/ X1 {2 u3 W* J
        {
" u/ d! K  g- h# V( X4 T$ g                .active_low = 0,) }7 }! M. }5 l. n
                .gpio = DA850_USER_LED1,
$ q, Y) a" \" y% B$ d0 g                .name = "user_led1",9 @, T$ W2 h/ s. l- G* v" _+ w, a
                .default_trigger = "default-on",2 k& Z( |& F  n4 x1 j
        },( ]5 n* N$ B. E% ]+ N. N, X
        {6 h1 x) v3 i( U2 H+ [1 t
                .active_low = 0,
5 W  U8 Z1 C. ]' ]                .gpio = DA850_USER_LED2,, Z/ a3 B  `0 z( g
                .name = "user_led2",
% R6 ?" A. {7 Z' u                .default_trigger = "default-on",4 N$ E% S8 z, C/ _- W
        },1 q7 S5 ~9 o  r  m' t( z7 E
        {7 f+ y0 B0 [* u7 A6 e" u- Q' t; l
                .active_low = 0,4 {0 X7 I5 c0 Y8 ]* q# h& S9 Y
                .gpio = DA850_USER_LED3,
! G& g/ g; h. P  S. v; E                .name = "user_led3",( D4 Q9 ^; _0 `' D  t( \+ t# C
                .default_trigger = "default-on",  {: b' d9 [% _. |9 o2 I
        },: t# N" z, b9 D
};
6 K) l1 s% {  g- ?
) b4 B3 T4 y3 wstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {1 ?$ C, O- c& N8 k+ s7 K$ c
        .leds = da850_evm_tl_leds,
3 ^/ z0 L# t' w; Q1 }        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),( K1 O& }; J3 e
};5 t* y4 @* c" V8 r) u/ W1 K
( w- h& O9 L& [' E# f2 h
static void led_dev_release(struct device *dev)5 J$ m2 f5 l' I1 ]4 ?% P( O
{
2 N& L: B9 z! K( }) b( {" e};
; K9 v, n, {, b
6 _+ M: H4 D- e$ I2 e& U9 istatic struct platform_device da850_evm_tl_leds_device = {
1 t) V) s% ?7 l" \& g        .name                = "leds-gpio",7 s, F2 @6 x9 X
        .id                = 1,% o2 I, ~; X/ y2 \4 S. P$ g
        .dev = {
" k( N% M4 @& h- {6 r                .platform_data = &da850_evm_tl_leds_pdata,
, U6 b# W1 Y. s# T: q1 f. X' o1 ?                .release = led_dev_release,
5 f+ N' j/ P' M# d4 L        }3 x4 @# b6 ?' D" G9 b0 w* R
};! v2 t1 M% l! d

2 d0 X5 F) M4 X/ X& A9 Lstatic int __init led_platform_init(void)" j" b' r% E& w, t1 P! y( ]
{1 p" R  o2 C' R9 i7 Z
        int ret;3 t( d/ X# j" O5 R) _' {
#if 0
/ K! p% c* w6 I2 c        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);7 C7 ]8 m: G7 y" Q2 l2 n, d" g
        if (ret)
6 @: t& q. U& i: B                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"+ q1 O, e6 v$ l
                                "%d\n", ret);
: a5 U9 \: {1 E, i, E6 O0 H+ d#endif! Y& J5 Z3 [( R7 e) [, B
        ret = platform_device_register(&da850_evm_tl_leds_device);
1 [% l5 J& s: J; i        if (ret)
9 {& w9 W9 d% J( F6 [' \                pr_warning("Could not register som GPIO expander LEDS");  z) O3 U" s/ ^
        else
2 f" j( P/ d: r+ F                printk(KERN_INFO "LED register sucessful!\n");2 M; c# r6 b; R+ g# J
4 I! F- R) M7 g8 @5 V
        return ret;
# V6 D  f) l. G5 C& h}
! v' X/ n- q- b. D
2 {6 s% L6 A( P1 ~static void __exit led_platform_exit(void)
& D& ^( {9 i9 n" f0 W{
- b* D; S9 ]) N        platform_device_unregister(&da850_evm_tl_leds_device);' J8 Q! P# U) q3 I

6 N) f! M( ~7 w* b' E! T$ {        printk(KERN_INFO "LED unregister!\n");
+ F3 \" J+ k& k0 V4 s/ C2 N}
: P4 t9 q# I% s0 `) n+ \/ _; ^+ r. d
module_init(led_platform_init);  `0 ?& M7 {7 T" b5 U- b+ L
module_exit(led_platform_exit);3 a0 U( p+ F" g! D8 i# j

. g6 \: ?& ?' tMODULE_DESCRIPTION("Led platform driver");
$ H0 p* n# ?+ n. NMODULE_AUTHOR("Tronlong");
. R# a+ v- T2 W& X: d7 c7 A; H7 z4 `MODULE_LICENSE("GPL");9 W( y1 N7 h) v+ b

0 C( V5 ?: k: t3 {4 |2 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 13:45 , Processed in 0.049132 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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