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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。8 F0 R, l1 s" v1 _
#include <linux/init.h>
) m* ?% F6 w9 C+ L/ ]  H$ ]6 n! \#include <linux/module.h>
4 l8 u& w& G* c2 H8 K#include <linux/kernel.h>! k0 W( h, r$ \  S2 q  P' e
#include <linux/types.h>
; b7 M* {3 M1 K. N0 P#include <linux/gpio.h>6 i6 n' U# G7 k. A% c
#include <linux/leds.h>
' ]" P/ R* w, B1 f; v#include <linux/platform_device.h>
0 N2 T1 h; o) U  B% u
1 x) f$ Y( H5 |& v. U#include <asm/mach-types.h>9 Q3 r3 V- `4 s1 S) Y; D
#include <asm/mach/arch.h>
4 N; X3 C  b3 |! ~! E# |0 m#include <mach/da8xx.h>
: e! d, h( B- c% b) L; n/ B#include <mach/mux.h>- e& V( x. M9 I: i
; U2 k, i! l+ p7 V
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
( m4 U, F0 A6 Y! E8 g7 K#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
7 p3 Q) d# s0 W: Q, b% S#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
' k6 G3 J* U' ]#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)# V0 n# W  Z/ {+ H& _

0 G2 k1 r( b6 h( v& {/ |/* assign the tl som board LED-GPIOs*/
1 d2 Y7 |) p7 {static const short da850_evm_tl_user_led_pins[] = {
9 C( k9 Y( C( T4 n/ I4 `        /* These pins are definition at <mach/mux.h> file */
) S) s$ u4 D# s4 v. ~( f        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
' _' P) T; W8 Q" w# A        -17 u/ G2 W3 ]. ^: h/ n4 A$ ~! u
};
7 T, R% m$ j( g5 W: I6 O5 H+ ~
4 k; D2 N- Q$ O, y$ bstatic struct gpio_led da850_evm_tl_leds[] = {
) O+ w( C) b0 T4 L0 \7 z+ B6 }        {
* V) ^6 ~4 l: d$ o2 y                .active_low = 0,4 [. [- m* D, k7 ~
                .gpio = DA850_USER_LED0,: S  g" ]; s, @- M2 Z% C+ W# n
                .name = "user_led0",7 ^" F4 I: C" Z. H& \$ S3 S
                .default_trigger = "default-on",, W, {& E4 A: e3 M: A3 Q( v
        },& u3 L0 |1 j/ Z$ A
        {
: J  e7 Y  g0 z& V8 u                .active_low = 0,
" p" t  T- V% Y3 T                .gpio = DA850_USER_LED1,
9 y, L4 S& D2 T9 t. Z7 ~& t                .name = "user_led1",8 p1 }& F3 I# l. r  v
                .default_trigger = "default-on",- d; `, k' }6 k/ S/ M3 D; Y
        },
& t# m/ K9 L# k. r. G( {0 j- \        {
0 a. p' A, N6 r8 g; O, U! |2 N                .active_low = 0,, W1 F4 t+ a% f* a( R: X0 T/ Q8 h
                .gpio = DA850_USER_LED2,
% l' ?( m0 q( H+ c                .name = "user_led2",
: a. C& u* q+ S* O                .default_trigger = "default-on",7 k* Z: x9 x) }/ N! A2 v
        },
) v$ s5 R4 v, q+ L0 p& h3 t        {
) g5 Z7 x0 ~0 ?; t                .active_low = 0,
4 R' {, n0 B7 Z* W                .gpio = DA850_USER_LED3,
3 u5 G5 H& y3 M$ A$ a                .name = "user_led3",/ U7 N8 `% J4 m! {% ?' w
                .default_trigger = "default-on",
& i0 W% ?" T6 i7 |/ x. x        },
0 ~$ r6 W' q1 @% M; F. H- J: o2 n};9 a% I2 T* p- W

- u$ J0 @8 S1 Y# H8 Istatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
- \3 W, |& x: Q- n        .leds = da850_evm_tl_leds,
0 f) Z: k, \- }! E1 E: Z+ F8 Y        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
0 J; G4 B$ e2 J/ ^* `};
) ?* _1 A& g4 M( s; S" ~) ?  u0 M3 j; }7 u0 h. C. d9 E
static void led_dev_release(struct device *dev)
+ L5 V  c2 b. G. Q{
  M2 u' O% f9 H+ P};) C7 B  y/ i) A9 `: I5 s
* R! e& C6 g: e. s; `- N
static struct platform_device da850_evm_tl_leds_device = {. W( t" X) S: t4 U" X2 [+ I
        .name                = "leds-gpio",% i/ |2 i$ |( ^) b. U% w* S
        .id                = 1,/ g1 d0 a$ o' ^! M/ D
        .dev = {
4 H1 ~3 b8 G' T                .platform_data = &da850_evm_tl_leds_pdata,
+ d" }9 ^6 D, `/ B2 a5 b5 {& n                .release = led_dev_release," Q0 @1 C8 \7 A1 W
        }
" X! k: L0 J) V! q};
  R# G8 j* M& l2 |& H+ s
8 Q( Q- Z1 s) o  J5 qstatic int __init led_platform_init(void)" G% _1 O1 w9 ^) L1 t" n- c5 d
{
$ Q/ z9 a* I# S        int ret;, W+ ~: R& S0 @
#if 0
4 ?! V2 Y) V- J        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
1 _2 C7 h2 G: \  O2 l1 z: ~1 ?7 J        if (ret)+ l8 y. O) y% @7 f" \, I
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"! k3 z- L5 X8 t6 ]( n
                                "%d\n", ret);
& t6 z3 d/ S$ ^#endif8 y* W+ F( X6 I, V6 X
        ret = platform_device_register(&da850_evm_tl_leds_device);6 m! H+ U) {# P6 {, g( I/ G
        if (ret)' k: d3 W; W/ _; a* M7 r3 D
                pr_warning("Could not register som GPIO expander LEDS");
. [; P) `- R. b0 |        else
! ~+ }1 l, L0 N                printk(KERN_INFO "LED register sucessful!\n");5 E% l5 I- C. Z) e3 h7 u0 w7 e
: @" S) O4 a/ B( H4 y! Y
        return ret;4 i% p5 {! m4 K
}0 ^/ u% h" I" O& x

6 ^% t) q; s8 f% I' s2 n) \) jstatic void __exit led_platform_exit(void)
, e. e4 A  T  Q9 S{' _( l+ @1 r$ U. N0 z
        platform_device_unregister(&da850_evm_tl_leds_device);* R7 L0 U, @7 r2 p5 i' d

4 l: x) o9 I/ Q8 h( J        printk(KERN_INFO "LED unregister!\n");! o4 W/ i0 h$ x! |+ p( ~* @& \
}
* w! }) l$ v0 F/ J- e7 A' x- V" p6 W) x& ^- u4 U4 C
module_init(led_platform_init);
2 \+ w9 p$ {) Y6 V  H8 E2 vmodule_exit(led_platform_exit);
, `( {0 x3 u; N5 k2 O4 C$ o% |
* C- s& Z4 U, Y6 B; \MODULE_DESCRIPTION("Led platform driver");
+ g1 h$ Z& |( Z9 ?7 e& |; l! NMODULE_AUTHOR("Tronlong");
6 j1 k" s2 K5 b1 u5 }7 S/ eMODULE_LICENSE("GPL");+ s2 l4 d. o% B9 s/ c9 L- t3 I$ Q

8 G+ X0 \0 v' O- X4 R1 J( \  F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 18:54 , Processed in 0.039118 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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