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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
* ~3 [( G# p- y: G/ d0 V#include <linux/init.h>, x8 P  Q9 c; G6 Z' n0 u/ g
#include <linux/module.h>/ k6 F0 N; \/ i' _+ S  R
#include <linux/kernel.h>
7 g4 G0 o9 `% @- o6 s, A- [3 O7 d, e#include <linux/types.h>* l, P4 }( t8 I- C- b& b& A
#include <linux/gpio.h>
8 Y3 H1 n3 x& G( A#include <linux/leds.h>9 h- M0 l; i8 j" s
#include <linux/platform_device.h># m2 }. }6 R* \8 @- x& L( j9 E

2 W0 a, |* c, b& J' b& c3 ^4 H4 k#include <asm/mach-types.h>3 }+ N. Y) B2 H2 m7 t
#include <asm/mach/arch.h>
1 ^3 l7 q! k- p9 x6 a) e: d#include <mach/da8xx.h>3 w# I+ ~# W# @4 p) b8 Y9 [" O$ k
#include <mach/mux.h>/ l. C2 o; y4 i$ |" h
: Y0 C. m4 Q+ n
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
2 a4 `% w$ R. I$ Y#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
: z7 T+ p7 @  u% o: L- h6 X$ ]#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
& B. X, [3 B* D& e' G* U6 ?#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)0 f; a, t* O- e1 Y" i" `# p
% e$ K( q$ Q: _1 N  {. K
/* assign the tl som board LED-GPIOs*/
+ r4 ]; A- ^! _" L* r: \2 l) jstatic const short da850_evm_tl_user_led_pins[] = {7 g& I3 c1 ?1 S
        /* These pins are definition at <mach/mux.h> file */
# ?, \: }+ z8 Z& P" ~        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
5 h; I# v% T! E1 [! ]1 I        -1
$ j) n9 V/ T6 h# m2 G};+ V' m, ]' T* k0 _4 }, |
+ |2 N4 P. Q/ R  i
static struct gpio_led da850_evm_tl_leds[] = {
# Z9 ~; C% x: W; b; q8 i6 _, ]        {) q2 a( s3 {- q4 J' B
                .active_low = 0,
" d$ y: e, i; o                .gpio = DA850_USER_LED0,
+ q- P1 ?# Q. g0 U5 @6 K# Q' ]                .name = "user_led0",* n; e* N2 C' N; U0 |/ q
                .default_trigger = "default-on",1 _( H7 n( D* u) w
        },
6 r% b3 i+ h, r! C* n) w: T1 C7 ]6 u        {# t* s( y' z5 H- m
                .active_low = 0,
: v5 t; v# R$ v" D- a# e: }                .gpio = DA850_USER_LED1,2 e& r' W% f8 B1 Z# i; k
                .name = "user_led1",- Q8 ~8 e; F$ y4 ?6 Z
                .default_trigger = "default-on",$ c4 d! E0 @( k& ]
        },
2 ]. y/ k! h- q  Q        {/ s+ y2 ?, d) v: k
                .active_low = 0,
- Y- _7 Z; w9 _% X' q) o                .gpio = DA850_USER_LED2,' d5 ]2 P7 C/ g9 `& q% |2 |
                .name = "user_led2"," M! M% S: i4 F4 K& f7 i
                .default_trigger = "default-on",. V& b, }1 W. [
        },
( k- P  T9 H8 v/ S7 s        {! n% C3 v' H- d2 W
                .active_low = 0,4 i6 U1 @$ }- l& Z3 n; P
                .gpio = DA850_USER_LED3,
6 C/ r" Z  F# T/ d                .name = "user_led3",4 v: Z5 J3 `7 g0 Y
                .default_trigger = "default-on",1 \. Y, E$ h8 p* S0 c9 Y
        },
' g6 O1 u9 P3 G8 e% }7 O% c};
  n  j2 S: ~* i% D" L! }; I0 O% A
