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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。$ R$ y7 r1 P  A) |! _3 [
#include <linux/init.h>
* x. d/ ]9 }: E; K1 z#include <linux/module.h>
, b$ [# U3 |6 W3 V5 K#include <linux/kernel.h>
5 u8 t6 N% M) S4 [8 @#include <linux/types.h>
! L% c. S) p# d" P6 w#include <linux/gpio.h>$ N5 }8 g2 }# t7 x% o3 j
#include <linux/leds.h>- N3 d1 E% E+ |
#include <linux/platform_device.h>
% A1 h% O4 x2 S6 f; `8 l5 `6 G( |& B, m1 a! P
#include <asm/mach-types.h>* ]5 J% H+ f% _$ \& h! B
#include <asm/mach/arch.h>
* Y9 s- Y7 K/ L#include <mach/da8xx.h>( w2 H9 i$ i3 C. x8 T
#include <mach/mux.h>
9 ^& C- |* ^8 W2 y6 D% j* A' W6 Y7 i( p/ P, b& d' s7 S
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0), s% s/ x; c  [- F/ I, B
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)$ B; a" O+ E6 d& k- h
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)$ t! q$ }/ K! A% q* g( Z
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2); Y& I& r5 {  q" [8 P* w' R* q) n2 P! }

6 F; h- c9 d, w4 t/* assign the tl som board LED-GPIOs*/
6 w- a1 V0 u$ {. ostatic const short da850_evm_tl_user_led_pins[] = {
0 p7 z! t. `" M8 j' o7 \6 t( O        /* These pins are definition at <mach/mux.h> file */6 W1 Q! {4 C/ W% t
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,* p( t. p+ H1 E; H
        -1: `3 A. j7 r* J4 b; i  P: C; R
};; f9 Y/ h8 z2 O" Q. X* K

% @3 z2 X: k; t- e, |" estatic struct gpio_led da850_evm_tl_leds[] = {) d' U! ]3 T7 u$ f
        {: t$ t  K* i0 L* ]& z" `1 _; ^: N
                .active_low = 0,
: r. k; P* d. v' I+ W% w                .gpio = DA850_USER_LED0,+ H% y3 ?# Q5 r' y& g. ^
                .name = "user_led0",
5 n+ i8 p; b* Y  L/ a% i# i                .default_trigger = "default-on",7 i4 _  V. l! z, ^) ^7 }) t$ i
        },; c" h  c2 \# h  u
        {" {* C6 f6 X2 Y" w7 j8 G
                .active_low = 0,
! P, @1 E0 o! S                .gpio = DA850_USER_LED1,
* R, ~* Y. |' U: v& n4 }& [/ t                .name = "user_led1",; _3 \# u1 x" i. I3 y1 ^
                .default_trigger = "default-on",
0 n/ S4 R  A* v) Y; e+ E6 [2 j        },
0 D- ?2 p, K% }& Y7 H5 j        {
( ]9 m# j! @% Y8 o4 l. y                .active_low = 0,* L  [1 K  N2 x
                .gpio = DA850_USER_LED2,
8 `/ F5 p! k* S$ S7 _6 ~; u                .name = "user_led2",. [. }: \! b+ I
                .default_trigger = "default-on",6 y2 B4 \% d! f+ `/ {2 ]; r  V
        },
$ }/ K' m+ L" e1 Q& Y! h: L        {( B* _, ?/ P; A& r/ Q, M1 g* a
                .active_low = 0,
' F+ P4 `& [( P" K0 K" r  m) a6 {                .gpio = DA850_USER_LED3,( T8 D+ K5 a5 Q% L
                .name = "user_led3",
* f4 f% |6 h. ~) }3 P                .default_trigger = "default-on",
: U/ d: ~& t7 i; Z' ^6 m& c        },: s/ E- ~( v  S  F
};
! w& d/ y$ \' \6 j% y
: J2 Q# S% S. I6 B+ V3 f6 K( ?" ]! |static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
- E+ F* ]" P% `        .leds = da850_evm_tl_leds,/ c& V6 }. v) O, C
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),; G* d. a. h2 s1 s
};
- `  v$ s# W. Y1 l8 Y" ?4 i5 M- _4 h+ ~8 H1 w' m* E
static void led_dev_release(struct device *dev)
) ?" B: c$ \! C{
6 B- r0 N/ f1 d! D};
2 l/ A  n, c9 c+ V& v% _4 e% f* e8 {9 Z1 V7 h
static struct platform_device da850_evm_tl_leds_device = {' J8 ^/ k8 a: g# W( I! L3 W; a  _
        .name                = "leds-gpio",
( Q3 q5 s* ]; K  O8 n9 J: {7 ~        .id                = 1,. K( h( s' D" i* }" h
        .dev = {
+ U$ g$ [! e+ ?( n+ j) |                .platform_data = &da850_evm_tl_leds_pdata,
1 I* I* [( X7 h% q                .release = led_dev_release,
$ D- S1 P( U3 z+ e! t+ f: k        }
1 w# \& w+ r. j" j2 |};
- b  C" P: c! u' r$ t2 h0 @
& z1 y9 b5 y, ?# ~static int __init led_platform_init(void)  M# b! j) B1 G( E$ G
{' J$ X3 _6 O0 g! M6 H5 w, Y: g
        int ret;
( f; Z: Y* J2 v) [#if 0
# L2 v5 v" N' G5 p) S- N        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
$ \3 Q. k* e7 ~        if (ret)
; A9 d9 e9 M$ ?& ?2 {7 g$ B5 Y                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
" T4 H& S' c; j: X' ]7 m, |( f: `                                "%d\n", ret);1 o9 p5 _$ T& H& d& N
#endif  N7 T4 V. o' y0 A0 U) S8 P  T
        ret = platform_device_register(&da850_evm_tl_leds_device);" S! M7 g! I/ @
        if (ret)* K0 c+ v; F1 x1 A7 E
                pr_warning("Could not register som GPIO expander LEDS");  [+ d5 k" A9 _( v, ]
        else# v8 z( o; Z$ p7 G- R, p1 [# b
                printk(KERN_INFO "LED register sucessful!\n");$ o" S/ M  E# q. g
' h( N8 O4 H' D) a8 m" Y
        return ret;
) W7 q( F9 e0 h' M: }& N& M! ]}
9 b  l* U! l3 C( k5 T( d  U8 Q) I/ ^% w/ ^. M# I# I
static void __exit led_platform_exit(void)
1 u+ o3 J1 R; W6 j: G9 ?0 G: l( `( H{
" n7 r# l, T) ]4 s6 D+ S6 k5 D6 d        platform_device_unregister(&da850_evm_tl_leds_device);
) s1 q' {9 ~# H# W2 O5 N) J- o/ q0 v! D
        printk(KERN_INFO "LED unregister!\n");& T$ o8 I. s& O8 [$ i( ]8 _% K
}
% b5 b- {& f+ m2 A! J+ I" O2 C8 m6 u8 C0 L) I
module_init(led_platform_init);
. }& N2 Z2 K. T2 _* N0 hmodule_exit(led_platform_exit);% ?% k3 _7 W$ a

9 R+ Q* n1 K( Z/ a2 ?) a7 [MODULE_DESCRIPTION("Led platform driver");
* W$ K' l1 C: H+ w5 C; \& W7 lMODULE_AUTHOR("Tronlong");  o& ~! F) B6 m" e* }' n; }* D' G
MODULE_LICENSE("GPL");
$ q) P9 d' Y6 o, F, b1 H" x9 g4 l- V3 \8 W7 a% c5 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 22:36 , Processed in 0.043402 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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