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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
- S, L. O! @+ [* J#include <linux/init.h>
# H1 j5 X% n6 G9 r0 j#include <linux/module.h>
7 J/ Z0 \7 z% h  ~* g& X  \7 o; ]#include <linux/kernel.h>
1 e: ?: u' a: C#include <linux/types.h>
3 ^1 Z+ b3 {4 J# O4 _1 n2 y' B& j#include <linux/gpio.h>; V. L; P& @2 D$ C2 ~
#include <linux/leds.h>
( ^* v& C2 `5 W2 D/ N; G# W9 [% X* x#include <linux/platform_device.h>3 i2 r( ]1 C4 Q2 F/ E% ^4 E9 u
* o! B( n- G# Y% b
#include <asm/mach-types.h>
& p/ S  x( s+ S) O8 C0 p#include <asm/mach/arch.h>
3 L; {' a9 l0 ^9 R$ l$ u8 O* }#include <mach/da8xx.h>9 h& \, p$ c+ c
#include <mach/mux.h>
; f! q/ Y0 d- t: ^" v# m( _& h& N1 t+ b
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)$ G/ {9 e3 s! F" l
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)4 h/ M; ?7 ^; ~& u5 V
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
% w# Q7 \( v5 V6 C) F0 _#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)' S& e! l* J1 R: D- b+ u2 T/ r
( T2 j9 z& |& f/ ]" H1 h! C; b! o
/* assign the tl som board LED-GPIOs*/" {3 y1 u% w/ C: q# j
static const short da850_evm_tl_user_led_pins[] = {
+ H' F' [- g" h        /* These pins are definition at <mach/mux.h> file */
& \- `+ i& D- D2 F        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
1 ~/ a" `( H+ r2 ^; v        -18 R( n( k# J  n7 x
};+ `# c4 r, f$ q- p. ~

: h  Q/ `/ H$ Istatic struct gpio_led da850_evm_tl_leds[] = {
1 w% o/ G0 _* I9 j" c: I: ]        {2 J* W9 M6 E1 k6 j
                .active_low = 0,
9 }' m$ z! m- l2 t7 N  Q                .gpio = DA850_USER_LED0,- A  R, h% v" I# s. o6 {4 Q
                .name = "user_led0",
$ i# H3 u2 [; x! V4 ^                .default_trigger = "default-on",
0 u, R4 I& I3 [* r* W        },6 h# p3 E, c0 ~; P' A% f3 {" e
        {
5 `! m8 a9 u1 m2 L) m                .active_low = 0,
) T  F/ R+ ~) O5 _                .gpio = DA850_USER_LED1,$ W2 y3 O: s9 @  G/ J( V
                .name = "user_led1",/ x: K3 j5 w  t
                .default_trigger = "default-on",
# V+ V" ]5 e& k) Y0 O* B2 \& j- Q# q        },
5 _0 f$ j/ ^  p        {7 d" X# v' u, {* {0 h
                .active_low = 0,. U# _9 t6 A4 z: |& m0 H+ Z6 o
                .gpio = DA850_USER_LED2,
3 d9 s% T4 }. r3 ?. S2 v                .name = "user_led2",
" y* C5 ]: W* }7 U, v& ~8 z                .default_trigger = "default-on",( R! n+ M$ K5 n1 u8 m
        },
' P% S1 P% r+ |! \, J4 c. w        {* g; w/ l+ b) H7 ~# Q4 R
                .active_low = 0," D8 j' G$ s- u; `
                .gpio = DA850_USER_LED3,: _" c1 e. |, d( z( j' m  T
                .name = "user_led3",
, E5 A7 A; r( w# s  b. Q                .default_trigger = "default-on",7 I( z( g1 ?) `
        },2 G- ~1 O2 M9 ?7 H: o2 R1 X
};  v4 Q8 q! ?: D& ]+ `- I% y

, b- c3 m, F* d0 h( astatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {4 N3 K& [, m  k# g5 z" Z0 t
        .leds = da850_evm_tl_leds,% A4 R* m5 S# F. V5 U' b
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
: v8 b( @$ r2 f};
$ U! ^4 K$ A- T; e
4 U' B7 [  s9 p" E5 t- \' Z; V6 T9 nstatic void led_dev_release(struct device *dev)
& }8 f) x! i3 |" N" o3 e7 C{: h. z/ ^0 j, U& `. B& D2 ~7 N# G
};
/ s! O" W% ~3 p0 h- \; u3 y" a9 K. ^6 P. t
static struct platform_device da850_evm_tl_leds_device = {) p1 ]9 L# |8 T& f0 O4 b
        .name                = "leds-gpio",
# s- l, t* I  G% R/ g& ~        .id                = 1,
; S9 ]# A0 w, l8 |3 i9 h1 I        .dev = {& ]% ^  Z1 \, p0 |+ |4 B
                .platform_data = &da850_evm_tl_leds_pdata,& V, q8 Y& g7 |0 Z' F$ F) [
                .release = led_dev_release,
! L, v* M; r6 }4 L, Q        }
' [# P- G2 O8 R" l" |4 B5 ^+ h};6 i- V$ U; ~0 n  J0 k
6 U! s+ m9 I! I( Y1 y* R
static int __init led_platform_init(void)
7 }4 ^$ T& Q3 r+ i3 O' F4 c+ ]{. i) O7 W: b& |8 |  v
        int ret;
5 c; |. `/ r( \#if 0
7 s$ Q5 \2 i5 B* \: i        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);% L! b1 w3 T! b) \
        if (ret); B% v2 z$ }  |( H
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"$ |: j1 W4 _( K, T6 M
                                "%d\n", ret);
  B8 c7 ^, A: c: K9 g#endif
/ ~3 V+ d+ X; E% d        ret = platform_device_register(&da850_evm_tl_leds_device);+ K; h. I: }( m2 x$ I2 K
        if (ret)! ^* e, M; r' }" k$ u
                pr_warning("Could not register som GPIO expander LEDS");9 O# X& \& s- d+ D0 n6 N! y5 Y
        else
, E1 C: i$ R$ G. \% c                printk(KERN_INFO "LED register sucessful!\n");6 C. Y) n- N3 |

( I! Z9 C: I1 Y6 H3 [        return ret;
+ \, w  E+ ?7 u4 G- ~7 M2 a( h$ R}( X: e4 w/ W9 L; H, @( O6 O) v' f

: a& s! J4 R1 A6 a9 [) Istatic void __exit led_platform_exit(void)  z6 |5 Y- x5 C, q8 m
{
- S: L0 i4 x+ d: f& a  ~        platform_device_unregister(&da850_evm_tl_leds_device);0 f9 E4 q2 n1 |& x

" v' M# f# y  f& P        printk(KERN_INFO "LED unregister!\n");- W4 l; e$ `6 n$ l' A" d# e
}; M+ x# ~2 G2 L' j: M

# C' G+ c+ {; e+ _module_init(led_platform_init);4 u: ~$ P+ f; I- a- ]! p
module_exit(led_platform_exit);
& A3 T; R5 Y$ u: r* H" d* R# b# @' y( |
MODULE_DESCRIPTION("Led platform driver");8 |) @7 u& z2 M* r! z2 a
MODULE_AUTHOR("Tronlong");
  B3 x" f# N/ }1 mMODULE_LICENSE("GPL");
/ ^1 t2 p' @( @2 W; j9 p- `$ Q' v
+ ^& ^$ @1 S% ^8 u( m6 Y# b) d! m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 06:02 , Processed in 0.038911 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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