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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
* N; e4 I7 r8 g0 [#include <linux/init.h>; J; ~& E  W$ M- z
#include <linux/module.h>0 Z  Q* s$ P: T4 t* g* O
#include <linux/kernel.h>
- r+ f$ S& K' e# u4 M; J+ X% e#include <linux/types.h>. W9 k+ s: h! J: v1 r4 U) V9 q
#include <linux/gpio.h>
; m# _# q0 z( h! f4 X: v. D#include <linux/leds.h>/ U/ D7 z& m! E$ ^) j7 X
#include <linux/platform_device.h>: x! \4 ^6 ^  t/ [4 W: G; X
% ]* F9 ?# `( m% g$ E0 U, w
#include <asm/mach-types.h>
# j; |) y2 U8 S3 W6 q0 F#include <asm/mach/arch.h>
3 n8 m( K/ u# X1 }5 P#include <mach/da8xx.h>/ v2 Z2 n+ }8 |( E  p7 Z
#include <mach/mux.h>& U8 T3 {" }) m8 I" o4 o* X$ r9 R2 U

% V2 _% G4 W8 |. k#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
" m6 ^9 L2 V5 {#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)" m1 x  a  h6 ^0 g! @& [+ W
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)  _( J, m9 x( j9 s% t
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)  q8 Q/ L) ~) N9 @& n

+ Q0 R1 P- l9 n5 n/* assign the tl som board LED-GPIOs*/
. C4 o, k2 G6 C/ j5 n3 C5 _static const short da850_evm_tl_user_led_pins[] = {
. K' k4 t6 {# r- X+ X( d( T! q" M        /* These pins are definition at <mach/mux.h> file */
$ `# I, V& N" x: q6 Q( c+ n, h) B( ?        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,0 M: y+ A4 T6 R. z6 T; x2 s
        -1- L" ?1 c6 Q5 M8 a
};
7 j. |! A* n: I8 k9 l* f# F; o4 Z, q, Q& p7 N  x3 ~
static struct gpio_led da850_evm_tl_leds[] = {
2 @0 k9 z& m  Q( b' c# y) v" x        {/ F8 X  ~1 D6 T/ d3 p
                .active_low = 0,( a: o+ R" j+ t% U" }2 J
                .gpio = DA850_USER_LED0,7 }0 u, x3 b* F4 d  e9 U# V
                .name = "user_led0",
) R1 D: G) Y$ o. U0 x# q2 T                .default_trigger = "default-on",6 E, }2 I& k) X' U! Z5 P" j
        },$ F7 A" c9 l8 P& i9 s4 O/ u
        {
2 A8 \# I  W; A% ~; L! |/ |                .active_low = 0,
' H7 D7 [* {4 _8 b; Q! g& P3 f                .gpio = DA850_USER_LED1,' u+ G: f: A! }- ~+ O) w
                .name = "user_led1",
% m9 k- k/ `2 ]. `  [  k                .default_trigger = "default-on",
2 h7 a. N' L/ K9 H2 O) W        },
- K' U- I9 R8 t        {- q! ~& X; @6 f0 L& }* L
                .active_low = 0,; S9 A) Q) ^4 s& g: A5 r
                .gpio = DA850_USER_LED2,6 Z# d" x/ c% L
                .name = "user_led2",
9 j) k) r  O8 n; j                .default_trigger = "default-on",# }& O' o7 m/ c/ c4 F
        },/ O8 F& M/ |2 s& z- K, f
        {, \) i' [0 D, J& E
                .active_low = 0,4 s) X1 M! C) n; \
                .gpio = DA850_USER_LED3,
" u. l* G) U7 y                .name = "user_led3",$ H9 f( ]9 _- d
                .default_trigger = "default-on",0 f- v& n: D0 A/ @5 S! W
        },; w9 t/ Y5 L8 ~- q( W- ^
};6 g. j) Y$ g; D6 T) r; [

- s: y: `7 J2 ~& {7 o5 i% A: Kstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
( T1 T( s6 Y& s/ A" T7 J        .leds = da850_evm_tl_leds,6 K8 i, P) i6 ?( t$ c5 ^& z$ x
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),9 ?: x2 H9 L( \- `% T  D5 z2 }! ~
};
6 I$ ^$ ]. W5 m" u, ~( }7 w
, R+ P6 }' `% dstatic void led_dev_release(struct device *dev), @- x" Z- c3 N4 X- x
{
8 P' z1 p  O# _+ A/ j};
; w/ K* E& @' c3 L4 F! C% v. H! g% ?$ n7 F0 q
static struct platform_device da850_evm_tl_leds_device = {; ^0 T5 ~  J( i: V) G& c$ v
        .name                = "leds-gpio",
. n, i* ~% ^% a' b3 Q        .id                = 1,- J0 T, Q4 p) A4 q2 t, V+ D: x1 [
        .dev = {$ [. Z' B. q' f0 k% n1 }3 d
                .platform_data = &da850_evm_tl_leds_pdata,
- y8 q# F" y4 K5 f                .release = led_dev_release,1 X) y) N/ _8 [  j0 K. L
        }
: F3 x4 m  n1 u, Z/ x: ]2 }  ?};: t* ]# X1 T' \' ~# I
8 q0 j/ H1 E6 _- F, X, E: z, }
static int __init led_platform_init(void)
" K" p2 C# Q2 y# `, Y2 m( j{5 E' U5 B" |, U$ ~5 k1 _6 K
        int ret;- H8 e* Y- {% l; h  b) K1 X; R/ p: D
