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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。. T8 V- I$ \: i% P( D& O
#include <linux/init.h>
8 K9 S. V9 j4 L6 L! B# |#include <linux/module.h>% f' ]; R; d+ A
#include <linux/kernel.h>) F4 Q: t+ A4 z% \' N; G
#include <linux/types.h>
2 Q& l/ d/ f+ ?' d#include <linux/gpio.h>
; b% T: U( L5 w) u  b$ F#include <linux/leds.h>
6 Z; ^- O, s' k$ t7 C: N/ b0 q#include <linux/platform_device.h>
$ q% U5 c4 \& {) n0 `
( L% \8 `  _/ g; X: x: C#include <asm/mach-types.h>- ?$ ?, \6 A0 s) V- v
#include <asm/mach/arch.h>
' p* |: [: ]& o) ?* O#include <mach/da8xx.h>
9 O& _& c( E% c: ]% y1 H' ^#include <mach/mux.h>
  S; C2 l- @6 J: l; f0 ?, F* \- }
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
7 _* v! `5 e# s#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
1 {" _! ]3 A3 A& m3 U& ~#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)4 P" ~/ v+ ]  O- z
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)' k; k* G( s/ Y, j5 a% |4 V) E/ B" ~/ `

/ \) G$ _0 O4 K' {' p! d/* assign the tl som board LED-GPIOs*/
* R. Z, z" ~' t( M- U- `& A8 q2 vstatic const short da850_evm_tl_user_led_pins[] = {
$ F! d3 Y) F/ U0 ~- [. ~1 ]9 o1 h        /* These pins are definition at <mach/mux.h> file */
% u. j" f- B# J' j5 H        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,6 p7 K! s3 g9 N' q0 P
        -17 m( M- N4 f2 ]+ P6 ?
};) t- n8 b' m9 X9 a( `2 T7 g& h
9 m2 ?& P: Y: d2 N- X1 a
static struct gpio_led da850_evm_tl_leds[] = {
9 a) i$ U0 V( p, |' I% W6 O/ x        {
! o3 U9 y7 `/ }& ^/ O! w+ J                .active_low = 0,
- k, T' A  Y! k! u& D0 }                .gpio = DA850_USER_LED0,
6 ^( |; w( j7 r" v# L1 W% G+ O( {                .name = "user_led0",: ~3 {3 Z$ r! e
                .default_trigger = "default-on",
+ N: r& d. N2 ]  y        },* u/ _9 z: Y! ^+ U3 p
        {
3 Y4 L' e2 D4 L& @7 l                .active_low = 0,
* A  c) a. d/ y8 k1 ?# y; u                .gpio = DA850_USER_LED1,
3 @9 H- g5 t, ]" M$ B9 ^% o" J                .name = "user_led1",. W: R5 z. a6 K
                .default_trigger = "default-on",& u: y2 u) U, Y3 w( M* B  u
        },
* W9 j# a3 q" p4 |8 o1 x/ {        {- Q, _1 z5 H+ |8 O% A3 ?8 c6 W( P8 Z2 @
                .active_low = 0," P% a( c, S* F/ j
                .gpio = DA850_USER_LED2,
5 f5 g+ b$ w8 Z% f                .name = "user_led2",
) U7 z4 r. F, u5 y+ c! z                .default_trigger = "default-on",8 L1 n+ p# N' }1 u1 I7 |7 q2 P4 N
        },5 X2 O$ F7 t7 F# R& T+ N
        {) g$ S! p- O7 l6 P
                .active_low = 0,
& s5 Q" d3 S" d: f                .gpio = DA850_USER_LED3,* Y3 i" H" ]( o8 r
                .name = "user_led3",
' p( ~* B- R- }2 o2 Z( M8 |                .default_trigger = "default-on"," q& L7 e5 w9 b
        },
  V6 Y. ?& M3 f! O7 ~};( M! [. }3 }! y8 H# |

; b2 V  ~4 Y; H% C  d3 H* Y5 B* xstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {. {5 J: N% R; m. r) Q5 y4 @
        .leds = da850_evm_tl_leds,0 Y; Q( X: ]& S1 e1 b0 n8 h  C, f
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),8 P% c) K- P& b
};4 x8 D  u5 F3 W7 E- F  A( z/ T

6 a% l/ Z- ]7 |" d! g3 j! fstatic void led_dev_release(struct device *dev)
" x$ l. A0 ?4 q$ I0 h  h{7 ]! G9 y3 Q6 Q
};- b+ g3 u9 @# y. _7 f& q; |

. _6 D  w, l: s  H1 a' ^% _( \* ^+ Astatic struct platform_device da850_evm_tl_leds_device = {* d' ^* {% U0 ~9 _5 I8 _1 _
        .name                = "leds-gpio",3 ^: e* u  L; P" v
        .id                = 1,9 a" g: m4 O6 E  r
        .dev = {
7 b9 \5 V$ v( u2 ?0 x8 ~                .platform_data = &da850_evm_tl_leds_pdata,- U% v+ Z. C  o2 R. ]+ N
                .release = led_dev_release,1 P' f! f6 H1 H1 `/ E% L
        }
