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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
8 \& ~3 M9 W' J; X- V9 ~#include <linux/init.h>0 ]$ \: F1 F  n. M$ \5 h* m
#include <linux/module.h>
- {+ Q5 F* ^- k#include <linux/kernel.h>
' y4 m: n5 Q" @' |4 J" q7 W#include <linux/types.h>
9 B) {+ \3 c9 E4 l+ ~#include <linux/gpio.h>" S8 L- R- |* g; [: R" U
#include <linux/leds.h>
% W$ Z4 p- R; S& {" {7 T4 q3 O#include <linux/platform_device.h>5 Q4 G5 o/ v( X& e  e0 U& Q9 P

" j6 H/ x' ]9 g% h) J  E#include <asm/mach-types.h>
* r( T; {. D# h#include <asm/mach/arch.h>5 o2 O! w" |( x4 r+ B: ^
#include <mach/da8xx.h>
9 r; W* e+ V; s  d' W4 R#include <mach/mux.h>
* a& c/ a  c* j' u! n& T; {+ B( l
: b" T1 r; [7 Z$ v* j: [#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)/ j4 U5 s5 F6 q( f
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)& A( [* E7 a% G4 L4 ]/ v$ `+ Y. Q
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
: k* P& v( C  D- t! B6 U2 d7 [#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)  ^4 ?. ~5 i3 K7 A# @4 K' @' \

$ o: k* v2 f4 P( i- K) c2 |  J/* assign the tl som board LED-GPIOs*/
( v* R/ H$ Y, m  {, Kstatic const short da850_evm_tl_user_led_pins[] = {2 `1 ]' z& T/ j; V9 K) M  b
        /* These pins are definition at <mach/mux.h> file */7 g+ }; b- t* ~( a: F/ [4 L
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
5 w$ S$ k4 k6 A/ A( n) K        -1& q4 Y$ J/ }6 e  K
};
/ M8 C  w/ g2 D0 [7 U' X2 ^; s/ o) h$ `) U0 ]  Q* o8 I* h
static struct gpio_led da850_evm_tl_leds[] = {( E/ [+ `- p# \: F* ~
        {) r8 w5 W" A0 |! C) z* P$ u5 H1 L
                .active_low = 0,( _6 e: f$ q4 y
                .gpio = DA850_USER_LED0," W# N% H7 N' }. \& d! R$ x0 t$ Y
                .name = "user_led0",
5 l3 |3 l5 X7 G2 H                .default_trigger = "default-on",/ }% ~8 W5 w" E6 }0 q# Y$ a: y
        }," k% @: F$ j6 y
        {- c% u$ ^0 f9 v! Z" d
                .active_low = 0,, G$ o: o: p( I
                .gpio = DA850_USER_LED1,
5 K3 {$ {. w( B- f                .name = "user_led1",
2 H# e8 k6 l( b& l/ p                .default_trigger = "default-on",) v5 n- V* ~" a  D
        },
- m8 r5 U8 z9 x        {
/ y) W% Y# n: r$ m                .active_low = 0,
1 o$ ~) `+ A' E                .gpio = DA850_USER_LED2,
9 F5 ]: o" k8 }% ^8 h' _2 G) d                .name = "user_led2",
) r+ w, |# L/ I$ q1 ?                .default_trigger = "default-on",
9 q5 N* N/ D9 C4 ]5 A% W        },
( j+ y, q, M) z& C) N9 z9 S2 t        {8 G. D2 W) U, u6 X1 ?
                .active_low = 0,
7 X. o* ^- {( k: Q5 a4 s: h                .gpio = DA850_USER_LED3,
" d$ o6 p; d' K4 k                .name = "user_led3",3 |+ n2 ?! s+ r8 {
                .default_trigger = "default-on",
  H  o2 x9 E# G' U8 A& E9 J        },
1 z9 A4 H- [+ k* `# }) x};  y0 T% e1 d; [& Y( ~( i

8 k  e* ^8 [5 W0 z- t' nstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {( i" I# i$ E3 w. p3 i
        .leds = da850_evm_tl_leds,
5 P0 S, r; \- |" e* G& e/ w8 \        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
/ ^5 K0 R3 {( M; b; p1 W8 ?; k6 j  }};
" k, E; t+ w4 {
2 Q/ A3 n, ?7 L9 E8 c5 ^static void led_dev_release(struct device *dev)8 x4 I' E" g) I2 e8 V/ d$ A4 m
{& Z, a. x6 g3 ]7 S3 z3 J
};
0 q# J  l. a- z  Q6 L# h; j: u( a$ a6 {) ?
static struct platform_device da850_evm_tl_leds_device = {1 n, Y, G+ }1 S. m5 @7 s/ F
        .name                = "leds-gpio",
8 ]! d9 c- I3 J/ ^" |        .id                = 1,
3 p! ?. e# Q% s6 E+ h0 E        .dev = {
6 I8 }  X/ a7 {( h% @& W                .platform_data = &da850_evm_tl_leds_pdata,
2 Z, X* i3 p0 A; G' C8 n                .release = led_dev_release,) L& V! z4 H0 B# ]) U* ?: ]
        }
) O& T* g& f: W! J# [% R' W2 C/ d: \};
# t% D+ k  ?+ }# ]( X7 G7 R6 H/ b5 U  Y
static int __init led_platform_init(void)
- H' Q0 M% j- {" H4 j{
% O  b( z* E# G7 i8 J1 U        int ret;
; J% E/ @* V8 i#if 05 L. {% w4 s9 R
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);2 X! ?+ w; P- `/ K% P% x
        if (ret)& H; G& k4 X5 Z6 h
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"& u& e+ }2 h7 u' f
                                "%d\n", ret);
" \  _0 B2 @+ ]1 v8 X) `#endif6 l5 O0 B4 V# x) w4 h
        ret = platform_device_register(&da850_evm_tl_leds_device);
& L0 n0 e, d- G        if (ret)8 K. n* I1 U1 l! M& N3 w: G
                pr_warning("Could not register som GPIO expander LEDS");' _! C5 [. X% w* K( I0 r
        else2 y- d# W( s  ^) z$ m( Z
                printk(KERN_INFO "LED register sucessful!\n");1 U' ~/ k6 f% U- o, n2 q' j  R
2 j- F: O5 s; S4 J
        return ret;: l; w+ U9 Y8 k: T; I4 q
}
/ X  s  ]% B- l" D) m# V
& c; N  |( U$ l1 V% Z& Cstatic void __exit led_platform_exit(void)
) p# T0 q- B& I: ^& U{
6 \% W; P7 t" y& a8 m9 b9 g& }( K        platform_device_unregister(&da850_evm_tl_leds_device);
3 B5 }& C5 W: i5 V% p! s9 ^# r% f, v; h( Q3 _
        printk(KERN_INFO "LED unregister!\n");
* h) X+ {) v8 P; }4 |}5 z. E) v: E, K; e$ i
; h0 o1 `- ^4 I9 u! v
module_init(led_platform_init);
8 i0 I5 r; c+ r+ {7 S) u5 V: Mmodule_exit(led_platform_exit);
7 g* R& \2 W0 P" s) T# G1 }# Q6 s5 j* W" b; `: }* O
MODULE_DESCRIPTION("Led platform driver");4 G- O# v0 E3 C( s& l* _
MODULE_AUTHOR("Tronlong");
+ T' S; Z2 A4 U! ?: \5 {  T" t  |: ]MODULE_LICENSE("GPL");
8 k+ J0 |  r; h+ J! W1 Z( T7 F  I) q/ p& `% H8 p" R9 y, i% k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 04:56 , Processed in 0.045074 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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