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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
* k6 o/ S: {5 `/ q  G# W#include <linux/init.h>' U) I0 l8 W1 n, I/ S& z, ?/ t
#include <linux/module.h>: ]3 W; E7 Y1 z/ w$ c! C8 {) |
#include <linux/kernel.h>
: ~' G: E$ ?; s% O5 I$ n1 M* V& I+ s8 @#include <linux/types.h>
) H) `" u" G! L  |' J" p#include <linux/gpio.h>; n" t5 J; Q& s! G( d% @
#include <linux/leds.h>% D4 \) `/ ]9 f9 m8 K  s. ~; Q/ B
#include <linux/platform_device.h>
7 [$ Z; P& ^- e( t$ W# Q" t
% E9 n0 u: X! ^8 i#include <asm/mach-types.h>2 \$ ]* `5 D4 v! c
#include <asm/mach/arch.h>
3 A! [  b( w5 ~; c" T#include <mach/da8xx.h>
4 y9 g: d" {7 {; m: q5 O- d1 y#include <mach/mux.h>
8 O8 @* l6 Y0 c: c7 T& T% n( @) o) X% }. I( B& _
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)3 v  ]+ R! M7 R
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)( W! ~( c0 B2 M8 ^0 j
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)6 Z7 V- P/ {& R/ O
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)9 f& L7 c( A4 N; m. k0 j# y% f* h1 ~

* v' x5 r" m, k$ ~+ s/* assign the tl som board LED-GPIOs*/! o, _! n: Z7 J: g: g
static const short da850_evm_tl_user_led_pins[] = {
, x9 K1 _& Y+ ]+ z" p6 P        /* These pins are definition at <mach/mux.h> file */
  D* U- ?4 P5 `4 u* V/ X        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
* X: |4 e$ r; x- m        -1
, s9 r1 o9 M" t3 G3 M};
% D# _9 s4 \; @( _, V% c+ ]9 F% v
static struct gpio_led da850_evm_tl_leds[] = {* d4 Q) _# \' X
        {& I) r5 U. l5 ?6 H# q: s
                .active_low = 0,
4 N! ^2 h3 ^3 _/ ^: ~. O                .gpio = DA850_USER_LED0,0 i9 R% w. b& m' r" A
                .name = "user_led0",
. c/ `$ H! B" ~8 C* M2 s8 `                .default_trigger = "default-on",
  V" G4 Y0 I  d) L( v        },( W- o; |' U6 f% K7 t1 \
        {0 v/ c5 D4 Z+ C* r. E+ ]
                .active_low = 0,( V& X$ J- f9 R. h9 ?8 k9 _! }* H& e
                .gpio = DA850_USER_LED1,
% e/ A6 U+ L; e. u                .name = "user_led1",
5 W) \5 G0 C& ~2 w* J                .default_trigger = "default-on",' ?+ X- ]0 q' r/ x8 |
        },
6 [. |3 w, u8 s/ w  d% m# P) }        {! O5 X  ]2 N! @. {" v) B
                .active_low = 0,
: @" t4 Q& T8 N' W$ o, |                .gpio = DA850_USER_LED2,
* D: E: s2 `3 O% t! i& ~                .name = "user_led2",
1 p+ y, y$ K  b# K                .default_trigger = "default-on",
) a" U8 V9 N9 G% [) C        },
1 ]# c4 F) A1 t2 V- A        {3 f5 T' f. ]4 I' h) T
                .active_low = 0,! K; N8 a. i4 q7 T- `/ V0 q0 G; @0 g
                .gpio = DA850_USER_LED3,
; {4 y: @8 e7 N( e% H! f                .name = "user_led3",  Y& A7 F+ j' v. t$ q9 K3 k
                .default_trigger = "default-on",: ]+ \; S$ V% o7 w2 ]
        },* n4 L5 m: r& T% Z3 O5 g+ K
};% M8 Y. E( n. d- H3 t9 R0 `. M5 `; H
9 o+ C; J4 k- O
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
5 b  h' K; G. c! P        .leds = da850_evm_tl_leds,
8 K! ~6 `/ d4 g+ s$ K8 j+ [        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),# X; _  B0 z& T. Z
};
" i0 u; x# _- a7 X1 ^
, B- X$ f. X" `, Vstatic void led_dev_release(struct device *dev)9 i# d) ]$ s- N  D& }& n
{
- X' P: M5 X( x+ M};
3 j/ c. A9 z8 Q5 Z
$ e3 t7 Y8 m" _  ?8 U# t( m$ ~static struct platform_device da850_evm_tl_leds_device = {
4 F0 J1 h- N9 R        .name                = "leds-gpio",8 Z# U' |# f8 @* i" K& V: Z+ x
        .id                = 1,
, D3 R) A  j: a- v( Z7 V6 y1 m5 c        .dev = {
) d5 `% F9 w1 ~3 I$ Q                .platform_data = &da850_evm_tl_leds_pdata,
' S. @1 [9 I) s& g9 ]! P                .release = led_dev_release,
$ E) N$ h/ q. [8 X0 q        }! J5 f0 R3 B' s8 ^
};* D0 ]  v5 _. N) a4 p
9 J" ?) c; i% v  A( O
static int __init led_platform_init(void)
; I3 n1 w9 q! @: F# c{
* t( ^6 J' W" [* y        int ret;, f6 \" F5 H! Z, ^  d
#if 0
$ F5 r. G. F( K& r8 n7 d4 m4 i) I2 ]        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
8 ^6 _8 o& `; N  |: a        if (ret)
- Y: o7 N$ M% ]9 S: w                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
& D" n1 ^7 t& [0 X                                "%d\n", ret);2 b+ `: x9 p* E% a
#endif
2 H0 y6 i. [- P' }- A        ret = platform_device_register(&da850_evm_tl_leds_device);
* T# I9 d: b4 I        if (ret)
* {* R. ?: O. o2 p9 B. A) Z                pr_warning("Could not register som GPIO expander LEDS");
9 S; H& u; s4 M& _        else
2 W: B1 D. [" R9 k- Q                printk(KERN_INFO "LED register sucessful!\n");
" p6 s# u3 q/ P  Z, D+ D1 x( U& Y/ y3 W' W3 X; ^" u
        return ret;( k+ s, v6 T, P' Z% X9 W. J; h5 V' \
}
' P9 L% R5 x3 f- S& b! ^) g' c. M* L' o3 p! p
static void __exit led_platform_exit(void)6 t( @. F  k8 ~' V9 ]! E( p
{: {* Z/ q& ^# o  O- q1 T; V) i
        platform_device_unregister(&da850_evm_tl_leds_device);
7 O& n6 V! U: o- _4 c1 ]' X. H' N/ a
        printk(KERN_INFO "LED unregister!\n");5 }) R+ v1 T% y5 W3 ?+ a8 e
}) X9 R# a/ ]7 n' @* p

$ w) U% ]1 c$ Mmodule_init(led_platform_init);8 e( q% e$ ?7 z8 u# ?# G; s& B5 H
module_exit(led_platform_exit);
, F* S' C" ~4 `$ [7 T/ J6 M
' b- k, ?  ?$ [4 {MODULE_DESCRIPTION("Led platform driver");
4 v2 l4 V7 |6 M/ C8 r. c  w* [; |  aMODULE_AUTHOR("Tronlong");! X7 j  T! U7 H, Y( o. ~, S- \2 F
MODULE_LICENSE("GPL");
1 R. o2 X3 U; ~( u& c3 h
1 N% l8 H( v  \& L( q8 j+ g8 R6 J5 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 17:26 , Processed in 0.040622 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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