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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。8 ^! {' B# ?' E) \
#include <linux/init.h>$ c& d+ S( T, S4 z$ R3 Y& z
#include <linux/module.h># e2 W/ x, Y' U) L3 T/ n
#include <linux/kernel.h>! q2 D* M7 R5 ?2 J- _3 t
#include <linux/types.h>% C; E$ W5 y9 L8 c  K* i7 k- t7 _
#include <linux/gpio.h>! J: Z. T) J$ r# o1 j2 a
#include <linux/leds.h>, ]9 d' m, b4 v+ r: u/ }
#include <linux/platform_device.h>/ _+ B. B, d2 x

& z4 `  H$ I5 O( B, {: F% w  F4 _" N+ }#include <asm/mach-types.h>
8 J  R# N! s- d# [. p$ F' ]#include <asm/mach/arch.h>
% ]) v  j  `! _" b6 B3 g+ @1 V# ]#include <mach/da8xx.h>" z3 l3 U4 ^# f. C  f- M! L- V  x
#include <mach/mux.h>) r% @% i  R0 }3 ~$ R! |% D0 a0 C' ]

) b) R! |' P4 d) Q5 I  Z; ?#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
) T2 e, b% Z7 E+ m9 I$ o#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)5 _9 h/ @/ [9 X& m0 A
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)- I, `( [  S3 \% u& P- g
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)! G; O; Y4 z2 Q  @7 r

( p4 P$ m3 o  [" F/* assign the tl som board LED-GPIOs*/: h' ^3 b; N" ~3 J0 t; a3 C
static const short da850_evm_tl_user_led_pins[] = {- O/ ?. P- N2 d0 y" G; h( i
        /* These pins are definition at <mach/mux.h> file */0 U1 @7 {. n4 s
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,* U1 R% ]+ K, C
        -1& k/ u5 \2 {! b1 @
};7 b& t9 L# z2 u0 n7 `
! {! T- T- |. r5 e
static struct gpio_led da850_evm_tl_leds[] = {8 d6 Y$ d" W' l$ J2 C7 f* {4 p4 A7 d
        {! s7 ?% h3 r7 O3 x
                .active_low = 0,
1 G  Z. B0 v) Z) ]+ q0 e                .gpio = DA850_USER_LED0,
( p; Z+ x0 u5 d' Z3 L                .name = "user_led0",& ~4 a" f4 S! D! [) B2 r
                .default_trigger = "default-on",
/ H3 O2 Z: r5 G( P9 c3 z        },
: C# u  G, i. K0 V9 v" q2 x        {
6 C6 ^# G% N* C. j                .active_low = 0,8 ]8 [' T1 p' f$ v* s9 d$ [4 x
                .gpio = DA850_USER_LED1,( K* x; g: j' r: F: i4 s( p
                .name = "user_led1",
9 `6 ?: {6 A0 d9 S1 I                .default_trigger = "default-on",
2 F) v6 a# S: h* z/ K        },) `6 }( `* N; ]' a( y8 [, w& b8 m+ n  Z. S
        {/ g1 x: G/ @. P- X  Q, |1 s' m
                .active_low = 0,% _; {' W* w( a3 n  G9 b
                .gpio = DA850_USER_LED2,, o, p# H' g- `( ~" R9 w
                .name = "user_led2",
% M  @  f3 P) {+ r- Y; [7 ^                .default_trigger = "default-on",
; o, w1 F2 j6 c# n        }," u3 K0 M6 o9 h3 @3 U, S8 p1 n
        {
# ^! @+ g6 T% k5 c, y                .active_low = 0,
; c: i3 I' a# \2 \7 g1 _3 g                .gpio = DA850_USER_LED3,  e/ t" T" ^9 \6 x$ k
                .name = "user_led3",, U1 h3 |' b: i1 A/ w3 s
                .default_trigger = "default-on",8 X( J/ m% q+ r( `& Y
        },: D: x- w8 M5 O) m1 _9 h4 ?. N
};
1 k) F' _3 T3 \3 E- Z& u( T9 X9 G6 W
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
& v. T; J$ x! I        .leds = da850_evm_tl_leds,* V1 C  `, |* m( |
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
9 q7 y' E4 i( p0 j  W! J3 d1 T/ G; J};+ |7 B# m6 ~, f! y1 m, h) i8 m0 E

4 A: c& t/ d) H. Z2 i8 o; A' ~, j( hstatic void led_dev_release(struct device *dev)
2 g/ e3 t! g6 U' o{" m0 g, v1 y" J
};
8 w$ a2 }( L! M- y+ M' D" g
, R6 |  V# v5 ?1 ]6 Rstatic struct platform_device da850_evm_tl_leds_device = {
6 h' h, S, j  p" Q# A  I        .name                = "leds-gpio",5 [7 T: C9 \3 M1 L6 l6 l7 F
        .id                = 1," Y$ V4 L2 C' [- `& }4 ~; f* e# G$ _2 l
        .dev = {+ U' S/ t4 A& \  p' a$ O  r. U
                .platform_data = &da850_evm_tl_leds_pdata,# \" e) G8 i8 `) D8 _* P, n
                .release = led_dev_release,
4 d# V) f+ ?; q$ K" m" }        }
1 M5 ?2 K. V5 e8 ]  B7 W; G5 X};
  E8 ~- {2 T7 c9 V
, t1 n: u3 J1 B& U6 G* J5 q0 D" n- ~  Bstatic int __init led_platform_init(void)7 d( j! P8 L0 ^/ L& z( K1 {1 t, a* q
{
' Q7 b3 I: M: E        int ret;
, y' A. X8 O4 _* k  p3 s! f#if 0, x2 `! V2 d2 e6 ^2 O" t
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
- E3 \. D( @' I- L, Q7 z        if (ret)
' c. O; U% U5 i4 j* m/ k                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
% x/ `: X7 ~" p( S  z; ]                                "%d\n", ret);
$ X2 m& m7 q  Y8 l5 k/ b  G#endif8 R7 g8 ?( s% O! C, p$ l
        ret = platform_device_register(&da850_evm_tl_leds_device);8 `/ }% E! `8 N5 o( p' t& K6 {" \3 }$ Y
        if (ret)2 ~0 f' L3 d! n9 v
                pr_warning("Could not register som GPIO expander LEDS");
0 d* s1 q, v; I5 d8 R; b3 G6 q        else
. |- g4 S2 I1 I1 ~                printk(KERN_INFO "LED register sucessful!\n");
0 j4 }4 |& K  l: r1 Y
7 y# m2 [, s* y' x        return ret;1 H5 [4 ^$ W% F! j# R7 {
}6 _, S+ v/ H3 [* x7 J

7 x' ?4 Q; \3 M  ~  X" a. k2 I' `static void __exit led_platform_exit(void)0 r# m+ E6 C( \9 k* e7 r8 H- N& V* [6 }
{
) T- R- a3 V5 }% x+ V# {        platform_device_unregister(&da850_evm_tl_leds_device);- G5 \% ~% i! X1 ]8 q" I0 N  l

3 C4 N% K* f" U' c1 ^+ E, H7 x3 h0 w        printk(KERN_INFO "LED unregister!\n");
5 D/ O" [" `# _' O6 W* r$ n}, P) s5 @) N: o. z$ S3 W, J! g

* Z4 X% |# A0 n7 Qmodule_init(led_platform_init);
3 ^" P0 A' }1 n* t1 O# kmodule_exit(led_platform_exit);
. k  ~* E& F3 `- i% r
& i1 h( U) [! ]+ `MODULE_DESCRIPTION("Led platform driver");6 h6 i5 l9 F+ Y& n& M6 u
MODULE_AUTHOR("Tronlong");! T- a4 S' T& }  g  K
MODULE_LICENSE("GPL");6 X& k5 w0 {, Q, M/ o; m6 u$ U

5 o$ n/ `- ~& ?5 d6 C. b0 b4 T5 z  S( a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 14:03 , Processed in 0.577239 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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