程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。: d* t7 J9 U. x) ^/ K
#include <linux/init.h>; @9 S' M: e" V' P3 B1 V; x
#include <linux/module.h>
" J2 m3 _4 }& G# v#include <linux/kernel.h>; s: e: s% w4 H# S) p# q% s
#include <linux/types.h>& [0 A; \/ i  ]- Q, s0 U4 Y& H
#include <linux/gpio.h>9 {$ s/ J# i  N2 w' e9 I
#include <linux/leds.h>
$ R& W5 h2 g9 I/ Z5 j#include <linux/platform_device.h>
+ x% p5 l( d& l+ C9 F( O9 f# V2 s
, r- y( \, ?, a3 A! u/ A#include <asm/mach-types.h>9 r+ }7 h+ B$ |' q5 S8 F7 v
#include <asm/mach/arch.h>2 |$ `& }% m/ [( B+ w; B) }' C
#include <mach/da8xx.h>! D$ W2 s( o1 |+ ~4 \4 T
#include <mach/mux.h>
2 R- f1 R, j9 r3 F' `2 N5 }2 U/ r: S1 _* W8 T
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)& l3 J* N5 Z: Q8 D
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)' U1 n* W/ ?4 c0 `
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)# h& }5 }& D$ w2 c7 m
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)  c0 Q- @: g5 O6 ~& c

. ~% K1 s. p/ I: B; k' n$ y: O/* assign the tl som board LED-GPIOs*/) X( e( `# B6 w- H* Q, k
static const short da850_evm_tl_user_led_pins[] = {! G$ `: @+ g' b
        /* These pins are definition at <mach/mux.h> file */1 Z: g' Q! Z3 Z, b6 H2 k9 b
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
% L: o) I' x0 c, P$ p) [/ }8 q        -1" x6 u  P5 P& o7 C* b
};
- ^- O/ ^0 }( i
0 i/ H9 u+ Q+ Z$ @# Dstatic struct gpio_led da850_evm_tl_leds[] = {- k$ }( U6 z. p0 n0 l
        {
0 X2 Y. z0 z% q' u/ e1 K                .active_low = 0,3 Y8 _( e/ w* ~! n
                .gpio = DA850_USER_LED0,
3 {: G% [' D; k5 q2 M' b5 g                .name = "user_led0"," N, @4 d: }( ~# p
                .default_trigger = "default-on",) F# |! }, \1 n/ {0 Y; t
        },
! G& P+ A& x- [# U8 f7 X        {
# s, a6 H6 ^* P8 N# i6 l                .active_low = 0,
6 N0 B; u0 a( Y                .gpio = DA850_USER_LED1,
3 E7 D% t9 ?" Q- ^2 s8 l) B' J8 r                .name = "user_led1",$ M( L; Y9 `# c/ [; K9 E$ f7 H
                .default_trigger = "default-on",3 ^/ N. E! p6 J* d" @7 u
        },
! a3 v7 @, X3 G        {6 {, |+ O: g2 n
                .active_low = 0,4 b2 V+ ~5 v& ~! T! L6 s
                .gpio = DA850_USER_LED2,
/ v! k* f3 x2 b- B# ?. z                .name = "user_led2",) M2 R8 U: m7 x: {9 p
                .default_trigger = "default-on",9 q0 I* w! y9 c$ D( o+ O* v- o* U* `
        },
& J1 H  v/ M- O% e4 B        {) s& F( n6 B9 `  u6 C9 U
                .active_low = 0,
3 p0 J! n& `  p0 \; q                .gpio = DA850_USER_LED3,
, y* f# L9 q0 b. ^  r                .name = "user_led3",
1 D4 f0 S* U( J+ A) s  v                .default_trigger = "default-on",: l& T2 P! l. x2 G* J) E
        },3 x5 X: N9 X0 m/ g' Z, Y7 F7 C
};
3 {2 ?2 @; c5 X% {2 H& p% p! e" f3 i% V4 J9 w6 L6 B
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {" F& e1 U9 C9 j1 T
        .leds = da850_evm_tl_leds,9 v' ~: ~5 v5 C% _" T" {& x
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
( _# t& a9 {7 o) h1 m' \4 m* l};, B) M% F, I& _) v$ [- k0 f& l5 E

6 W: x% a0 o: y! fstatic void led_dev_release(struct device *dev)- `! K( `9 t/ |( O
{
9 I' Q1 s8 l8 D: W$ C7 Z$ O6 ~% F};
. S8 g& d3 f, b5 Z5 t$ ~5 }
8 Z$ ?+ E9 }( u% f4 Cstatic struct platform_device da850_evm_tl_leds_device = {
) e+ [( n6 n: J& B* y        .name                = "leds-gpio",8 P# y/ d6 k- y/ n3 Q
        .id                = 1,
1 J% L% @. L& ^+ z% F- A1 G        .dev = {( j6 q& [' t: V2 `  q4 [
                .platform_data = &da850_evm_tl_leds_pdata,
* M8 ]- X4 N6 P& G                .release = led_dev_release,
" W) X) z, i, o8 H        }
1 w$ z  `9 M& h. c8 q  N& r};, ]( j+ ~' ^# |' t4 v; I

7 Y/ g' e* L/ x( N1 w" U/ vstatic int __init led_platform_init(void)  G: l* d& u0 |' S( b- E, K
{# W9 e* m/ {: S" N# E
        int ret;3 u/ a& E2 o9 M+ w
#if 05 K# p1 t: R$ E  H# i& E, V9 W
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);. I- |- K7 ~' A, n
        if (ret)
0 Z. M$ f! y+ a! V                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
2 Y$ g0 }# ?9 e7 m* P/ t& G+ t                                "%d\n", ret);2 t) z/ t6 D; A) v
#endif
! ^# J) M  I1 w! C+ ~3 R0 t        ret = platform_device_register(&da850_evm_tl_leds_device);  e: }) g: |4 |4 @
        if (ret)
9 O! j  T" Q0 O. Y4 t5 F6 `                pr_warning("Could not register som GPIO expander LEDS");
! a. N: k5 R( `! K7 a* R        else
/ H4 t. Q, v' y; R. Z1 Q. U                printk(KERN_INFO "LED register sucessful!\n");% c4 G" @+ w3 c* @
" r& f5 A/ B, A
        return ret;
. i  n0 I$ a6 z. A1 R, b; R+ J( S$ g}
" B9 Z5 r5 s) \2 F  z; w$ F6 P3 \6 {4 k
static void __exit led_platform_exit(void); Y7 H1 Y, O! P& S
{' R& I% C, \) ^- Q, u! f8 e* r
        platform_device_unregister(&da850_evm_tl_leds_device);
9 z. [! i+ ~3 v/ ?( v+ y. e7 {7 w% y6 a4 }' a" F! J
        printk(KERN_INFO "LED unregister!\n");' x) d* M) u: E( V
}& p2 o: j4 U  ~* @0 D

2 A, ?6 w3 ?5 j0 ?, H( D  x  n4 @, omodule_init(led_platform_init);
7 c9 f% S3 O1 Y; umodule_exit(led_platform_exit);7 R6 w& z6 U0 B, i1 x# L, G
. D6 J: I+ {# O5 Q4 Y
MODULE_DESCRIPTION("Led platform driver");
' W8 b# Q( d1 B# v& kMODULE_AUTHOR("Tronlong");
4 ]3 `: H6 x' D/ @8 \3 QMODULE_LICENSE("GPL");
0 E  l7 y0 r( E% H; }" ]5 [. R9 e8 t! g" l8 B' Y/ v% }  X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-15 03:25 , Processed in 0.037922 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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