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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
( e; ~) @2 o$ L% K# T7 L#include <linux/init.h>
5 s/ C+ {7 `) }% g#include <linux/module.h>
/ H* ]% {( j; V( G#include <linux/kernel.h>) K! B1 P5 }7 q9 \
#include <linux/types.h>/ a1 }# K5 {0 [* E2 _: g- ]7 q
#include <linux/gpio.h>
5 m: W" _- i; z$ ]( {/ V#include <linux/leds.h>
& c6 M2 Q( |% Y) ~$ @1 @#include <linux/platform_device.h>
" R4 {* D* B( r$ i! B
' b! x, D; x7 }/ b#include <asm/mach-types.h>/ n1 w, L1 p: o" P
#include <asm/mach/arch.h>
# n( d0 M* M; ]$ C6 N3 `5 x#include <mach/da8xx.h>
( D+ N5 a# r) F& i3 ]#include <mach/mux.h>
9 m, U0 ]% T9 w, Z, m1 J; x
3 c' [4 |' d# A# ^- C8 P2 F0 D' O0 W! M#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)( N* h- R" L+ z, Z7 w. h& b
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
. A6 G  O2 e! [/ I2 }- g8 d4 v#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
& t6 Y2 R6 |8 ^8 K( ~' _, O8 [- H3 n#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)  {9 _, q3 H# g( ?" D% e
2 C" d0 H$ l& I4 k# t8 }% y
/* assign the tl som board LED-GPIOs*/
) z2 x# g3 W7 ]1 u" Bstatic const short da850_evm_tl_user_led_pins[] = {
  K3 R3 H2 K. A        /* These pins are definition at <mach/mux.h> file */; W& B2 O$ E. N: M* R- K
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,' i& c7 Y* V3 G, a$ k
        -1
2 s' P1 G& j# N  Y) s8 _};4 Y# G; M# f- [& \7 W0 [
+ I; \+ @$ J$ m) [
static struct gpio_led da850_evm_tl_leds[] = {* D( R- K; R7 r1 o& j$ o
        {, o) H( c: J% V# d
                .active_low = 0,
& y' h) @1 p8 w  q                .gpio = DA850_USER_LED0,6 \+ E$ x1 ]& x2 M; S7 U# n# i
                .name = "user_led0",
( e+ E1 y* A; u7 c5 D                .default_trigger = "default-on",
' U/ U; o" e# n  h        },* H2 X; Q1 S9 A! u
        {
2 g  N5 E6 W6 j7 Q* x: m                .active_low = 0,. T: ~% f1 B$ S# P# I5 l* B( \
                .gpio = DA850_USER_LED1,
& Q5 h! q6 x/ I/ k. k& p                .name = "user_led1",
! B7 N5 `7 j7 {( |; l                .default_trigger = "default-on",
+ e6 f$ l; R9 z  B        },+ K% E" ^( n" F- b
        {7 r+ W, d; L% ?8 j3 d
                .active_low = 0,6 S/ p& `. w0 s0 S! `
                .gpio = DA850_USER_LED2,. J+ W! m& A0 |+ N
                .name = "user_led2",* Q$ L; b& ]; N$ ~. _# j, W# y2 z
                .default_trigger = "default-on",
. P4 @, F8 b2 ^6 a# W5 D        },; J* x' @2 h8 H
        {, W7 V# j/ I: X: u. i* t1 J( q
                .active_low = 0,7 H! f9 d# N) o  V# }7 J, B  r
                .gpio = DA850_USER_LED3,
  X* t! V4 j& w8 M* E                .name = "user_led3",* d9 ]8 j$ Y! ~% l% B' k& `2 A
                .default_trigger = "default-on",6 m7 x+ L  o# j1 H% P
        },8 S% T  ]( s+ j9 S
};
8 Y0 n! o0 r( ~- d
! [: D8 `5 {: |; q1 d. j& Estatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {  H- S, j; ^* v6 n
        .leds = da850_evm_tl_leds,( ~, b) a0 M/ R. f1 z$ I
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
, _/ q4 ?8 l$ \3 F! C! h5 o};
$ h' t, A: R: V- a5 t
: b3 T. D/ ?/ tstatic void led_dev_release(struct device *dev)
% G! b' u! b7 s' m4 D9 U% }{
- `( H$ y9 j6 e# _};
+ D+ v, \) z) I" [4 I
( O+ X) u8 \5 @. {+ @static struct platform_device da850_evm_tl_leds_device = {* W9 ]  l8 P0 Y. }7 l, \# b
        .name                = "leds-gpio",
& y$ j# T! k9 T9 F4 ~        .id                = 1,
% v  [* L* k- N: V        .dev = {
0 s; S# F1 N& X3 j3 h5 r                .platform_data = &da850_evm_tl_leds_pdata,
3 a+ ?" n5 S& d4 g                .release = led_dev_release,
* j& D$ y3 D# R! W/ I        }7 M' R  ^# h" a: z# E$ U
};
: ~2 |- d# ~* M' H* |2 `  V7 d8 u8 C+ D  [) A' S5 k7 B
static int __init led_platform_init(void)- o: r3 U* b# k' }
{
4 g7 T$ r& V4 D/ h1 V% p1 a        int ret;; L  [0 T* [) k9 z0 n0 |6 u, V
#if 0
: d4 E9 q. I* i  m" E. l7 i2 U        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);/ p9 \- m# ]/ A4 ?0 ~: t
        if (ret)
$ U6 U. e) v% _9 V                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
  G5 k% H+ ?' B$ f+ p2 B* o: f                                "%d\n", ret);2 X* B6 t5 I6 }$ T+ Q. Z
#endif  Y# g" {/ p  r( O% e+ |
        ret = platform_device_register(&da850_evm_tl_leds_device);+ ~/ Y& w' }6 i
        if (ret)
1 P# r' K& ^4 h: j                pr_warning("Could not register som GPIO expander LEDS");
6 |. ^+ S! ?: f" M, L        else
  F; v# \, }: w  N% R' E                printk(KERN_INFO "LED register sucessful!\n");
& _; i( K+ a* I4 e7 z$ B
5 X- R, ^4 Q+ x3 q1 C3 ]        return ret;! R0 N0 a) W+ ?: L
}
# J7 p/ z6 v! ]5 c% g7 K: O; }+ e" F4 ~0 Q* N7 E
static void __exit led_platform_exit(void)9 Z8 l/ |% u& Y" @8 a9 r3 F. u
{
# q6 N2 p# ]/ q2 O: \        platform_device_unregister(&da850_evm_tl_leds_device);
0 K# Z0 |3 U* ]' u4 k
' F$ `8 q7 A; m4 l2 m4 Y- g        printk(KERN_INFO "LED unregister!\n");3 y8 b0 D1 B/ Q. ?8 H8 l+ C% |
}+ w7 w0 L3 j! f: O4 g9 N1 U
0 W0 g6 V3 _* n
module_init(led_platform_init);
5 ^; }5 U- y1 O( D9 bmodule_exit(led_platform_exit);
# v: T& J2 a9 h, T: [0 I$ g; k9 V: Y; w" l
MODULE_DESCRIPTION("Led platform driver");9 X1 F/ \3 W2 L/ ~: R, u
MODULE_AUTHOR("Tronlong");. l9 ?5 k4 D! W% @5 `
MODULE_LICENSE("GPL");0 T/ Q8 H# c) ^, c3 \5 A8 e9 \# E
& q: l6 {' L2 ?1 U, Y$ S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 17:01 , Processed in 0.038695 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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