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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
( I1 W* T6 G- V% W& [#include <linux/init.h>
0 R$ a3 O; {, j' A/ F# h#include <linux/module.h>
6 y' [& {9 j5 B9 x5 s8 _#include <linux/kernel.h>
+ J& w' w' M9 u. v1 I#include <linux/types.h>
* P: w" s1 k) \/ A% G, g: a#include <linux/gpio.h>- L$ x/ s! W3 _5 k9 \' e
#include <linux/leds.h>6 @: x' x9 [4 a! q0 Y# ?2 y
#include <linux/platform_device.h>% G# v, V% i1 j7 N- k+ R4 M( t
( N( j2 Z4 b7 [- l) t% {
#include <asm/mach-types.h>/ b: d% p: L" K1 @- X- B4 n
#include <asm/mach/arch.h>. v( S, q6 O- J5 W: H1 s0 c
#include <mach/da8xx.h>) Z, j' n6 H5 y' V; _4 P" B
#include <mach/mux.h>; S, R; H) L& }/ `3 Z. R! V

6 w8 D0 v! \# E; B8 i+ _#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
. Y- z( k5 c+ V) G0 [5 J+ w6 j#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)! k& c  A0 x# F6 I, L0 c
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
" `. N) X8 R  t9 k" X#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
5 v& @$ z  `: g4 h1 ]4 p$ d5 b! U9 h7 r0 J5 v' a
/* assign the tl som board LED-GPIOs*/
0 ?. L9 N! O8 ?8 g4 dstatic const short da850_evm_tl_user_led_pins[] = {) h5 Q6 C- y3 I8 M
        /* These pins are definition at <mach/mux.h> file */6 p# D4 u/ q, I# U" V: A$ ~( F8 y+ `
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
" a! C0 L6 H' R6 J" s6 o( B" |$ ?        -1
( b- B1 K. @* {, |};
8 T& b. p( b/ ?) @, {1 l' ^7 W+ t! u7 s- `3 M
static struct gpio_led da850_evm_tl_leds[] = {9 m  p: j8 K" \* l8 l
        {
6 j) F: N( k. Q7 B- V9 e                .active_low = 0,
2 C6 o0 v8 W; U9 O4 _/ v- }& Z1 t5 H                .gpio = DA850_USER_LED0,/ }6 u  I9 \. n, F1 s" L
                .name = "user_led0",
* U/ R' f/ ?. ^' N% d                .default_trigger = "default-on",
# g- m. Z0 z5 a# {        },
+ p7 j" K4 e: A2 W1 }        {5 U) E. x! g* S$ ]% x; n
                .active_low = 0,
! H- W4 Z) X) Q  J                .gpio = DA850_USER_LED1,
4 a: p' u& [; o% D                .name = "user_led1",
+ k: g7 s# f6 H& r( i                .default_trigger = "default-on",7 @: c) O8 e- |! T1 V# c6 x
        },8 j* s  [8 X" K, e3 r7 |4 }
        {0 R3 U* n- M8 G/ j9 {& g4 V
                .active_low = 0,
9 v5 s8 `% I5 i/ }                .gpio = DA850_USER_LED2,
+ T; Y1 o% Z( s5 L  {  R                .name = "user_led2",# W9 P  X) w! o& R, r* e/ X0 `
                .default_trigger = "default-on",
4 ^9 v4 S" D( \! `& n        },+ }( F. o1 ]. y/ V5 z
        {) T( }1 h" A( A- S6 F% t
                .active_low = 0,
2 }. d& u: F+ `9 L- G: `2 p0 p                .gpio = DA850_USER_LED3,
" C7 g( C7 z0 h+ w, s                .name = "user_led3",. R( M/ {: A$ L% j0 T; G* s
                .default_trigger = "default-on",# \2 G7 j9 x! x& ^. l
        },
  r' A+ f: g: T2 ^5 |};
8 R+ G+ x* y; U! T7 v. {
  ?6 a" E( i8 _static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {3 h, t5 W# Q) V6 W
        .leds = da850_evm_tl_leds,
" Z9 _1 m- {6 {# D        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
" ?1 b, M/ F0 c  A};3 ]& b7 S% q6 N. v# g8 X$ n

% l% y4 a* E. V0 r5 ^# {# Wstatic void led_dev_release(struct device *dev)  P3 {1 Q7 o/ b
{
1 O4 H! C7 Q% N* S% W% `# ^0 `# A};
" g( ~3 Y7 m/ s) @% ?4 _& E3 O  Q) r+ }- L/ @, L
static struct platform_device da850_evm_tl_leds_device = {
3 K0 ]* `* _" _, ^- ~1 d        .name                = "leds-gpio",
+ V  R. s8 j; C6 Y* j3 _; E. o8 i        .id                = 1,
7 T2 ^3 u8 j' Z4 X4 a        .dev = {
" V) p3 h) L7 ]& m, _! M% g                .platform_data = &da850_evm_tl_leds_pdata,2 j) n/ E6 Y1 e4 N! {8 O
                .release = led_dev_release,
) K$ q( ^: v! Q& S# Z# b" R        }0 i: F* O3 q9 L/ _: W8 h  A
};
: x4 X( k. P3 u2 R5 y0 J
( d5 w0 ~8 R3 y6 P! b5 A0 Z$ \static int __init led_platform_init(void)( r/ a* t) a% b% K! o
{
6 N- e) ~( v9 @& u( Q' h        int ret;0 X, b) y  g0 a/ N
#if 0  Z' B$ ~& {7 |  a- M  [1 E9 _4 l
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);4 }4 ^0 ]( `! j7 q# w
        if (ret)
/ m3 \9 E* \, @9 R5 O( J% \                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
) j+ T/ m2 ~) ~( T& \' m. Z' `                                "%d\n", ret);; M* Z6 U0 f6 g2 q  h- K/ y
#endif# Z8 O3 s: f; B& u$ L( M
        ret = platform_device_register(&da850_evm_tl_leds_device);
2 q! m, ^# M/ V1 e  T8 M6 M1 [9 R/ W# t% r        if (ret)
2 x( D6 o3 W2 d3 o+ K                pr_warning("Could not register som GPIO expander LEDS");5 c2 j- a9 x' d$ n& K) k
        else
2 G( q. H# n0 E+ P! D                printk(KERN_INFO "LED register sucessful!\n");9 f$ i, N" u( _2 V3 z
  l. x/ O* |* _5 x* A- |; Q
        return ret;
: @. p9 O) _2 |! \  ]1 Q}5 G" r' t. p! y

, ^1 L( D' _2 V; e2 `static void __exit led_platform_exit(void)( d: {  Y3 x' ^- T) \% o& L
{: v* p" c  J4 @
        platform_device_unregister(&da850_evm_tl_leds_device);' K( q! Z) K! M4 l

" C3 l* b2 g: R4 V, }/ s$ s        printk(KERN_INFO "LED unregister!\n");* A7 z9 J# n0 D) S( n: m3 e& B1 s* B
}! z2 q% F' c  l! k
/ i" Z$ g3 N+ J
module_init(led_platform_init);2 c7 Y1 V) G0 C, y7 Z
module_exit(led_platform_exit);
+ h/ e$ D1 n2 ?7 o
9 ]- w  d% [4 y' W' @5 u, F6 UMODULE_DESCRIPTION("Led platform driver");
  ^/ ^- W; `  \5 {" IMODULE_AUTHOR("Tronlong");9 i2 p& k/ R3 D" `2 s+ r4 F! X
MODULE_LICENSE("GPL");- j. w# M& N% e! q; x9 k( T7 B! l

* y: U! _* k& n2 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 18:27 , Processed in 0.039856 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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