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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
9 R8 m7 K$ T8 Y& o5 r& P#include <linux/init.h>
- `- w# Q/ o" j, T! p: A#include <linux/module.h>
  h& M: g. k0 E$ F7 Z#include <linux/kernel.h>
$ b/ |% c+ u/ O#include <linux/types.h># ]% X; f1 C$ c
#include <linux/gpio.h>
) W  z- V7 a+ J' i2 k& J9 {#include <linux/leds.h>2 ]- v8 H4 g0 j/ ~: E6 ?
#include <linux/platform_device.h>
7 E/ h$ p1 u. `0 \6 t0 o3 F4 w, d: b/ g7 S) f2 r
#include <asm/mach-types.h>: ?+ X& S$ b9 T  C( Q$ ?
#include <asm/mach/arch.h>
( r. }/ L/ t4 x: m: U  z#include <mach/da8xx.h>' j! ]9 h' C5 j1 ]! d
#include <mach/mux.h>
4 {+ U1 |# M! a# e% f; o/ S4 S/ M3 U+ A- L, F$ L3 \
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)/ b% I6 J  h) o- V: b7 ]' M/ H  K
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
- o7 B+ B$ p2 [% J. @6 i#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)) a7 c3 P9 d! x& @/ }
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
5 t2 W2 |& X* o$ R. Y: W8 h. l" I9 m. Z3 d% `% U
/* assign the tl som board LED-GPIOs*/
0 L- k6 ]1 l* D# Q' ?2 }static const short da850_evm_tl_user_led_pins[] = {
1 E+ z0 i7 Q" J' i5 ]6 B7 B$ l        /* These pins are definition at <mach/mux.h> file */
* x) A7 L: n6 C        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,1 o" @* _6 L( M9 d! T
        -1
2 d& X2 I2 H" e) i- O) N! U0 a};
  x- y, @2 M8 S2 e
" V2 \) E  k; @  xstatic struct gpio_led da850_evm_tl_leds[] = {/ {' [, N0 [2 Z* k; R# x
        {
' r% N9 ~3 _& K8 f: {                .active_low = 0,' s  W% m6 ?* K% o) P
                .gpio = DA850_USER_LED0,6 i! x5 P4 L: f
                .name = "user_led0",
% y. q/ i7 K) I0 j% S3 X                .default_trigger = "default-on",) f% `# F- f7 ?* |% [# `
        },
7 _, K2 r, m$ f( P        {* B" c, [) |. Y6 u
                .active_low = 0,2 U( l  i# n6 I% G* W- p
                .gpio = DA850_USER_LED1,2 i0 u6 w7 p! |/ o, O
                .name = "user_led1",1 G7 S) D+ x  R) \% s: h, C1 q
                .default_trigger = "default-on",
6 _3 t; I' b3 X& H! w4 L) i( x2 t/ y7 s        },
3 {. c5 e6 P, f        {
+ H) r- r- X& _" f7 f3 }- r                .active_low = 0,5 b: E1 {% o( k( i) @( {7 i
                .gpio = DA850_USER_LED2,* P7 A& ~- s) D7 n. b8 W
                .name = "user_led2",
# [  P" x6 Q' K  b                .default_trigger = "default-on",
' P; r9 J: N$ f! V8 h6 P# Q5 D        },; ^& R/ y5 I; r( n) y
        {$ H3 M, I( e7 V4 `* B7 e5 b
                .active_low = 0,
% n- [/ X5 b$ R. Q9 W, o7 E                .gpio = DA850_USER_LED3,4 ~) f8 H" v$ O5 r% \
                .name = "user_led3",8 N- P9 d8 X) Z; J
                .default_trigger = "default-on",# ~) D9 y: |7 o% F' `+ n: s- d
        },$ Y% ^/ e( N- D8 a$ F1 u) e
};
* A; g1 c2 w) v, D7 Z* O! ?- P* Y
9 w: H- t4 F5 ?1 p: ostatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
9 S( c8 S3 i7 w        .leds = da850_evm_tl_leds,$ N, v1 |0 u- L
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),# o, @0 ~* \( {  w) a* p  T
};
, J( [5 S/ R% L5 Q4 I( |
& _& S2 [; p3 }# v$ x8 y# [, wstatic void led_dev_release(struct device *dev)6 H) Z6 Q, }  x+ C. \3 A
{' l3 E2 c2 `8 `& U1 p3 y
};3 Y; S) ?  l8 Q1 p

* _8 i  S6 _3 hstatic struct platform_device da850_evm_tl_leds_device = {: m! }  u9 x* o2 ^+ ?; Y6 _- [
        .name                = "leds-gpio",
/ T: f- P9 h+ |, G        .id                = 1,
" p! |- B6 d' d( K( @0 m        .dev = {
& K$ I3 z3 i7 x& P                .platform_data = &da850_evm_tl_leds_pdata,; R) Y' i) m7 z; R
                .release = led_dev_release,
& n+ i% q3 G7 v0 `, I0 p3 X        }6 b# A0 o, A$ y
};
- }. f1 i, e* J. l" _0 d- e$ s& f* T6 T& k
static int __init led_platform_init(void)6 v! U  e5 C4 M# p
{
' R8 ~! a7 m- j4 ^; Y/ a! q        int ret;
( }9 @# f3 o3 L. e* t4 t#if 0
" t& d5 w9 z* d, J: P0 r# q$ i' z5 D        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);0 j. U4 I! b0 F+ E
        if (ret)2 r, k4 H. o3 G5 ]
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
$ t4 ?! f  k3 P3 a, O# `                                "%d\n", ret);) m. d: l3 [8 p) M2 a1 Y
#endif
% F7 q6 M$ F3 Y        ret = platform_device_register(&da850_evm_tl_leds_device);/ }6 j% {: t# `! H7 f2 w
        if (ret)
' l* G( V2 X1 r4 h5 C/ p                pr_warning("Could not register som GPIO expander LEDS");5 ]8 i1 C) _5 b6 p6 k2 ?& Y7 I
        else
  U  Z- v8 O+ |7 w                printk(KERN_INFO "LED register sucessful!\n");8 t+ ~0 k! A. `( k* e0 k

, w  l) J& b/ w8 y        return ret;
! |2 w6 Q  o) l4 C! m- a4 h}' u! T( t2 p: N$ d
" q" w5 f7 Q7 c2 F$ Z7 p3 ?) e
static void __exit led_platform_exit(void)2 E" L+ |! W/ D  h+ {( E* S
{  G% L/ d4 d- k+ l6 O0 W  i. n% d
        platform_device_unregister(&da850_evm_tl_leds_device);
# T, W/ Z. H) O
- V# d0 E7 a9 i# l2 {0 }! W        printk(KERN_INFO "LED unregister!\n");( G, e4 q7 Q6 v
}6 D2 Q/ v5 E0 a( h

! q: G% h( }9 f! K: b% z% M& ymodule_init(led_platform_init);1 `+ D. d0 N3 f; R
module_exit(led_platform_exit);$ f1 G6 h5 T+ {" e; ~; c) g$ K/ i
6 o" w) b' M4 j+ _+ V' k
MODULE_DESCRIPTION("Led platform driver");( p* G  V% N% o$ S: k0 ^* Y
MODULE_AUTHOR("Tronlong");, R( f- D& b' N6 i
MODULE_LICENSE("GPL");
* H3 T, ~1 g1 ^5 {8 ]9 h4 @- e, T( B/ Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 05:34 , Processed in 0.046259 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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