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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
% ]2 o) C8 q7 d* t$ o5 ]#include <linux/init.h>
+ d0 `, u' Y; J* x3 o- Q* G#include <linux/module.h>
( o3 P2 v# Y3 F8 W. f#include <linux/kernel.h>
7 W. ?; c9 Z* M( b( ]6 l: o#include <linux/types.h>% y5 j/ W  d" y5 @6 A
#include <linux/gpio.h>/ o6 q+ M4 e8 F, t: s
#include <linux/leds.h>: ~3 x" i, ?& h) S6 n- x1 }
#include <linux/platform_device.h>9 w) `8 H1 U3 ]3 ]/ h5 W& `
' p' M- I% _, r+ b2 f
#include <asm/mach-types.h>7 |: K: v% M, ~4 r1 x
#include <asm/mach/arch.h>
: a5 J, L3 u$ V! M1 B#include <mach/da8xx.h>
0 R' Q. }9 z  z3 u. e! P#include <mach/mux.h>
9 ?3 [* A* q2 r; m
# Y. _$ y5 S2 [  g$ S1 |) G#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)$ K/ ]4 n0 f' K( Y' k! M
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)2 o- ?3 @* J3 x8 ~* L
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)* X* w. @' N2 j; b5 x0 h
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)2 ~' `/ f% Y( Z1 b: g$ i* ?

1 `7 l5 O# Q7 p4 U6 v/* assign the tl som board LED-GPIOs*/9 n6 S* p* [: ?; n
static const short da850_evm_tl_user_led_pins[] = {) M4 O9 i" F) s! s1 s
        /* These pins are definition at <mach/mux.h> file */  X# Q, x, N  D. F
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
2 b: T2 k  T3 |4 t1 |8 d        -1
8 ~$ ?$ r/ T% h3 ^: [3 I' Z};
- o3 t3 u  N! M( _* G/ Y) b/ {1 k2 s. u
static struct gpio_led da850_evm_tl_leds[] = {
  Z" F( a6 y  Z% f        {. l/ J% h$ P' P1 Y0 F$ H
                .active_low = 0,
( V" s: |, B0 {* S% f                .gpio = DA850_USER_LED0,4 T1 W  ^8 k8 h7 U  `6 A
                .name = "user_led0",
2 O8 ?' K4 x5 w# o6 y! d% D1 _+ m                .default_trigger = "default-on",- c" d$ s& l, b) B
        },
/ u5 \, p1 {1 w. J! B( f1 b! f        {' ]2 B/ r  ]; O" Z' y, V
                .active_low = 0,
3 ^( o$ |' t2 i' x1 V                .gpio = DA850_USER_LED1,
5 @. H/ S7 b' d5 A                .name = "user_led1",  l6 t9 I* R& F& n
                .default_trigger = "default-on",
2 Y5 T, X! F$ B% U0 p! N$ B% r: F        },
1 g7 ~) o# ^5 m5 K& ~4 E3 V0 B% {        {7 D4 \% f$ A: m. k
                .active_low = 0,: a- t* b" P" ?9 I9 ?! i
                .gpio = DA850_USER_LED2,/ Z$ T" l- B0 J' l( y* F
                .name = "user_led2",
% B3 Q/ |  l" E; W$ g* G. M* p1 R                .default_trigger = "default-on",( I+ w6 w, T( Z0 v/ J
        },! K4 D8 B8 f! W8 ?# O3 G
        {
' Q# h( f" B9 e) T, t/ |                .active_low = 0,
1 c# b# D  v; E$ ^) |: [                .gpio = DA850_USER_LED3,! g- T$ b0 L2 q/ C6 @, a
                .name = "user_led3",- Q* ]6 S$ O0 {9 I) e5 d9 }
                .default_trigger = "default-on",
- p- W1 V$ A2 a+ _& m        },( W: o8 ]  }. P1 n2 w
};  \7 C' f) `) }2 k$ e
% A) o3 K% J9 X+ K# A
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {3 D& K/ j/ \7 f3 @0 @) o. s! j
        .leds = da850_evm_tl_leds,
9 o8 o6 u- G; b- _, s        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
4 T7 v- L! T) S$ g# p};! }1 S$ H' y8 G) ?3 `% {
/ O4 q+ B5 [- m2 |; K
static void led_dev_release(struct device *dev)9 A7 L/ l9 k; l  K
{
# }( |" [- N" y7 P8 F6 i& u, B2 V6 ~/ y};: `: j/ z0 p9 C2 D( R
, b& R2 Z" ?. s6 j
static struct platform_device da850_evm_tl_leds_device = {3 F+ P; v. {0 F& C# j  k0 z
        .name                = "leds-gpio",1 B% u& ]" p9 @1 d
        .id                = 1,) c) R3 j0 U% x
        .dev = {+ S# b8 \+ k% H% j5 u
                .platform_data = &da850_evm_tl_leds_pdata,
9 L; V8 j/ o( i; @' `! P# f3 b' e                .release = led_dev_release,3 B9 n! W* o: z& v
        }
/ S! E% g' O8 c5 {! f6 ^+ h};  I4 v6 m( y/ ]% t

8 u: c. U' `. p% Wstatic int __init led_platform_init(void), R9 t$ g. X1 y
{
% K% T5 ^% r& k# l        int ret;
% ]9 j$ @/ Y- x1 j# \#if 04 L7 |* D' e7 R8 _. P" S
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
2 f$ F: g6 w$ _% j: ~% ~        if (ret)& L( {) `% [7 _% h( U1 r0 F
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
; u) C( w9 ?, o( ^0 B                                "%d\n", ret);( ]: o6 v( o2 |( K% ]( P6 g  w
#endif9 g, x4 D( |5 c5 ?; d& v
        ret = platform_device_register(&da850_evm_tl_leds_device);
$ P, b5 Q( m: A        if (ret)2 j7 H* U% K! c# U% R
                pr_warning("Could not register som GPIO expander LEDS");. p" w7 ]& M: b* l1 m2 ^
        else% N) n3 F. q) w
                printk(KERN_INFO "LED register sucessful!\n");9 {* K% x8 I1 {+ j' w4 {* A' i: R

. ^$ I. w8 u: D# h) d/ x: H        return ret;  i. [4 _6 {, R0 H, O$ g
}
5 _% J$ y$ Q6 Z4 [& I7 S) I
0 c7 h" N8 Y3 }5 Gstatic void __exit led_platform_exit(void)
4 j- j, d* a) S4 ^$ p! G8 h{
- R% z8 B9 a/ P* V/ \1 u5 ?7 j        platform_device_unregister(&da850_evm_tl_leds_device);. Y; z/ q+ m9 R

, i7 r6 a- ]0 u) D        printk(KERN_INFO "LED unregister!\n");
/ {" j% h1 X9 l. s}
# ~; q) G) x0 [/ j" u0 P4 j0 s) q4 ^& P- U+ w% N; k
module_init(led_platform_init);) I8 H& m! h2 ?/ F- I) _
module_exit(led_platform_exit);
* `9 a$ S0 J+ H3 j) x# {9 a% O; c1 ]  D. i
MODULE_DESCRIPTION("Led platform driver");# U9 b4 [) t& X4 x$ ?$ F8 [
MODULE_AUTHOR("Tronlong");. b9 T( k; d4 _. E
MODULE_LICENSE("GPL");
+ s* t3 S/ d0 [( L2 r. {- Q0 i- b1 d) ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 04:04 , Processed in 0.041141 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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