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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
5 t0 l8 q2 C4 U8 _#include <linux/init.h>
% G- r. P  e" C% M. B) H4 `9 Q#include <linux/module.h>6 l& ~* G9 c+ Q; _$ V1 p
#include <linux/kernel.h>0 O- U" W% B7 \$ N- ]9 L5 c
#include <linux/types.h>4 p- o6 d; A0 b, {" ]6 R
#include <linux/gpio.h>
6 Z" ]4 ?  p3 x6 [( s#include <linux/leds.h>
, O6 R6 D7 R% s3 ?#include <linux/platform_device.h>9 O! O! h/ c* g( I
+ Q1 \* B* N' |2 M! M
#include <asm/mach-types.h># r' \  y0 ?2 r+ g& r# X5 x3 p
#include <asm/mach/arch.h>
3 B8 I' A4 c7 f3 ?$ [#include <mach/da8xx.h>
4 Z, U$ O5 ?9 C& M) a#include <mach/mux.h>& O2 @" p6 w( H! D

+ C$ N4 b) T" I4 p0 S1 I4 ?$ G9 W#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)/ C7 H: j/ N9 \9 Q) Z' [# F
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
3 f9 g: _1 c3 ?#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)" l* U5 x% ^! x' T' j; ?
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
: d2 i% O$ E" y7 F% T! N* ~' g# h: i2 s* E! _
/* assign the tl som board LED-GPIOs*/& Y$ H* e7 p0 x( a! S! f
static const short da850_evm_tl_user_led_pins[] = {4 t1 f( q( |3 h
        /* These pins are definition at <mach/mux.h> file */0 O, t/ n$ F) l, C' n5 o5 K
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,3 }" \3 t- j; u' }
        -1" n  H0 ~) Q, V4 S& a4 V
};
, l2 Y8 J% W4 c4 T  `% h# F
% h* S- T$ V3 B2 E# vstatic struct gpio_led da850_evm_tl_leds[] = {/ {  y6 e6 w; b; n, X2 i. y$ x
        {6 y" W2 Q; r& R- j
                .active_low = 0,
1 e  m8 D; S5 M                .gpio = DA850_USER_LED0,
' E) V% E- o6 L" j4 L                .name = "user_led0",
6 i4 }/ W% v4 r* x* h$ l                .default_trigger = "default-on",
+ q) {0 ^3 c- ^        },) F* o" x8 O/ S  x5 y* T
        {: A' n$ N3 X: Y$ V1 l, D
                .active_low = 0,  f& y4 [- x- B* h
                .gpio = DA850_USER_LED1,  V7 u+ t  n1 x. O( r, n. @
                .name = "user_led1",+ w/ i5 s7 E% l* {
                .default_trigger = "default-on",) C4 v1 d, T! `# w5 i0 j( J
        },
