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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
; M* }% C& D7 B, \. R#include <linux/init.h>9 \* C8 K  G8 j
#include <linux/module.h>! C) X0 C( t# j% T- p. R  N
#include <linux/kernel.h>
* P5 A9 ^. D, X. }2 E. i#include <linux/types.h>* z- E4 U& {* K2 _, Q9 k
#include <linux/gpio.h>) n* ~4 w" D1 a* L
#include <linux/leds.h>5 w) N* p6 S0 C$ I8 z  ^
#include <linux/platform_device.h>9 i* z7 R9 j; ?/ L) @& g' P$ X

* H) Y* U  L9 x' K: i! b) i# u" M#include <asm/mach-types.h>' U$ z) V( }+ G6 t  M9 k, x/ G" O* i  t
#include <asm/mach/arch.h>
* T$ o9 E9 n9 {" l#include <mach/da8xx.h>/ M9 V" p6 B. C3 f
#include <mach/mux.h>
* u& {3 {0 S5 t, I, n0 D  i- d2 y0 z  G7 v" A+ v
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)$ g7 {3 v( Y  O
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
" c0 |6 C- O* T, \$ T#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
/ I( b/ t3 T' l. Z9 Y#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
$ R( K# o# M3 k1 Q8 i/ o/ a7 @  g% C' \( j# W3 d
/* assign the tl som board LED-GPIOs*/
) U9 [2 R" m& Y; e5 @6 _- Qstatic const short da850_evm_tl_user_led_pins[] = {0 |* @0 e  J1 w) y7 V
        /* These pins are definition at <mach/mux.h> file */
+ q" R  S+ [8 r3 O        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
# C0 C" i; G! m2 O        -1
1 d* v0 o6 U6 q% x};. ]( H4 v3 P: H% N* v

& C: l, W$ s+ w4 bstatic struct gpio_led da850_evm_tl_leds[] = {
1 F# E5 D8 g6 e* j- U$ n; o        {
: ^: [; {2 w2 V" y& k  P0 J                .active_low = 0,) ]3 Z4 }0 X+ k) g% q4 h0 q
                .gpio = DA850_USER_LED0,
7 N' i, Q6 \4 j9 J& j* I                .name = "user_led0",6 Y3 D6 a( |7 z; Y
                .default_trigger = "default-on",4 f7 b4 B( r4 G8 m) P
        },5 p( q# b0 U+ c( S7 p: S$ Q3 n
        {* r, x3 f* [6 F0 |. h* i
                .active_low = 0,- ?4 k" @) i) Q9 B7 j7 Z1 A
                .gpio = DA850_USER_LED1,
. k7 B: f9 d8 z- W# N) Q                .name = "user_led1",1 U; m! Z: w' ]) I% u
                .default_trigger = "default-on",& @& N8 t. M. Q) `
        },& f8 ]2 q0 ]0 d
        {0 ~8 x8 J- A2 I8 r: E* O/ ?
                .active_low = 0,
. v* K- w9 C) T                .gpio = DA850_USER_LED2,
& ], l; G: O" K. i                .name = "user_led2",
* ^) T/ N- Z/ M# M% y                .default_trigger = "default-on",8 X' X5 R3 I4 M$ D6 T6 u2 N8 C! p
        },
) O+ L* d* [0 k- e        {0 A0 W0 |0 A5 T' w8 }- B
                .active_low = 0,
' Z: y6 y" v: V3 `                .gpio = DA850_USER_LED3,! \. o4 k$ N& R0 K" a# Q
                .name = "user_led3",
2 B- f1 h2 U5 ]' y. P$ }+ [7 T                .default_trigger = "default-on",
; j- A5 g9 g! {6 h: I, u5 ~        },
* A) l8 X. K, b, H};  ?! l; R3 ]! H/ I) j8 Q

8 x2 `2 R! b& V) K( fstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {2 ~0 |' t3 t0 n: e; P- k
        .leds = da850_evm_tl_leds,
9 t# }- a; e- }1 @: y; X        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
  v& ]; y0 N( l};0 Y6 V3 _9 ~" I

5 n8 B. k# J0 }+ Dstatic void led_dev_release(struct device *dev)
' h, f, D. H& @( t) D" D0 T{
' Z1 E! T$ @. E};
: k  R$ z- ]% r7 @; h9 t+ d1 y8 }2 I7 y- O% e9 ?* c
static struct platform_device da850_evm_tl_leds_device = {3 l6 d7 n8 c+ x( E4 X
        .name                = "leds-gpio",! G! w2 G" F5 _  Q
        .id                = 1,
, [4 T' A9 I4 H2 C& a        .dev = {
( J0 C( o1 U( _7 k7 N: j                .platform_data = &da850_evm_tl_leds_pdata,
% U! K' e/ r% N* R+ W) n                .release = led_dev_release," c6 Q2 |6 V/ e% X! B9 B
        }
" _0 }* Y  P5 l% y6 Z3 x# M( M};
1 @8 z' }% B. ?9 h+ w0 H
8 r! h3 J4 R; S% Y* W* Gstatic int __init led_platform_init(void)2 e* `4 E/ h( }' W, C" H- E" b
{7 I* Q: Y1 T' Y: k; E: z
        int ret;& d6 |$ a/ o! g0 X: ^  N
#if 0
' c4 o; w; j. ?  @2 V% `' s        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
) A, M" H9 {& U- W- w% [, ?        if (ret)
- M2 J  t. d0 H                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
; x- g( B( p8 o2 g6 [9 C. }                                "%d\n", ret);- K# W/ w# R4 s( ~7 _
#endif
6 F7 \2 x! c! K/ b7 d7 Y" Y/ X        ret = platform_device_register(&da850_evm_tl_leds_device);6 d- f' C2 M5 S% G
        if (ret)
/ }0 M1 g( z6 f) H9 D( h/ U                pr_warning("Could not register som GPIO expander LEDS");6 h2 F) j# \* |/ X3 {( K
        else
5 w5 z0 ~/ g! V. `+ p                printk(KERN_INFO "LED register sucessful!\n");8 P; j: ^: ~" t' U* R

/ c. r$ a0 t; J# D        return ret;# T, u$ _0 z7 ]1 C" Z
}( [' ?$ Y, o6 f: A5 G9 H! c7 `2 b

3 f! r& W1 k' _0 @- R! estatic void __exit led_platform_exit(void)
: w* ~7 ?* Z1 x9 Q) e{
9 |8 y" A3 a* a2 R# R1 R9 e        platform_device_unregister(&da850_evm_tl_leds_device);9 D% n8 O) w4 F, N$ v% `7 X

% _4 ~: u. ?$ s) Q3 L7 e3 b        printk(KERN_INFO "LED unregister!\n");
9 Y+ x+ X8 U9 m% ]- _8 \. x}
3 D: G. f. d* F  I' O4 M& [5 ~
5 q( K8 ~6 {: O! G9 A: t/ ^module_init(led_platform_init);% w/ A6 _$ U" u3 I9 k% h
module_exit(led_platform_exit);
' }- V( f" y% ]
  L% D% ^  Q0 P( o4 CMODULE_DESCRIPTION("Led platform driver");0 F/ k# a. G- |2 Z. @: g
MODULE_AUTHOR("Tronlong");
. U6 x' [3 w: s& ^3 [MODULE_LICENSE("GPL");0 M: K) G6 }) f- x( i' D

. s6 x4 u% m( L* L( j" t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 05:29 , Processed in 0.049523 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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