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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
& E1 i. ~! d& t* J#include <linux/init.h>
3 v6 G4 x: O/ p5 O3 D#include <linux/module.h>' i" j3 h" W3 [7 U/ b; m
#include <linux/kernel.h>
6 F: ]- E  a: R' @1 T2 t4 ~#include <linux/types.h>! L2 o6 L! I) l3 e( |8 x) |# H
#include <linux/gpio.h>7 @) N* m  V" b8 s* m6 g7 }, }
#include <linux/leds.h>
# n) O( }( L9 J. x! o) p" q#include <linux/platform_device.h>" m- i  B, N% W* i; L$ D; I
  @- O7 c  a8 b$ O8 `. a2 P
#include <asm/mach-types.h>  U; u- c+ M* V& u( a. I
#include <asm/mach/arch.h>5 N- Z* c7 f1 t4 x+ d9 c
#include <mach/da8xx.h>! `) t* v  w- g. \# x5 w
#include <mach/mux.h>& _+ r1 O0 J+ G3 q/ W- g# x
4 u% C$ G8 U+ g2 }
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)' |7 v, Z2 [- e8 N# B# f& O5 l
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
* |4 k- C# B- l" Z#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
: [3 c% Z9 r. q) O0 v  N#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
7 M( q8 k# t" C2 A) u$ a2 n) F  m3 r) v$ o' p9 G; |4 g
/* assign the tl som board LED-GPIOs*/
8 v. q' d" p( {. `* w: ostatic const short da850_evm_tl_user_led_pins[] = {
/ ^. M* V: M2 W. [. a) h9 K        /* These pins are definition at <mach/mux.h> file */
6 ]) e- h. }! @" s: n        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
- t6 y' f3 n1 d, I, H- `        -15 \! @4 A) Z) w; |; ~
};
( Z7 h# _) k9 m
$ @! T; I0 b5 G" @9 ]3 {static struct gpio_led da850_evm_tl_leds[] = {
" Q. Z  K# N0 p. E        {
( d& B( {: J5 B                .active_low = 0,
4 n! r* Y6 B1 r, {                .gpio = DA850_USER_LED0,  R3 L1 |: S; D9 v- d: g: R9 D9 _5 h  W
                .name = "user_led0",; y* q1 D' L. D4 L  k* u  L
                .default_trigger = "default-on",
# T! H- J' r3 Y( E  Q* i0 K        },
1 d7 B$ m. U: Z% M8 \5 N/ |        {. _: t5 V! u+ ^/ B
                .active_low = 0,6 u9 R$ t& i( ]9 g
                .gpio = DA850_USER_LED1,
3 a% p5 I% U  k3 N" \+ d3 t) R, C1 h                .name = "user_led1",# t! r& J" [, l/ c7 h8 ^; e
                .default_trigger = "default-on",
; A; L, k( r  T( Q' e0 ^* t        },
: K' ~, p$ ]) ?) l        {! l5 ^- ~6 ~0 U+ \* }" {) K& q
                .active_low = 0,
0 t$ j9 f: O8 x/ ?                .gpio = DA850_USER_LED2,+ X- _6 I: |% M3 Y! Q: ^+ {
                .name = "user_led2",/ n7 u; V! u4 q  D3 [
                .default_trigger = "default-on",
* s! @$ E4 X2 o' e+ T3 H) m4 k* S        },
, K1 G4 t- D* e        {
/ H# U! ~; ~# q: j1 D' K% a                .active_low = 0,7 Z$ x2 l) ]' K$ c' ~# k4 O
                .gpio = DA850_USER_LED3,5 j9 G' t4 b$ n* c" @: i
                .name = "user_led3",
0 Z6 t1 v2 j* X% o& `# b                .default_trigger = "default-on",$ h9 d9 I- f; }  f( t* |8 h1 v7 @; e
        },
6 g5 g% B1 n+ y# I; u! K};
, `/ \( C. ]% M2 R+ a7 f: }
7 C( h, F* Z# W. ]6 r# istatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {" s) Q: k9 K/ c( N2 _" x
        .leds = da850_evm_tl_leds,( ], z2 {, S/ R) _' l$ Y( L5 D9 V5 ?
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),& A, H5 S9 L  h3 K- [
};
0 k! n* l* F* P0 F  ]) R& p! N2 C
7 a8 [/ k' I1 N" S3 Jstatic void led_dev_release(struct device *dev)& F- e  \% g4 A6 c$ W
{
8 N% r6 h: W- `; m% H- {};5 _* ^( v6 ]. p- @
" `7 `" A/ d3 u+ g/ z: ^3 h
static struct platform_device da850_evm_tl_leds_device = {# |+ s9 u* H9 z3 Q7 j# y
        .name                = "leds-gpio",
; u6 v. j5 x1 A, O4 t5 E4 A1 K        .id                = 1,: ~) w. X" I9 n
        .dev = {5 L+ k. |0 O* K, }( l6 s" m+ r
                .platform_data = &da850_evm_tl_leds_pdata,
& r& _+ d) `+ F0 l                .release = led_dev_release,
8 [% `; c/ ^) c9 B        }
5 F0 g; v! G; u/ W. c};- ^! [7 k4 ]3 ^
4 A* Y8 j7 z8 l6 R1 F5 E0 s: C
static int __init led_platform_init(void)
% Q5 q2 s  q' U. z{9 A4 z2 X' _# Q4 e+ Y' H
        int ret;6 w1 H3 U! _  q% Z- ?
#if 0
# v3 o; G( \% ~* W2 U2 {, u- P        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
$ {  a8 B0 Y' x: @+ A2 q' r% @        if (ret)
. {2 M4 P4 Y% M! c                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"8 S' P, t* [* ]# X- K( ^8 O
                                "%d\n", ret);! E3 t% j2 h3 p0 p1 `4 A$ S0 p
#endif) u* k5 S3 p0 b4 S: a- g
        ret = platform_device_register(&da850_evm_tl_leds_device);
& O4 f+ ^  C7 j$ [3 O+ H        if (ret)1 M, S. c, C- |; j. N0 Y- ]
                pr_warning("Could not register som GPIO expander LEDS");! O5 E, i0 u4 C4 ?
        else  i- s% `  Y  u+ l5 q
                printk(KERN_INFO "LED register sucessful!\n");! n2 E6 v, k% O

- T+ ~4 Q; l/ j6 K4 L7 h        return ret;# `' {% k3 s& R2 t+ E
}# f- ]7 t( d% A- A3 Q" o9 @
% k9 ?. J* f7 S" H# s$ M4 \
static void __exit led_platform_exit(void)
  G0 Y( G; G  v* G$ ^: c3 m{
. i1 v2 _4 t5 ?: g* @7 W  W6 N        platform_device_unregister(&da850_evm_tl_leds_device);4 v! v( i7 w. z- V

+ [/ \/ _3 D2 |  {        printk(KERN_INFO "LED unregister!\n");& h2 k! R: o8 Q& A. n( ^
}
. b# Y7 s1 b* R1 G3 M) |. P( _5 l; }( w9 T6 i, f3 n9 z8 z0 V# u
module_init(led_platform_init);
$ M" x& q, ~" r# |, l1 _module_exit(led_platform_exit);5 L- {8 {0 H0 C# @2 H
! k% S& |. Q) t
MODULE_DESCRIPTION("Led platform driver");
9 W) x% x  X: C3 \' Y+ d' l! E5 }; hMODULE_AUTHOR("Tronlong");
9 t1 w' ~5 y* ]4 B. Y% F5 MMODULE_LICENSE("GPL");: p" O2 {* N; z  s! ^5 T  E$ p

% L+ W4 _2 ^4 i; B+ i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 08:17 , Processed in 0.039153 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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