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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
0 s# g% \% \: D2 H) L+ r#include <linux/init.h>
: Y% U: x6 U/ A  q#include <linux/module.h>9 S$ N$ B$ A# t- d6 `0 A1 h: @: l5 U
#include <linux/kernel.h>4 k2 r" k7 J# m/ M7 p3 N' T
#include <linux/types.h>
" C2 `+ }4 W% ?; t* k5 I% z( C$ C#include <linux/gpio.h>
% Z; n6 m+ P& T#include <linux/leds.h>
6 {" C, `6 f7 z# }. ]$ H- [#include <linux/platform_device.h>
% e; K, {  n5 l! P7 |- z2 V0 N) B( v% `
#include <asm/mach-types.h>
# S  |3 }4 k# E4 c#include <asm/mach/arch.h>
) D3 U; C7 E2 X#include <mach/da8xx.h>! R; ^. x9 Z( s0 o2 ]2 }$ h
#include <mach/mux.h>$ H; u0 F3 F6 h. {) s

: i  V4 `" r; _* h  \' Q+ h- g#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)+ C4 |9 Q* ?% r( f
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5), e1 ?* \; p' i# y* P9 }3 A
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
7 S5 v9 N, g, y#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
& P3 A/ S& y# ^8 x9 P* b$ Q3 ]1 Q. \
/* assign the tl som board LED-GPIOs*/
9 N; j  X, f. V0 R$ t7 m. Q' Nstatic const short da850_evm_tl_user_led_pins[] = {
9 {2 h" U7 l% v! c9 L        /* These pins are definition at <mach/mux.h> file */
8 {7 ~0 ]$ y7 l, ~9 V        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,' d' `6 t) a3 j- w1 |+ U% u
        -1. x) R$ K2 c; f# d& j4 s8 |5 f( t+ T
};* |* A% g9 d5 C6 O4 U( r9 N/ Q
. D2 ~* U/ e  _! @
static struct gpio_led da850_evm_tl_leds[] = {1 Q3 k* E3 g- p: s8 C/ B
        {/ `6 N) s4 W7 C1 ]4 F: i
                .active_low = 0,
, n3 [- o/ _# \  t- v, G0 ]( s                .gpio = DA850_USER_LED0,4 R" R+ [7 c# B0 Z
                .name = "user_led0",
& T9 \3 B. S9 P" B+ R. V8 o8 c                .default_trigger = "default-on",' \/ D$ Q/ p& u: ?: A9 z
        },
5 r9 Q- O/ B3 n5 ]# c8 Z        {# l7 s0 t4 |8 _4 x& s( Y7 d
                .active_low = 0,; f8 _# u: n3 `+ E+ j
                .gpio = DA850_USER_LED1,8 l  d+ {# i& W+ }* s
                .name = "user_led1",- r3 v, ~2 T; a! c8 o
                .default_trigger = "default-on"," u! U8 `: y: I+ V3 Z$ ^
        },, ^; ~  s% w- \+ u. }
        {% @! q: `* `5 j4 U# T" D0 C: m
                .active_low = 0,& w+ q* C  [, |# }
                .gpio = DA850_USER_LED2,; j* W5 `' n, C+ ?7 K* Y
                .name = "user_led2",$ Q* k  M. ?% M5 h' q* n
                .default_trigger = "default-on",& R3 l" Z: W) W2 f
        },, S  z& X: G# ~; L+ U! ^0 T
        {
# d. B7 e. e4 G                .active_low = 0,
" t& G3 O! {* d8 }4 ]4 C                .gpio = DA850_USER_LED3,
+ K4 D1 w- s5 Z9 y4 o7 U  Y                .name = "user_led3",
2 I/ o$ M7 z* d                .default_trigger = "default-on",
  n  q9 {2 U9 V- k, D        },
  g# x: c2 F( n, Z. ^: {};
4 ]+ x/ g* ^# C. |
! s% u2 O& ]+ I& j6 D" Dstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
, ~& b  S0 |+ q. O* B2 i        .leds = da850_evm_tl_leds,
1 w" }' V7 D  U  i/ F        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),; m% ]: _3 [1 X( Y2 M! B0 R
};8 w, d# d% f6 n7 v
! b8 k5 ~2 k! Z; G- T
static void led_dev_release(struct device *dev)+ w" F. E5 L9 u1 v4 J  e
{4 Z  P  w! \4 `* B& P( f, M6 C! I
};
; c$ B5 \8 Y, D  s% B
. P  e; i1 q; O8 r2 Dstatic struct platform_device da850_evm_tl_leds_device = {# a- F. O) r& q" B6 C0 O3 R5 C8 R
        .name                = "leds-gpio",
0 y3 y8 m: f" ~) k  G        .id                = 1,
$ G, F9 X% z5 ^& t- x$ D: g        .dev = {
0 U7 Y* r- R* y0 F2 l                .platform_data = &da850_evm_tl_leds_pdata,
7 o: `: {7 \" _. R                .release = led_dev_release,* P/ T7 V. }, J7 m6 R7 W
        }2 z2 h6 C! n* q$ E) N1 s# x
};6 N: ]5 n8 |  r

) ?1 M) m) Y2 i; c# [8 A# Vstatic int __init led_platform_init(void)
6 Y* t$ V' N" X" y{8 o! m7 p# D8 M
        int ret;3 D/ u; ^' K0 g; S$ t' ?
#if 0% V* z. `+ D6 B- F3 i  I
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);7 `2 }+ H% O% @: g
        if (ret)
! a9 r$ H1 a% Z                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
2 g( m1 G. Y3 q2 N9 C6 c! b                                "%d\n", ret);" y% c5 B+ H* {- X, x) F. @
#endif' \% i2 l- @7 e* r& K3 B
        ret = platform_device_register(&da850_evm_tl_leds_device);
2 S+ G4 d2 ^, D+ O% |* t* g: R# S        if (ret)/ O3 D0 H8 ?2 |9 W/ w
                pr_warning("Could not register som GPIO expander LEDS");
) Y6 u/ M- S8 F( X        else
( O) H' S7 n. o0 ]8 U2 V, e                printk(KERN_INFO "LED register sucessful!\n");# c( P* `' {7 ~- a3 C5 s5 g, D

* t1 n0 S, Z; ]4 M        return ret;$ }& l" Q2 [+ N+ r  I
}
6 o, b4 n0 x/ B+ |! G; F3 T
* r0 Z& g* c- ]& d( v( y) ~static void __exit led_platform_exit(void)+ O1 y; [/ ]' }" \! ~+ X% H) Q. t' r) ^
{
, @6 N! M* ?* G3 T' E, |# A        platform_device_unregister(&da850_evm_tl_leds_device);2 `$ I4 e8 S- X' ]" Y8 F& P+ S

* j# f+ }, P% b: i! R        printk(KERN_INFO "LED unregister!\n");! n+ H9 D3 K7 u4 B+ j
}" M' n( S( ^! d. o3 G/ d. u: j1 U- d6 a

: k2 C" Y( x' H1 X. B" ~module_init(led_platform_init);$ M  W. Y9 m0 I. I  C4 H
module_exit(led_platform_exit);- |5 q4 \& x/ E+ e6 Z
2 W  _9 O. N3 |
MODULE_DESCRIPTION("Led platform driver");% x6 b4 O& d% g- b: }! V1 H
MODULE_AUTHOR("Tronlong");
% j$ G$ s% P, UMODULE_LICENSE("GPL");6 E8 L+ J9 b" C2 Q  Z
+ h5 `& a& T0 U" o! V! H9 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 12:52 , Processed in 0.039012 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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