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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
6 o# Q$ M1 X$ i9 A#include <linux/init.h>. _( L, W' p/ Y# s6 L2 @
#include <linux/module.h>, V& J. p/ h1 ?7 i; X2 C
#include <linux/kernel.h>
, G( p8 e$ [% _) n: S! p#include <linux/types.h>6 H; ?) f' d1 R+ l8 j$ R5 D* h
#include <linux/gpio.h>
/ Q  T  x4 ^+ l#include <linux/leds.h>
6 ^6 o9 {, Z: `9 F' W9 H#include <linux/platform_device.h># a2 n- }0 x3 d0 i, n0 F

3 k3 y" f# s: D, N1 [% q#include <asm/mach-types.h>( l" u- v8 H6 `: o4 v. i
#include <asm/mach/arch.h>0 e* i: G; `( U3 Q, N" s
#include <mach/da8xx.h>
* ?& I" h& B* `) F* `0 J! U#include <mach/mux.h>5 }( f  B% S- h1 B* P3 C

9 J& Q& ]. _% y8 \" T#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
' q2 {; Z! Z2 y2 y( ?4 k8 @9 V: X#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)6 |3 s# S; p! d7 g- O
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
' r0 j9 l1 ^5 S! x# I, e) @0 N#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)5 n0 }* d. E* W
. [. c7 [( x' _; P/ B+ v' }. h( C8 I
/* assign the tl som board LED-GPIOs*/* P7 |$ K7 o  ^6 ]* T8 \- E, C% `
static const short da850_evm_tl_user_led_pins[] = {
; q' Z8 P2 E4 n% z# F  ?        /* These pins are definition at <mach/mux.h> file */: E1 H0 t6 ]2 i% u: c7 ^$ [
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
. u0 e) z; E6 ^. N5 a        -1% @9 h$ w- g& h. _
};% A4 @' d8 `$ Y# D

# j3 g  V) [' X! V' N* {static struct gpio_led da850_evm_tl_leds[] = {
% O. p; `2 I/ j6 Q1 ~, s! E" O        {
$ P7 m1 [0 D- x                .active_low = 0,. I0 H6 J8 e) N% ^4 J; P
                .gpio = DA850_USER_LED0,
' S2 c+ q0 v* Y* u* }4 E" K3 ]                .name = "user_led0",9 t8 F; w3 x: d" x9 l
                .default_trigger = "default-on",/ }" v, ]% Q: l" v! p. f* g; g+ `
        },
* n7 h2 E$ s5 P* [' B( I        {
4 v/ f! p( }' O/ \8 M$ \                .active_low = 0,
6 j) m* U: B* f: A) J" c                .gpio = DA850_USER_LED1,3 ~6 k; D9 [: j1 |0 K
                .name = "user_led1",: R! I/ H/ L$ `1 |+ ^2 O" h5 q& A
                .default_trigger = "default-on",
% |5 g+ o0 V3 n  k- n* P1 ~        },8 O0 @! @# B: q& g- E
        {
3 _  Z0 U+ D8 x. a                .active_low = 0,
5 W8 q% Q* A6 S6 n                .gpio = DA850_USER_LED2,0 f6 @5 M/ O! M  V
                .name = "user_led2",
- b5 R9 G. y9 ^8 b2 U& E                .default_trigger = "default-on",& n0 F% \4 G1 i/ G# t$ g0 O
        },
+ N$ h( v* H0 O) W        {
# |/ ^, ?: b1 ]0 }                .active_low = 0,
& R% ^2 ]  M9 |1 v$ d6 j9 S$ o0 X4 u* a                .gpio = DA850_USER_LED3,7 L7 l# Y9 d+ x7 c
                .name = "user_led3",
; p1 W/ Z0 t% L: W4 ~3 H' ^, i                .default_trigger = "default-on",* S5 Y; P7 l$ q+ q0 t0 O
        },3 F/ A8 ^7 O' ~' U
};1 t9 _2 F( m* C( _/ X/ O- O
/ o; a; `' F, }6 D, h5 t# v
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
5 s! Z0 f7 [  r" [8 A7 q        .leds = da850_evm_tl_leds,: F" M5 c2 {4 b3 p' x! b
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),& u7 V! W" n+ E/ I
};. F7 O  j1 j" Z5 K- o' t/ g
6 B: W5 y8 m" ~  ~) Y! O7 k- F7 g
static void led_dev_release(struct device *dev)+ ~: q. u7 \& \- k8 i' x
{7 ]% |( [$ [: t$ D7 c; X# b/ V$ s
};. D% Z+ g; \' ~
0 H* J* S& D. `+ c
static struct platform_device da850_evm_tl_leds_device = {
# o: y7 m+ t4 G: z# }        .name                = "leds-gpio",
. [" e$ |. d( a        .id                = 1,
2 C% p1 k+ ?" r        .dev = {
0 O( ~8 p" Y* `2 H9 u7 Y                .platform_data = &da850_evm_tl_leds_pdata,8 m1 s. h8 s: F( @2 P) X
                .release = led_dev_release,( I4 o2 U( T7 ]: t1 `
        }; B$ R, t- _. ?0 t2 S; K
};9 o# X% y  _; P+ s  N

3 f0 }& i9 h; i: ~: dstatic int __init led_platform_init(void)
3 p  X9 Z6 u( }. A: B{
" {; Y( n: A+ w$ b        int ret;' O) d+ q# ~7 R5 Q7 R$ Q+ {
#if 0
# r* Z! N$ b3 R        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);3 j. p7 d8 i1 l2 M( `
        if (ret); f& c) G; d8 g( a
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"- n- k& B3 \9 u- q; F3 c3 ?0 `
                                "%d\n", ret);2 |" g; m) y7 f  b( c
#endif5 l  s; y* H5 k; C
        ret = platform_device_register(&da850_evm_tl_leds_device);
# |' G% X+ {  V2 l        if (ret)
- [* C! n6 n) ]2 n5 I0 W: z4 r" l                pr_warning("Could not register som GPIO expander LEDS");
# g, }: y6 Q9 V. \! U        else2 {1 J$ B; h4 m% E) \6 v' d
                printk(KERN_INFO "LED register sucessful!\n");
' R* s; }; O2 @; Q/ [1 N" k% J. N2 ~, q! p: L
        return ret;
9 m4 V+ I0 @4 r# N- E  j}. ^: U- \& h  E) M( ?5 g9 p+ V8 {
+ M: K/ _0 D' S' O; G( I
static void __exit led_platform_exit(void)
# V# c0 R8 F- O" o- o, Q8 ~2 Y{
+ K8 U; p+ u8 }/ q- x6 D        platform_device_unregister(&da850_evm_tl_leds_device);/ g/ V0 y* \  F' x5 g! c1 Z
8 @) }2 m( T5 X( N
        printk(KERN_INFO "LED unregister!\n");
$ ]. S- h0 n7 j/ J* g}( G3 _3 q8 L2 k5 U/ B

! _, \7 f3 u0 X7 ?0 {5 ^module_init(led_platform_init);: u0 y: R" W& r) S# m2 F* G
module_exit(led_platform_exit);7 b# D- f/ k. S2 o
4 R% Z! l, D. d. l: \! A! B
MODULE_DESCRIPTION("Led platform driver");6 N, _% i) h9 `" E+ u1 C6 T
MODULE_AUTHOR("Tronlong");; `% r& D4 G4 t( T" X* l3 Z8 p
MODULE_LICENSE("GPL");
' h) b# a$ z7 K7 E& c, f
' z& j& T0 q2 C' F) Z  |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 12:41 , Processed in 0.046480 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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