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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
, j7 z* K: x) \$ H2 M" ^1 K1 N8 ?#include <linux/init.h>  h4 r) x9 x5 v3 O$ k
#include <linux/module.h>
( V9 P" ^0 k4 W5 J" w#include <linux/kernel.h>6 Y7 T8 C* {5 h1 a7 c6 c7 `$ v
#include <linux/types.h>! @5 I( Q0 J3 w1 Y+ R* A
#include <linux/gpio.h>" ^! u- n* `) n. k% d6 v  ?
#include <linux/leds.h>
" g! Y/ b  x* [  a2 l* @0 H#include <linux/platform_device.h>/ n; Q% q1 B3 T) [: l, a

, m' p" a% J, q! q) a- M# ~! e#include <asm/mach-types.h>- r# `+ H6 Q7 I, P7 L# S- ~4 ?
#include <asm/mach/arch.h>: K; P9 M' ?# w1 O( o
#include <mach/da8xx.h>" f, P1 S" e4 D. S7 s
#include <mach/mux.h>. Y7 g$ h* b' S: h
8 b7 J: s7 k' V0 a9 h+ Z- Y: w
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)* f/ l/ E) X# d& S
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)- @! \* A. t  {$ b5 f# t/ r3 Z% e
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)! w. b; D; M* Z3 h
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)) i- }. l% J4 k  h  V. j

! O  v3 k1 y& n9 N: C. U; f/* assign the tl som board LED-GPIOs*/+ F* \" x4 }, t" {0 _0 }
static const short da850_evm_tl_user_led_pins[] = {, Z  E) G6 ~' b/ x
        /* These pins are definition at <mach/mux.h> file */
) D4 v  a# D! A' ]& v, X' ^( W        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
- _2 X( z6 |- k1 n        -1
9 z0 L- c  }4 v( f};
1 b) J' e) X3 K( N1 \& F$ V+ C  v- t9 x# V6 K7 l/ f% D) E
static struct gpio_led da850_evm_tl_leds[] = {
8 S( a8 w8 F8 Y8 B' |: t1 I2 n- K. Z6 Z! h        {6 ?" {' F. ?' V9 Q5 v% q
                .active_low = 0,
8 z, s& X' H! n" [/ m                .gpio = DA850_USER_LED0,
' K8 a: ~% i% B  V0 z6 }+ o% _                .name = "user_led0",
( O3 X8 v- j* D                .default_trigger = "default-on",' R2 q2 T" @& b( y/ A
        },
5 y) @! F) K6 z. [% j        {
5 w1 k4 w$ M5 x$ B1 Y/ v                .active_low = 0,
/ D# _/ z* K5 v3 I$ G8 ~& n                .gpio = DA850_USER_LED1,
+ Z% ~& F2 X* X1 F* G1 U                .name = "user_led1",$ a: s. @! H& T3 I7 T+ C3 c
                .default_trigger = "default-on",& k4 X0 t+ U8 r0 a9 T- v
        },
# N' i# l0 [% t* p: G$ o; d        {
) d( q+ Q& t1 B8 m                .active_low = 0,
" ^) L" I& V( F9 y7 n7 O                .gpio = DA850_USER_LED2,
6 E& J& _% S) j6 y  |' ^                .name = "user_led2",
+ L- k4 R. ?% \7 [6 a, k! K  S& e1 r  A                .default_trigger = "default-on",
$ Q0 c" S8 m4 |7 y* \9 n0 Z        },
0 Z6 V. p6 o1 _" p& ]        {
9 ~* }- _' O% r; C) r                .active_low = 0,
2 U0 i7 v% f1 U+ ~                .gpio = DA850_USER_LED3,
  f' F8 M6 c3 o# `                .name = "user_led3",
$ a4 H: k3 I8 t7 s                .default_trigger = "default-on",% V" O& Q) E. N7 W
        },, B; u( ?' @: k+ \+ C
};
1 Q2 L' m. G# W1 Q
) `( c' e( ^) a6 ^# q0 i$ @static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
8 |& n5 S9 v5 ?        .leds = da850_evm_tl_leds,
2 E  S# {4 ?! C" a        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
( m1 y) t2 s9 y2 X2 C};' _1 m  w6 \& T9 L2 {8 `
" _# N) A4 b. r0 O% N( |: a
static void led_dev_release(struct device *dev)
( C5 _% p" K! _; o" |4 P{: X8 H& g1 }/ P5 N  M; n
};/ v# R5 ?! f; A, V& j

3 d, h' z% D5 y2 X7 ~- |static struct platform_device da850_evm_tl_leds_device = {
4 _( n7 g0 @9 B. v/ k" M        .name                = "leds-gpio",: g% L" M0 O1 m. d7 u
        .id                = 1,
! Z  b1 Y, Q2 o        .dev = {0 E1 G0 }; u: D5 K( G( l. L
                .platform_data = &da850_evm_tl_leds_pdata,! g! @! _/ F% T; ]4 w0 Q9 H
                .release = led_dev_release,
# m& ^! M- G. w5 d        }
/ N* t: f5 ^: V) R! Y# }6 x( n- _5 M, {};. y" f/ U5 r, V! t" T) c

/ }: R, \1 W! I/ R# _static int __init led_platform_init(void)
# Z$ y# M! i$ t( B: G{% O4 s# ^3 C0 Z& D: k& Q! [. W
        int ret;% Y& l5 i$ @1 M3 _8 s, k: p
#if 0
* u! d$ n- \8 d! K        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);: x8 ?, d+ R: f
        if (ret)' r5 e: q! ^8 P8 @4 `% a
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
6 v) D4 s6 z  r2 R! x                                "%d\n", ret);
% U/ z6 b9 y& J, Y  ^7 `' b#endif: _. |8 E6 B; I: k. i4 X' v
        ret = platform_device_register(&da850_evm_tl_leds_device);! P9 i+ Z) S+ e0 h) L" `
        if (ret). v3 [) e& U" D: c7 G. z
                pr_warning("Could not register som GPIO expander LEDS");
. E/ e: k/ }& J        else
6 I& D$ f; i/ b# \0 L: X$ w0 C2 [                printk(KERN_INFO "LED register sucessful!\n");
  P# l7 n0 o4 B% `. M2 P
6 v9 n( T- {' i" r1 D3 X        return ret;" x- h7 H6 Y' i
}3 E0 C( t3 j) P/ S
5 a/ @- _; L; i) d' N1 \( \
static void __exit led_platform_exit(void)+ I9 J8 V: e; c' m& d7 @
{  B- Z, k6 U7 F' n* L. r- s
        platform_device_unregister(&da850_evm_tl_leds_device);
$ |1 s. O8 E1 ]/ I* b8 v* Q- u* |' \
        printk(KERN_INFO "LED unregister!\n");
! B$ }+ ^4 K, o# _" s& [/ }1 |! k}
& t+ c5 P4 W1 g- \2 t  s6 i) I: Z2 y6 A% Y! s9 r5 T
module_init(led_platform_init);
0 K; @1 y# R' U  H( m5 Qmodule_exit(led_platform_exit);2 n7 C2 g- R( T! `$ r( b& x+ B1 c# i
* a6 r' @- r; F
MODULE_DESCRIPTION("Led platform driver");! B- Y( X- e1 e- j) R3 Y
MODULE_AUTHOR("Tronlong");
, }9 G# S. I1 v, g( j5 @- wMODULE_LICENSE("GPL");6 s0 ~; E6 I. h( H% T# e. S

  F7 ~* c/ t7 y- W9 a% T: a, U1 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 18:45 , Processed in 0.040454 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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