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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
) f4 G' I4 w! t* v#include <linux/init.h>
* N( q0 U9 U! a) V9 {  B  Z#include <linux/module.h>
+ ]  S2 L3 R* z# ^#include <linux/kernel.h>8 U& k, Y/ R+ t1 ^, b. S
#include <linux/types.h>
: P6 F/ x6 j+ r" }#include <linux/gpio.h>- C- F0 `4 [- i5 J
#include <linux/leds.h>( H5 j8 W+ d+ o
#include <linux/platform_device.h>( r% _' s4 `$ a% G

: y# r$ i" B: Q) m#include <asm/mach-types.h>9 c3 t9 l  h  \5 \" }5 g* u( T
#include <asm/mach/arch.h>
9 ?! [# s1 E8 K  L#include <mach/da8xx.h># r0 a' r, }; S5 X1 W6 u* J+ E- s
#include <mach/mux.h>
7 `& ]0 j5 [: }1 c' d
- q. O7 |6 m3 r# E4 [* \#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)6 c1 N: M1 m0 ]3 m' j& `
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)9 U8 g  v# z. J% e1 w1 I+ k* j0 I
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
1 B" |2 f5 N$ k#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
+ h9 o: y' c4 {" P  T
" |3 H2 M. I& U7 {3 ]4 @+ q4 ^7 ?$ E: x/* assign the tl som board LED-GPIOs*/
# x) {6 ?1 i# p+ Estatic const short da850_evm_tl_user_led_pins[] = {1 `( B0 K" F1 m: v1 D
        /* These pins are definition at <mach/mux.h> file */! V2 i- X# o- B3 t$ [
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
$ k5 E3 x( G9 _        -1
. z9 l6 W% s4 x8 f};
, M* d( U0 e" m: E9 t1 k' L0 |7 m8 z' r& o8 {
static struct gpio_led da850_evm_tl_leds[] = {
& d5 b/ ~7 j1 t2 p: A! N8 v        {' X& H' ~% {7 ?/ }; l4 Q0 z+ a
                .active_low = 0,
, ~# [  ?8 F  J4 u, }                .gpio = DA850_USER_LED0,$ E7 ?9 `# r! s* H% B- v
                .name = "user_led0",8 J! T) s: \. l8 F# l; t5 L7 V, F" i
                .default_trigger = "default-on",8 G+ ^( Z& Z( z% r3 Y
        },
  N4 M( d) _* _        {. P& ^5 h2 ^# J, H+ u6 G$ y
                .active_low = 0,0 \7 s& y# [5 X& `8 S( u) J1 x: k
                .gpio = DA850_USER_LED1,5 \  x$ J4 w+ {% E) s6 `
                .name = "user_led1",8 @" X( ^& C$ Q4 U# S1 V7 b( h
                .default_trigger = "default-on",& z0 Q5 V: B4 `. o. j; `
        },
8 c7 |7 [0 C! l        {2 r* g$ W+ ~$ ?( I- [; X
                .active_low = 0,, x8 G1 ~% |+ V1 n3 \) }) A
                .gpio = DA850_USER_LED2,
1 d* g9 B) w) n                .name = "user_led2",
) k% |* |7 }8 A5 s4 I5 h4 r0 x6 z' T: f2 o                .default_trigger = "default-on",( c  L. W  Z0 m  C
        },
9 w; Z0 q0 p9 L2 u        {& H) c1 R. [+ w' O  ~
                .active_low = 0,
8 K. M& ^; f# C9 O; b# ~                .gpio = DA850_USER_LED3,
$ H0 \5 ]) p0 n+ C4 j- i                .name = "user_led3",9 u. e  ?0 ]! C% r8 I
                .default_trigger = "default-on",9 m1 p1 P  U. P9 {* _: `" G8 S4 ]
        },
; Z! W& o4 T; i  j$ f" @$ P% S};
, x& Y6 I/ e' X% i0 Q3 u8 O+ d+ U* U3 E
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {& C9 y& P2 g! k6 k4 o
        .leds = da850_evm_tl_leds,
6 a- r- p! s2 \- B4 j        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
$ e5 N* v$ X% j; B2 T};
# U9 }( E5 ^6 ?( |. C, y% n
* d. Q5 d; J5 j& y. l8 f9 e8 }static void led_dev_release(struct device *dev)" J. l9 l0 [: Z4 X( j
{  K3 z( n9 h. G: C
};
0 c0 g0 z7 r( b, G# m
# @" A- T$ ?+ k' T  [1 V7 ~3 b( rstatic struct platform_device da850_evm_tl_leds_device = {
; @3 n* l1 s$ c' C6 K6 k        .name                = "leds-gpio",
: x# x' M8 @6 i6 b        .id                = 1,( c* T" {$ q( T% A, L4 Z8 P& T4 E
        .dev = {& }( {/ y. D% c" L
                .platform_data = &da850_evm_tl_leds_pdata,
5 ^* ]" ~2 q7 _5 o* K                .release = led_dev_release,
# ~# W; v% h6 Z: K3 k        }4 }% ]8 @' t( s; D* G
};
. e+ v& X$ Y, M& N( g0 A( p2 E* o2 B5 A7 V6 a3 L6 J2 f
static int __init led_platform_init(void)
, F- L" C3 o3 X. m; D; L4 {{
4 B: \: m8 Z) n! I; g        int ret;8 I+ a- F9 \7 B, y
#if 0
, m8 p4 b+ m: i7 y" w6 ~        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
8 F8 I5 @, e! G2 L/ Z# q        if (ret)
  \" L! d, `9 V9 |                pr_warning("da850_evm_tl_leds_init : User LED mux failed :") n6 i2 N8 t6 r  A0 L
                                "%d\n", ret);
& x8 f2 e' ~/ l0 \/ ^$ s; o6 H0 J4 |#endif
$ K. n1 P( i0 }# c2 P        ret = platform_device_register(&da850_evm_tl_leds_device);
5 E% r, X  \$ |        if (ret), N# L# {6 `6 ?
                pr_warning("Could not register som GPIO expander LEDS");" C9 R( u# Y% ~2 m/ I# A4 ?- E4 Y
        else' D9 w7 v9 h: E  b6 t, V
                printk(KERN_INFO "LED register sucessful!\n");7 K' `! B3 H  \0 O+ d! |; `

0 v0 f+ ?( z& g( q, m0 d        return ret;
+ C9 p: ]0 R4 {4 P}5 }' e2 x+ Q8 Z. P4 C% v

. e: J2 J6 q1 o0 Qstatic void __exit led_platform_exit(void)
+ {" F' F" t: C5 F6 e{
6 R. j) c0 a, Y2 X9 t* p        platform_device_unregister(&da850_evm_tl_leds_device);
4 k. T: L/ A# U/ F& s* S+ ^8 F# N& f7 N" G/ K! E) H4 \
        printk(KERN_INFO "LED unregister!\n");
' m( J6 ?/ _2 d! t5 r: ~! x}, Y' `8 x* v2 f
/ i" C1 f1 G6 @$ P7 G8 M) i
module_init(led_platform_init);7 r; O# b/ x& C$ m' }( a
module_exit(led_platform_exit);
* U9 L# t% f& @9 Q/ B; v" ~. q6 {
! h8 o- b9 K3 sMODULE_DESCRIPTION("Led platform driver");3 a! d4 J% O3 E9 H
MODULE_AUTHOR("Tronlong");7 ^( q" G: [  _' t. r( `
MODULE_LICENSE("GPL");+ ^2 C0 d, C5 o# `& c
  X/ c! N0 z" v- M7 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 04:23 , Processed in 0.038541 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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