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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
6 P2 o2 g' C' B: N/ p& L#include <linux/init.h>$ Q2 ~0 [3 D9 O  @" e# ]
#include <linux/module.h>
' v0 e4 d, M8 S8 _7 y: m#include <linux/kernel.h>
5 M4 g; s/ y) ?#include <linux/types.h>' y7 ~* k& n/ k+ R
#include <linux/gpio.h>
. n' b! z0 v+ A/ t; P/ z; T#include <linux/leds.h>
' W- g+ a" `/ l& d+ X! i! h( k#include <linux/platform_device.h>) ~3 i) s5 M$ }( q# N) f+ y
7 I2 I; ]* h: }- V+ H: }
#include <asm/mach-types.h>
! h: L+ f! z3 o  X$ d+ t2 s) [5 j; z#include <asm/mach/arch.h>
0 l2 Y, ~" G; L#include <mach/da8xx.h>5 l3 T% f7 A0 y4 p% s1 c& v
#include <mach/mux.h>
' W" u( [. I% |9 `3 V; L/ _, `' F2 n- L& b) @
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
. n, l# o4 _- w$ T- S! r! N#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
- L0 N% {" A- R2 Q( M4 L& T; r#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
* w0 ^  N0 h1 V4 ?4 M  _+ @- T#define DA850_USER_LED3        GPIO_TO_PIN(0, 2); |+ p3 b8 P, ^, a: l
; R) _9 {7 y" q1 Y2 `- a* W
/* assign the tl som board LED-GPIOs*/+ Q# y- J/ n6 {/ ?9 p! A( v. j
static const short da850_evm_tl_user_led_pins[] = {
4 y+ f1 J  V3 N0 a9 h        /* These pins are definition at <mach/mux.h> file */
1 v2 D6 n$ M4 V        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
: r% g% z# _- v, [3 U        -1
6 ?3 h3 q0 t. _' H- M};
9 u: X2 Y7 ?# y
, F5 e- f* m/ l0 B7 o' L+ U5 |4 x. {static struct gpio_led da850_evm_tl_leds[] = {
6 S2 \) Y& f4 ?/ D        {
5 E  W- n2 l! M% W$ p# Q                .active_low = 0,. D! T+ `% J# J9 J5 i0 x
                .gpio = DA850_USER_LED0,  T* M$ x& V: d; j" ^2 P! G4 O- _
                .name = "user_led0",
' C1 ^+ _/ b9 V% i  `! P6 W1 m, w                .default_trigger = "default-on",
; k& `* ?5 c7 k! S5 b8 i; r' A        },
5 ^* X; a2 R3 A9 ?& c# A+ M        {
* t/ R8 B8 Y7 S+ [. H                .active_low = 0,
2 M0 m4 }0 E/ x# W2 M( k  v  a                .gpio = DA850_USER_LED1,
% K1 R; k8 F) y  V, Y% b                .name = "user_led1",! c& D' g4 D. ]: b
                .default_trigger = "default-on",
1 B/ T/ H) j' j5 J3 _# _. s( `        },  C, }! t) T, h
        {: Y$ z2 S9 ?; T
                .active_low = 0,( ^' a: |3 F) c. Q& Q  r5 N' W, v
                .gpio = DA850_USER_LED2,
; z* J1 d' B2 R! a  B, c                .name = "user_led2",
3 Q: ^9 a2 i) H) N: Y6 N                .default_trigger = "default-on",
( \; K% v1 O, m" J7 {) u        },5 E# m9 R( X1 c2 }  m& m9 L
        {
6 _! Z! P: ]! _* w* v/ G                .active_low = 0,# w) K: a* s2 _. s9 i5 w$ X
                .gpio = DA850_USER_LED3,
7 [: C( _8 B0 B6 W1 t) z& N1 S                .name = "user_led3",/ c, e. \/ G8 Y9 V8 G9 ~- {
                .default_trigger = "default-on",7 {" E. [+ @7 `; n" x
        },: S3 k5 a8 ?% t. K7 ^. d6 x  r
};
6 G; W* I; o* Z8 t
/ t' [2 y$ V$ O6 x9 i" hstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
6 s! s( c, L3 w$ ^/ ?+ f        .leds = da850_evm_tl_leds,+ d( l9 T6 t8 Z7 z
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
* `! c6 v* w+ L7 y};
- c6 G; I& X, g
8 c( a4 w( Y" P; L: [$ X3 }static void led_dev_release(struct device *dev)
1 e9 @/ F. ~9 F! Q{
5 g" K( e5 C6 P: V};
' k' ?6 \: [* a
4 M1 I8 H: {* O8 d1 {0 M  ]static struct platform_device da850_evm_tl_leds_device = {
7 D( j% S2 u% b2 ?" g        .name                = "leds-gpio",( C! O8 W) F. K& a$ `
        .id                = 1,: F; t0 H( ?% O, X, v4 L$ B
        .dev = {
8 s& Y# F' L: M% ?" c1 b# l4 F' R( E                .platform_data = &da850_evm_tl_leds_pdata,; B! e7 @- t: f/ |- s( M  g  l. _
                .release = led_dev_release,
# n1 _2 {- z  r7 C, T, Z5 _        }' R! |* o* K2 K1 ^' Z" [; U
};  m. |. E$ [8 D3 {. p/ z5 F

) D1 ^" I  c5 e1 k3 E0 }static int __init led_platform_init(void)5 ^, I0 a+ F* V1 c4 q
{& D9 c0 y8 f) J* U9 r& p9 M
        int ret;: @2 g/ _1 h1 c/ J
#if 0! p+ K2 k# z/ a1 h; c2 u
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);7 A& V0 D+ F: ^4 m9 b! I; r4 I
        if (ret)- a6 p8 {0 c2 Y9 ?
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
5 j- Z! R4 L" e+ L2 f( w. K1 {                                "%d\n", ret);8 I7 n3 G+ q4 h! i
#endif& h) E4 U. N0 C6 s( P+ V1 l
        ret = platform_device_register(&da850_evm_tl_leds_device);* W7 y! Q; g' g9 ^+ Y
        if (ret)
# [; O  g0 Y: {/ }  `7 u                pr_warning("Could not register som GPIO expander LEDS");5 P2 q' ?* i0 R% g! O4 ^
        else$ P& n7 m! y4 D& B% n: |
                printk(KERN_INFO "LED register sucessful!\n");
+ P9 e4 b' g' }$ D5 g1 D' u! Z' V
8 p: C8 X2 b. C& P. f0 X3 U9 |        return ret;
  N/ z3 U  G  ^6 ^* ]' L0 C}
4 Q- a! K% i8 W5 i2 A4 D4 l4 l4 I, O* d' @
static void __exit led_platform_exit(void)
& h- E4 w8 \, e3 v5 ?; Z{& @9 p1 p0 p8 M
        platform_device_unregister(&da850_evm_tl_leds_device);2 u& C  }2 N9 @& w8 V
" h7 o( s/ h7 X% w* N! U
        printk(KERN_INFO "LED unregister!\n");
$ U0 |" A) I8 @. ]4 e9 N1 E6 H}
) ]% Y  Z( S/ g) i3 ]/ i# {' ^+ G
# a3 S. y; Z9 k1 h, emodule_init(led_platform_init);. v6 I6 S  j$ N4 |( _
module_exit(led_platform_exit);, s( R2 R' G2 X4 n

7 i! `5 P* ?& A8 tMODULE_DESCRIPTION("Led platform driver");
7 z' [" [; F/ T% D0 tMODULE_AUTHOR("Tronlong");
" K4 m% S. p, `3 A% H3 GMODULE_LICENSE("GPL");1 V* e+ ^) t# A+ U
% z  D- n' B0 [& l6 ?, G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-24 12:39 , Processed in 0.083779 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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