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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
0 g& [. Y; q, H. E* y6 l9 ]#include <linux/init.h>* K+ O& Y$ |$ h
#include <linux/module.h>
2 @4 P% A. v1 \: ]' W! ~#include <linux/kernel.h>8 s& e& A& l. R2 g; \: ~$ X
#include <linux/types.h>
0 T7 I7 \% G6 O2 I* P#include <linux/gpio.h>
5 r  ~9 T/ D& L! u/ U9 q#include <linux/leds.h>
9 {7 C* A' n( r$ u) |#include <linux/platform_device.h>
1 J9 P. R- K3 b2 b. G  X; T; n' P) H0 b+ c
#include <asm/mach-types.h>
# u' v1 G- }1 U& y$ n#include <asm/mach/arch.h>
; K+ U! H$ N: v& J; G$ g' J#include <mach/da8xx.h>, J# N( \: A! ?) w) E. K
#include <mach/mux.h>
- b9 y  F0 Y- g$ W
! `2 _  \: x5 b4 \" |#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)/ x# B; c8 ?" q
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
3 r3 }# m1 Z, e% [3 @' I#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)0 i/ A! K9 V- g5 S) Q
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
  l) n" S5 `# U- e0 A' Z% u, Y- [$ K( [7 |* h% ~. n% c
/* assign the tl som board LED-GPIOs*/
6 Z( f2 X; g5 ?3 o  pstatic const short da850_evm_tl_user_led_pins[] = {5 u; l6 A/ w( Q; B" {' M- U$ C
        /* These pins are definition at <mach/mux.h> file */8 j3 r. j5 |, K: V$ Z  j
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
, y; b! b0 \, h4 K4 L        -1, U2 D6 d! V, N! Q9 A
};
0 o' h& L# _% n+ R5 b1 q4 [& x5 V( f, s- ]( G' d' E
static struct gpio_led da850_evm_tl_leds[] = {
6 t. [7 x& ]$ I" @2 N        {3 b" ?5 I, N4 B. L
                .active_low = 0,) z) a/ ?4 ?" p( d2 J! D, _, \
                .gpio = DA850_USER_LED0,3 `2 {* `) ?$ Z% u7 j  X
                .name = "user_led0",7 y; N/ w8 Z) f. K( O3 T
                .default_trigger = "default-on",
2 q7 F' O$ {3 I+ y( w0 y        },- C. h6 ~) |, v* m: I3 I
        {' C7 z* A4 q' }# s1 \
                .active_low = 0,4 j( U  O/ }! [% p* W
                .gpio = DA850_USER_LED1,
2 x5 j+ L9 q8 C                .name = "user_led1",
- d/ w3 ]/ b2 r                .default_trigger = "default-on",
+ |% j- N- h0 N" w. j        },
3 m0 G; N7 J' j: U7 b1 V8 d, K        {
3 H9 C) y2 p8 h2 v! V. r                .active_low = 0,0 E6 ?2 d1 s( `) ]& `; ^; z
                .gpio = DA850_USER_LED2,$ @5 U2 j0 d! \6 _
                .name = "user_led2",
6 A( g$ {4 ]& G9 P, F                .default_trigger = "default-on",& ~1 k- x  E$ c1 h& \6 `. k8 u
        },
  m# I2 r8 P" O: S" A7 e7 V        {
  @" _0 N  z0 K3 C: h% k                .active_low = 0,
  K' w  _' X5 N                .gpio = DA850_USER_LED3,8 y& |: t* K0 B
                .name = "user_led3",. o: N9 l4 {) L2 T
                .default_trigger = "default-on",
1 n, Q; v  e) R        },
9 a  f8 }! B* T) \8 V, Z* t/ S, T};, f/ a0 G! W: e4 p- O
; x) T, l+ l& ]/ M! }+ Q
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
( C$ B5 w4 x2 R        .leds = da850_evm_tl_leds,
2 A: @$ t! X3 E8 W        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),% A5 |3 _: |$ g8 G3 s
};
; {& z; L1 t2 H* Z; v; f6 L& |, B4 U9 U4 a! U, [
static void led_dev_release(struct device *dev)2 K+ M! t, M* z* z7 M% g5 I% c
{
) `) E; q$ @+ U};( |; b# |6 V. {/ T

- z- M( `/ N" _9 y" |) J& A* Istatic struct platform_device da850_evm_tl_leds_device = {6 E! G: |/ ~6 v6 v( F
        .name                = "leds-gpio",
% z1 S  h- |2 r& k9 R: m" `, |+ M9 r        .id                = 1,9 ]# N% k5 ^: e& M
        .dev = {
, p5 K9 m5 z% |                .platform_data = &da850_evm_tl_leds_pdata,5 i. M. M/ Y1 p2 E1 z
                .release = led_dev_release,
0 V9 R; ~  I2 U! C% [) A        }
% u9 [# H; e( Q- e& \2 N};9 t/ b0 j% O; B6 D- R& V9 D3 M( H
7 U; l$ z) J9 T9 u3 j8 p( q+ r
static int __init led_platform_init(void)- x0 g2 @, ?. c" O. R+ W3 R
{
1 Y+ Z4 k+ h: v3 G% U+ m. }# e        int ret;
% a& S* W" {  ~5 w$ G% N#if 0; \9 O0 L# d, L2 z
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
% d4 U4 h% V) d. `        if (ret)
" o* k" V3 _1 b) X3 w                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"3 U- H$ w8 L5 ]' t
                                "%d\n", ret);
! P' B2 B& c! V+ Q1 w#endif7 n2 |4 w0 }: a' b* l# d) j
        ret = platform_device_register(&da850_evm_tl_leds_device);
0 S/ I, {$ [6 K: n3 L        if (ret)/ [. a% Z+ K2 z0 y$ x5 W
                pr_warning("Could not register som GPIO expander LEDS");
2 B6 }* v1 I/ K* m1 w, P: e- p        else5 m2 ]3 _$ V) x7 F. a; R  g
                printk(KERN_INFO "LED register sucessful!\n");
  u  A+ h: h9 Q# T+ ^2 @! a+ \1 Y8 x& ^) _0 S/ k
        return ret;
& u! P4 a# b! U; V! R}
+ G7 i9 W7 F5 J" \8 w7 S2 w+ _1 `" N1 \: [; {- U
static void __exit led_platform_exit(void)' e& C1 V* e" z: C) X' ^4 o
{
! I: B2 h. y2 I# [3 X9 _7 ~        platform_device_unregister(&da850_evm_tl_leds_device);5 @0 C# `" |$ X7 G
. A( E" D+ X8 J8 \% Y) P  g" f2 A' o% \
        printk(KERN_INFO "LED unregister!\n");- _2 t* s8 F2 Y* V1 H
}
6 ^9 p/ N4 T9 I; P
9 u/ P$ k; z4 O. `module_init(led_platform_init);
/ F; ^( d/ A3 l9 U' ~module_exit(led_platform_exit);
0 j4 o7 t; U' F! z. |4 }  s% k# X
' T! x4 g& f) gMODULE_DESCRIPTION("Led platform driver");, e" D( W) Y4 s4 z. \
MODULE_AUTHOR("Tronlong");# I( D/ H1 _: |6 @1 v6 P4 _
MODULE_LICENSE("GPL");
" q6 L. A- f* a1 O* r) t) T. {5 B; b# X/ E& C) T8 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 07:34 , Processed in 0.048416 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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