#if 0
. a) }3 O. ?# D        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
' E! i+ ~- v* E7 I3 q( ~( I        if (ret)
' x: P$ C$ A" m* l+ l                pr_warning("da850_evm_tl_leds_init : User LED mux failed :") f/ J4 }3 ~1 ], b  N) Q
                                "%d\n", ret);
6 A3 o! P/ p! |8 W8 L#endif
, Q8 y2 R5 d3 q# H) Q! s* W        ret = platform_device_register(&da850_evm_tl_leds_device);1 Q- F4 ?% Y0 p7 N) k
        if (ret)
' ?% c1 Q" X3 M$ q  `& M; Z                pr_warning("Could not register som GPIO expander LEDS");' l# e0 g8 k; y# S! E
        else
" E: S  Z" s( k+ o# M+ f0 |+ R                printk(KERN_INFO "LED register sucessful!\n");
/ t( `( f  W4 L6 `5 U
! M9 ^! x, ^9 d; C        return ret;8 X  n4 n' D" A. C. o) O
}0 n+ D8 l9 _5 V  N
4 A5 `' l& k/ Z1 w$ x3 [  n# b) A
static void __exit led_platform_exit(void)
6 \: {& d5 H1 l- l5 T+ Y! K{5 ?. B' C9 c9 L8 r' A6 J% H! o
        platform_device_unregister(&da850_evm_tl_leds_device);
1 M: u: s# f( y; ^  I1 ^1 F& K' K8 b
        printk(KERN_INFO "LED unregister!\n");) U$ C/ M5 }2 ]; G
}
/ k: [, v; B" D* s& h" F% H, h* G6 ^
module_init(led_platform_init);, q# N; j1 f# Y" a' y
module_exit(led_platform_exit);1 L1 W9 I% j& p0 f4 p
% C5 c2 F9 J0 u; }+ U
MODULE_DESCRIPTION("Led platform driver");
0 L& S( R5 v4 Q9 r/ H6 cMODULE_AUTHOR("Tronlong");" l7 K4 a2 j& f6 L. L; [8 _& f
MODULE_LICENSE("GPL");" j0 K9 Y% C, c2 A# c. A* D' [' S: @+ J

  [$ f# ]: I: Y7 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-21 04:21 , Processed in 0.040832 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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