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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
- Z$ u5 Y$ d& `& Q#include <linux/init.h>
, G  B& m4 a! e+ u: v# ?! @#include <linux/module.h># k$ ?" ]% ?3 H9 X
#include <linux/kernel.h>
6 ?  _1 P# r: N) S% q2 r#include <linux/types.h>/ _, y# @! \* n2 y
#include <linux/gpio.h>; @) S# m! t& O
#include <linux/leds.h>
! I- _' A- R. W7 |1 |3 k#include <linux/platform_device.h>6 Z6 P5 s% }9 d( O
9 J- H! [1 S: C3 y
#include <asm/mach-types.h>9 E* s1 m. I9 W% W7 Z& a4 X0 t
#include <asm/mach/arch.h>
' J  d: Y4 Y/ [# p) d# w#include <mach/da8xx.h>
- F" O! R6 T$ j* \7 B; a. r#include <mach/mux.h>
! u& p2 @$ p: t( l$ z6 Z+ }7 g6 M! z* I6 E4 ~! a& h
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)6 o- {( ~+ z) }/ w8 H
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
  h1 m  s8 v+ L9 k. C# M#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
  i9 d6 O5 b7 k+ \. }+ f; _: U' J#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)  ~: A! D+ g  ]; s
1 L+ N  }" n2 h1 ~; v0 p: S" a' Z
/* assign the tl som board LED-GPIOs*/
0 r, a; |5 o: Q( qstatic const short da850_evm_tl_user_led_pins[] = {
' T* O% q! I: A2 }# I. [0 D9 [2 C        /* These pins are definition at <mach/mux.h> file */
" ^$ A' M7 S1 j2 p        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,' x, x' A" N- O6 O
        -1' Q8 O( H! G% u9 n% a& }
};2 ?) I& z& |8 T/ V$ V' ?
) n  A0 ?  Y  L" ^9 v4 N
static struct gpio_led da850_evm_tl_leds[] = {
" r) b& l/ E$ D) d: I        {- K; c$ r. ?7 ?( |
                .active_low = 0,
/ E' G( R8 _. q7 `                .gpio = DA850_USER_LED0,9 V! L1 H/ w9 N6 y/ a% z* y
                .name = "user_led0",
