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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。) ]. R1 y( ^3 X/ ^' K
#include <linux/init.h>
+ z2 o& g( p! w, i#include <linux/module.h>6 ~7 i* S8 e$ i# S! j4 C
#include <linux/kernel.h>& K4 H. s: B. B- N4 n4 {0 o
#include <linux/types.h>+ c5 ?0 E1 y+ E0 i6 }
#include <linux/gpio.h>
3 _% }, ^: b; T0 p( W1 M1 L+ N3 ~#include <linux/leds.h>
& P( {* p( B) _* Z: P* P# c#include <linux/platform_device.h>  j/ f$ u. {2 m; G1 j

% z6 T0 }, ~& Z" m& _1 m' Z0 ~1 v#include <asm/mach-types.h>
  @5 R$ X3 [% k/ V& m- m9 K#include <asm/mach/arch.h>0 d' E/ G  e/ _1 n0 H& ~
#include <mach/da8xx.h>
3 ]; v( K9 W. V9 M% U! N) B#include <mach/mux.h>
( w- u* e7 r* z) Y/ y, t- P7 E% K
( Q: I; [! a% U7 S$ p  U6 M& {; x/ U#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)! O* ]; _/ G+ p- `
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
" j1 V  S; J  v5 R$ x9 j$ N  N#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)+ |9 u& f& p: ]  P9 w3 f
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
- v6 A7 w3 \# E* Y! M0 g
% C6 w( M) v+ m9 _/* assign the tl som board LED-GPIOs*/' k7 e- w0 O1 O& \- U+ f
static const short da850_evm_tl_user_led_pins[] = {
, P6 Z3 j4 C: c" Q* |& b4 F/ V, g        /* These pins are definition at <mach/mux.h> file *// ^% B; Q4 H- a# ~* j$ B7 [
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
# _9 e8 ?! z/ Q: s4 }        -1- _* R0 |4 J' k5 d) c. }
};
1 [9 E9 {5 q# V: f: o5 e7 d4 _  B8 p4 ], ?6 ~  D' F
static struct gpio_led da850_evm_tl_leds[] = {' E- M8 q! ?. J* I) w1 Q
        {
' m- d/ S3 `8 W& ]  b5 q9 V# ]                .active_low = 0,
6 }+ d2 D1 W2 s; v/ t" J                .gpio = DA850_USER_LED0,
) N, s/ P* F$ {+ X& e! n                .name = "user_led0",& K" Y, v4 w! O) y; W0 R
                .default_trigger = "default-on",
1 i& I( \( ^0 A+ \+ o  @+ }& W3 s1 l        },  N  W: x1 w: h. o
        {3 x1 U& l, L! C5 j( M+ c
                .active_low = 0,6 p5 Y( q) {- p. K/ k- w) m
                .gpio = DA850_USER_LED1,
) |' |6 g6 Q- r  C- b- h: @                .name = "user_led1",
& i# t! z6 @- E" A: i6 ]                .default_trigger = "default-on",
3 T/ ]7 F5 @/ k4 }6 q% d        },/ }$ }4 d1 f" i5 l
        {
7 x+ Q$ B: [8 T5 ?3 g( d                .active_low = 0,
8 a3 W1 ^0 p& X3 Y                .gpio = DA850_USER_LED2,! H5 `* h! L  z5 f* P  C+ V
                .name = "user_led2",% m5 K/ b. l! x4 e% ]1 D& i
                .default_trigger = "default-on",
+ s. \: m# A. w# s7 s) X5 R        },/ O% R7 u* F% ?
        {
/ y  T  k6 |) g                .active_low = 0,& o6 k! `# W. l4 E/ {; ?1 M- u0 q/ V
                .gpio = DA850_USER_LED3,, P1 c+ S. \* K  }
                .name = "user_led3",
. I( Z% v! l; T- `9 U( K6 o                .default_trigger = "default-on",
' I+ a/ [$ X; {) i        },( u/ @, V0 q; a4 \8 M+ M4 s
};
! [# ~. l' b/ R( f5 p7 A/ w& v  u; o- s: \5 a2 W
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {3 D. O( l# M. ?3 `/ e- Q: ~
        .leds = da850_evm_tl_leds,
7 f4 M4 ^, X) k        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
7 e& T& r+ v: w' U6 k/ ?5 c};
# N) c/ o. A# F0 [9 q  k6 o
0 y! f1 V0 J6 H! sstatic void led_dev_release(struct device *dev)# i& T+ V) q1 S0 v$ O' I/ g
{3 m. l7 I+ o. y! Z- w# i
};
) w8 N4 a2 b: b. J  ^( R# {- H5 o2 ~5 E! k& m7 I8 i
static struct platform_device da850_evm_tl_leds_device = {
: v- m. I0 V( _+ ]7 `        .name                = "leds-gpio",1 P/ H' R7 ^9 v6 S  `( @
        .id                = 1,! P3 |+ I5 Q% b7 z( `* ]+ v3 W$ s& J( o
        .dev = {8 K' U9 A1 Z/ v$ W
                .platform_data = &da850_evm_tl_leds_pdata,
1 _4 F$ C2 q, s6 r; N9 y+ W                .release = led_dev_release,! G  u3 P/ [, p5 Y$ }' y
        }
$ L# l) b% i6 H1 i5 v/ `};' C1 {/ m1 {, N2 u! \+ c5 r
) g# F" s5 l, i( k5 j; ?, x5 E' F
static int __init led_platform_init(void)  U8 `! Z  r% c: X, T* V
{* a+ v. n% u5 ?" Y5 _
        int ret;
. l. t" R! x8 |#if 0+ C0 v: E5 f. k* c9 p
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);3 F% f. b+ h6 s4 z
        if (ret)
$ {7 u+ L/ ]0 W2 Y                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
( j, j2 H) k' d8 {- P2 Y8 Z" h                                "%d\n", ret);" \$ {4 u- N; m& e
#endif1 |3 k. Z  ]% P
        ret = platform_device_register(&da850_evm_tl_leds_device);
- A- n6 u) c( n3 h: }        if (ret)
& T6 T  `  D; \& X9 D/ F$ W8 ~9 q                pr_warning("Could not register som GPIO expander LEDS");
( ~) v( V. `' A, i  V+ @! b" x        else7 z& u! g2 K2 Y: a5 r  n+ Q( a4 T
                printk(KERN_INFO "LED register sucessful!\n");+ r- S; {6 _. w0 e

% w, }2 P' D. u. E! s3 K        return ret;* R0 S$ g9 y! d6 z! \8 D% H
}
% L$ o& d$ |6 i1 M8 ^& u# i/ D& ~$ g: {9 `$ J
static void __exit led_platform_exit(void)& T" A7 a4 J$ {8 U6 ]) [5 K
{( W+ {* F# i/ i, n1 Z5 ]3 v6 K8 U
        platform_device_unregister(&da850_evm_tl_leds_device);
! T# n0 Y9 B9 d/ C9 i: G; v& M4 z- o" w2 v$ n
        printk(KERN_INFO "LED unregister!\n");; w: F, v# Q( ^+ x$ f- G
}1 ~$ `8 D& R! m. g4 L
6 F1 w" J5 N. C6 h' V8 ^
module_init(led_platform_init);
; \  r$ v$ K( W/ _7 y. Umodule_exit(led_platform_exit);% V0 j8 j9 p& I  h1 @' U' C" a9 n
+ w( i7 C0 ]6 _# M4 N3 A
MODULE_DESCRIPTION("Led platform driver");) c6 {- j( }" ~; n9 r
MODULE_AUTHOR("Tronlong");7 c9 y; [) c6 n2 Z+ ~2 T
MODULE_LICENSE("GPL");
6 k7 B) F: q4 S1 x1 K( b8 \1 ?% c# N3 \% `! [- E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 07:11 , Processed in 0.040393 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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