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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
" |3 @! r! `0 x7 Q  w#include <linux/init.h>' T4 `% A0 ]1 i7 i
#include <linux/module.h>
- H5 D7 \* A, Q  o2 U#include <linux/kernel.h>
& y( r7 z1 s; H$ @& z#include <linux/types.h>4 L+ W( r! E; A
#include <linux/gpio.h>6 x! x7 T& H1 }$ B$ D
#include <linux/leds.h>+ I0 O( j/ B( h. _% B+ B" M2 a/ D
#include <linux/platform_device.h>, r0 t) C, X6 F% k' {3 e

4 _9 U# C. W% }- i# s) d#include <asm/mach-types.h>
# E, I: h' z6 O5 O; u* n, o#include <asm/mach/arch.h>
! P6 I& ]- ^, f- ~#include <mach/da8xx.h>. B) R; P1 }+ ?
#include <mach/mux.h>
8 \) `( u$ t' h3 ~8 u1 ~& b; g: R- ]# Y1 k
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
9 B, ~0 [, q+ c. }4 I#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)% [' `& H8 m6 A
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
/ _# a0 n: Q3 {: w$ N8 H#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
0 f$ _1 \+ _7 L! v+ k! ^7 }
0 D% I: i/ k  w/* assign the tl som board LED-GPIOs*/! J! X5 F! F1 R) d& L" f
static const short da850_evm_tl_user_led_pins[] = {5 d' W6 C  O; x7 m+ _
        /* These pins are definition at <mach/mux.h> file */) n% g1 `& N* T: v; v* O0 ?3 `8 h
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,2 l; h7 V9 X2 j$ Y: q
        -1% L: z0 |& F8 f# w0 ]  M
};
9 ^& T' s; A: [" U. e5 H
/ B5 t( j; K6 d4 g' a; P) \static struct gpio_led da850_evm_tl_leds[] = {  p# d5 e* j3 @# M4 G5 p
        {) m  ?1 p/ {  u4 G5 F
                .active_low = 0,
4 w$ T; T, K/ P# g+ t                .gpio = DA850_USER_LED0,  k. A0 L' e2 |/ h8 u1 F+ t
                .name = "user_led0",
# X7 A( }9 Y6 K$ J. d2 P, s3 q& E                .default_trigger = "default-on",4 `/ R3 D% w, a# g  I9 o
        },
( t8 @- w" k  A, g( f$ E        {
# A; `6 P  |2 ~; m  E5 H                .active_low = 0,
% b0 ^  }; z, I) \, h* ~! p+ F                .gpio = DA850_USER_LED1,
" i9 l5 `$ V% j. n4 |                .name = "user_led1",; |' {* b& w3 H5 p' c3 E
                .default_trigger = "default-on",: l3 Y4 M& g% k  t. f& w0 @5 h
        },( R+ w, P3 D, x' h
        {
; n/ Y4 O, q9 |, l: s0 x                .active_low = 0,
' o8 T+ n( ], D' M& O, a                .gpio = DA850_USER_LED2,. w+ t& r% g! I) q# d  h5 L
                .name = "user_led2",
3 j8 v; w% T3 r1 n, g5 \                .default_trigger = "default-on",
) l/ s  X  e7 |  j5 R# Z        },2 _) K, n+ p8 J+ d
        {: [: Y( G8 r% q2 k9 T3 p, ?
                .active_low = 0,% K4 e4 x7 \& _  r
                .gpio = DA850_USER_LED3,/ j8 x1 L% S  v- I4 {) \
                .name = "user_led3",* H8 y4 F& d7 H+ {$ {0 y
                .default_trigger = "default-on",) D4 [4 G9 o  L: ~0 u" X0 ?( B* R2 h
        },- l$ w4 o% Y9 ?  {4 V8 x/ M! l) n6 @
};6 x* J* q7 f: J+ G) A

8 R0 O9 z8 x. zstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {; g9 k- f) A- t
        .leds = da850_evm_tl_leds,
$ Z% P  a  H" a: |        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),0 @! V5 \  O) _/ e
};% M+ T3 [% I: L( v0 U- _8 u

) w9 ]0 v% e7 H' W7 ?/ O# k2 I9 tstatic void led_dev_release(struct device *dev)
1 U/ ]: Q' @8 G, w9 z{- a$ l/ _7 e' C
};
# b9 Y! [: i/ _/ l! X. z, W: x
  w* J2 S. V$ s8 K* s4 h5 j9 ?* gstatic struct platform_device da850_evm_tl_leds_device = {
* c, W0 f# G# D, K! l; A6 f6 z% ]        .name                = "leds-gpio",( v- E0 `6 |: e. {3 K" H
        .id                = 1,
$ B  Z  z6 R' Y2 n6 V: [) |        .dev = {
/ {* o5 d( A7 A5 ]                .platform_data = &da850_evm_tl_leds_pdata,/ R+ |* E* K' S+ q7 B( S
                .release = led_dev_release,
' ]5 P9 `2 H7 I2 Y* w% Y' c        }$ j: t; i4 h: z1 u
};) I* B0 i6 z& U# H

) i: A  W: {8 U- I( k' S( dstatic int __init led_platform_init(void)! c4 ]/ r: ~0 g7 M
{( U, ^! {% K# ]8 o, n) t
        int ret;. N( a' o+ g+ Y" k
#if 0' j& J  }* }2 E! c
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
# Z2 A4 x! d4 O. h3 E        if (ret)
$ @5 B0 E8 {4 }& ~( |                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"8 Z8 {) v* m$ I
                                "%d\n", ret);
1 w/ D: N) W2 M6 V1 |#endif1 ?7 e, S2 U0 E+ g! Z
        ret = platform_device_register(&da850_evm_tl_leds_device);6 ]; f+ w& \5 @# R6 G+ g1 T6 T. h
        if (ret)  D+ Y3 G- {4 `8 b( e
                pr_warning("Could not register som GPIO expander LEDS");  v) b; f$ J1 ]$ L% W; T. s
        else
& e$ ^3 l7 `* }8 z' s" H/ ?$ @                printk(KERN_INFO "LED register sucessful!\n");+ q& t( D6 l5 O1 L; J$ _
" W. o( }# c6 e; y2 G2 d  C
        return ret;/ I  W$ N' W  r" [
}. i! |2 ^6 s* M( k
" Y  {' G9 N$ O" n% R# V4 C
static void __exit led_platform_exit(void)
: B$ L2 |8 [$ N{1 ^6 Q  R+ v; H$ g0 [# ]
        platform_device_unregister(&da850_evm_tl_leds_device);% ?' M1 q, R6 L" d2 q' g8 J$ E

# W- l* G1 }! @% }; [1 P2 j9 w) [% B        printk(KERN_INFO "LED unregister!\n");1 j$ c( U" W4 n
}
# t, \! Z$ G; E/ M' Q+ B* |
/ }: g! E2 k1 O7 k3 q: ^- y0 jmodule_init(led_platform_init);/ ^/ N. ^  Z- C+ ]. h1 q; x
module_exit(led_platform_exit);8 u& m% ]( \) h) `. v' E

$ U$ g4 E1 z! \( W0 ?7 L  dMODULE_DESCRIPTION("Led platform driver");
$ ?5 ]4 z3 H6 nMODULE_AUTHOR("Tronlong");3 [  }) ~& k1 X5 Y8 l6 \/ [4 O& Y( a
MODULE_LICENSE("GPL");! N1 a+ S( ~& I- H* z6 W  K! B
/ F' y4 T) U" D' |! g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 14:22 , Processed in 0.040716 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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