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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
8 F7 m8 T$ O4 v; o  |9 T# f7 A#include <linux/init.h>& ^+ M9 e& k6 M: o4 S
#include <linux/module.h>
6 j% x4 S4 ]+ s) B#include <linux/kernel.h>9 J) P$ C: }' t5 ]
#include <linux/types.h>
3 Q! [3 r4 W- A#include <linux/gpio.h>5 Y* F' f& P% w* f! y
#include <linux/leds.h>5 [* N4 T% g3 c( J0 W
#include <linux/platform_device.h># r- g0 N0 |" M! E
2 Q5 R5 \8 S+ w( w0 t1 C( J
#include <asm/mach-types.h>
. x2 M' R* S6 z/ `! u: F' Y7 j#include <asm/mach/arch.h>) t6 ]$ v6 ]/ A- Q- d  c1 w) K$ t% _
#include <mach/da8xx.h>
+ x3 R! h/ ?) W' j  Y#include <mach/mux.h>, A. A% ]% l3 I7 o
) N9 n3 J6 B. f! w5 i" y
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)# \0 ?. C' Q' Y1 v: ~+ D" Y
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
8 g2 \* P  c+ a4 R- o#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)7 N4 L! s. P# I& f& K; M
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)8 ?" N: g" C$ j* [

  j4 ?" X" E' w  T. L6 g, g3 \/* assign the tl som board LED-GPIOs*/
! ]* r* s: ?5 Y+ A: O+ vstatic const short da850_evm_tl_user_led_pins[] = {1 R6 P2 H0 Y3 L! H! F/ a  \
        /* These pins are definition at <mach/mux.h> file */+ j% b. L1 c! X* I( G, F
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
4 z* a+ D# |$ V- f: c4 P* \% I        -1
& A; g' Y1 Y' @2 `8 B! y; i" x) q};
* V; f# ^* X) E
' a, G  p- n" A0 b! B6 J- Nstatic struct gpio_led da850_evm_tl_leds[] = {
0 n2 v- b- Z5 A( u, s: V! y        {2 A  M2 H$ j4 w
                .active_low = 0,
+ [1 l, M3 m- _; {! W                .gpio = DA850_USER_LED0,2 C2 ~' C$ s4 l9 g0 o8 A
                .name = "user_led0",4 l1 X" u8 [, X. J8 }
                .default_trigger = "default-on",
; b0 g, G8 h5 D0 g& t        },
- F+ I/ _0 [6 a) Z        {
: g2 \' j3 _' a) k% b$ j$ C9 l/ \0 f/ F                .active_low = 0,
( u3 d; u3 I" J                .gpio = DA850_USER_LED1,
2 _) }! E, L; n4 [                .name = "user_led1",( I1 u) `! z+ ?% G* j' n) x# }. q0 M4 ?
                .default_trigger = "default-on",
! }5 ]0 {1 Q2 A1 F% _! u        },7 l! n# @1 x. `, A7 a
        {
# ^8 @7 |7 @* Q9 R                .active_low = 0,! e: q( \5 G* ]: H4 I' J
                .gpio = DA850_USER_LED2,, @& |' d) U0 E1 P
                .name = "user_led2",; _# Y2 k7 b3 O- ?8 B( }6 O
                .default_trigger = "default-on",
5 ~4 X  A5 j( U" u        },  _$ _- N; D$ n/ f; x
        {
4 I* I- h! D9 i$ g. N                .active_low = 0,
9 U6 l) B9 @6 W5 o' r4 o                .gpio = DA850_USER_LED3,
) d6 h7 {( [, k( M+ g- y# m                .name = "user_led3",) X6 i  Q# V7 d) Q4 A! d1 w
                .default_trigger = "default-on",0 k4 ~# U6 t; ?5 A6 W. G) D
        },- Y: O9 T6 B& Y- G
};
- |  K- G: u6 m2 ^1 u" E* @$ }- d; }, W- z
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {" f; L: J9 d2 @3 D' C
        .leds = da850_evm_tl_leds,
8 r( G" Y' _2 Y0 N  _        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
( V: H- \' c: N1 E3 B. Z};9 L5 ]: v) T6 x
( ^3 U* b% r( Q, g
static void led_dev_release(struct device *dev)
7 J) }5 h' L. |( `6 y' Q, Q4 p{
8 G+ B3 r1 M3 d};* @+ `  h4 d$ I# n  E6 a7 ]) f
( P! J; Q- `. {+ w5 z
static struct platform_device da850_evm_tl_leds_device = {
" [! t1 L# q* h) @4 M        .name                = "leds-gpio",. c9 W- D$ h/ d: S2 @
        .id                = 1,& _6 k* S- q! I4 r' e
        .dev = {# g6 r: y- g( R) C6 d( {: _9 W% C
                .platform_data = &da850_evm_tl_leds_pdata,
7 p* t" w! J# c8 j; _                .release = led_dev_release,6 \* k$ g1 O+ F
        }+ Y3 m% `2 ~% v& i7 F
};
  l, [  I$ H! a( j* x; t  f! m6 Y+ i6 Z# n4 I# k
static int __init led_platform_init(void)
" ^, G2 [: \# c7 O2 J. S8 o{- j0 R: c2 v. \% P1 M2 V
        int ret;
" c2 t; ~8 z0 [! n- K#if 02 w& i' r$ b8 p+ ?$ y
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
5 v$ I" C" Z" w& {  q7 P; D3 M: N8 Y        if (ret)
7 |) r* y  J: _6 H- {% f5 C                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
0 E6 s1 k* S3 n+ a7 U# s2 L0 U                                "%d\n", ret);8 A# p9 k+ I; D# N8 ~( M
#endif
0 }! i; I6 X  h# n3 o2 p- Y7 s& l        ret = platform_device_register(&da850_evm_tl_leds_device);
4 K; Y8 ~& T! c- [        if (ret)
/ q+ G2 c" H$ I) y: d# H; n+ m                pr_warning("Could not register som GPIO expander LEDS");/ v! V" w1 ?& N! \3 x" Z( E, K8 y
        else1 U5 ^2 Q0 e- Q7 _. S
                printk(KERN_INFO "LED register sucessful!\n");
) n; u% v& k/ X+ y  l+ Z( m& T+ E( a( R$ ~
        return ret;
- _# z4 T  w( H$ {}3 [/ J3 \# m3 p: l" P, O8 P
% w. Z# \3 a7 K  B- Q; |* f2 v
static void __exit led_platform_exit(void)8 [8 U$ `+ A. I! {2 A9 P: Z+ o/ m
{9 r0 F# [) Y3 L- X( _& Y
        platform_device_unregister(&da850_evm_tl_leds_device);
" _2 b5 {7 H! p/ h7 U6 g# |& H2 {4 v+ {$ _$ I4 |
        printk(KERN_INFO "LED unregister!\n");) M( X: r" E  ~
}+ N& J% b# a; {
' G6 t3 g7 ?2 b0 g" S& r4 s
module_init(led_platform_init);: `; V$ h1 |! R
module_exit(led_platform_exit);, _% l; P/ t: Z* J* Q. o

0 @# _; R' G7 f9 N  @: p9 [, SMODULE_DESCRIPTION("Led platform driver");
7 i; S: S; X: f( S4 vMODULE_AUTHOR("Tronlong");0 U9 t9 v5 M/ b( }  [, b
MODULE_LICENSE("GPL");( V! v; X& C; |  C6 u0 ~0 X9 @

; G$ @' A% L8 B$ `% N  ?; L0 e* v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 17:45 , Processed in 0.040248 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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