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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。6 h) S. E) O4 H" y- t
#include <linux/init.h>, j% w& W# ^" T0 }1 X1 \
#include <linux/module.h>
) w+ k' s: }  G1 k. f#include <linux/kernel.h>
6 a1 k2 ^* T2 O+ r# x#include <linux/types.h>; c: A! A9 d/ S+ g# I0 p& w
#include <linux/gpio.h>6 g. h- Q' J6 [" q7 O
#include <linux/leds.h>6 F% J0 j& I* T& q+ ^
#include <linux/platform_device.h>
5 f4 e# M! F8 |. y& H" o% s& v4 m* S, e4 r4 S& M
#include <asm/mach-types.h>8 M, w1 r* s$ {& T+ O+ ?: R* x
#include <asm/mach/arch.h>$ }* ], z8 q) H+ L# [4 J2 X
#include <mach/da8xx.h>
' Y' w+ ~( I' W4 `#include <mach/mux.h>
/ a7 l0 k: ]1 L; w3 b9 y. O& U, M, [9 Q
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)( T( J' H( w' T* a6 ^1 ]$ v
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)3 R5 |. b' a! G3 s: g
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)6 n, X: t1 L  Q0 S; F- G+ N
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
& w0 }7 h$ o+ C" ]# H; F
0 R- ]0 T' }9 U( z3 U9 g/* assign the tl som board LED-GPIOs*/% y- j8 ], R, `/ s* P
static const short da850_evm_tl_user_led_pins[] = {) o6 _3 @; e/ G3 ?2 n: k2 I
        /* These pins are definition at <mach/mux.h> file */
0 N; P; v; }, I0 w: K        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,. V  [* V2 [& \
        -1" m# F/ ~( ?) i8 ~) L/ `! e
};- x* k) I  a9 U
$ G) L' s2 a% ]2 ]# {5 |
static struct gpio_led da850_evm_tl_leds[] = {
3 j  m- _" V( _7 ~% l' {" O5 r        {
0 B; G2 s& O0 ^2 z/ P1 [                .active_low = 0,1 y* S- G+ U$ E5 q  C4 x
                .gpio = DA850_USER_LED0,0 r+ E' U7 }- {% O. ]9 s
                .name = "user_led0",% x2 s+ @8 X8 M5 |- n7 B' C
                .default_trigger = "default-on",
/ g& w- e; ~$ l! j7 `$ p" J        },5 @  k# i; g# _+ J$ H: d! y/ C" v
        {
. p6 z2 M$ z, L7 g: y                .active_low = 0,/ G, Z2 `" Y0 y+ m. o* Y
                .gpio = DA850_USER_LED1,, I% S# U$ x3 S4 B
                .name = "user_led1",  u: `  y3 C4 x+ D; x6 t9 B1 R
                .default_trigger = "default-on",
, }" p. M$ h; k; i/ ]" P9 ^( m        },) C* f, O  H2 O% e
        {
3 ^, I. S0 e; Z3 q. K5 O                .active_low = 0,
, O& Q/ I3 |% W1 p& [9 I7 I                .gpio = DA850_USER_LED2,4 x  p' ?- w5 e  q
                .name = "user_led2",7 {7 ^. {# Q) N8 [/ j1 k
                .default_trigger = "default-on",( I' G3 h0 r: C7 F2 D
        },/ o# q  V$ f1 u3 p  i
        {. M- k% L& ]. ]
                .active_low = 0,1 M  g! S3 S% y3 P- ?7 X6 \0 y
                .gpio = DA850_USER_LED3,7 z) f. j* G& C* n4 Z' k& b; G
                .name = "user_led3",% r9 E5 }5 l  l- w1 s4 ?# \
                .default_trigger = "default-on",
" X$ p7 c' P  c* N3 m2 R        },1 L3 d1 \# P8 F9 E. M8 R
};* @( p. r0 H; f4 Y

6 r: D) n/ M6 S: P( Bstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {6 H  G# A2 a5 Z8 B' a4 N4 H
        .leds = da850_evm_tl_leds,, R7 W( k+ H! f- I# _3 k/ P  m
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
" X* |4 q1 w3 a: W};
" Z) C/ q# C! b5 O; C7 T) O  l% q* }9 d" v8 S9 I
static void led_dev_release(struct device *dev)
2 f& X1 q3 O8 s2 j{8 K+ _. E. [0 A* Q! J$ ^/ ^
};9 l/ t3 E! g5 i1 G( j+ C

& u% T( M+ Y3 ?static struct platform_device da850_evm_tl_leds_device = {7 N8 q1 G; \2 w( m( ]/ V
        .name                = "leds-gpio",2 s% W9 i* t# t! ^3 K0 o2 V4 K
        .id                = 1,' D* g- g& D/ d4 A
        .dev = {
- C! b. G, S2 b: _5 a7 i                .platform_data = &da850_evm_tl_leds_pdata,3 C6 f/ b: P2 L
                .release = led_dev_release,
, w! z/ l1 A5 a1 C- [        }3 `$ D  C3 N  d+ _
};+ k. `5 f% h$ G
- V$ F: L7 b. i
static int __init led_platform_init(void)
( w8 l& _$ i3 O; U4 q* t{+ L% c* e- C+ }' _  @
        int ret;
! V/ S5 ]) H& X1 ^: d#if 0' J# s% M7 X! a
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
2 T3 `4 o0 Z4 b* M7 e+ c9 m        if (ret)
, z1 V# k$ O9 A9 j                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
5 y1 m. f+ o$ ]# o                                "%d\n", ret);
2 H$ Y; f; n; N) ?, B$ z#endif
2 O% @% B& {. Z        ret = platform_device_register(&da850_evm_tl_leds_device);) R7 S3 K) |/ G6 a! _1 I
        if (ret)2 E: A2 v3 Y: ~, s
                pr_warning("Could not register som GPIO expander LEDS");* N7 ]3 n- v( G8 M1 b
        else) p7 V8 ?# E% B! M. b2 ]* ^; A
                printk(KERN_INFO "LED register sucessful!\n");1 ~) p. C+ q- i) l4 I
( i  t8 G% u; S5 @6 Q) Q
        return ret;
$ P; D# z6 j4 S- K}5 ?6 a- U0 t0 \- y/ F4 R

: W- Z7 }# s: n) P2 N9 |  ?static void __exit led_platform_exit(void): P2 v- O) A* g4 B
{6 @! F6 d; G$ k! W, x% ]) S5 q
        platform_device_unregister(&da850_evm_tl_leds_device);5 Y" A4 k: X+ U2 I

6 J, z" K$ M2 O4 P        printk(KERN_INFO "LED unregister!\n");! _: Z- m1 C/ k/ Q: `
}; g6 g9 `- _8 l$ q  p

) B) @- P3 M$ W0 I& K' N" bmodule_init(led_platform_init);# o4 ^1 X* v7 i# ^9 Q' y5 J! p" q0 a
module_exit(led_platform_exit);8 T( k4 X8 B$ q& x. A" m
6 R7 d. q$ }- S# s
MODULE_DESCRIPTION("Led platform driver");
' X* t% x* {- M" l0 Q2 [! p8 @MODULE_AUTHOR("Tronlong");6 a7 [2 N6 v% [, S( \
MODULE_LICENSE("GPL");
+ q7 F  A2 G* r
; G) z0 j$ g5 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 23:52 , Processed in 0.038356 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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