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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。8 g3 }% k! e8 E& m. ~- H
#include <linux/init.h>2 Z! F! o9 }% X5 M, @
#include <linux/module.h># P3 ~! N  S& p6 c  L1 @
#include <linux/kernel.h>
+ _% i7 u, o( c( M# l1 q#include <linux/types.h>- K, a" }0 L" w: G! d
#include <linux/gpio.h>
/ U+ J7 J% q5 q/ l#include <linux/leds.h>4 H7 r, ~; ]; P/ G7 [9 @
#include <linux/platform_device.h>
3 S2 b6 b3 a) k6 z' ]3 e: U% _5 o' i& \5 c
#include <asm/mach-types.h>4 l" V7 C2 @! v( ?1 r" B) q
#include <asm/mach/arch.h>
2 v; J# n$ |$ n5 }) B# i#include <mach/da8xx.h>
: U5 c* G3 |/ h: k; A#include <mach/mux.h>( R9 S! u8 y4 t
( N3 V4 U2 u( l1 \
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)- a, C2 ]0 O( o+ i$ y- i
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
, g! T: _) u  H8 F#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
$ Y; }+ F0 D& Y% D#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
! O* u1 Y( L' H! B, }/ E: S( O0 p6 ]0 B* Q0 j
/* assign the tl som board LED-GPIOs*/
; T$ O( q4 B2 G% Cstatic const short da850_evm_tl_user_led_pins[] = {! B9 Q6 I5 {  V, g; a
        /* These pins are definition at <mach/mux.h> file */6 h" T  B" B) g. l2 b  H5 \
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,% X6 |8 P$ G1 n% E7 s2 @0 e
        -1
* j9 f5 M) i; e/ q* X, L};: M' c. u, ^6 z% c3 u
9 ~" U0 T( e! ~, d3 ~, m
static struct gpio_led da850_evm_tl_leds[] = {
, g5 M8 I1 P. k. M* w8 |        {
3 P0 w& C: X" f# s                .active_low = 0,+ _" V1 c3 L% p' N6 P
                .gpio = DA850_USER_LED0,
" i8 G6 K  x9 y4 F                .name = "user_led0",
, a3 N  E) f8 S" u) P                .default_trigger = "default-on",
- c5 t9 i) C0 K" z5 g' P0 z        },8 H1 n/ V  w  @) D
        {
* w, }8 \1 o8 Z. Q  l  z                .active_low = 0,
+ _0 R/ b. o9 A& e$ n5 [                .gpio = DA850_USER_LED1,2 M6 S, L# Q; N
                .name = "user_led1",# V: n* O! G8 f( d
                .default_trigger = "default-on",/ f, E* V+ d& `5 p  S% ^
        },
( Z4 ~+ f" H* o) Q9 D        {
% B& W( a9 m) ]                .active_low = 0,! G: k+ L) `7 S2 z/ T  z. c, @
                .gpio = DA850_USER_LED2,9 G0 r! |7 z' }% |3 H; Y
                .name = "user_led2",# n/ R' v8 y' y2 |
                .default_trigger = "default-on",
, U( z; r/ Z% t. D# y7 R/ S        },4 V4 J8 y' [- i7 _% k- m/ k. ^
        {% g( I8 f( P4 W, C# R! g$ v$ |  |
                .active_low = 0,
8 ]& z" Q) ^: H: Z/ H" ?                .gpio = DA850_USER_LED3," L7 ?4 t0 O2 Q. z0 ~! F
                .name = "user_led3",! n$ F0 {2 Q# |' l
                .default_trigger = "default-on",
2 V1 s! |7 |4 u        },
6 o6 Y5 @- P; I4 J2 V};) \7 M4 `2 e& a) b
. ^3 K; w+ P& I+ I
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
; W3 f  C/ x2 S  N& I        .leds = da850_evm_tl_leds,4 `& ~, Z  P2 V7 r
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
6 U$ k, e* i: D, H1 y};1 ~, T. Q" ?3 m4 Y7 }- R
2 ]& @2 F) o" `, _
static void led_dev_release(struct device *dev)0 D( c3 E/ c& \0 U% E, o% K
{4 z0 k5 u' d. {2 f: C1 a/ m
};
$ W: B, m( q6 o5 t8 y6 e& r6 j
- T: ~3 S# o% |* vstatic struct platform_device da850_evm_tl_leds_device = {
9 ~3 A$ ?6 ?# Z6 A3 g6 T9 U0 w6 {/ e        .name                = "leds-gpio",) u  o3 ^1 K# b
        .id                = 1,; ]1 r7 K/ k* F' \) X# w; e
        .dev = {) Z' O. F. p  R3 k7 I% b$ O$ b2 \
                .platform_data = &da850_evm_tl_leds_pdata,
$ z  K- Q0 Z% Q                .release = led_dev_release,
6 K! ~2 [7 v4 k0 `' R$ K        }
( Q, q6 S* K. @# X};% p; V- g+ A5 V+ l- K2 q

; h4 f: A) P% a& Xstatic int __init led_platform_init(void)
' P8 W* Q. g+ }. N  p% j( C{- \4 C+ z" ]3 E* b
        int ret;" l2 t# J  X1 E' g6 x1 i
#if 0: w$ g3 H* o3 K
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
' N( Q+ W7 x: ^5 r        if (ret)
+ m, a- ^  o7 Y/ B+ g- Q                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"- H  L4 B# ?+ r7 J* x. [
                                "%d\n", ret);
/ H% F: X+ m8 m) O0 g8 M5 n5 I#endif
& L) @3 j9 {0 g3 C% p! R        ret = platform_device_register(&da850_evm_tl_leds_device);- l& T7 T% i: z  u4 }  o9 g' f
        if (ret)
$ r! y$ v3 J0 w/ @. P' T4 T                pr_warning("Could not register som GPIO expander LEDS");
9 ?& E7 T, y' a" ?5 p% Z8 o; _        else* e8 |9 J1 G) U% T3 f( u. y
                printk(KERN_INFO "LED register sucessful!\n");& f# G: l2 S( ]1 f1 ?( z/ W

1 }: c: ]: @! H( F5 D        return ret;
1 X" k1 n7 S9 v8 K+ s; b: m0 q}& o2 X/ k  R  q& L- y/ A! t

+ I& z! s/ r6 W6 ^7 _( z! V) vstatic void __exit led_platform_exit(void)
$ F4 h- s7 k3 M& u{- w' }& C6 k6 ~; l
        platform_device_unregister(&da850_evm_tl_leds_device);* b" `+ X5 \! W+ l
/ w" a  H  x# K: l! Q- T) ~2 Y) i
        printk(KERN_INFO "LED unregister!\n");; L0 |1 M5 y: s4 Z  K4 Q& }
}! e4 q5 L, |" K
# j" V! Y$ S( ^! _! \; ^- ?  l6 A
module_init(led_platform_init);  b; V1 B, E) q/ K8 y' F, _
module_exit(led_platform_exit);
. i" ]; v& n; w4 Y: L8 D
; |9 {+ B' C3 ^( o! o( WMODULE_DESCRIPTION("Led platform driver");
, K* F7 U8 \9 H& A, \$ hMODULE_AUTHOR("Tronlong");2 {0 n" g. n( G5 [5 V( w
MODULE_LICENSE("GPL");9 k" |5 ^- p( ]: u% M
+ w8 D* K8 s# P  `5 P* Y6 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 00:57 , Processed in 0.039624 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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