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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
" i  Z6 Z* y8 n. F4 X2 b#include <linux/init.h>
. n9 M" J- c; I1 a- N#include <linux/module.h>% @/ N' D3 Z; p5 }
#include <linux/kernel.h>
# T; f2 L, E- d4 S' J#include <linux/types.h>
. e* [1 Q" M5 }0 w. Y: n, |#include <linux/gpio.h>
# X% E" j* ~4 Y5 U#include <linux/leds.h>& g2 J. a3 }& a5 Y' ?. k$ Z
#include <linux/platform_device.h>
" C+ W: v" f3 B
; l" x4 {. A1 h6 W* Q6 P#include <asm/mach-types.h>
# o4 m& E# H' Y#include <asm/mach/arch.h>
6 d! L, U9 {( ^4 Q% a9 f#include <mach/da8xx.h>3 c6 j1 ]* \2 q" m% M, N
#include <mach/mux.h>
, V* o- n! g3 P+ p$ q" V% f' @( }# W! s: c! w! A) ?
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
1 q. p6 _+ s# i0 R+ v: I#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)* i; @# j" b  }
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)2 d9 J/ z% j! S
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
' r- j) K/ Y* l. l$ @# H9 q) a. N0 ]# @$ H' @
/* assign the tl som board LED-GPIOs*/( m. M8 B' r8 p8 F+ Y- X: }
static const short da850_evm_tl_user_led_pins[] = {
* O6 O# Y; ]* W  S9 b' |# \" w- z        /* These pins are definition at <mach/mux.h> file *// J+ A) l/ C  P# @# b7 ]5 H# `
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,% \3 C) R! p, @+ b
        -1  V2 L- a7 I9 w' m- o
};# x. _! ]/ @2 ~5 [, D% h

0 x) Q* ~7 H/ w' Dstatic struct gpio_led da850_evm_tl_leds[] = {9 T: _/ p6 w* j' _- K# a0 T
        {
( l1 u) \, C1 g* o' Q! d6 c                .active_low = 0,9 S4 g1 n: q* I
                .gpio = DA850_USER_LED0,
. U! I3 \9 S: }  b                .name = "user_led0",
5 S  R8 w7 H( c+ y                .default_trigger = "default-on",! O" o% P* [; F! N3 C7 T) Y/ x
        },) H- K4 b7 h6 Y" h$ t
        {
# i( Z4 h0 b$ N- S                .active_low = 0,8 J- a, i6 R# k% J
                .gpio = DA850_USER_LED1,  T, U* f& E% U
                .name = "user_led1",6 u6 G# Z/ O  e' V* b3 P
                .default_trigger = "default-on",# {5 |, H; d3 P* D' V
        },& ?6 N" Y4 M0 `1 L, k- M( n
        {
, W. v1 ?2 {& o( J: l" f4 g* Z                .active_low = 0,; _) _8 x& o2 J8 i, ]. {/ N
                .gpio = DA850_USER_LED2,/ [( Z' G% _( F  |
                .name = "user_led2",
) @' @. |- ]! y! _$ G: l                .default_trigger = "default-on",
0 K; L# I4 j" x        },
( k% |7 n5 ]) U; v  \- z3 M: t- c  t        {1 B2 z$ C" K$ O" m. [$ B* f6 P
                .active_low = 0,
% R6 z1 K/ k" o                .gpio = DA850_USER_LED3,
2 V! A; o2 l) H! ~! ~2 b" b                .name = "user_led3",1 W9 q) U* Z8 c( U" }* d  m
                .default_trigger = "default-on",; W! F8 F" O1 B4 T1 X$ e
        },4 f. g/ D8 r3 N( M/ j  n
};1 X. s* ^+ Z2 O1 V) l& W7 U

8 J' t# [3 t  ?; A  _4 @# P$ w6 istatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
+ ^4 z4 v0 _+ r  a: b5 ]- Z        .leds = da850_evm_tl_leds,- @& A( R8 d6 A
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),6 s$ _- e1 s6 {& L% m! j, d2 [- ~
};% R; @# d4 F+ r5 q& t/ a$ ^# |

& p9 ^  P6 g( y& c; U7 a% O: @static void led_dev_release(struct device *dev). C+ _; {) y+ _) `4 i6 B+ E7 b
{
0 |& Q6 ~: \( q# h' H};
" i) B" b3 \; L0 e9 m
$ {- A* E4 U7 g% e' |1 R! U* L. pstatic struct platform_device da850_evm_tl_leds_device = {, f% S3 l" u2 _- @: p5 R( M
        .name                = "leds-gpio",) ]  P( Z  k) T& b+ i
        .id                = 1,
% N* }& ]( W* ^        .dev = {$ S" ?" Q) W/ |9 n
                .platform_data = &da850_evm_tl_leds_pdata,
: \- I% A5 y" _* S3 l. T                .release = led_dev_release,
& [$ m( V9 C' Z4 C        }# L$ I9 D8 K2 r/ S
};9 ?, T* q5 T1 F. q' H
1 e8 S6 R' N/ H* B
static int __init led_platform_init(void)4 G* g( E; E7 A# e7 J% C
{! T3 h% H. L' u* z: ^
        int ret;" ~. K& [* J! O
#if 0$ U$ l+ i; T/ n4 ?: p
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
( ?- C. r# c+ K4 F        if (ret)4 F1 ^+ T4 u* b+ D) ^: s5 X
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"/ t0 z4 u9 X. m1 l# \3 T# x
                                "%d\n", ret);  e" G; Z2 B6 m3 m
#endif! t( C  ^" F" W: J
        ret = platform_device_register(&da850_evm_tl_leds_device);
* K( w- b/ {& @3 o& J0 ~& U# [        if (ret)7 a* D, t% ^3 H% V5 G
                pr_warning("Could not register som GPIO expander LEDS");. `3 o: M1 l* {) E
        else
; d* w) S) \$ P! t0 t7 C! s                printk(KERN_INFO "LED register sucessful!\n");$ o6 }$ r( C0 I& Q

7 l; q1 g2 Y: O        return ret;
+ m+ @. x4 c+ l" T2 X3 Y}
; v! z  D3 [; Q4 m6 u1 A# _. q  {) w- q& N% d% ~
static void __exit led_platform_exit(void)
6 ?; @$ v/ k; Q+ N+ \* ]{+ a) r% U# Z5 R
        platform_device_unregister(&da850_evm_tl_leds_device);
! M2 ^+ S5 |4 W5 l' N& P: Q# n
* u' {* B+ {' f0 h2 l        printk(KERN_INFO "LED unregister!\n");4 z- E1 E2 X! Y
}- {7 N) i( X5 j6 E

9 D! K4 z: O4 e  imodule_init(led_platform_init);% x1 Y' z. j4 i( C
module_exit(led_platform_exit);
& T  e8 _5 r0 M( Q6 v# L, U! q9 V
1 G' [8 v8 O& `8 u5 Q6 kMODULE_DESCRIPTION("Led platform driver");" O$ v7 J5 l6 m- @, _9 u2 O
MODULE_AUTHOR("Tronlong");# y' B! W" |4 O6 d
MODULE_LICENSE("GPL");
$ \5 k2 ^* a. q. @8 R$ n1 O! B& W1 s4 r1 u* U5 J/ ~) q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-9 03:18 , Processed in 0.042998 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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