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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。. C( t3 e% f$ }  l: s- J6 Q/ j' S
#include <linux/init.h>+ Z- _8 \+ P, C; _0 J* }
#include <linux/module.h>
* \1 d4 x% y- Y: Y#include <linux/kernel.h>, p5 z: b3 D0 V" L! s, u
#include <linux/types.h>
- G: J, y0 J: J' Z1 `( G7 _8 ?#include <linux/gpio.h>
3 N! c6 v( H; F/ r- k; R0 x#include <linux/leds.h>3 A* @. `9 F5 l& _$ W
#include <linux/platform_device.h>
' h5 F, G1 A* O6 s2 G3 ^3 w" q5 Q8 y. k% ^6 a
#include <asm/mach-types.h>
7 v2 A+ w6 U/ l; R( k9 a! L* U4 W#include <asm/mach/arch.h>1 n- G; u4 H; X& @1 v" L* u
#include <mach/da8xx.h>5 J) J7 ^! p7 O2 v2 X
#include <mach/mux.h>( U. O+ [4 A0 K/ |3 h& ]
2 u1 K, V: E: ^1 s! e6 n$ `& d( x
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)7 h& v& ?6 r! D: k0 i/ ^/ {
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
& o$ g. W6 ^8 z! y#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
$ a( N% k  |7 D9 _+ Y) L#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
% {4 p1 O5 O  r9 H+ h- U1 |- @( j' e# o9 y) K: m
/* assign the tl som board LED-GPIOs*/
+ M$ S0 S/ G* L# E" B" k0 e" C3 u' \static const short da850_evm_tl_user_led_pins[] = {3 E; P& ?( e4 A; ?- p
        /* These pins are definition at <mach/mux.h> file */
0 U6 u) t$ }: \5 _$ F3 F        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,4 O4 ~  w1 ], ~5 O) o9 Y0 \
        -1
# D& y2 r& P# w};- [/ p" u( O" u" |% n7 d: q

, h0 W6 m& \' E& B) Qstatic struct gpio_led da850_evm_tl_leds[] = {) [; f/ W9 ?& R" S8 _) c
        {
# X3 I3 q  b. f% P                .active_low = 0,
9 `- [' A# x; }/ l# l                .gpio = DA850_USER_LED0,( N' r4 e0 _) s5 e" s8 c9 r1 m4 K, W9 r0 x
                .name = "user_led0",5 P) j1 l1 K7 b+ _! g: b/ n
                .default_trigger = "default-on",
/ {+ l8 J( d" d" y/ q5 }        },  F1 B: H- ~- j9 m" q; ]
        {
$ Q0 H. L# @/ r4 u# I- T                .active_low = 0,
8 W7 D( i' R% L/ o                .gpio = DA850_USER_LED1,
0 y9 K! ~9 l1 D7 K9 @2 q# H                .name = "user_led1",4 T- W) M4 W( a$ @4 [( Q  U
                .default_trigger = "default-on",6 b; S& U. O4 K! R7 y! Z
        },
% d6 m% X* r. k# x" o3 [# P        {6 R% ^" P0 `: E+ S; `8 Z
                .active_low = 0,
1 F- F2 h: l8 A: ^6 {" G5 L                .gpio = DA850_USER_LED2,5 _! M$ f% T2 b3 a. ]
                .name = "user_led2",
) e- X9 f) y; J                .default_trigger = "default-on",
' `/ F; ^9 ^# Y  ]        },
( O$ n* ~; x: ~  G' @0 C6 m1 A4 G: z  ]        {
( Z0 w& a8 b5 q) _  h                .active_low = 0,
) C+ d1 v- _1 p+ A* Y                .gpio = DA850_USER_LED3,
4 r2 a3 W1 A2 n5 B& _: }/ e                .name = "user_led3",
; P7 O, [6 F+ ?, d1 u/ h                .default_trigger = "default-on",& F9 Y$ w( K" ~* U9 z1 S
        },' C+ `) T5 s4 c, b) R4 v) K
};
1 [5 Z; L4 w' e( n+ H' O: Q, Y8 x( e' u' D7 ?3 X8 R9 z1 b
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {  {5 @1 ~+ n0 Q$ P3 v1 h  L2 q
        .leds = da850_evm_tl_leds,
" t) e1 u8 E2 y; O        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),/ _4 H5 ?9 E, I+ b3 T/ U
};0 l5 d5 t) g7 d
7 x, {  l2 U7 l% H3 v2 `2 v" b6 r
static void led_dev_release(struct device *dev)' s- w0 R0 P5 p4 s+ [( R3 d
{
$ Q" M8 z& i+ w9 F: ~4 e* x};
8 r4 A# r9 r  C. m, X$ P9 X/ n; R1 Z5 f0 s
static struct platform_device da850_evm_tl_leds_device = {
% x. j1 [8 s8 W! i: _7 l6 I        .name                = "leds-gpio",
; o& y9 i' I- J# G        .id                = 1,
% r2 e6 A+ P5 t2 ^% e        .dev = {
4 t, A# l. b" @1 y  k! {, e9 H                .platform_data = &da850_evm_tl_leds_pdata,
/ P6 Y& ~8 g8 k( R) c3 V                .release = led_dev_release,
7 q3 O5 P- l) O& i& c# m        }5 |9 m- C% }$ n* I7 Y% X
};/ Z/ {2 r, p; [: g
) n+ J1 d5 v+ G; S5 L7 f4 |# J
static int __init led_platform_init(void)- B( E7 y8 |2 T& P
{& j% e" M! o& G) b5 o5 L7 s
        int ret;( G# R8 I- A# ^; P
#if 0
9 m% r) Y5 E7 k" v0 K        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);- K2 U4 _/ q  U6 E' O8 C2 I
        if (ret), L0 o3 b8 [- d7 I5 I0 q) [
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :": a' }/ W5 f1 E
                                "%d\n", ret);( R. u" y9 |2 ~7 D- v. h7 d3 O
#endif% n8 D9 @$ |, n( W7 V
        ret = platform_device_register(&da850_evm_tl_leds_device);
# h. }! {# U* M" K0 z        if (ret)
/ p$ {9 P3 a7 g7 N0 u* f6 L                pr_warning("Could not register som GPIO expander LEDS");" ]7 `6 e8 N1 J9 Q2 _  p
        else
! T% |! ~4 g. V* A( c                printk(KERN_INFO "LED register sucessful!\n");
. s/ U! J- R6 n9 Q% T$ e' W" I$ M" L9 @, |/ _' V
        return ret;: y7 x+ f, H1 }8 w
}( @- H% Y6 I% ?& u

$ a# A' {& c4 P# U" y4 r  Gstatic void __exit led_platform_exit(void)* I# H( w5 Q9 M
{! W" r* f. [6 F! D  S3 ]0 T5 I1 L
        platform_device_unregister(&da850_evm_tl_leds_device);
5 B" u& u8 \5 N" P
: L* Z$ F" c' G. I( {$ [3 n        printk(KERN_INFO "LED unregister!\n");8 |$ b5 ?# ~/ A. [
}
) N$ y0 Z. s. N$ Q
) K- }( Z9 E, ^/ n( Xmodule_init(led_platform_init);) z0 O, x% ?6 F# |+ l
module_exit(led_platform_exit);8 b( a  `7 n2 F: N; V
: P. c: }$ s9 b. r" O
MODULE_DESCRIPTION("Led platform driver");
6 c2 s& s" M/ P0 m2 L0 {MODULE_AUTHOR("Tronlong");
6 T3 Z# \! v6 A0 l5 IMODULE_LICENSE("GPL");
0 X4 l5 P8 G9 l% g( Z: A$ B
- }: F1 \4 ?8 E! U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 07:15 , Processed in 0.044707 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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