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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
( m4 M9 D, y- ~% r0 ?#include <linux/init.h>1 \+ z0 Z$ {0 N7 Z4 q
#include <linux/module.h>/ S8 U. ^# Y, }$ q0 h$ U
#include <linux/kernel.h>$ v% t! k! }# s" \+ J5 Z- r
#include <linux/types.h>" N( c/ N' O! U
#include <linux/gpio.h>
$ O; T4 j; n0 M* \# U1 m. X#include <linux/leds.h># H2 h6 j% D5 `5 [
#include <linux/platform_device.h>
/ }+ S  u5 T" s2 e& r3 e/ ~! ~6 O! Q  a! n9 t: q7 ]- T
#include <asm/mach-types.h>
+ H/ R! x( W' r2 Q. j9 J#include <asm/mach/arch.h>5 x1 `5 i$ @( e5 r( q5 i4 P
#include <mach/da8xx.h>2 N9 G. a8 F5 `
#include <mach/mux.h>! h  Y1 H, f$ L' ]0 N* O* @

$ Z8 f1 \, y/ F#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
/ A, Z$ Z3 ?4 X3 F( b8 K#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
4 T" S& H0 A: W% n9 E#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
/ T' X# J" n- `( H. D6 F8 o#define DA850_USER_LED3        GPIO_TO_PIN(0, 2); E6 m4 J2 u, I, Z/ l) v, ?/ f+ O3 S
! }" q2 `* l: T5 A  H1 u
/* assign the tl som board LED-GPIOs*/( I; L: U+ Y4 D- M4 U
static const short da850_evm_tl_user_led_pins[] = {+ h, M2 P2 \: J$ ]
        /* These pins are definition at <mach/mux.h> file */
$ q. ~* P( n' F( J, Z2 e        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
! h( m2 w  _0 G7 p1 @        -1
5 k/ X! f0 K9 _};; X8 r; T6 ~/ {4 }1 T

! A4 a9 E8 i7 r$ Ustatic struct gpio_led da850_evm_tl_leds[] = {
5 ?8 q0 A/ f9 F& J% J% t8 k7 ?! v        {+ P" c/ _, C4 J/ L2 R- z
                .active_low = 0,
  e% V* ]9 ]% y' b' _                .gpio = DA850_USER_LED0,8 R6 N1 b1 h( W0 Q3 X! c4 A5 R2 e
                .name = "user_led0",
8 M2 p6 P. I; [5 S9 }$ f                .default_trigger = "default-on",
' d9 Y% [9 v4 S, }) R9 f        },
$ e: h; H9 K8 R, `: ?        {
0 \7 d1 ?+ M& b) v2 g' }6 D1 U                .active_low = 0,! V8 R( p. e& I5 E+ n% r  h3 S
                .gpio = DA850_USER_LED1,
( g# s2 f1 x$ [: s  O3 s2 N                .name = "user_led1",# X; A, c4 g$ O# L5 r, J
                .default_trigger = "default-on",: r% ~7 N9 q8 D. D4 M# c  F
        },: m. |0 @1 {/ X
        {" i, l0 X* [0 Z5 L; ^
                .active_low = 0,' z' C" K/ N4 W5 x
                .gpio = DA850_USER_LED2,
. M; d) e6 G5 [# `7 H0 p                .name = "user_led2",' s' S0 ?. c: J  `8 c
                .default_trigger = "default-on",
- f# X6 k8 [) k) I" T4 N( k0 u        },
* I) J/ W7 X8 B% \        {
( t* o: ?/ {0 v. r5 ?- ?                .active_low = 0,
4 A! Y0 k' S. `) N                .gpio = DA850_USER_LED3,4 x- v* C; \2 A9 o. n
                .name = "user_led3",
: `1 s. n) T3 W5 \2 b2 u+ v                .default_trigger = "default-on",1 |6 l# j. z1 ^2 q
        },
* @( s) x/ h9 M) O};) M) }9 i! m& s
# b# l3 V, C) i" y4 y6 T2 Y! @/ s. c
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {& `: x1 |; z* T
        .leds = da850_evm_tl_leds,: _$ z! x) r9 P) S: b
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),6 W  |( V7 `9 `) b
};
" `' h  Z% I1 t% z7 J' I5 C% U5 L+ X3 [6 K- F
static void led_dev_release(struct device *dev)
/ e. f0 Y' o! R1 V% c0 }% g{
- P0 G4 _+ w% y2 ?2 ^};
. h- b6 {1 f1 E0 _0 `  X
! F0 D( @. C9 `5 l  q/ m7 M8 Qstatic struct platform_device da850_evm_tl_leds_device = {
) I. R+ c9 M) j& L+ N2 \# q! J        .name                = "leds-gpio"," p. F. p1 D" }8 |- b
        .id                = 1,9 a. |! ~" R3 Q0 [5 M' {# F
        .dev = {
3 T" q! b7 I! Z1 X# b                .platform_data = &da850_evm_tl_leds_pdata,
7 m) u7 C* Q5 F! y& J0 }# t" [+ s! {2 {                .release = led_dev_release,
5 p+ w3 R( C" L. i        }2 h# `* R  V1 {% W) M/ W
};- s+ A/ B/ r* n3 Q8 T6 W

