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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
/ p  ?7 Z# z* f. Q6 j) h% f! M#include <linux/init.h>
, r& ]( q# a4 p+ E5 s#include <linux/module.h>! Q7 u# Z5 k( V; T) ~) m" z% {
#include <linux/kernel.h># k' u0 j8 {) v( A9 W+ y
#include <linux/types.h>8 X' s. r) `9 m  Z$ t2 A1 d+ K
#include <linux/gpio.h>
. W4 B$ ?+ h% `$ i2 b) S#include <linux/leds.h>
# H  U$ o# X! a* _2 P#include <linux/platform_device.h>
3 t0 l$ `+ E% X) f: G4 n4 D2 h" K4 u4 i) V& I8 E
#include <asm/mach-types.h>/ _! D8 e: Q. T+ o$ i5 B6 F, I' ]
#include <asm/mach/arch.h>4 z; l" t5 `4 `4 v" X
#include <mach/da8xx.h>
! R9 `! ]+ h+ R5 i( F#include <mach/mux.h>, S( M% h, q# e  V
/ b5 R- U& W/ C" I% V8 w7 A5 w5 w
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)- Q6 Y8 T" g9 U' Q/ e
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)! P( K: D2 Y" }, U8 L+ l4 ^2 [4 a
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)+ u: e2 t" K4 Q5 Z# z& y3 ~/ _
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)  D0 w$ S; v8 h: W6 Q1 o8 B

0 N. c9 g3 O8 E5 U! a' a  `/* assign the tl som board LED-GPIOs*/# G& f% @! O8 |& i+ [
static const short da850_evm_tl_user_led_pins[] = {2 ^7 X# ^) r& c. X
        /* These pins are definition at <mach/mux.h> file */$ J0 Y" g8 g" |! \- x
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,1 [& M8 w- ~4 [2 z" S
        -11 [: T+ d/ _3 v- \: P9 b5 N
};
! e; C% l3 U( Y6 M0 ^1 O" T
5 o% K# b8 M) lstatic struct gpio_led da850_evm_tl_leds[] = {
* u6 d; s9 J  l- J) j        {
4 v+ z3 T5 h5 K( }; R; \& V                .active_low = 0,
! m  ^8 o+ H# C+ A7 c! S" _8 v                .gpio = DA850_USER_LED0,
; b/ ]4 G8 C3 u) ~8 M! B/ g                .name = "user_led0",
' j6 O2 G# ]5 U                .default_trigger = "default-on",
' @" P! R; s. j# V6 \6 Z        },2 D& T6 l1 B: |" M$ W
        {9 `+ l2 A" M1 C
                .active_low = 0,1 `1 G0 R* U% L
                .gpio = DA850_USER_LED1,
. ^# k# Y* ]! R- n' a6 @                .name = "user_led1",
6 S5 e- I9 }" h: O0 k                .default_trigger = "default-on",$ [6 a. e, `$ N8 V: }& [0 w
        },
) X+ E# {. Y: x" [; x4 H        {
- J$ z, m! z* }- ~                .active_low = 0,7 h- }# W0 ~% R3 m0 U8 X1 {; n
                .gpio = DA850_USER_LED2,. b( V0 W& v8 n
                .name = "user_led2",' f: W( y$ ]9 z/ ^' Y
                .default_trigger = "default-on",
+ K' w- ~; D: m& ]        }," k" f3 a6 A  L# Q' l" L
        {
4 K( l& D% ]) A# D; m                .active_low = 0,. S* i' k- \3 L7 O' h9 i1 }
                .gpio = DA850_USER_LED3,2 A" t1 y7 l4 X
                .name = "user_led3",8 g$ _3 Q9 ^. T6 R/ w- v
                .default_trigger = "default-on",( k% }* e( _7 b6 t  k& a( [6 w
        },  |% h, G! _( s9 D* |
};
/ \( d9 d; o  C" o- w
( J  S5 z4 t( i: I1 |static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {! ]! s3 A9 F8 N5 s# i; s
        .leds = da850_evm_tl_leds,9 s5 r1 T  {6 _% Z* X9 z; ?# i
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),4 {; Y. [( \& y$ p( a$ f
};, N5 D4 w& C9 u0 U7 c
0 Q/ R4 [; G. g! H& d; T
static void led_dev_release(struct device *dev)- C$ I. B: n) c
{" k  t+ a' J0 d
};0 t& |8 U5 m# [- J- Z
" ^2 ]$ e5 T9 v& L
static struct platform_device da850_evm_tl_leds_device = {( w, s+ t1 b: @9 E7 D) T, Z  @8 G
        .name                = "leds-gpio",
; J9 d7 Z+ P/ ~- B# E! J        .id                = 1,& q: M9 ~# D& L) T$ j' A. B
        .dev = {
  k. u2 i2 ]# O; Q# u% [3 s                .platform_data = &da850_evm_tl_leds_pdata,
# R/ c. E0 W( H# G) m* s                .release = led_dev_release,
( T5 r' ^, H: \        }
- t5 B, L0 @3 |! ^6 ~, E};
  i9 E7 w1 F3 b% @9 H: x5 Q" f. `; g, X9 Z5 d0 P
static int __init led_platform_init(void)% j1 W* I! R  a$ r' U6 z& F
{( R% S2 Z% u, L, }) c3 G
        int ret;
' Q' u* }3 q( E* h7 S#if 0
3 h# @% Q1 v0 B) h8 ?/ u4 h; r        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);: b  g2 M. h7 |/ G5 H* `
        if (ret)! @% o; s0 w/ ]2 j+ [" R
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"9 W3 T7 g! ^8 [3 i
                                "%d\n", ret);  S5 y9 _& k' F9 a+ g
#endif- Q/ b+ |- \' |; l% y
        ret = platform_device_register(&da850_evm_tl_leds_device);3 N* f6 G; E* O* a
        if (ret)/ N' _. U7 Q, T9 W, H- J: M% W' v- G
                pr_warning("Could not register som GPIO expander LEDS");# q' b2 S: o* _- g
        else! _7 Z; g  J  w: ^2 E
                printk(KERN_INFO "LED register sucessful!\n");9 v/ V( g4 p) N

, [; e, H- M0 g0 u        return ret;# w5 G3 ^9 N7 _
}! M, G. F+ G8 m. f: _( D/ U
$ ?$ p6 P. n8 @9 l2 O! z
static void __exit led_platform_exit(void)" C: ^: \% H  B, S
{
4 E) f8 t& p: \        platform_device_unregister(&da850_evm_tl_leds_device);
4 L5 a1 y8 u5 m, z8 z/ U/ i9 r; B; x# a
        printk(KERN_INFO "LED unregister!\n");
5 R! L7 r& l0 e+ t4 N4 V% s}
6 O# J9 J2 }- V6 t
* N2 K9 a8 [% N" k5 Rmodule_init(led_platform_init);
+ f1 p6 l( N, Z$ Bmodule_exit(led_platform_exit);5 v' y& E) |: t/ ~: l
% X7 S" v1 l, x! B4 D- j( J0 X1 X5 y
MODULE_DESCRIPTION("Led platform driver");; `4 u* P4 N2 r  e9 o% z8 {6 p
MODULE_AUTHOR("Tronlong");
2 Q* @% ~; ]+ zMODULE_LICENSE("GPL");
2 r: Q/ |# t* [: e7 z; Z% }' R# i+ r- n: W' P( ~9 A6 x, H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 11:12 , Processed in 0.039329 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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