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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
' j. `, _$ h7 q+ A2 x#include <linux/init.h>
" r% t+ ]% u( ]* D4 X7 n1 e& e1 y1 [#include <linux/module.h>
4 r7 F" {7 ]! h9 u$ [5 l& f: R1 ]#include <linux/kernel.h>
1 j$ N$ c" g/ c# |- W2 L#include <linux/types.h>0 o9 V5 Q) N# ^, s6 u0 q
#include <linux/gpio.h>
3 v) z3 \, [% I4 l) }  p% w#include <linux/leds.h>: O) A( T% P: m! [. }, M2 N/ F
#include <linux/platform_device.h>  S# s; K% ]/ p! _

% \1 ^! ]+ u$ h: _5 J#include <asm/mach-types.h>
' P6 g2 s% u, {2 }#include <asm/mach/arch.h>
/ @: B, k# E6 o  p#include <mach/da8xx.h>* s( X7 m5 n; |( [: @% d
#include <mach/mux.h>! |. _( h- Z# V; ~6 G$ X/ p
3 V! C, I  X. Q
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
9 s" Z; Q2 N8 j" H% u# D5 s#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
( r$ y, |# E8 q; ?! x3 e#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
5 ~" R% @/ h; w3 W' o' t#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
9 Z# d9 \, V+ v/ ~* k4 l9 J/ {7 l/ K& h2 A. g/ |
/* assign the tl som board LED-GPIOs*/
" S% E* E5 j. q  A& M  ~7 f$ Nstatic const short da850_evm_tl_user_led_pins[] = {6 T5 D  H0 ~% \* ]# a
        /* These pins are definition at <mach/mux.h> file */: U: p4 \! p9 ?2 n' o% h% k
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,  t, C# [. M; D2 M+ M0 h
        -12 a3 D- h, ~1 I
};
2 c) Q" \6 f  G2 l/ j3 v" a* [* n& \  g# o6 \1 V* y  p! s5 N3 b
static struct gpio_led da850_evm_tl_leds[] = {
' p: k; |, Q: J4 x( [/ @        {- F  t$ L- I8 @) |8 d4 C9 R
                .active_low = 0,
& L, `( q0 G! ?( v3 U+ P2 I5 ?                .gpio = DA850_USER_LED0,
% L) }( N9 a6 a                .name = "user_led0",  o8 q6 f4 H9 m2 U' z1 l
                .default_trigger = "default-on",
. e7 Y! T% O7 Q5 R" V        },
( b& N! H) n. N! U) ^  `        {
' N% [, ~8 R6 z* U7 f! w                .active_low = 0,  `+ v+ l( L3 T
                .gpio = DA850_USER_LED1,
: j2 o: ?. U% B* U  F- b! S                .name = "user_led1",
4 d. s* l+ E0 s! d' r: p                .default_trigger = "default-on",
/ l$ Z" Q0 ?! f) X5 H* G- N        },- y; n$ j+ m2 q/ u* S3 [
        {
' z' {" w" O3 X& a% P                .active_low = 0,& b. L3 H* w( y) v. W! _8 o
                .gpio = DA850_USER_LED2,
( s# h* ^: h8 X/ H" [6 `                .name = "user_led2",: W  X% n/ k  }- C3 z! S# I
                .default_trigger = "default-on",
: R' L- }+ w# E4 V; U$ C        },' a* E1 l1 ^' \
        {
, E" G7 t; l9 n4 B7 q& i                .active_low = 0,9 Z) b% M! ^2 Z
                .gpio = DA850_USER_LED3,
+ G- I* C6 U- E; Q) U                .name = "user_led3",4 I9 a4 A# ~$ W9 g
                .default_trigger = "default-on",
0 V. |# `' X# |1 s5 E        },
- ~' Y7 X5 _, s( ^+ h* ]};- U- s# E* }& E7 i. h4 Z' H
  Q/ R4 J5 d! O7 [+ j, m$ ~4 |
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {0 r! w* t0 T1 }; Z
        .leds = da850_evm_tl_leds,0 S, O7 K1 l* `$ ^* j  C! I4 H
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
  a6 X- \, U" R" X2 N- z- R- j};
7 }: w( p) w6 F
* ?3 X0 s* ^, y  _5 E! jstatic void led_dev_release(struct device *dev)
3 e8 ?- }4 R& B{
# `/ l( I" v; \& ]};
# `& l8 a  j* r% L. P  N$ A
  C9 w1 e) r$ ^static struct platform_device da850_evm_tl_leds_device = {" h1 ~+ t' B( u
        .name                = "leds-gpio",
' o1 k; k3 B: H" M. ^3 D, Q5 m& \: m        .id                = 1,
, f# c. |, `5 |& Q$ J8 A9 n        .dev = {4 W# f0 v, i* ]% e& Q# r% x- S: t
                .platform_data = &da850_evm_tl_leds_pdata,$ H, _# x5 r3 _+ t- z2 B% a
                .release = led_dev_release,
* l3 X9 C2 n7 x5 k: M, ^        }
# D  f, q6 k6 a. `' G  P};0 x1 {9 l- v, \; j7 Q- K5 U2 C
# @2 v6 C/ @! e, M. ]
static int __init led_platform_init(void)7 N: ]7 q1 i1 D/ c" y( W% |4 r
{
0 Z& t; b- @+ x: Z, ]8 G) E        int ret;0 U. {$ _- k* X9 p* R
#if 0" {' C4 P8 }1 N0 Z
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);5 R9 ~+ C. P. w
        if (ret)% J. K0 X# g6 U1 I0 X; V) C3 A( [
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"0 f) o: Y  I+ G1 D) Z
                                "%d\n", ret);
% q9 U  g" ]0 h% ?+ @2 S% j1 A#endif: ]* \( S: E$ w
        ret = platform_device_register(&da850_evm_tl_leds_device);
. j8 l% a; u4 J" E5 b        if (ret)
: A* Z  U& I0 L, P                pr_warning("Could not register som GPIO expander LEDS");. Y, |) ~7 d8 C" ~6 B" ]) B
        else
