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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
) n& |# r: q! G9 B5 t#include <linux/init.h>' ~" o) Y( |# A! ?) @
#include <linux/module.h>
3 j9 e1 f& n( E) b8 o0 o1 T/ o#include <linux/kernel.h>
/ }5 R/ b! F' e# }; d4 i" S9 o#include <linux/types.h>& R3 I$ ^, I5 h2 U2 E( n
#include <linux/gpio.h>4 b& w7 v* b+ V5 A+ U, E. r" L
#include <linux/leds.h>
$ d% `" X& [- x$ P8 R- p#include <linux/platform_device.h>
, z, X/ v8 T; W" P* y9 f# N- h& ]8 k. {9 ^: I3 A: g
#include <asm/mach-types.h>5 ]7 V2 E3 |3 n
#include <asm/mach/arch.h>; n3 U! A/ U. {8 H& r$ r1 ^
#include <mach/da8xx.h>% A5 z1 A8 c  S; U5 q
#include <mach/mux.h>
& E, E4 J% P' }/ F& F; I( q/ p" e, B  [* D' ?
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
% c+ L2 o' \9 V+ C#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)9 f- h0 k) i4 U1 e
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)9 w! n) M; g! C4 ?# A- [* O, O
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)6 G8 v9 u* b  S" v( w5 I
# E; w5 C" O) T
/* assign the tl som board LED-GPIOs*/
0 e; u* u0 f! R5 Q. |* Gstatic const short da850_evm_tl_user_led_pins[] = {
, a% u% Y/ I+ W# w/ [        /* These pins are definition at <mach/mux.h> file */
8 d7 z( e' a9 ~$ w2 E4 Z  F8 D/ i/ X        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
/ e& ?5 e. x" j# y, E( m0 E        -1) `! a* e: g. h1 D; }
};
- J- _5 i; n+ z0 g% V' y
+ E& d& L5 o9 [/ o8 ?4 e1 hstatic struct gpio_led da850_evm_tl_leds[] = {
! u0 K1 V# c' \, r$ u        {0 Q. n8 ~9 k' W) U/ }! J8 J  \
                .active_low = 0,. X4 a/ Z6 U) |
                .gpio = DA850_USER_LED0,+ H( g) G+ E; u; K0 g* B# t
                .name = "user_led0",
  ^+ X7 h) _: Z2 ]1 |( f                .default_trigger = "default-on",/ ?$ t, @0 Q& G( f
        },
2 C3 Q, n/ @, ^% y( i% e        {: P* a" M( S1 p4 w
                .active_low = 0,
# h# K) W7 T; o; `5 a% v                .gpio = DA850_USER_LED1,
1 t* _% k! m6 O' J% N                .name = "user_led1",
3 M4 W5 c+ n" J9 v( X. q. v) j% d' l                .default_trigger = "default-on",
) D. b* ~. `, ^1 w7 R# S/ u/ ~        },
! n# n7 a1 k5 [  j' m        {
' J7 \* |8 {2 L0 Z6 N5 c, k% Z  m+ ~                .active_low = 0,( E' h$ D( c0 t. `- C5 |
                .gpio = DA850_USER_LED2,
1 ~7 ]1 l) S3 e* D, m' a                .name = "user_led2",
2 b2 T  x* a) }: a7 k# V                .default_trigger = "default-on",& |9 F$ p2 u- \+ e5 T8 L' ?$ {
        },; ?7 Z# q4 I5 r- r3 T4 s
        {! @( l# U7 I# l+ M* _8 l
                .active_low = 0,7 ~$ n) j9 m; J# T% V# U. b
                .gpio = DA850_USER_LED3,3 Z$ |' B9 m4 X! `. }9 M
                .name = "user_led3",
: N+ B! l- I1 J$ X7 ^& C                .default_trigger = "default-on",
6 V8 Z3 X. u3 L# i" L6 X, h7 J        },
& ~" Q$ I9 R: _' r) l6 }* i4 g/ V7 W' G};
+ I7 B4 }, \2 X
5 ?; }; `; a; ]( |static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {9 K  L1 d" H; {
        .leds = da850_evm_tl_leds,( R& H9 r% e, ?, H
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),5 T0 x, o  g7 M2 F
};
+ D, J  }1 G/ X5 O6 i5 V: N7 D1 S; D! d. x' B
static void led_dev_release(struct device *dev)
# K) b/ Y+ \  f{
, G* Z8 i* ]- j};
6 f) u- E' n& L3 J) \) N! n5 x3 s% m
* t+ P5 R! e9 Ostatic struct platform_device da850_evm_tl_leds_device = {
# L' i) X0 V2 U0 D  Y        .name                = "leds-gpio",
* t/ k% g* `3 ^/ ^  h/ s8 z        .id                = 1,
4 b: J8 [$ ]3 H( j" B( Q, N        .dev = {6 Z, Q+ Q% w' p1 O/ x& m
                .platform_data = &da850_evm_tl_leds_pdata,
7 ^7 S/ V3 |9 T5 T                .release = led_dev_release,
. T! D0 w6 Y7 q9 {8 R) l        }) Z9 i7 y0 t  M# t
};. X! ]" g3 C2 a7 m8 L3 @

2 o4 ]& J/ d9 K1 P; P* ystatic int __init led_platform_init(void)
8 W6 u/ L( o2 K" [/ |9 W0 d{; A- I: w* S, V1 `! w. a; r6 Q! u( ^
        int ret;
' w- w& G9 C" ~/ y8 @#if 04 x( `$ v& x0 e
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);! U: H% e2 d/ u+ |: ?. ]# E
        if (ret)3 z# ^2 o/ s' N7 r' I* S
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
3 |; @+ K9 [5 B                                "%d\n", ret);  q( r( k( q! f5 v
#endif
& ]+ z9 f$ V. w) y3 |        ret = platform_device_register(&da850_evm_tl_leds_device);4 G4 \# P; A) N; Z0 ?! t5 B: L
        if (ret)* s$ X+ d* f* U! M6 k6 y
                pr_warning("Could not register som GPIO expander LEDS");! I/ C' F; j9 O
        else
& D& _0 C8 ]+ U. y4 |                printk(KERN_INFO "LED register sucessful!\n");
+ Z' [3 C2 z9 u- z: N+ T9 V( K( f. x( S1 h# d
        return ret;% ^2 w7 J# V2 c' h; w
}- F3 m( d7 g& M- Y4 Z3 W( I

! \/ n  t# u, @8 v6 j6 n& E) astatic void __exit led_platform_exit(void)# z2 h0 a+ W: w  h; s8 I
{
% Q6 \* X: G) m. a/ j/ c        platform_device_unregister(&da850_evm_tl_leds_device);/ d7 G3 X+ E5 c# p; f/ f1 d
7 w$ Q" G% x; C) _+ f! r
        printk(KERN_INFO "LED unregister!\n");
% E5 N  K" j5 d0 k; z}
- ]2 _! {& k0 ~7 o# `5 n  Y* f: s- r1 k9 j  j5 k& \/ x
module_init(led_platform_init);
  e8 b8 e0 e* [  Jmodule_exit(led_platform_exit);* V( k3 j% x% s: H5 S$ E3 `

& X3 \! F; J5 n+ ^0 jMODULE_DESCRIPTION("Led platform driver");
& b, y! A1 c1 jMODULE_AUTHOR("Tronlong");: R; G  E6 K& a
MODULE_LICENSE("GPL");9 _6 ]! M  y* C" [
2 ]5 |/ |- \- Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 12:56 , Processed in 0.039953 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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