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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
3 k6 D1 u) ?9 Z2 i' j#include <linux/init.h># j1 g- B8 m$ Y% U) N- ~' Y
#include <linux/module.h>1 u: ^/ I! c8 e2 v: i, c
#include <linux/kernel.h>
( z+ F& m# j- ^! C#include <linux/types.h>' E/ `* L8 x5 \4 b$ w
#include <linux/gpio.h>$ h+ M" M( c: o+ f! G* j% ]
#include <linux/leds.h>4 g' i, j' H" @8 I5 x
#include <linux/platform_device.h>. C5 u: Q0 I6 x9 J% U

' `  r/ M: ?# N+ R$ Y0 u; Z9 c#include <asm/mach-types.h>- m# k$ [2 J' C& i7 S# t  n) y% M
#include <asm/mach/arch.h>
7 }5 E3 s  C. f  _#include <mach/da8xx.h>
1 x+ g  Z% `( R#include <mach/mux.h>
+ ~  J0 z/ A( o
8 A& Y0 E9 `- g7 k7 h6 C#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)6 p! e% V/ u# U4 y
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
4 a0 o' h) f" e1 ?4 h#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)( K! \7 [' S( {! P: N" t
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
8 p6 I/ X5 z. _8 p8 n* L; ?2 E2 F6 H
1 k; J+ g( s# q% E3 A, v: j/* assign the tl som board LED-GPIOs*/
) Q, {- o! L1 d; x. Sstatic const short da850_evm_tl_user_led_pins[] = {
- T8 _& P9 R% N$ q# u2 W        /* These pins are definition at <mach/mux.h> file */! c+ h5 }2 G2 T& A
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,  F! M) Z% n" [: e. F+ N
        -1
% X# a6 p* B6 q- h};
* {* N* M$ k' |( ?4 v/ D  g2 u% P
static struct gpio_led da850_evm_tl_leds[] = {+ o: z9 u& c4 ?7 R. N! O
        {9 a) o' T, K  j( ]# n
                .active_low = 0,
$ r3 H' F, ?) L                .gpio = DA850_USER_LED0,1 x; P' K2 }7 `- e
                .name = "user_led0",$ C" c! f0 A7 n2 [" T& e
                .default_trigger = "default-on",* e# I0 v2 n( k
        },
! e& U* p) w9 Y2 l        {8 h5 F3 {. B: y! g
                .active_low = 0,
, |; k2 M! [- h" O: @                .gpio = DA850_USER_LED1,9 A% }$ N2 y; n. j8 a2 I8 B" _
                .name = "user_led1",7 m/ c7 z+ K# F" P
                .default_trigger = "default-on",
+ \. S4 R, J9 @% [3 m! b        },8 K. Z' \/ z. ]) ]+ V% p7 X% K
        {* |1 k. k: ?. Q% i3 n' [- d
                .active_low = 0,  V+ d' g  s; L3 m
                .gpio = DA850_USER_LED2,& d( i# f8 D6 Y& t
                .name = "user_led2",
  G' A( p: {" k9 Y                .default_trigger = "default-on",
- Z) I3 \) L% @+ Q: x        },
: i+ B# k. R; [* G+ k% `  e! u        {8 d5 O6 `; Z% j4 E
                .active_low = 0,
3 R' X/ V, a. J" p4 \                .gpio = DA850_USER_LED3,9 T- E# o# |' j2 s9 C+ X2 X7 t
                .name = "user_led3",4 N+ j* s" }# g: C
                .default_trigger = "default-on",
: F9 P4 A5 [0 T" R& h        },
/ Z" M' L$ y, h" C' Y7 i$ U2 x};5 ]% W5 c' B4 O5 \6 }

9 p4 @! y" c- t% l2 F7 Estatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
) J4 T6 M7 X* c3 m$ ?: S: ]        .leds = da850_evm_tl_leds,8 g" I$ ~1 Y! G7 O& e2 x' i
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),! E2 A. d# Q7 `3 a) D
};2 d$ H3 h) X- x

1 ~5 p, x+ P0 Hstatic void led_dev_release(struct device *dev)5 k) T$ g. W9 n
{
; H- t! n" |6 H& o$ p6 C};- d& j+ z: J3 G
6 J( c/ Z+ V( l
static struct platform_device da850_evm_tl_leds_device = {
7 C; i0 Q. x2 ^: V- }" G        .name                = "leds-gpio",4 {& p9 D9 @/ F+ Y
        .id                = 1," d$ S  @0 Z: F% ^
        .dev = {
0 N  v6 p4 Y0 F0 q                .platform_data = &da850_evm_tl_leds_pdata,) s, v/ H! A8 ?4 V1 ?# t, M1 v
                .release = led_dev_release,
$ a# c9 h( F2 q/ \: M, g        }
' f" S9 B. r/ o6 Y};0 P" o8 Z# a! B( F& T

! Y( k: I* A( n# j; ?static int __init led_platform_init(void)- H, Z# W8 k6 ~$ R
{6 N  i, ]1 _; Q6 f/ B
        int ret;5 Z/ {) Y; w: z4 C* f+ {
#if 0
+ M; X# H& W* m        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
  l+ b; t. Y& N- X. {  P6 q        if (ret)
+ B( h/ E# }# f# m                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"0 h0 I9 K7 H/ h
                                "%d\n", ret);
% Z) N. b3 y2 }1 u  A% X0 _#endif
; s9 C# T# \$ U5 J( i        ret = platform_device_register(&da850_evm_tl_leds_device);: z; k/ S, U/ d' D' D$ P- o' z
        if (ret)& A- O3 y4 e3 C# S) ?& U
                pr_warning("Could not register som GPIO expander LEDS");
$ L1 W4 G: F3 O9 V; U' \, t; g        else
$ R8 @7 H1 }4 P+ J                printk(KERN_INFO "LED register sucessful!\n");
* v! p3 f6 |: H- K
2 Y4 g+ J$ H) W1 o, h        return ret;
4 p% R* w  E1 g7 W) o}
0 b$ [! C' k+ E4 U. a% W) p, t" b2 x" d- W, v6 {1 c
static void __exit led_platform_exit(void)' T2 S) B1 o, I' y" U$ x; m
{
- F" H4 S7 M4 c& X- F        platform_device_unregister(&da850_evm_tl_leds_device);
$ W" M: j" x* J" E9 q/ Z' y2 G, B$ X& c' B
        printk(KERN_INFO "LED unregister!\n");
, J; l% v  I8 x# K/ s8 ^0 n}
" f/ V) M3 J- \; d" x6 P
% ~4 m* \3 p% j2 G  kmodule_init(led_platform_init);0 G" U! i% C' ~6 M* f' n
module_exit(led_platform_exit);- C, S( j! M1 Y3 n  `# y7 r
& T2 H: X1 {0 ]- H' b
MODULE_DESCRIPTION("Led platform driver");
2 S( S# n$ t, D4 V% N1 LMODULE_AUTHOR("Tronlong");
/ s% G" K( J7 c" r/ xMODULE_LICENSE("GPL");9 |8 E3 D0 [3 N: f
0 P& |$ {" T0 N; L4 k9 Z' q2 l8 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

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

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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