& T1 Q* `% M5 K; L; v' ~static int __init led_platform_init(void)3 S5 G0 K) v2 b4 _
{6 ~2 {# `2 R4 u9 n3 L2 U% K* |
        int ret;
  s2 G5 U3 k. B3 f$ W, T& l2 y#if 0
* v0 ~7 C! Q1 I, X        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
' @( R3 o  ]! b        if (ret)$ o* E$ U& K* L4 t
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"! E% C- G  w) z+ }* _7 V) I
                                "%d\n", ret);
7 n( l$ d9 W3 S* _; y#endif9 X0 g$ e7 ~- r! K' O7 d+ O
        ret = platform_device_register(&da850_evm_tl_leds_device);7 O; j3 h/ @5 I8 X+ O! z
        if (ret)
1 |, T- g: K. M8 x  h2 C6 O% e- I                pr_warning("Could not register som GPIO expander LEDS");5 p' Q( s% F2 S* L/ n3 x9 T% D
        else. d: w* O5 b0 e' \
                printk(KERN_INFO "LED register sucessful!\n");' v) [: Z4 Y, R! c) `8 o* ], X' a0 O
, ^7 [& }9 `' d% f8 j3 a( u+ \
        return ret;
" O- c4 `: W2 \# G. T}, Q" ?- m" A. V+ C) J4 x. `- ^
1 D9 m4 `6 e6 E( a% Y7 d
static void __exit led_platform_exit(void)
$ v2 F+ a  ~' ~- R+ u3 I# d{- u; c" m( X/ \, ^7 p# F
        platform_device_unregister(&da850_evm_tl_leds_device);5 n! d1 w1 |: [/ f$ |( V
9 h" R, ^8 E9 L# O8 T9 j
        printk(KERN_INFO "LED unregister!\n");" S, }3 z* |. C
}' Y; o3 s" N9 @, t
0 @6 X% D' N- V( r) _" b
module_init(led_platform_init);2 K7 Q  `% N: n0 s7 h  x
module_exit(led_platform_exit);
! w/ c* V- P- y( M8 C8 P" T$ X  [, C: b; p
MODULE_DESCRIPTION("Led platform driver");
/ x! b5 l5 v8 |* c; X: A2 _1 ZMODULE_AUTHOR("Tronlong");# o" y4 n( ^  B. m2 M( h3 t
MODULE_LICENSE("GPL");2 g- e% E; D6 \0 d

4 d4 G! w* b; u& A( `8 {& E6 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 13:14 , Processed in 0.040269 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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