% e* y$ R, s# I" o' d! w        {
$ G$ x' A; y: S& m                .active_low = 0,
& e$ V$ X& ]7 Q1 P" E7 ]                .gpio = DA850_USER_LED2,
0 _2 I8 y( L/ L                .name = "user_led2",/ Y1 U" h1 G2 S; A! j3 {
                .default_trigger = "default-on",
6 d' h/ r2 d. X; T8 B1 K& p        },
$ X0 j1 Y$ q5 n/ K# |5 c0 B% a        {& w9 J2 J" ^+ E% l9 ]: Q
                .active_low = 0,# N* V! |' R' p+ s2 P/ h
                .gpio = DA850_USER_LED3,! Q$ u$ A  R( t2 J# v$ K" Y* Z' W$ Z# B
                .name = "user_led3",% G  b% ~, \: h
                .default_trigger = "default-on",1 v1 m0 C6 m( e9 V8 b
        },
: x- t- W& g" @4 }# x* R" V% C* B};
/ o- I# g9 k" q, K7 W; A" v
- d, ^( o. u8 j6 m5 \static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {" F. e7 r1 y+ {* u5 ^7 l
        .leds = da850_evm_tl_leds,
$ p1 ], ^" G: K% w: Y) o. b( N        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),1 N& ^5 u6 J  ?! y0 M
};
3 P5 t, E. P. ~* _; I; L
7 u3 n; e% f3 F. @+ l3 ^; [9 astatic void led_dev_release(struct device *dev)5 t0 {/ g' B! e9 }9 _9 k3 j
{% n3 W! r6 ]( w1 E. I0 g% O- r
};
# Y) R$ e0 f  s2 d/ ^# b1 N6 J( N# v6 S* t7 P2 B' c$ v
static struct platform_device da850_evm_tl_leds_device = {
/ h$ p; Z6 R* L        .name                = "leds-gpio",0 l5 e: J1 U: u1 c) b( G2 F0 K/ z9 H& }
        .id                = 1,
& X6 N: q% p9 U/ f+ M        .dev = {  J+ I( H, k( G3 @: X! a/ o) t
                .platform_data = &da850_evm_tl_leds_pdata,% _5 L9 x. z2 g, }# y8 q
                .release = led_dev_release,* [/ y4 Q/ _' x0 g" S
        }2 N$ i. j5 R2 ^8 C2 E: L
};; V7 b) d2 ?$ z. y4 b. O+ \
; Z+ j8 `- ?9 q; Y2 I; V) ^/ m+ l
static int __init led_platform_init(void)
, j: r( k6 g) d% J* G8 b{
9 ^$ ~7 c, s/ g" ?, t6 l/ h        int ret;! D5 q& p; E4 b7 E
#if 0
2 ?) a  @/ H% p, z9 J4 S        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);! c8 n) F- o" v' ]6 R( |
        if (ret)
. d$ R2 d. ~: `, i3 z. Q                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"! d5 w, O8 [. v7 @3 |1 h
                                "%d\n", ret);) z8 [2 u5 b/ q' @  U* _" I
#endif8 e" Y& h( m! p4 P9 [" F7 s
        ret = platform_device_register(&da850_evm_tl_leds_device);
- m- M7 F" J8 t& |7 j: m        if (ret)( m- u7 q8 j7 c: Y
                pr_warning("Could not register som GPIO expander LEDS");
  [# d  Y1 @7 X) Y$ R5 A  d. C        else2 R* ]8 Y# }) ?& J' |; R
                printk(KERN_INFO "LED register sucessful!\n");
6 z/ R) o8 P1 U" k. ]3 \. E- i- p3 [0 \+ b" Q
        return ret;
1 P# f9 O  p3 q% R% z9 Z; g}
+ Q2 @. C% Z9 w# S( y( H; f% |
6 k; \0 U; K; Q+ f, u+ v: dstatic void __exit led_platform_exit(void)/ y$ k( s- l7 f% z5 x0 q
{' ~# O+ U; J% X& V
        platform_device_unregister(&da850_evm_tl_leds_device);9 ~5 w6 |6 F1 L1 E' E* m

" \$ O6 ~$ G5 I2 N, H! ?. ]* S, ~        printk(KERN_INFO "LED unregister!\n");
6 v9 \7 A$ s( a2 o- u. [: f}' k/ `/ v" g: P6 y2 T; g

9 J3 J6 v9 u! ~0 i, i5 A/ z7 i+ {module_init(led_platform_init);
0 s9 D9 P. o( E) m9 Cmodule_exit(led_platform_exit);9 W# ^/ F' B; c: M6 m" w3 @$ Y% e
3 a  B2 A0 a+ \; I2 U, _
MODULE_DESCRIPTION("Led platform driver");
- i& Q# G( C; q0 f/ NMODULE_AUTHOR("Tronlong");
8 w$ [2 ]4 k# [2 ^4 q+ P4 zMODULE_LICENSE("GPL");
8 p0 _4 Y" f1 _) o
2 p& t+ _8 N) e& G0 o$ E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 01:23 , Processed in 0.038422 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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