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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
+ ^, ~7 p3 G2 n0 _#include <linux/init.h>+ O: v" @! n5 J1 z, }6 \3 A
#include <linux/module.h>
  E0 a, e& v0 B3 G#include <linux/kernel.h>$ _5 ^; t/ S- G$ ]6 ]) w$ r4 K
#include <linux/types.h>2 @5 b- u- v' c4 E, x. ^
#include <linux/gpio.h>7 K3 |; ]9 C1 j' N
#include <linux/leds.h>
% v# y* g3 ], s8 c, [& y#include <linux/platform_device.h>- `! j+ e8 [6 d$ P  G) _4 W% ?1 w

- S* M+ D; H& z8 r4 t6 b. A, @#include <asm/mach-types.h>& ~+ ~! L, w1 a
#include <asm/mach/arch.h>
! k% ]3 h5 k: J3 I/ a9 p#include <mach/da8xx.h>
$ P% u! M2 J" r5 m#include <mach/mux.h>7 d. }2 @' ^( G/ g( w7 o% A
3 |# W$ P) f- y# c
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0), q- U% g7 \3 R' y& Y0 J3 p
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
0 J3 N$ ^1 C( ], J* y- s#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)4 I  o# N! g; B; h  _7 x6 O
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
* O. \! A( o4 P- Y0 t
$ c; D* r/ V) x8 @: f, m" W3 w/* assign the tl som board LED-GPIOs*/
7 u& ~1 N; f8 ostatic const short da850_evm_tl_user_led_pins[] = {- I) a5 }* K5 |3 }
        /* These pins are definition at <mach/mux.h> file */
0 c. d/ j4 j7 e2 C        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
/ g% }4 {% _0 t; h$ M9 G) o) ~        -1$ h% E9 g: A5 k) e3 D! @, L: Q
};% R" b. O1 o5 ^  p, e

9 {: h! T5 o! D( W7 f% l/ Bstatic struct gpio_led da850_evm_tl_leds[] = {* N" d* h8 a# x9 N
        {
/ P* A4 B! M$ v# T; t! c                .active_low = 0,
8 h1 K+ `' n* Q6 b; q- [                .gpio = DA850_USER_LED0,
6 G9 U4 Q! P2 {7 u                .name = "user_led0",: Z( B4 r9 e0 Z' A+ U' W
                .default_trigger = "default-on",
) o& T  |  n7 i: n% g; I% e        },
1 Q& d: W8 W5 h        {6 n. @9 Z1 n6 E
                .active_low = 0,* Y* ?( G9 V% T  k
                .gpio = DA850_USER_LED1,
7 t7 K, O; Y$ y$ T                .name = "user_led1",
5 E# `" X) {8 N% [) c/ G                .default_trigger = "default-on",
1 D$ ^  W/ H3 B, }; i; Y        },
) F9 @! I2 b: u0 \  n        {
+ ~& Y  i8 m- Q* ^7 z7 Z, W3 q7 ^                .active_low = 0,
& p  n! s1 X& ^: j% ~# w8 ^                .gpio = DA850_USER_LED2,  s5 i% H% W! R% |2 ^0 J
                .name = "user_led2",% f% @3 H/ @3 x2 O; u' N, ^
                .default_trigger = "default-on",
( N) U! k7 U3 x. o0 f+ G        },
7 A( a9 w- l9 L$ L" q        {5 a' g4 ~, T' g
                .active_low = 0,( E7 B- r* n) K, [6 b
                .gpio = DA850_USER_LED3,2 H5 N8 o6 f0 n0 o' i6 m6 o+ f) \
                .name = "user_led3",# I' s4 t3 R& x
                .default_trigger = "default-on",2 L! g( T* j# t" b
        },7 h1 {4 `0 s- _, C  V9 q* t: ]
};3 U* b4 D' M  w/ F9 I7 ]
. g- l+ v2 @) O" m* z9 k7 Y
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {7 c, I3 W  z0 t" W6 B, Y2 e6 Q& b
        .leds = da850_evm_tl_leds,; K5 c9 o+ l* D
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
+ k; a$ A. s7 S  h};7 T. V6 ~4 M' A
, j% z/ X0 p" i+ r! W! q+ O9 I) Q
static void led_dev_release(struct device *dev)
9 r6 V* a! }; y0 d+ f{8 ]$ r! O) P+ B+ S+ y
};# o% S# ?; b* i/ c3 U
4 y. W$ u9 z5 p( A1 U/ p
static struct platform_device da850_evm_tl_leds_device = {7 R9 V. K. u4 Y" \! w
        .name                = "leds-gpio",
2 D: h6 `: q" h+ P3 E        .id                = 1,. F( R" q! p5 L7 o% r* o! ~
        .dev = {
7 D. u" c4 o( f1 |4 C! T                .platform_data = &da850_evm_tl_leds_pdata,; T( V' G9 n" e, T! e" Q3 V
                .release = led_dev_release,
4 [( ^+ u) h% \5 X( L7 b        }
, |* S4 ]4 t* j# b; T! u};
) I3 r* {$ n" w6 O( R% K" k# q: A2 V! H; K* B: j- t0 C
static int __init led_platform_init(void)
2 A+ P) X% D- h  e6 ~{% q% Q2 o& p$ [
        int ret;9 ~& v. s! b% K  z6 I& H
#if 03 w' h: S9 U3 x7 N6 ~0 R0 ]
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);+ A  ~# |! i% Q7 `* p! Y
        if (ret)
" M5 _% f. a9 U( i                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
" T+ M! A/ N. L/ t                                "%d\n", ret);2 f5 Q/ u: Z/ Q' H. T
#endif! ]3 O2 |: ?1 @! d# e$ |4 u2 d$ b
        ret = platform_device_register(&da850_evm_tl_leds_device);. Q3 l1 `! V' p
        if (ret)6 x0 P, ~! J9 \/ N
                pr_warning("Could not register som GPIO expander LEDS");
. g5 Q" @* Q' M& m        else, t' P9 R& L- k* F; Z# k+ @" q
                printk(KERN_INFO "LED register sucessful!\n");  w+ o3 Q0 \' R6 w7 g) U6 e
2 |! T# x- s6 k' F6 i" F
        return ret;' b8 _0 u9 T; u% a1 ?3 f
}( W$ b2 X& r) Z; |
; T6 v" q$ S; L8 B
static void __exit led_platform_exit(void)
* k! x$ v' `1 C+ R" |0 r8 |{0 B0 c* M2 {" S/ G1 H  |1 ~% y
        platform_device_unregister(&da850_evm_tl_leds_device);
2 G4 ~3 _( D4 e8 O# X9 ?* ?0 k: t
1 D) Z6 j( U3 |6 e8 G        printk(KERN_INFO "LED unregister!\n");
( e7 `9 z' `  D}" f% _# w) D* [
) S4 Q4 P) Y  V+ [" |
module_init(led_platform_init);
' Y, W, T. h  j- g5 C8 a' Emodule_exit(led_platform_exit);2 z( `2 ?. z, O
) m8 z: O0 |3 \% Y
MODULE_DESCRIPTION("Led platform driver");
# V' T/ r) ^8 H8 DMODULE_AUTHOR("Tronlong");1 U% ?; ]# O! A6 o
MODULE_LICENSE("GPL");1 K! u# l0 n. `& a) k# N
% P5 n$ |- \; ^: u+ Q* T+ J5 U$ w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 08:35 , Processed in 0.042065 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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