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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
- ~5 Z. Z5 n5 i8 Y6 r#include <linux/init.h>
3 V" E- ~& k/ z#include <linux/module.h>
5 a9 [7 }1 l3 H4 f#include <linux/kernel.h>
, s' g! C! y4 u0 r, c8 y1 ?#include <linux/types.h>9 ~0 x7 L/ d  n# N# S5 Z! ^
#include <linux/gpio.h>
9 I* T* Y3 f2 w: u$ o& l#include <linux/leds.h>, k* C4 a* F! K5 r
#include <linux/platform_device.h>1 t3 o0 t7 z' I  {3 O' d# d
; P- |& P; W( G! N/ t# d: w
#include <asm/mach-types.h>, @6 f6 ~1 _: D! H  _
#include <asm/mach/arch.h>* K; X* e) t- u# k
#include <mach/da8xx.h>2 N3 T) G# Z  x
#include <mach/mux.h>
0 X2 |+ C* U! g" x0 l  a5 C7 F+ q$ J; t6 P8 ^* h9 N
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
- E% {4 }: g4 ~) O* _  K0 `#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
+ I6 p0 q/ [( i) S$ |* O#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)5 `' L6 B4 O$ k4 r, @: C
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
$ U1 N8 u+ D3 v: U0 d  B, a
2 `7 ^0 P1 ^- \; h+ A/* assign the tl som board LED-GPIOs*/
' o1 ?; s' i7 l1 m2 w7 S/ Istatic const short da850_evm_tl_user_led_pins[] = {8 {) G5 z  L) H+ s* H8 _
        /* These pins are definition at <mach/mux.h> file */: f! L0 A( l$ u) Y* T
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
# S9 [: S4 t6 q7 ?0 v        -1
+ w  @! d1 ^. C! d# [3 B( M5 u};
+ }- }) F' u& G* C$ r3 M! I* w3 m  i% F8 n1 \' [1 B/ o5 }
static struct gpio_led da850_evm_tl_leds[] = {
, w' P- J( x: i5 g        {
: V2 i- h3 ], j+ X7 G                .active_low = 0,+ R" f/ l7 j* s3 B9 h6 w6 R& ~
                .gpio = DA850_USER_LED0,
- R  Z2 G$ p9 B' g9 o+ F                .name = "user_led0",
; D; r, v% e; w7 K& }0 q- Z  ~                .default_trigger = "default-on",+ V- N. ]# v1 x8 ~0 B" K: x4 l! H
        },
7 K( l0 `# d/ G; \+ S: h" b3 w0 W        {
5 x6 E7 d, v3 g: @! U                .active_low = 0,
8 V1 |& y9 d5 k2 R8 a1 t6 g. {& h2 u                .gpio = DA850_USER_LED1,) Q* o+ d/ `0 ~! o* ?6 x
                .name = "user_led1",* W4 e, p2 d% t/ L, x
                .default_trigger = "default-on",
, Y6 h. j  u, W; z6 ^- ?        },* R6 Z9 D3 r0 R+ w3 g5 y' X
        {
2 E3 [/ i0 J; W' ~' h# B                .active_low = 0,6 y  `1 A8 Q; W; D3 J
                .gpio = DA850_USER_LED2,( O* ?0 P8 K; p0 Q& X$ I( m
                .name = "user_led2",
% ]6 c  ^6 t3 _+ c& L  V/ r                .default_trigger = "default-on",
% U5 t4 f) ]! V2 {6 {  J. Q( {/ z        },9 R8 l  P( P. j1 E( Z- f
        {
( L% P; o7 k6 G* L3 X                .active_low = 0,
$ Q, Z& ^( O7 k# J! n1 _                .gpio = DA850_USER_LED3,# }; x* Q! w, O& ^
                .name = "user_led3",# o+ w  P$ W% e- D7 y
                .default_trigger = "default-on",
, l- U6 |+ ]- D& J        },3 J, d6 i% B1 C0 O% w) k" Q# e
};
4 Z+ n" j2 h/ B. X
+ \& d' n) X4 P/ V0 y/ astatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {4 Q: k' e+ Y, O7 W% v8 G
        .leds = da850_evm_tl_leds,
4 {% n# r* N$ L( M, K- o, P        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),# F% Y* D9 g3 x7 {4 o* ]
};; I9 C0 h) b+ A

+ t( r! U7 S0 [4 U% p2 _+ hstatic void led_dev_release(struct device *dev)
. G* |1 D/ G0 o0 X{
- [6 q2 ^2 P9 b5 ^8 Q: d" V};
- k6 G% `1 Z. E0 R7 u
- J+ k4 k) v; t7 f# O) Z5 z, Qstatic struct platform_device da850_evm_tl_leds_device = {5 ~1 |4 n  c7 f9 ~' V
        .name                = "leds-gpio",
  i' j+ k8 Y: \! {5 P        .id                = 1,% o+ j9 b5 H7 S6 ]: r2 P4 S; p
        .dev = {7 |% z7 F) i/ Z2 u- l* e) f
                .platform_data = &da850_evm_tl_leds_pdata,
% u8 l. t, O1 Z! N                .release = led_dev_release,
9 u0 q2 m+ G* f: J7 S( B; w1 \        }2 ~! |1 |1 v7 w+ l% ^- O
};
" R, L5 r; P; l8 y  L4 }' a9 \$ l+ m% O; S3 s; D
static int __init led_platform_init(void)
3 g5 U; ]) x7 I1 U* P% V/ \5 f{
; B* _  ^; J( J2 C% o        int ret;9 I* }( ~6 o4 m' ^5 ?
#if 0
' z  g# M+ E, S+ |        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
" u- [% t1 N0 x8 B4 ]/ W        if (ret)- B4 @! B4 v+ g
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"7 M2 w' Q& E( N9 I; C5 M- v4 x
                                "%d\n", ret);, b/ u4 N- ^# {1 y
#endif
+ e) ]5 ]2 H9 ^8 t& E* V4 [/ l) k        ret = platform_device_register(&da850_evm_tl_leds_device);
& w' h6 U) a" x; G        if (ret)/ A- [) F; ^8 `% O: S6 t" }; P
                pr_warning("Could not register som GPIO expander LEDS");
. l# e  ~. w2 X$ X' k# @& R        else
( T2 D% o3 s4 L3 @. P                printk(KERN_INFO "LED register sucessful!\n");$ s, j, v0 c, a

/ s" t) r/ j) }        return ret;0 |, j. D$ c( R' p3 T" Y
}6 {0 R: f! L# D2 X

: P: ?9 T3 R& x/ I/ h7 Vstatic void __exit led_platform_exit(void)2 N) `4 E2 i/ w% z& n/ J, V+ J
{  d) p$ |8 l& Q
        platform_device_unregister(&da850_evm_tl_leds_device);
3 V& T, I# V' V& ?- o0 r5 i- D
        printk(KERN_INFO "LED unregister!\n");
  Y9 E1 O. G7 u' D- k0 |2 B}5 r, L4 K# K/ Y1 D7 N

6 _5 b4 v8 b2 F5 P: qmodule_init(led_platform_init);" @& C7 z& c+ d4 y1 Y6 u% S
module_exit(led_platform_exit);+ k( j5 u9 \) L+ @. {

# ?& l0 D$ T- Q) L) }4 \/ vMODULE_DESCRIPTION("Led platform driver");2 V& L6 d4 ]5 G
MODULE_AUTHOR("Tronlong");
! p- C. g% H* f$ C1 r$ pMODULE_LICENSE("GPL");
" C: e, {# c) Z% g7 W4 d! O" J
2 N/ E, I' b% _5 {* \! D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 08:18 , Processed in 0.044331 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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