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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
: H9 |8 k' D" S( p' S4 Q1 v0 H#include <linux/init.h>
2 X, e9 W, Q: o( [: d8 Q# ?" a#include <linux/module.h>& e3 H8 C. |' e4 S  p
#include <linux/kernel.h>
, `$ w. W9 t# I3 B#include <linux/types.h>
1 C, u! Q4 y& A+ |* e5 I8 I. E#include <linux/gpio.h>2 G5 g5 u  {$ J0 i5 f% Q0 a
#include <linux/leds.h>
! `1 ~" {4 g3 l* }- l9 x' r0 u#include <linux/platform_device.h>
+ m5 N" V: N* H- X: C1 C
0 k+ D4 O8 c4 |! S2 }, r& u#include <asm/mach-types.h>! O# D! Z* k2 N8 L
#include <asm/mach/arch.h>% s0 L& Z2 b: T/ A& s" @4 x* l2 d
#include <mach/da8xx.h>: i, H0 Q5 t. h" I4 {5 g
#include <mach/mux.h>" `' k) S7 D; \' Z
* c9 O) P4 g4 Z7 I3 \& F
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
- E4 [" h3 u5 T) m, N7 G  A  \4 t#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
) E# ^, U& D: n, P#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
$ Q, D" H# |5 J) d' K#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)6 V; ^+ \6 C- T" ^) a7 M6 T: L. ]

8 j* g- @! i+ t+ P- F/* assign the tl som board LED-GPIOs*/
- G8 ^' e% {* pstatic const short da850_evm_tl_user_led_pins[] = {" O) S  @! L, T
        /* These pins are definition at <mach/mux.h> file */
" u# X0 G9 U2 F* n4 p0 h: d$ B        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,0 k8 H2 n6 V; W$ b
        -10 ^# m0 S+ H/ h( _
};
. r' P) z: }. ~( M- d' k2 Z" c! n5 o$ U
static struct gpio_led da850_evm_tl_leds[] = {( U7 z, ?1 E3 ]& M: w4 t
        {) i- i5 C5 l' I  O
                .active_low = 0,. V' W# s$ y, |6 E8 ], Z9 R: ]
                .gpio = DA850_USER_LED0,1 f" V4 F$ X4 j' r
                .name = "user_led0",/ d+ Z. K9 |! |$ }: ^
                .default_trigger = "default-on",
" g% h$ Q+ d* j& K* b" f; l  q        },
" J) s; X& a! T        {
# n! u; S8 E$ P* i3 G                .active_low = 0,
3 n, D# z: u: Z                .gpio = DA850_USER_LED1,
) f" Q, G5 R2 O4 X% ?                .name = "user_led1",
* t7 [2 s, {5 p                .default_trigger = "default-on",8 {  l" O& Y& \6 U( x
        },3 b& N6 h) D6 t1 X+ H
        {
! H1 P1 h1 v- q$ q                .active_low = 0,6 U4 b9 ^( c( {. g/ b% B/ x
                .gpio = DA850_USER_LED2,
# \+ [1 Z. [, f& j5 z; o3 s                .name = "user_led2",- |0 R7 ]" j- D; U& w& Z/ n
                .default_trigger = "default-on",
) ?/ y" _8 U* }        },
9 M8 L2 g9 @2 T        {5 L3 K) ~* E4 e/ _
                .active_low = 0,
) U, d1 ?  y; X5 x- ?% s" ~$ \                .gpio = DA850_USER_LED3,: t8 s" W+ X/ S0 u5 p
                .name = "user_led3",
8 P3 Y( U6 c. G1 @                .default_trigger = "default-on",
* D# j% ?! K  W3 \# Q2 I        },
' t3 h+ v/ m, X$ H8 Y% |};9 ?' e1 A, h6 D. Y; s* K" g
, @" f1 |. I) ]# V1 j) b3 A% A5 l
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {% h; P6 K5 Z- |/ V* _- j( V7 E
        .leds = da850_evm_tl_leds,( n" P' Q4 o$ b0 t
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
( p; J" C! Y1 }( M2 ]* c$ N};
# E( X  x" W: g3 i" X
$ [1 x4 h( z' K; mstatic void led_dev_release(struct device *dev)5 J' S9 B# e1 h' p2 T: L
{2 C& Z3 d. R# a' ?) D4 P# @+ E% A
};& u: A  ?3 e4 @, v/ p: Y+ N0 c
) R/ N, u  M; G) e& v1 ?
static struct platform_device da850_evm_tl_leds_device = {
3 c' |6 D+ Z; C% O- S* O; A        .name                = "leds-gpio",
9 O- Z- b5 H0 p; w: d5 P3 x* O8 J2 t        .id                = 1,* y# b; t5 z( t+ }( t* [5 I
        .dev = {
) N  L1 x: G( t) i6 ~                .platform_data = &da850_evm_tl_leds_pdata,
( [" U8 {$ u1 Y/ z  r! a* l                .release = led_dev_release,
2 A% ~0 K, x$ d, m/ _8 h        }6 X) n2 J3 |& b& v( j; J/ K
};
% r' c  `" @( B- y$ a$ ^/ b8 M' D) n/ U2 E
static int __init led_platform_init(void)
& I# e2 i( Y( Q1 d{1 A7 o8 l0 u. m- I3 `5 @9 D( A
        int ret;
7 m5 ^6 O* ?5 }$ }* d) `% a2 \& ?% L#if 0
( I6 Q0 |) m$ g. ~( V) H; W7 c        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
# U: m  Z- S( ?8 c0 C        if (ret)
' v. M+ L5 }1 W: d# z  A                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
4 h2 ~6 y4 O* C9 \3 X2 \4 e                                "%d\n", ret);
' d. Q: n$ c! k#endif% [* w$ J$ U/ a* F. B9 a8 U
        ret = platform_device_register(&da850_evm_tl_leds_device);
. M3 Z4 G$ d/ a$ q        if (ret)
- R# h4 W; M' s& |9 F- a4 v, n                pr_warning("Could not register som GPIO expander LEDS");9 Y$ j, c  a% _1 ~2 j' ?
        else' t+ ~5 V, F2 h# l
                printk(KERN_INFO "LED register sucessful!\n");5 l) i0 l6 x" |7 _: |! L

% z- s4 ^6 q8 B3 u* ]7 i7 Q        return ret;: {( b, T3 w% P# B0 [  a' V
}& R- {: e* v& r3 W0 |5 Z
9 C: @+ n1 Y" Z# V
static void __exit led_platform_exit(void)0 _8 H. q' s6 {  F8 t# ]" _3 `
{! v2 W2 P/ s$ j8 ^0 ?
        platform_device_unregister(&da850_evm_tl_leds_device);
+ s& j7 I$ O  D) A. Q5 i! C+ x* e$ d5 F4 D% c' {
        printk(KERN_INFO "LED unregister!\n");9 g& n" ?& p) {( H2 s
}; A* H7 ~$ t/ |. O
: q! x; S- X8 L; h8 E* v3 C5 B
module_init(led_platform_init);  ~  E1 M5 Q5 Y; d
module_exit(led_platform_exit);; `' Q: D: v/ t, d

" ]: ]% y% @0 W* UMODULE_DESCRIPTION("Led platform driver");
/ z1 p9 n$ Z; k' I& e% ]5 D0 ZMODULE_AUTHOR("Tronlong");3 x# E$ E! u7 F; B0 z/ p
MODULE_LICENSE("GPL");
; D; N! Q* z! Z- Y* v( A; g, R6 ]; ^' A% W, V+ C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 17:53 , Processed in 0.039890 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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