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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。, K* |- K; K6 H6 G3 {. Y
#include <linux/init.h>
. y  T1 L; B" N8 n/ q7 i#include <linux/module.h>
4 o; N, n3 M1 r# }#include <linux/kernel.h>
; t' ?! v4 E% U2 A7 u#include <linux/types.h>
6 L$ Z% v! g; w0 ]#include <linux/gpio.h>
4 i% n' A2 J0 t#include <linux/leds.h>8 ?6 x, H; [- K3 |1 |: o' n
#include <linux/platform_device.h># n. g* V- y4 i1 {2 }) {
9 K. I  v" D( a+ I0 p4 F
#include <asm/mach-types.h>6 r4 T. x* b) m9 P8 r
#include <asm/mach/arch.h>/ F) j3 w2 k# u1 }* j3 }! ~, z
#include <mach/da8xx.h>" ?1 [/ i& \& X, [5 h# Z; `2 I) P
#include <mach/mux.h>
( W8 ^+ i- ^+ f! g, g' X8 _
0 t4 D* w& \$ J- s* F' E2 R! Z#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
5 \/ R$ @  z- ^+ R% }4 H) O#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)& F$ b0 h9 [& g1 h4 g4 Z6 F. p. H
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
" j% C6 A- \' h% C: h#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
( ~1 @, y; Z  O; m3 q  ?) O: u* ]; t  D& g% w
/* assign the tl som board LED-GPIOs*/8 l. B6 _. ~& q5 c: P: ~
static const short da850_evm_tl_user_led_pins[] = {8 p7 d7 ]. I: L2 p' o) b
        /* These pins are definition at <mach/mux.h> file */5 _' |2 ~. h# }2 F
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,  B8 @4 p" G! q( Y9 n% P7 _2 G
        -1
, U6 A3 L8 b/ z1 b, f. G! N};
. p0 b8 S: q9 `, T  |0 B# g( a( {# o) g
static struct gpio_led da850_evm_tl_leds[] = {. L/ |3 A0 t9 o
        {
' A0 n. [% b. ]                .active_low = 0,$ H' ?1 V0 \- y8 m/ C
                .gpio = DA850_USER_LED0,
& k. n- U0 ?' ?+ R                .name = "user_led0",* B+ X8 x3 J7 `5 y9 D
                .default_trigger = "default-on",
; i- m3 d: j1 N: o& N- g/ M, N. G; E% h5 T        },0 }4 N* I& [9 \6 S# H  N! K  m
        {
: k7 |. g  @# P* V$ q                .active_low = 0,
/ d; ]* L1 L7 o# o0 _; `/ R                .gpio = DA850_USER_LED1,
$ ?8 F2 J9 z. m' s# n8 j                .name = "user_led1",
5 y2 u& T) Y& g! \3 m3 ^                .default_trigger = "default-on",
& D. i% M; }1 u" p/ d6 b7 Z0 i        },
, D' t/ _# f. W8 F! R* o) n        {
# h/ x/ ?, Z0 d% S0 v% N" A                .active_low = 0,
% T  n% h0 l6 Y4 i7 Q                .gpio = DA850_USER_LED2,1 L* L+ m. s& H* u% T9 K3 d
                .name = "user_led2",- _% W2 q, K! m9 O( Z
                .default_trigger = "default-on",
: z4 }7 U! O1 w3 X! H4 I- ~        },( h  s6 k- \0 j
        {! `1 m& u* P" Q: M7 O
                .active_low = 0,
  Y& t4 h( ^* B$ F6 Z* i                .gpio = DA850_USER_LED3,7 D( N" z) A% D& @. r5 w
                .name = "user_led3",  K1 f! i- N5 J, d) W
                .default_trigger = "default-on",
' V5 L  ~3 O2 H3 e. K        },4 ^1 Z% X9 b0 {  c) ?! e% e' m1 y
};$ ~* Q4 y+ S; \9 C* ?4 y

7 s' q1 Z% {4 T4 f0 `static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {8 V4 R6 n1 l& L6 C, I' h
        .leds = da850_evm_tl_leds,' |6 K6 c) x7 V% z
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
2 n3 I! n$ @* u7 @};
1 a' \& D$ G$ P$ t! @) Y2 O" j/ U- a2 S1 i# s7 I
static void led_dev_release(struct device *dev)8 e  k- W1 [6 \/ h; P
{
8 |* P# B# E6 B( {};4 q* ?( b7 m$ }$ c7 ~% r9 [2 b
: l' T0 V9 s6 X
static struct platform_device da850_evm_tl_leds_device = {
! s4 D! F. t5 L7 Q7 \  w7 [  G. {, }        .name                = "leds-gpio",3 D6 _3 e, Y- \
        .id                = 1,
: z7 Y2 k+ ?1 g* D/ k9 `* e        .dev = {
& i% H( |) ~; d% L; C9 `                .platform_data = &da850_evm_tl_leds_pdata,0 K5 k$ ~" e$ R* @: U% i
                .release = led_dev_release,8 J# e0 O8 x, v: P
        }- _7 }; ]# m5 e) ^2 v
};
5 f9 P  g, Y  ^. L# V4 F2 P0 z8 `# J) t
static int __init led_platform_init(void)
3 k' w  u- F3 p6 s. S2 U1 [{' J6 W: M% P' Q) t1 ^7 }( M
        int ret;
6 a$ T) i% ~' Q. f0 v4 y6 U8 G#if 0
; G& w, {3 g& r. W$ A; O        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
$ O* p8 H0 G, S7 E) o        if (ret)
5 x2 [  K0 {1 V5 ]: ]                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"; {, x; s3 Q: A4 R4 F
                                "%d\n", ret);  {' R# Z4 ?9 ~3 t6 m* V' V3 }( e
#endif' Y2 M8 k9 w$ Y1 o: B. S1 e4 _5 j
        ret = platform_device_register(&da850_evm_tl_leds_device);
% \- ]2 ^7 q. C! c        if (ret)
# t& E3 o; `! ?& O                pr_warning("Could not register som GPIO expander LEDS");( R5 T2 F) R$ h: i% v/ N2 M
        else3 V) k: t  Z% f2 @3 |4 P
                printk(KERN_INFO "LED register sucessful!\n");
' M* `- q1 Z) p7 w6 b; Y8 `0 v' d# `, T
        return ret;! W5 n6 E8 [5 [  E& J
}
2 e% c$ b% S- ^8 c. q9 }  y- p# j5 F" X: w2 n& N( D
static void __exit led_platform_exit(void)
- X  g. a9 m0 f; r- ^( m9 W{2 q' k4 y2 Q* H
        platform_device_unregister(&da850_evm_tl_leds_device);2 S$ l. a: M% p; G
6 k6 h; g' r9 n9 e1 O
        printk(KERN_INFO "LED unregister!\n");
" X7 ^+ U' n) G1 p$ P}
  S3 E, h1 O+ x' e
9 G, j% d3 l+ }$ C8 J6 t4 Kmodule_init(led_platform_init);
  Y& S9 @2 ~9 ^; Lmodule_exit(led_platform_exit);0 j5 h* C, k. G

& P/ ~$ B5 N' E* N( X6 EMODULE_DESCRIPTION("Led platform driver");
, D) y$ k# W5 eMODULE_AUTHOR("Tronlong");
$ ]! A6 p9 M5 p5 zMODULE_LICENSE("GPL");
, l9 R- a; W/ b8 F7 }& p' I. h3 V7 A3 N! ^6 A/ i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 10:16 , Processed in 0.040646 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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