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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。5 S9 t, H! k9 ?$ p7 |" s
#include <linux/init.h>2 n7 i* J" V" u4 t' g
#include <linux/module.h>, f& M' w$ K% t5 p, F
#include <linux/kernel.h>
8 i' y$ I7 c! V+ S#include <linux/types.h>8 w8 b8 n9 E  `) D: B5 @6 U
#include <linux/gpio.h>
9 l0 J2 d4 Y# o0 Y% ^; ?7 t9 ~$ r1 {#include <linux/leds.h>+ z3 j; F  ~0 U) p
#include <linux/platform_device.h>, s: S# V3 ?6 }7 y
' m) Z  t9 q. n$ v8 g9 t6 z3 Q
#include <asm/mach-types.h>
/ B$ A. S1 L$ C#include <asm/mach/arch.h>! B5 `) Y7 _- Q" E: g; B
#include <mach/da8xx.h>
. X# P4 ^& j( v4 q" i1 s: Q; N+ V#include <mach/mux.h>% Q' [7 Q& x, ~: p. H. G$ P

8 L% S+ e1 G& ^& l& o#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
2 j, }4 W3 w  u; A8 @. O1 e/ n#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
" K2 l# _4 G6 g#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
( _6 @: S$ T0 }) U#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)7 f3 [& G" f6 ]3 h, n6 s
' W* v8 H5 c- {5 i
/* assign the tl som board LED-GPIOs*/% A* b, z  P3 t: e- W9 }0 F- }
static const short da850_evm_tl_user_led_pins[] = {1 ~/ e: W( B/ [+ c! p1 r
        /* These pins are definition at <mach/mux.h> file */
" s  ^  a' L+ g# [        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5," T- K, T; r; x, R; p5 p3 Y4 b
        -1' f$ a7 Y$ J3 I# e9 N% D
};
% S' F! e* [7 o! b8 P; s8 s7 j4 ^
- A: c. c& e& p1 Kstatic struct gpio_led da850_evm_tl_leds[] = {) P" i3 p4 }6 K+ K; E7 E
        {3 J/ S+ C. N7 p; R# L; a+ [
                .active_low = 0,: a% Z- P3 A4 z% M" f! s* {+ s
                .gpio = DA850_USER_LED0,
1 s2 _* @+ j' J7 h) E                .name = "user_led0",; q0 |  }; p6 d
                .default_trigger = "default-on",) M: s3 r; _( O# \
        },  Z. C8 J1 J  Y( h2 B0 H
        {
9 V. t5 N+ t9 m# }9 m                .active_low = 0,! D' l6 k1 l6 _8 G' w4 H
                .gpio = DA850_USER_LED1,
6 ^3 `* y9 {. y                .name = "user_led1",
, O; E. z! _8 Z' _. k* ^* }$ l9 U                .default_trigger = "default-on",
% e5 N' D; i6 e' `) N- I! ?! H0 a        },
; Z. M; y4 `2 E1 H9 @* t        {, |8 C& C( i: g7 L7 ?* U
                .active_low = 0,
6 U. J0 D3 c& G1 W* P" C7 l                .gpio = DA850_USER_LED2,
3 i$ M$ \1 ~, n                .name = "user_led2",, Q% V' @' a6 Z4 y
                .default_trigger = "default-on",% ~' O! x* s- D6 n5 U
        },
$ m7 n& e6 Y$ I        {
( Z; w/ ~; z% P: `0 O( {& y" d: y                .active_low = 0,  x" s; e& L2 U9 I8 L+ L/ I- j
                .gpio = DA850_USER_LED3,
- c! @/ ?1 P6 A2 C                .name = "user_led3",- G( z3 |  `: ]/ K
                .default_trigger = "default-on",
9 h# A  x9 ?/ l/ F        },8 V, H  [9 ]% r/ e6 j! |+ z5 `
};
( g' |: H) A# w+ b" y. u0 H
. ^/ Z2 t( z6 t7 H3 z9 H$ S7 mstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {/ s  E4 g4 J; w
        .leds = da850_evm_tl_leds,2 N6 g1 V, Z! _) B- {, \: O
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
0 c+ ]* [2 o$ M1 G};
3 u( U( |3 B, i( u1 j* q7 ]! L2 ~
static void led_dev_release(struct device *dev)3 x4 Q# J7 p  y+ `' X
{
# }) `, G- B" o# X0 w) N0 @( s};
+ I7 z  B+ j! a  M$ C' B" r% r4 N3 o8 m- B
static struct platform_device da850_evm_tl_leds_device = {6 H, Z& k2 ~) e+ q; `! @% [+ O7 O
        .name                = "leds-gpio",3 a0 a+ V2 t" u6 U, o5 Q
        .id                = 1,
% p9 c. P6 O" s' K, ]  [        .dev = {9 b- h9 r- K, a" o
                .platform_data = &da850_evm_tl_leds_pdata,
6 f$ P& \. V$ I& ^0 x. b                .release = led_dev_release,
- ?. \" w4 v0 }        }0 j, q5 g6 l# s. t5 c
};% K* q4 a4 ~( C

0 D5 [! {5 d" E& S# \3 Nstatic int __init led_platform_init(void)
5 S3 [4 ]1 o5 \/ y{
+ {5 p  t( _4 o' z8 u% P- }        int ret;, K) J8 \" V# C9 V  l. }  U2 I
#if 0
* p# W6 W) U" `/ L0 ~/ }: C        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
/ U% \8 \6 T! ?& n& ?7 m8 _        if (ret)4 P1 Z8 U, q! w$ d$ @
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
2 r/ x8 W: i1 o                                "%d\n", ret);$ l, e* f( q: d
#endif- J% s; Q. o5 a* c0 S1 P
        ret = platform_device_register(&da850_evm_tl_leds_device);
% R% |9 w" F; @7 \! n! c        if (ret)$ i, L6 z# w/ D% }/ _4 N
                pr_warning("Could not register som GPIO expander LEDS");' @5 p0 L" N4 G3 A6 q
        else/ W5 Z2 Z+ V+ F6 i9 o+ A. i
                printk(KERN_INFO "LED register sucessful!\n");
7 h0 x# c: h  J1 F. ~& e; g  G) q/ x' s0 w
        return ret;
% a) B. ?# v# Q& u; x& G* R: c$ p}1 f+ f: K* l' |( c

1 J, o" y, ^* ^- w* Pstatic void __exit led_platform_exit(void)* [2 k  H9 \* J: V5 f
{) G- }& W9 q- o  x+ A" q; I
        platform_device_unregister(&da850_evm_tl_leds_device);
  b# G3 D% R" @. {" p
/ t( L+ d$ i3 T6 l+ v        printk(KERN_INFO "LED unregister!\n");6 n) R+ e" b. H8 t, `. G( D
}; R  P- v  L- Y- d  x6 N7 h; I
4 N  U; `, ?$ T/ {8 j2 a
module_init(led_platform_init);: ^7 a7 F: z6 s) q# Y% r9 g
module_exit(led_platform_exit);
# w6 M# ?: V& p0 Y: o/ J8 x3 F  H% i( v- _! ]
MODULE_DESCRIPTION("Led platform driver");
+ h  q) c1 l* I1 Z! L& r* C- [% v5 }7 PMODULE_AUTHOR("Tronlong");/ c8 j( ~" Q% ~5 t* ?
MODULE_LICENSE("GPL");
+ @' \( a! N+ R- w: n
1 e* C& X# X9 `5 s8 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 00:43 , Processed in 0.039886 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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