; r8 u& `2 o( K$ R8 Y2 m9 _/ I- i                printk(KERN_INFO "LED register sucessful!\n");
- a% M0 W2 @2 q% k: A% G7 j* X6 S* c5 n8 w, D
        return ret;/ E( J4 y  V8 ]- L
}
% S8 g' M7 B% u: _' q0 B! h2 B) f! U# X6 {7 `5 @
static void __exit led_platform_exit(void)' ^6 K' ^3 }4 ^1 z! g
{
. Q. R8 D+ y! l% ], ]; n5 e; B2 Y        platform_device_unregister(&da850_evm_tl_leds_device);- l# b( N  W3 z: \2 W
! c, A' Z( ^8 L1 \  d$ m' Y
        printk(KERN_INFO "LED unregister!\n");
0 s. _8 W5 Q- ^" e2 ^9 `; ?}
9 F0 ~: y  y9 x, [) `5 V4 E2 ~3 l& V( j
module_init(led_platform_init);
$ m0 p9 V7 B' y. @2 g( C" u& q( p1 |module_exit(led_platform_exit);' l9 O' G4 T4 W3 T3 o' H

7 z( F  P6 z& P' [/ h, [6 w4 nMODULE_DESCRIPTION("Led platform driver");
  B3 p4 _! w6 ~' g& U! S& p* ]MODULE_AUTHOR("Tronlong");
4 Z( ~1 J4 @# o: k) Y: H3 qMODULE_LICENSE("GPL");
! s( P' k, ]: |$ o/ f
  f" d; u; G$ u% a8 _0 h1 F9 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 06:03 , Processed in 0.040220 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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