程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
5 Y& ?& f# N& F+ v#include <linux/init.h>
0 ?7 L7 X4 z8 D" E# o: N( j( R#include <linux/module.h>& ?  a4 D# K+ _: f% ?. c' ~
#include <linux/kernel.h>
: x* K- Y2 K# B; v+ N3 p* N#include <linux/types.h>$ U9 F! Q& X/ d5 _. f6 T
#include <linux/gpio.h>  |, F- O5 [& C& s
#include <linux/leds.h>: i1 m) |( d( P8 J- ]. E( G
#include <linux/platform_device.h>
/ d: [# L- E" B5 ?! m4 e
. j5 M1 k6 a; j) g: E; c#include <asm/mach-types.h>6 w) P" U" P* T8 Y9 G5 h
#include <asm/mach/arch.h>
/ i% \% M) y1 k#include <mach/da8xx.h>% _) Q( `5 w* p9 t6 P7 N. H
#include <mach/mux.h>! C9 M* z& M- Y. N! f& c
, H* B2 r. F' N  D8 x6 A/ S( X9 Q! K! L
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
2 b  _* @4 l7 w- I0 u% O9 S9 H6 P#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
# @' y  O' H7 p+ C. k. g#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
0 F: ?, c/ B: {  F#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
9 U) A7 j! g& L* X- \: N3 E5 l6 g( G0 F
/* assign the tl som board LED-GPIOs*/
) s) g: n0 [0 k/ Ostatic const short da850_evm_tl_user_led_pins[] = {9 S2 z; H' W5 x" b7 @% s3 M
        /* These pins are definition at <mach/mux.h> file */6 _, U# w; U9 }
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,) b9 o" w( ?- n* e) C
        -1
( i5 y/ z& E( C. X2 C};
7 f* x" A; @; i' {
8 S3 D* h( t3 v5 x: Ystatic struct gpio_led da850_evm_tl_leds[] = {% d( v  {6 w% g8 c. N8 R: _( T
        {# Y( I. j# `& G
                .active_low = 0,
1 V4 l1 O" Q0 Y3 U* M+ s# v- l                .gpio = DA850_USER_LED0,9 g" l4 {( ]6 T
                .name = "user_led0",4 |! `* |* E9 ^' z
                .default_trigger = "default-on",
) E" P. k5 d) t5 a0 y# m% m        },0 d; U* X- m7 X# k
        {$ d$ G7 `1 o: L" m+ `/ b: [$ U
                .active_low = 0,
6 {  z) |9 H6 \' m7 e3 l* h                .gpio = DA850_USER_LED1,
6 n! X/ m3 s; F3 |+ F; V+ m+ _8 t                .name = "user_led1",
) o6 [. n& K" ^  x  [: z0 A. M6 A                .default_trigger = "default-on",  N3 @# k) ?# A' y% i3 E2 i; g
        },% L1 a: u5 [7 z/ X. w4 @& f
        {6 M- c) i0 u" p- D& b6 u( ?
                .active_low = 0,
; G$ ]$ Q% {4 A# |                .gpio = DA850_USER_LED2,+ m+ P  g) s9 D( h/ D
                .name = "user_led2",
6 c7 t1 U- J1 \, m! o2 q( w                .default_trigger = "default-on",
8 w! C) t% X% M% z7 A; c9 @- m        },& P% G3 u3 o9 M" j7 l8 V2 e
        {" v: ^! `8 l) i2 d, ^, [) P5 a, c
                .active_low = 0,
) u/ h/ f. I/ y- z% q                .gpio = DA850_USER_LED3,, l% |- V7 e% U* x. V
                .name = "user_led3",
+ W/ o. |2 ~  e% b& o                .default_trigger = "default-on",
: \0 a1 J9 L! F) O9 Q/ ~: ^        },4 l7 ~8 [, n3 a7 N. U
};
( o7 Q* I% ^' {0 j* r4 _; q0 x/ y* j; a
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
  U9 j* ?6 v. H4 n9 N, S9 l        .leds = da850_evm_tl_leds,! j# _) Y3 Z. `+ Z  R( J' p
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
! |7 d4 D7 w; T  F+ z+ O9 u+ G: X};
4 p! y/ x3 r/ Q% m$ z' a3 @7 o! t/ C- W# K; Y
static void led_dev_release(struct device *dev)
# j4 G: r# E# H7 v- a$ h{
4 L1 Y& H  B1 m4 B! g- x% C};9 W* P) k9 H( |# p1 @, R
: a, W& @3 B+ j
static struct platform_device da850_evm_tl_leds_device = {- N& c7 m) ~- V
        .name                = "leds-gpio",
! n& V! h. {) X' ]0 m6 m7 h        .id                = 1,
; x, }( q' b# s9 P/ d8 L        .dev = {; v/ p9 T5 \# l0 B6 p& Q7 H
                .platform_data = &da850_evm_tl_leds_pdata,
/ Q/ ^1 i6 ]4 s1 }! @                .release = led_dev_release,
& z4 B0 X  Q7 Y9 c2 H, @* n        }' T0 d; ^) I5 x* D
};9 `7 t  |6 o9 r  Y" V5 [9 |

9 H8 F3 z8 a7 `' T6 Estatic int __init led_platform_init(void)
* P" K2 P' H3 E$ _5 q2 u9 X  J3 Y, s! T{0 `& {. W+ L. P2 k
        int ret;, D! y& g8 t3 A8 s
#if 0; |" _7 u6 w2 |+ D4 R3 V6 t
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
5 L% Z: ]$ _0 m  T* d- c1 F. v1 t        if (ret)' g" Y  k  o1 A9 }& ?
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
6 Z6 k8 |/ Z  N- O" o  K                                "%d\n", ret);( k# _3 M. z# ~1 ^/ O, o' H
#endif, ?5 p: M7 o' }, L6 U0 X
        ret = platform_device_register(&da850_evm_tl_leds_device);
5 F9 s% v$ E# R# F        if (ret); H: a. L# r) N& x5 t
                pr_warning("Could not register som GPIO expander LEDS");5 Z& y- W. T' T* l% `' U1 C
        else
1 {! X$ w1 g( R, D3 k3 k: Y' @7 q                printk(KERN_INFO "LED register sucessful!\n");3 H, \5 l; i) l

* z* e2 b) d) I! Q1 i" c7 e# z        return ret;
; N1 T: L+ a5 L3 w: @# K- ~- f}) N5 \( Q3 E- p1 o; d/ d8 s* \
- k! ^6 w0 i! Z* |
static void __exit led_platform_exit(void)7 d' S) S& i  K- i6 f9 v1 o/ |# B  `( e
{. G% O2 e) }- n. h# j
        platform_device_unregister(&da850_evm_tl_leds_device);
6 X# C7 m! k& \+ ^
: T3 E! @' ^$ v3 c1 y' ^: A) n        printk(KERN_INFO "LED unregister!\n");  P2 B  r) X+ k- ?
}5 @+ ]4 C, D9 q% ^: l

; s2 ]- w; Z- w' p' e1 jmodule_init(led_platform_init);
) {  G! X5 p& L( {module_exit(led_platform_exit);
, J! g+ F/ ?0 Z- r7 D- c
* z5 s4 g1 {& s5 v  e  k" L- `MODULE_DESCRIPTION("Led platform driver");# B* n/ ~) p2 T8 @* P0 \
MODULE_AUTHOR("Tronlong");
6 i% P3 P2 w* F! HMODULE_LICENSE("GPL");. m8 r, t$ p7 E0 |( B
; d+ A" h4 d; G6 \6 e. j- t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 21:17 , Processed in 0.038143 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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