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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
, T) q9 m! N, ~' W#include <linux/init.h>
4 z! x; {# Y% K2 h#include <linux/module.h># A6 y9 k1 M" Z- r+ ^. M
#include <linux/kernel.h>4 _5 E$ K% ~5 `! w& D. g* N# i
#include <linux/types.h>4 l9 c/ A6 U8 Q3 c( ~2 ^% P2 @
#include <linux/gpio.h>
& F* @+ S6 V3 G: L3 N1 a#include <linux/leds.h>
& E/ g" {! \1 ?#include <linux/platform_device.h>
$ M2 x9 @# t: V' |
1 j; V! V4 w+ H0 Z/ p3 y0 u( v) T#include <asm/mach-types.h>4 y$ k6 ?( r9 {5 Z
#include <asm/mach/arch.h>
3 U" _) u2 G( I1 c1 q% ^3 `' w#include <mach/da8xx.h>/ J' }  i$ s! L; G8 s& M- _+ y
#include <mach/mux.h>
6 v8 _$ S* y* }1 n: z3 C  G6 }) L. p* o( B6 J9 k3 F9 r& H
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)7 a4 s  K% w2 c9 V& T
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
3 V1 l* o5 F' K- Z! d' V: L#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
8 o% l! C1 Y8 }! Q* [/ H#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)8 z" K9 P* q) s- M7 K# F

  f: j! V6 E; [8 u/* assign the tl som board LED-GPIOs*/
0 m; D2 x$ w* L, b6 Sstatic const short da850_evm_tl_user_led_pins[] = {
7 p7 g- Y9 p% e        /* These pins are definition at <mach/mux.h> file */, `; i: H) i' }* L3 a
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,4 V9 b6 v/ E" w8 Z$ a6 ]" N" y
        -1) p1 `0 g( k6 r5 u, G( w/ j
};
; X3 ^) {. p/ m5 [4 m% j! p! L# E. b3 p" G
static struct gpio_led da850_evm_tl_leds[] = {
  t; w  s9 F7 _( x% V        {7 @  i7 ~; _. C, `+ a; ]9 p) J9 D6 w7 \
                .active_low = 0,9 }! A3 E1 _' t1 @$ O" I
                .gpio = DA850_USER_LED0,
; X- ?5 p& c( h4 D; w  Z4 C% F' h                .name = "user_led0",* L! z" }- z& ~3 o! l7 C+ [& K8 m
                .default_trigger = "default-on",
: ?4 k4 @$ n( ~7 J3 @: v+ O        },
  I# M9 |! @8 c* j        {2 b6 a2 |" y1 m+ @8 x% _, S
                .active_low = 0,# [+ ]5 |' w& \  P6 t" \* A# q
                .gpio = DA850_USER_LED1,
$ A, C5 _. Y  T                .name = "user_led1",
% w4 I- h- f8 t# i                .default_trigger = "default-on",
" V" ?) {2 O: V' J        },
0 b* k* H2 H% O- G        {
# G( G' u$ A) w( g1 q                .active_low = 0,
- U1 @0 ]( Z1 x# D" t                .gpio = DA850_USER_LED2,* n( t, ~; K8 g  ^( V) D
                .name = "user_led2",
5 M' J" o- z& @% }/ |& Y6 O                .default_trigger = "default-on",
! o) {$ \6 K$ v& u, M        },
# M* P* O  e) c; G) r( P$ {  M5 P        {6 E0 N" X6 |" E$ ^8 Y) z* L* b
                .active_low = 0,+ y# ]! A9 z0 E5 Q* N- z$ }
                .gpio = DA850_USER_LED3,
: S3 Y9 T- e5 m/ b. I# z                .name = "user_led3",1 o+ J0 @6 A, L) ^. x+ g7 g1 Y
                .default_trigger = "default-on",
; b/ u. U4 ~* J2 P( X        },
' h7 P. f- S' g  B0 X& K$ d};3 w/ h5 }9 @: s1 a
" a. x+ N5 J. \
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
0 o6 k1 G( |; ^4 x4 W, Q' A" o        .leds = da850_evm_tl_leds,3 Z8 T. c0 y& l7 F; i( E3 [
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),2 O9 S: F: H7 l* U( m
};
# }4 ~; H. @2 Q8 i' b! b
: A9 U& T- L; Z! S- astatic void led_dev_release(struct device *dev). R4 O7 e0 O% V) o! q" }! x3 G
{: q$ Y) @6 `1 |, L0 y- h
};9 g1 X  K9 i/ j: I% J% U3 b

8 Y6 ~: J: j) s6 g% y" estatic struct platform_device da850_evm_tl_leds_device = {, w6 w3 e2 S1 a: J
        .name                = "leds-gpio",: J: ?' L" s/ k4 B/ t( l
        .id                = 1,0 U( F0 |7 q% `0 `* f
        .dev = {+ z% A9 q! Z# e  J
                .platform_data = &da850_evm_tl_leds_pdata,
: ~1 c+ S/ j/ J# V4 P                .release = led_dev_release,7 `+ B! R- Z3 o' e( v+ @
        }
+ ]8 j( Q# f0 n4 i};/ T& `' r$ X8 u/ L/ M0 u8 j, z
- F4 Y! c+ N$ _* b6 v& m2 }6 _" E
static int __init led_platform_init(void)
: r% s: S; q2 p{! B5 I" K/ b9 Y4 q
        int ret;
* W8 L8 g, Q$ X3 Q. ^1 N: r0 N7 |#if 0: m: g; r3 d" p! A
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);: s; ]6 Q$ \# p3 P/ E- q+ [
        if (ret)
  z, x$ y# |6 j" ~                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
. i) n- d2 ^" E4 h. Z3 l                                "%d\n", ret);
  U* t6 h4 K7 o#endif/ W5 {; h7 |9 d& C$ O8 X7 S
        ret = platform_device_register(&da850_evm_tl_leds_device);
; t& C- ]8 j' V: O5 X        if (ret)
+ v2 m3 [  j- g                pr_warning("Could not register som GPIO expander LEDS");
0 H  @/ s- ]' {# S  z/ E        else+ g- W2 Z' W# |# N/ F; {5 N: d6 r8 Y
                printk(KERN_INFO "LED register sucessful!\n");
5 x! ]4 C4 p2 Z# o" N5 a. z3 i% E
+ U5 Q1 s" W4 f( m& T( A        return ret;
! F0 Q" P1 [$ N( @}
/ G) U1 E5 G" M" i+ ^4 s, R: L+ v) P7 I9 H3 d
static void __exit led_platform_exit(void)( V6 O! Q3 M  p
{( J9 p. M0 }$ V, w/ O+ ~0 i
        platform_device_unregister(&da850_evm_tl_leds_device);
) O7 Y8 H- z5 w2 V
0 f6 H/ ]9 g- t, k) k, [' ?( ~        printk(KERN_INFO "LED unregister!\n");. c$ o! Z9 R2 a$ E, P" ]
}
& N( ]& y0 @/ C) {
7 C" k, e) P7 p$ z, P# x; I3 F$ Umodule_init(led_platform_init);% g; W) l- n7 j# M
module_exit(led_platform_exit);
+ F) ?2 P3 B% ?+ |: r
' z) f( B' Q; f, _0 d  mMODULE_DESCRIPTION("Led platform driver");
' _) o( x; b" ^4 N6 V$ uMODULE_AUTHOR("Tronlong");# V, Y5 Q4 `( z( }
MODULE_LICENSE("GPL");7 E+ y' [0 o  l
# O8 s1 X3 Z( }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-19 16:41 , Processed in 0.044466 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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