5 F2 E8 @! c; L                .default_trigger = "default-on",
3 z9 ?/ |- g9 y! o' R5 p        },2 a0 I' @6 i9 \4 m
        {0 H( L- @9 s' F4 e  w" H
                .active_low = 0,
$ w; ^' g3 K2 z. b: Q                .gpio = DA850_USER_LED1,5 n/ w" w- o9 q: r! x) [9 }+ R) s
                .name = "user_led1",
" D2 n6 {- T  W' ~8 Z0 G                .default_trigger = "default-on",
& K2 _6 V9 |8 w        },
% {8 ]" H$ s4 ]# o" T7 W5 C        {
7 q' [2 p4 j* {7 G& M9 ?& A                .active_low = 0,& |1 \. U/ {0 k- b! P* a
                .gpio = DA850_USER_LED2,
/ b% N) F4 t* b- H5 P2 c# c% }; L                .name = "user_led2",
0 t: Q2 @% w0 ], A                .default_trigger = "default-on",
' A% X* v* w+ K- k& E. s# M& z        },
: M8 G! i0 [% v- o% I% i2 U, @5 P        {; ^& @  U2 K' R9 V/ Y: `
                .active_low = 0,7 t. d+ ]: x! u& ^' K1 Q
                .gpio = DA850_USER_LED3,
" g4 U% r) c& X2 e: p5 R( d                .name = "user_led3",
8 W5 f8 _% E. a  A3 ^& _( G                .default_trigger = "default-on",# m6 k4 M: F( E) s+ W1 e4 [
        },
* p3 k; P2 H; y; a( U- I};! R. b; ^, A' v1 b# f. f
, T3 k, k# e8 K% c1 _
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {" Y' l5 _! d( J$ E2 t3 W
        .leds = da850_evm_tl_leds,
& T. G! T- }# l, r        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
- q0 b1 n) s! f* y+ y3 t9 E, d};
6 |# G5 v$ h& E+ n* Q( p: a# @. S, ?2 C# y$ b: |
static void led_dev_release(struct device *dev)! \& q2 P, B# I% e5 ~
{+ b2 s* I. r, \4 Q
};& A4 F) p! Q5 C- d
9 G* v9 v, S& N9 g/ E4 U6 s6 N
static struct platform_device da850_evm_tl_leds_device = {
9 V, @4 ^' |. l" D% T+ e% I+ R        .name                = "leds-gpio",
, t4 M! d# \" _! r$ _7 K        .id                = 1,
. W- O0 J# X5 Y2 R5 s. Y, g        .dev = {
% d' t6 J2 W2 Z0 [' l9 N                .platform_data = &da850_evm_tl_leds_pdata,
8 D, A5 v  v$ t                .release = led_dev_release,
4 p( U% d3 k& p: E* I        }
9 ^; k1 T" W; n3 b$ H% @1 o8 R};9 p* r! J% O( w* q

) u! M+ o9 m; f/ sstatic int __init led_platform_init(void)
" Y6 t1 Z. t- T. a2 o2 Q$ x- ?{
, M0 N7 i. x0 |5 T! @2 D        int ret;9 }% I" R7 W* @* D7 |
#if 07 }9 Y( L. B+ V! P4 J& m2 U
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
! ?, d: t0 y; e4 c7 K, q% n        if (ret), t0 `/ ?5 ^5 f  F5 E. [$ o2 ~2 k
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"5 z- w- W' p0 F8 u' x" v
                                "%d\n", ret);
7 M6 Y7 _: r- R0 r9 j1 ]#endif$ {# [9 x5 u  |& l. Q/ m
        ret = platform_device_register(&da850_evm_tl_leds_device);
3 ]8 E) p2 k/ T7 m2 t. d7 Y        if (ret)
! ]( N6 Q4 D; w6 Y                pr_warning("Could not register som GPIO expander LEDS");
1 A( d4 a* P  |/ S& c( J        else7 P# N0 n: i( ?& N2 J, `
                printk(KERN_INFO "LED register sucessful!\n");
2 Y, h" ?% J' M  ~% T7 r6 ]3 {3 G4 w
' ]6 S( K3 P# ^; G! E0 b7 b* A3 |2 U* _        return ret;" n2 T  E2 A7 U' a+ K
}
; o0 e5 C+ d) U! E8 Z/ t+ V$ b) N2 G4 y4 g6 x9 D/ b
static void __exit led_platform_exit(void)
* H, b' b8 Y+ I$ }% _/ w{
, v9 I# q: G$ [, W( ^' ~        platform_device_unregister(&da850_evm_tl_leds_device);; b9 V- g) t4 N) ^: A8 C* C1 d- w

+ |6 h( L/ o( e: f8 H        printk(KERN_INFO "LED unregister!\n");
3 ~5 l  G4 V& [% ~) A3 z- k' x7 U6 A/ q}
0 N. R1 S$ ?& Y4 i2 M8 a, J
, F4 R3 w* V6 o0 z% v& omodule_init(led_platform_init);
$ B% g5 I1 \0 e* d8 `7 Nmodule_exit(led_platform_exit);4 L2 Q' F8 w6 w7 e+ l$ y1 _( F- h
6 t) U/ @( m* a' }( f
MODULE_DESCRIPTION("Led platform driver");
. r9 h2 n& o/ c' p5 A( kMODULE_AUTHOR("Tronlong");' j6 e+ U6 y' t
MODULE_LICENSE("GPL");( `4 d: x4 ~. t, _

% x- P: B# @: z5 d- Z1 w& f& R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 19:48 , Processed in 0.039108 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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