3 @5 ^8 p# p) t1 c" z) z. L};$ y2 F1 K; G- c! A: h

! q; B# E# n( W# t. p: Jstatic int __init led_platform_init(void)
( S& O" S/ W- E0 f{; s: o8 i1 T1 w. q# `  u8 `  `2 u
        int ret;' C+ ~" u) C# n
#if 0
/ p$ \$ i, P3 A& V5 z" u+ ]        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
2 T" u* H, v7 \$ a3 C! _        if (ret)
1 @4 P( O9 S( v' Q4 k                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"' R4 g/ g8 ]# x8 x: h
                                "%d\n", ret);( o/ b9 A9 S1 E* ]+ S
#endif: U( ?4 W& M' S' \' c" |, S( h
        ret = platform_device_register(&da850_evm_tl_leds_device);
* A' F2 B1 g# l/ t        if (ret)$ R, Y! u  M6 k  j8 {8 Q& U
                pr_warning("Could not register som GPIO expander LEDS");
. H% E- I7 J( ?- s  ?  `        else
6 e5 f6 d. {0 a! z7 e7 N                printk(KERN_INFO "LED register sucessful!\n");  k$ `4 o) A' H9 B0 a+ ~, f

. h2 y) ^/ x* y3 Q" x        return ret;8 ?9 K/ s& F- i7 D2 X; z
}
5 T7 |9 x+ y( f9 k. A2 z
+ ?' w! w8 g) x: e( G' ^static void __exit led_platform_exit(void). y. Z9 b7 w) H0 @* u0 A
{
$ P  E' f- N: l. u9 K1 x9 }        platform_device_unregister(&da850_evm_tl_leds_device);
% `* T% x8 B( x! \4 h9 H
1 T; l+ u" H9 L" H- f/ o' u$ H) z        printk(KERN_INFO "LED unregister!\n");" W0 U- T9 z, m  y5 P# C
}1 c* s. R5 c* r) f" W. I7 I0 _
4 p& \7 U8 s2 q2 J
module_init(led_platform_init);
' ~, j$ g- `. Zmodule_exit(led_platform_exit);1 B5 @9 `1 w: p6 F# e) d+ F# Q
( r& [9 I4 }; _, b% t# X
MODULE_DESCRIPTION("Led platform driver");; ?1 \, G* U3 }/ o) Z
MODULE_AUTHOR("Tronlong");
) T0 P) j" X0 K! kMODULE_LICENSE("GPL");
8 r, J; \% x0 l* H2 G7 |$ Z) {) J; r6 e5 T* e" Q1 V& c" a- d" |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 15:27 , Processed in 0.040718 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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