: E, ?- E" D% ]: {static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
! X; v8 j* c- U        .leds = da850_evm_tl_leds,
" o9 O/ F5 D0 V4 b1 U2 u1 w; I: f        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),: w8 G7 m7 l. ~$ W* g7 t
};
* w6 g1 q# q8 M, q+ J) m# k* d% q. W% u* S0 G2 Z2 r
static void led_dev_release(struct device *dev)$ M, a- p: G, ^# f/ A
{& }$ _2 T& R( u1 e: |2 u' I; _* }! I
};1 R2 L: o; L1 ?( F6 A0 @  P% C
1 C) w$ q2 b$ ^- S5 T& z- F
static struct platform_device da850_evm_tl_leds_device = {6 N0 G$ X, f, v$ m, r
        .name                = "leds-gpio",
/ a/ W8 q, D' \0 P7 T2 [# N5 V" V        .id                = 1,
. c! i1 `& O8 d! v0 g# `/ l- q- D( I        .dev = {
) E3 V5 c, X3 n& ~+ u" {/ C                .platform_data = &da850_evm_tl_leds_pdata,
* D3 M* R& o; c; I$ i& ^1 F, j                .release = led_dev_release,# w( H4 \4 r  `) s4 V, e
        }& j2 C/ h8 @5 F5 k$ Q* g! t
};  ?- U9 v- p( X4 D% m% y

  |, A* y7 m, q" c4 }2 Q2 i3 Sstatic int __init led_platform_init(void)
1 `8 A8 k! h& j{
" g# }$ ~! l# T4 E3 F! c        int ret;; m% v( V. `1 B" _
#if 09 u' n8 X( ]' X
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);: V2 E0 H0 R5 m4 e  [. [: C! j
        if (ret)! i$ F$ ?2 W  f9 z5 i5 A' q. D
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
0 c2 a( d. d& j/ H  N                                "%d\n", ret);
: j9 t; ?+ w* [9 U3 s/ k#endif# _" L0 q7 L9 ~& E. E
        ret = platform_device_register(&da850_evm_tl_leds_device);# P( u& l8 _5 X; K
        if (ret)
5 O# Y( T8 t% F                pr_warning("Could not register som GPIO expander LEDS");
) C' K6 C" @6 ?5 g# ?4 X/ t        else
! h7 S& _8 w8 W0 Z0 P                printk(KERN_INFO "LED register sucessful!\n");
& v1 r1 C8 \5 o+ P8 T% W& f2 w9 G, m$ _8 k
        return ret;
1 O* y+ J, D4 i/ L' g, E}4 @2 }5 R/ ~% o8 P3 f: Z" s
7 }9 H1 P) f2 |5 \. i
static void __exit led_platform_exit(void)0 _: p& C* p( G* w( t
{
% d$ b6 u( @6 _; _$ C/ T9 |! c        platform_device_unregister(&da850_evm_tl_leds_device);* l9 z. r& r' A6 L  k1 x/ E

% j) D8 d' ~5 J        printk(KERN_INFO "LED unregister!\n");7 C3 g/ Z1 d, _& D% e: z, ^$ y- B
}
3 k# N# X8 f, I8 H8 S
1 ^1 u( e. F3 s& m2 H9 `" Umodule_init(led_platform_init);' O2 i  E2 ~; C9 K, Y3 u+ C
module_exit(led_platform_exit);
) S/ |! l$ h7 j8 l/ z. W! b+ ?7 p% g
- i" x2 y+ e3 c) C: JMODULE_DESCRIPTION("Led platform driver");
0 R/ u  P9 l) J  _4 A0 k% o) uMODULE_AUTHOR("Tronlong");
% J" K7 ]/ n- |1 c' J# V4 ~3 BMODULE_LICENSE("GPL");# Y) T3 N6 ]* B

6 _  g; x( [  {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 07:49 , Processed in 0.044277 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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