程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。9 z( D0 X6 u  n1 ]. P6 z
#include <linux/init.h>; d* [9 C6 f( i8 [' N/ q
#include <linux/module.h>2 H4 D& K- a7 B% ^- Z! O, u
#include <linux/kernel.h>
9 e( W" L; P/ M# L( G8 v- {$ o/ V' L# s#include <linux/types.h>
; F9 x1 ^. a( Y2 k: H, |$ R% n#include <linux/gpio.h>
' [4 u) H, J; c5 R; g#include <linux/leds.h>, ^& t) T# U0 |$ `: R( Z- a& I: o
#include <linux/platform_device.h>  F+ r7 U$ [. X" ~: h( l$ A7 c/ e

* Q3 P1 f3 f8 h" W9 Y; Q#include <asm/mach-types.h>
% `8 W5 d/ \9 k0 m) {#include <asm/mach/arch.h>! Q: g8 Q2 h. r% X3 a4 o
#include <mach/da8xx.h>$ w# s! ]7 ]& }! {
#include <mach/mux.h>
9 p7 c2 b; q0 I7 J6 f# f. m1 m7 ~. T$ v) F' n, E+ t
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
0 R/ Y9 Q" p: \* x- \6 E7 k#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)+ @! N4 O. }4 m7 q$ k
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1): B% p- ?( f% U) s" g8 H4 v% ^
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)3 M% @5 J$ K* J  m
9 n! q/ f* b1 f7 w/ \8 M0 [$ \1 x# B" M
/* assign the tl som board LED-GPIOs*/
) D5 c# s- G0 {static const short da850_evm_tl_user_led_pins[] = {
* c, g- L5 C( A- s/ U  b; J! W& p        /* These pins are definition at <mach/mux.h> file */0 c# }& G8 q; j! B8 D+ M8 s$ g+ U
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
% j  e0 G. F1 e4 N        -1
4 R3 q# ^' \* V};
9 h. U% e9 e9 f  Z. ?5 \6 i  {9 l# ?: W  C2 n5 M; T: r: b4 M
static struct gpio_led da850_evm_tl_leds[] = {
) ]; i$ U7 I1 F        {
" Q- \4 y  p; P! |& I8 y; m  `/ {, O                .active_low = 0,
( P! U7 {+ h/ \4 J                .gpio = DA850_USER_LED0,% e0 k6 m" a  {2 O
                .name = "user_led0",
# ?  G$ G+ D$ E( S( R# _3 W3 U3 I. F                .default_trigger = "default-on",
; X# p' f7 R- a& |; V* g6 G. y" |        },
  t0 V) I0 h) D        {  s/ S% c6 c! F' }6 W+ {2 ]
                .active_low = 0,! ~0 y% U6 {7 J: F* {. a
                .gpio = DA850_USER_LED1,, I% W7 c3 e( m) ]
                .name = "user_led1",
2 G$ S/ k1 D" \% L/ g/ |, `                .default_trigger = "default-on",
, n! I( J$ ]0 o3 A" y) R5 n4 ^% n        },
4 E4 o- U6 L- P# W( z        {
) X9 m! C$ d! A% Y: [                .active_low = 0,
' n& c* t# n3 q* Y+ P                .gpio = DA850_USER_LED2,9 c/ D1 b1 a  f. m7 R2 C
                .name = "user_led2",; b! R7 \8 j+ L# H* N& \( {: y+ k& n
                .default_trigger = "default-on",+ l: m* @( V  I: n
        },
, G, G' @' f6 _* T7 Y/ x        {
6 r% l9 {1 M) H% T& w$ [. D                .active_low = 0,
9 v% s0 q) g, R4 c, `- g                .gpio = DA850_USER_LED3,
/ a9 y0 \7 K6 m# j                .name = "user_led3",
/ k6 A0 Y7 l# ~' ~6 r& U                .default_trigger = "default-on",
1 n; W: z7 L. `9 B' m" c# k        },
4 I1 c" C) {' E6 R# }};1 p# i& s! P* |% ?7 m

+ G6 _) k6 G0 r8 M" Lstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {% F- R( G0 F% Y
        .leds = da850_evm_tl_leds,' _8 R; V7 e' o' B, H- l( B& W
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),% u% D; m0 U2 D: d6 t" S
};
' e5 J+ v  u# h* j( ~1 z% `9 l6 R. J1 f$ K# M& ]* r: m( |8 u6 V
static void led_dev_release(struct device *dev)
6 x8 A& r3 J4 y: @{
( S9 O/ i8 t' h( Y  {};
2 S" f. B9 C; c: ^) q) Q7 ]: ?( w& `5 [7 X
static struct platform_device da850_evm_tl_leds_device = {
/ @" s3 ^0 K: D/ ~  x8 Z        .name                = "leds-gpio",8 K6 k# y4 L4 e5 [% Q
        .id                = 1,' \$ g7 w& A% e  o9 l
        .dev = {
+ o. a! F" Q9 l                .platform_data = &da850_evm_tl_leds_pdata,8 j: H5 V/ H: S: ], K: Y, g+ r
                .release = led_dev_release,
! ]) `/ |, F/ s* M/ P, [        }
- }4 ?0 t" w% J* j- j};. U. |1 P& Y) }% Q- i
! u1 R* e" [. Y$ |: R* J' ]( u! x
static int __init led_platform_init(void)  ?, V" B+ U! t% G% _
{/ q+ q1 O( L; \' A4 }* a" M8 y
        int ret;
4 L: }4 c) j4 g#if 0+ T3 |$ C9 J4 x- R
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);9 p; _3 B. f5 h& R% V! |
        if (ret)& J! x, g& Z8 j6 f0 i$ w
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
$ d: }1 K( B& I+ K. x                                "%d\n", ret);# @& m$ b& n8 V( X, e5 N7 ^$ M
#endif
' e! @$ j+ y) T2 m& U% f        ret = platform_device_register(&da850_evm_tl_leds_device);6 {% \$ W3 l! Z0 o) O; j; j
        if (ret)+ W; Y. S, P6 Q2 A6 e5 Q! c3 n7 f
                pr_warning("Could not register som GPIO expander LEDS");
' \5 i8 c4 M% |! N& ]        else* v! S4 ^" f2 ~0 Q6 }2 t' e, }
                printk(KERN_INFO "LED register sucessful!\n");
8 {( b/ }; U: X& O& w0 R, s6 s2 E+ {) v0 w, |2 H$ h6 y
        return ret;% r& N. Y1 p9 g. Y3 Q4 Q
}
7 [2 P8 f- J5 H: F7 q% a* i7 e/ i( y, r7 S
static void __exit led_platform_exit(void)( e) m/ A6 b, H3 f" c  \2 w
{. a7 _# k) Y/ g' p4 h/ n
        platform_device_unregister(&da850_evm_tl_leds_device);
) n9 j- d/ \8 S5 K
- g( C' h* J$ a/ q$ |9 w        printk(KERN_INFO "LED unregister!\n");
' q: e! {, E, O( i# S6 V7 z}' q5 v. D9 q( e/ m
9 n( {& ?' P" s( Y& k5 H' n
module_init(led_platform_init);: c& L; s' C. s5 d% X* Q
module_exit(led_platform_exit);( }- I1 ^% N8 l% j
6 Y. y, E' z7 }; Y
MODULE_DESCRIPTION("Led platform driver");; C( }0 q8 D# n" J$ u$ a
MODULE_AUTHOR("Tronlong");5 q; M) Q2 L3 i/ n" r5 D
MODULE_LICENSE("GPL");) O$ C$ n5 K* q7 ^. @! q

# L' [! J$ q* s  \0 F/ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 23:19 , Processed in 0.036503 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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