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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
  O: G' T" T) L/ r5 I#include <linux/init.h>: R5 G3 o0 j. V8 i$ ^
#include <linux/module.h>
) Y% C/ D  @( _9 J8 a#include <linux/kernel.h>
" {2 E, c6 w7 x4 ~, k8 S#include <linux/types.h>
- W- o8 D1 l1 R7 R. E. S9 n+ R/ ~#include <linux/gpio.h>/ i  {  V. v7 E3 H2 b4 b: v9 V. x
#include <linux/leds.h>3 D! E& b; n& g+ h; R
#include <linux/platform_device.h>/ o6 a: I$ R& o3 h

% \* y/ G. V" d# G( H#include <asm/mach-types.h>
: V/ a% h) X/ u, p#include <asm/mach/arch.h>* d0 L% E" t9 I7 C0 ]" ~1 j
#include <mach/da8xx.h>
3 T8 W. y- ~, r  j& ]#include <mach/mux.h>$ l$ B" R  j" l- m$ x
3 n) I$ ~% M, z$ _( d6 }- W( ]
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
( u: ?8 X! A& K+ m: i#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)9 Q7 m6 q  ]3 h# H
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
$ Q4 h5 N/ c* J0 i. r; I9 [7 q4 m#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)" L+ m( f  A0 I  W. w9 _6 K

, C4 ]& Z& m' H& f: [: C/* assign the tl som board LED-GPIOs*/0 g* a: k7 w8 w' o' l
static const short da850_evm_tl_user_led_pins[] = {
( D/ O1 w( Q0 F5 C- c        /* These pins are definition at <mach/mux.h> file */2 r. c, v, k' [6 u5 p6 m' w( n' H
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
$ A9 O1 B' I1 @        -1$ o# Z+ ^- L$ h4 z, f4 x4 {! y
};
+ G* T4 s! A7 m- S3 y) v* ?' g1 S, G5 t7 |6 q' g
static struct gpio_led da850_evm_tl_leds[] = {
& F! I5 ~; ?5 W2 I7 T2 p4 R" N        {& J% t  ~) i4 X' h
                .active_low = 0,
* f9 f! K& |3 Z. ?: h( Q) a                .gpio = DA850_USER_LED0,5 l/ Y. o, U& ~9 W
                .name = "user_led0",$ i( y' y$ X' C# d9 ~
                .default_trigger = "default-on",+ ^5 Z0 P4 @- N- M/ P2 ]  S& W
        },9 S! k0 I) Y$ Z6 o
        {
/ Z1 H) s( y- j7 a                .active_low = 0,' K- F( X+ z  r8 s# \& |* I
                .gpio = DA850_USER_LED1,
6 [! S: `# K) l$ [- ]. d0 z                .name = "user_led1",4 b% ~0 j$ `9 K# L9 Y! Q( j9 p2 M
                .default_trigger = "default-on",+ f, ^; ^: ?/ l5 t  [' m8 e* \
        },
8 i% F; P, M5 D        {
9 M* Z5 g- w8 c' X9 r% I) L                .active_low = 0,
. c  N" d2 G6 S( t  c                .gpio = DA850_USER_LED2,6 w7 K  B  n1 S1 J7 u. T8 N
                .name = "user_led2",
' E  k# n% b, b' `3 ^  {5 g                .default_trigger = "default-on",. O, U* b/ H) @- @+ F+ I7 k5 s, g- ?
        },
) I0 j, @7 G" R1 ~" \6 m' P        {
* b0 [2 g# D, s$ V3 j                .active_low = 0,1 w' T5 |% r0 @! `' J" }
                .gpio = DA850_USER_LED3,
) Y+ z( R; Z. g6 L& V1 ]- d, ^$ e                .name = "user_led3",
+ N$ c  a' {" `, ]( U5 w/ Y, `' n                .default_trigger = "default-on",
: r, @" z5 J, }% o        },, `7 ]7 S. _0 ?
};
7 n5 `0 S8 U% B3 B4 _8 b  P2 _6 f1 B: V2 x+ m' c. ^% [
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {9 i# `2 M4 T( a, v$ X& \- n0 M
        .leds = da850_evm_tl_leds,
+ E" ~/ e: q8 Y. s; m$ w. p5 i( R7 R        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
4 X- A8 i/ E$ U, [0 W8 V  ?5 S};3 r  S1 \  H" |' U0 y  O) u4 z& [

3 B* D0 W  g" L/ I- Kstatic void led_dev_release(struct device *dev)0 H  ~$ P* |, S! }7 U) w+ y
{9 N4 G% R) Y7 c0 {; A
};2 x$ [. P5 R8 q4 [
0 S' C8 d8 ]9 H$ Y3 N
static struct platform_device da850_evm_tl_leds_device = {7 ?7 a. [. q! G: v  n
        .name                = "leds-gpio",
% x0 d4 q2 t. c. J! L        .id                = 1,+ T3 ~5 S$ f& [! y+ y
        .dev = {. _9 _. o1 v. d& }/ j) G4 z6 i
                .platform_data = &da850_evm_tl_leds_pdata,
1 D: I* u0 ^( Y1 R1 z$ A1 p                .release = led_dev_release,
$ t4 _" g8 a4 I+ v+ ^, j        }3 X3 I* _+ j' H" h
};* `9 g$ O) ?# P5 N- n% X
6 B: `1 w7 }3 y9 {; _
static int __init led_platform_init(void)) ]4 A/ E" u: A
{
! P8 o# @, {9 U  w5 I        int ret;1 w7 ]" x) v2 ]2 A8 k+ v5 U0 `
#if 0" l7 @7 a, A( M5 t
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);( a, H+ D9 h4 X. w: ]% Z1 K
        if (ret), J& C7 L& s9 C- M! O: E  y
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"* A6 h4 r1 V) y# O# b
                                "%d\n", ret);
) h) K! s1 k; L0 Z+ e#endif
- V' G- B+ Y( E' _: c        ret = platform_device_register(&da850_evm_tl_leds_device);
' j& Q4 L( A/ T        if (ret)
, Q' o( y' K0 a+ f; C* W                pr_warning("Could not register som GPIO expander LEDS");
% L* D+ {* y, P- R2 U! l        else" a( ~5 A. \- |3 l7 s, n  r8 l% {$ T
                printk(KERN_INFO "LED register sucessful!\n");
3 x) N+ C/ [' t& C. n6 n5 Q
$ b% n2 @+ ?% m0 Q+ p& f        return ret;
) U3 ~4 s3 ^! n2 \8 q, Z1 q}4 N( Z+ _/ N, a! Q/ }, f
$ H& S0 [- ?( g7 n$ }! {0 @8 ^
static void __exit led_platform_exit(void)0 f( `% Y9 p( j) U+ b5 f
{
$ w8 o5 m5 J: f# T4 n4 z6 Z& [        platform_device_unregister(&da850_evm_tl_leds_device);  {9 b8 _6 U4 s! [7 T
. \) k( ?) B% \3 w4 m, ^6 N
        printk(KERN_INFO "LED unregister!\n");
) p( y! [+ {9 Q; r}
' Z5 E5 ^0 Y! I% f* m: w
; f9 K& R3 l) E- Lmodule_init(led_platform_init);  ~: Z  l9 q) c& f4 v
module_exit(led_platform_exit);
* k# ~; U' y" b% _5 o4 Q4 P
; {4 T' [8 w3 Q* N& _- QMODULE_DESCRIPTION("Led platform driver");
$ _" z% D; X4 b# ?5 ]MODULE_AUTHOR("Tronlong");
: u! D  j( x4 G0 g" q$ @8 u- w! sMODULE_LICENSE("GPL");% m$ ~% K( o, P- j) p% u% y
: R) L) e0 l+ q9 S, [2 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 22:13 , Processed in 0.038310 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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