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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。; g; U8 }  A: q1 m5 x, z  q/ t
#include <linux/init.h>
# ^  N# G+ {. [' T( s#include <linux/module.h>
" h4 m) ^  z) O% o/ N* p- V#include <linux/kernel.h>
& `1 a/ a6 [$ }( }( p4 m#include <linux/types.h>' j- {6 u7 \& ?
#include <linux/gpio.h>
6 t3 [+ B7 c  H+ e  P8 V#include <linux/leds.h>3 r0 M6 q6 S/ n; o0 {! o$ |4 ~: q
#include <linux/platform_device.h>
/ ]7 b$ V0 Y) r
  r$ f1 H" K3 z" g  x3 O#include <asm/mach-types.h>
. x9 b8 l- e) C; G9 I2 o9 L9 D9 Y7 |#include <asm/mach/arch.h>
0 w# @3 j6 j3 G$ v; \; Y- v1 n#include <mach/da8xx.h>
: s- \: Y# S, }7 l% `1 o2 A#include <mach/mux.h>- t& ^( G1 j% _, _

( F5 [9 a7 q$ [* W/ @8 s7 o7 o! S#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)- e9 `6 M3 l! q  S1 K
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
) ~4 ^1 ~" e2 ~. j' q9 S#define DA850_USER_LED2        GPIO_TO_PIN(0, 1); [( d2 [* E. K* z3 ^
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
+ ]+ O8 M2 I" a3 w  D
3 K+ r5 D* r( _6 E, ^5 w, Z& \0 l/* assign the tl som board LED-GPIOs*/
3 \( G6 N( a9 [, G2 M0 f" mstatic const short da850_evm_tl_user_led_pins[] = {
1 n! ?% r. W! H8 H* S- J( L        /* These pins are definition at <mach/mux.h> file */* U* Y' @% m: y6 G0 p8 n# `1 n
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,5 n. J' W: L- R) {5 W
        -1
# K: g3 u6 \) Z};% t2 f5 R7 z+ P! r7 r# b. d# i  {' l

7 U( O+ @+ }- J7 y/ A# cstatic struct gpio_led da850_evm_tl_leds[] = {
/ s5 O' K$ u* ?# h7 d; h( I        {2 S  i% u% m/ ~) n
                .active_low = 0,; r9 m' k% _0 e, w$ k- C: Y8 f' A
                .gpio = DA850_USER_LED0,' s# U+ p0 ?( ~: l
                .name = "user_led0",
* R& s* U( Y1 W                .default_trigger = "default-on",2 ]8 O, U$ t$ p7 C1 F2 s
        },$ _5 W  l1 Q7 `4 h% N
        {$ D1 X, Y" x( g: K) M
                .active_low = 0,5 U/ G* _! c5 j& h1 g( k5 n2 h8 u- u
                .gpio = DA850_USER_LED1,
, n1 e6 G' ^* H' h                .name = "user_led1",
8 N- Z9 l" l7 O9 `9 P                .default_trigger = "default-on",, u. h3 Z) U1 l# R) E
        },! ~% c  ]+ r8 P
        {
0 Z$ X) t! m. v( h0 c                .active_low = 0,  U8 n; ?( r3 \+ _% F4 y7 G; Q
                .gpio = DA850_USER_LED2,
- d; R" O7 H+ Z6 Q. S' O% [                .name = "user_led2",/ |& k' j. ~! N) q6 p
                .default_trigger = "default-on",
* ~, h: G9 u( b& X/ i; C# F2 y        },! a- s+ E  P* `% P6 K# A2 L/ W
        {1 x3 J  x+ D/ k$ Z
                .active_low = 0,
. K- c: k* G! c6 L' d3 X' \                .gpio = DA850_USER_LED3,
5 u' ^7 F  k7 Z! `. s                .name = "user_led3",
  S. m0 h9 g# J9 O8 y' B7 F, r                .default_trigger = "default-on",( h7 ?' P$ G* i( ~
        },
- L5 \' T  d: n  ?};
$ P" J6 O" P6 U2 k" A
! k# x5 e6 n7 J& N$ D; s1 Tstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {; U" v( B9 t, E& O9 ~, f/ B0 g
        .leds = da850_evm_tl_leds,
; \/ \6 c1 u6 u7 C$ m# D) ^        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
' O. H2 I/ e# A# i1 w+ u  C" V};
4 w$ X7 S8 ?3 T$ i7 Y- X7 G* h( V! k7 _( d3 k- @
static void led_dev_release(struct device *dev)' J2 n! f# h/ J
{
1 s3 B- X) y( X0 q  b9 O) S* I+ }};) Q5 R, ]% W, \2 x* [  x7 k
" |4 ~3 o. j  i0 v$ C
static struct platform_device da850_evm_tl_leds_device = {9 E% j9 a& M* w* E4 \
        .name                = "leds-gpio",
7 J& X! ?" C) l7 g; J7 f' v        .id                = 1,
0 I' `4 b9 X& D        .dev = {
" a: e# [. X+ y; C* y- P+ p: Y                .platform_data = &da850_evm_tl_leds_pdata,+ R  ~! h2 I4 N% l
                .release = led_dev_release,
$ f: f3 G9 a; W% \9 y9 @' Y- h. g        }
0 g1 Q1 K7 E8 t/ @};& W* |1 n1 |* C5 j

% J: k6 M* H3 [( ]2 S: X4 ]( fstatic int __init led_platform_init(void)
4 f  u7 _0 ?, s6 i# U; J{
" g" T" V* l7 \6 O        int ret;/ S( w, q* T$ }& v; v
#if 0( ]0 U$ m3 j& a& r: j
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);9 e$ ^% t0 [6 F+ q; ?  F. S) r
        if (ret)5 E% D+ D9 J  q1 `
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
4 A/ E: [& m2 U7 O+ {  b: O; c' n5 M                                "%d\n", ret);( K$ V% ?3 h' P) |$ W, k1 Q/ T+ h
#endif# t: s; _0 L8 C$ L5 U
        ret = platform_device_register(&da850_evm_tl_leds_device);, U/ c# H2 \1 o) K
        if (ret)
/ h* ?# _: P8 i3 k                pr_warning("Could not register som GPIO expander LEDS");
& Q2 d# g' _4 ?4 r+ w        else' o1 Z$ e9 ~8 t: V
                printk(KERN_INFO "LED register sucessful!\n");
; I7 l( C7 S# e
. }# a1 ]) L$ l. ?9 L        return ret;
4 h, ~" B- ~. L1 e}
; G/ v8 K) q/ g$ A, H6 F) h+ u8 ?2 P+ a' ~- E5 ?6 f- G# |% y6 Q
static void __exit led_platform_exit(void)4 A3 f6 s" R* T4 i7 y
{
: {8 D$ v& b2 b6 c        platform_device_unregister(&da850_evm_tl_leds_device);* l3 |# \+ s2 b0 G$ h2 \

4 T6 I; s7 r+ ^) l0 s  g, w+ S        printk(KERN_INFO "LED unregister!\n");
# {; c$ T1 p6 m( n}
( ~; i! ?& {6 I0 z) J7 N7 s' Y* ^( V# S; v. t& R) _) }
module_init(led_platform_init);
; ^& k: L3 ~, l, wmodule_exit(led_platform_exit);
& |/ d1 Q+ Z* U, ~& k1 K8 M; U5 ~3 G, j) j3 o
MODULE_DESCRIPTION("Led platform driver");
6 j/ I1 G4 u: qMODULE_AUTHOR("Tronlong");
* w, A+ K2 z+ dMODULE_LICENSE("GPL");7 i& [. T  I; v) u7 n

/ _. }5 T* f* v* Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 11:15 , Processed in 0.039907 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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