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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
% K- G1 F' {; l  }0 t#include <linux/init.h>
  R% B! B6 y* L4 z#include <linux/module.h>
- Y1 _$ \9 ^4 O4 M8 d" ^#include <linux/kernel.h>
/ ]7 t1 p5 C) l* A8 ?#include <linux/types.h>& I! ~! W4 x. w* }
#include <linux/gpio.h>
, W: B2 v2 @; w#include <linux/leds.h># }  b4 `6 J) j; \
#include <linux/platform_device.h>0 P0 L8 L/ E+ p/ _& p* s

, J9 x/ X9 l0 a" ?4 T#include <asm/mach-types.h>
" [1 G9 W3 r" M! e$ q#include <asm/mach/arch.h>
/ k: u2 f7 S& [6 l6 z9 Z  K#include <mach/da8xx.h># A! K. A+ u& h$ ?4 C! A2 w2 F
#include <mach/mux.h>: K5 E' S- G* W. j: f

+ E8 f. \' G% t4 F#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
2 Z- G4 r" g2 t* Y' o. C$ g, U#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
6 S* j3 ?# c# Z  P) b* m& m1 ~#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
2 K! P' D2 K: R2 Z4 Y#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)) z9 D, [8 f  f

9 }1 ~, L' V* a& y) n2 ~/* assign the tl som board LED-GPIOs*/
) R: o4 c- I. d$ H4 rstatic const short da850_evm_tl_user_led_pins[] = {
- b0 x* M0 f; J  W& i3 F1 y        /* These pins are definition at <mach/mux.h> file */( ~2 }. ~) R; {9 h  J
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
9 b! H, G% ~, G) p/ V& W9 P4 Y* f4 T+ \& B        -1
! B) @8 K$ q/ o};# s& y* v4 b/ h& m7 G
' Y9 c9 U3 T$ W. `  R
static struct gpio_led da850_evm_tl_leds[] = {; ^% C+ o6 g, X
        {. F1 ~  g: X: b. ?5 a& K4 C
                .active_low = 0,
! J) h. F8 ~/ U2 _' \1 G0 Z                .gpio = DA850_USER_LED0,
% z. @" |4 H) ]7 V                .name = "user_led0",! N$ j: X$ D+ X
                .default_trigger = "default-on",8 m( [) F9 n/ g1 a  d. ?0 a
        },  z, `: _3 j) V0 v: |
        {( l  j  m3 R2 d/ \2 A# N  C
                .active_low = 0,( g! u: F& N& Y2 |
                .gpio = DA850_USER_LED1,
9 l( D- X+ q" e0 y                .name = "user_led1",
0 [  z. i5 G. ?0 m( c  T1 y" C! b                .default_trigger = "default-on",0 ~5 F' ^3 g' ~, p* z& v
        },
0 _9 q# t1 b" b& M        {0 N6 g& {7 {6 r6 t& @
                .active_low = 0,( Z. U+ ]+ E& w" _
                .gpio = DA850_USER_LED2,7 v+ a1 v( }# m
                .name = "user_led2",
$ A! |* v0 d% P1 ?8 [                .default_trigger = "default-on",
0 h' o3 v7 _2 H5 ?6 N! v9 Q        },; k3 ]% r- L7 s  j- u! l$ l( U
        {
+ ]! l$ |' [" S3 k' i  B                .active_low = 0,
+ y7 a( K) X/ O3 X1 w                .gpio = DA850_USER_LED3,
" |9 P" m6 @. y% R                .name = "user_led3",7 G- X) @( @- g# T
                .default_trigger = "default-on",
! k. J1 R# t" C+ n" Q: z! P- P        },: R: j% F% _6 d# W8 N; p
};
6 O& n0 H6 b: j' }4 X) S' h% x' G# b" B, h" g
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
0 L  z3 c) h  r% p7 M        .leds = da850_evm_tl_leds," q( I! K1 Z, i4 f
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),4 P! Q+ {- e( ^; ^, [$ p
};
" U/ G$ i6 B% l/ D' o+ E2 U* ]
) |2 i5 O) ?9 }( p+ v' rstatic void led_dev_release(struct device *dev)4 |9 f- H2 O- }5 e0 X+ _
{
' ^  o+ O5 W: a2 m};9 \0 |) v) ]0 ]( Y6 r' O2 I
: _( n* R6 b( Q9 i. p5 t7 N
static struct platform_device da850_evm_tl_leds_device = {
- a+ I7 P* D# `        .name                = "leds-gpio",
1 a" ^& x) h- y        .id                = 1,2 w0 v3 Y. d" |3 {
        .dev = {) S4 I+ Z' L, v8 {- o- U" ~  Y
                .platform_data = &da850_evm_tl_leds_pdata,, B5 [+ O5 N* t" m
                .release = led_dev_release,
, Q2 S% c9 |3 h+ S        }
) j, [3 B/ w0 ~# X4 p0 [};  `7 ]9 J* M- D1 ^; y# J7 E
. ^' H4 V8 A9 G: }1 G* X9 [2 L
static int __init led_platform_init(void)
7 {+ h; q0 R3 i9 e; s/ Q{+ p7 K- {2 m0 S3 V! w# G
        int ret;
% m! P# o- y0 D7 Q: M( W#if 0# B; v8 K& ?6 F# N$ t, q
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);& t! j+ ]* Y6 Q. A" O  m* H
        if (ret)
0 D4 Y9 c, c# y! E; _                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
4 N  N5 X' f' K' `                                "%d\n", ret);
0 W7 k8 \2 @$ P: X$ j. m#endif
7 C8 b/ p8 ^% a# i        ret = platform_device_register(&da850_evm_tl_leds_device);6 ~! r6 z, y# s# W4 n5 f( |
        if (ret)/ q5 Z: u2 D2 y$ `* L; k
                pr_warning("Could not register som GPIO expander LEDS");
% r" ~9 k$ Q' n) S2 C) K+ W; C        else7 P4 V, O, U. R" m, k9 W  u
                printk(KERN_INFO "LED register sucessful!\n");$ d2 I$ i; S2 j  j

( m" ^) y+ V) ?& s1 p        return ret;- m5 k8 T- {1 g: F' B, K
}
1 \7 e& U1 M2 [" n. S
6 b/ n, o; K5 S) P& N, vstatic void __exit led_platform_exit(void)
$ }' ^2 t7 k/ m6 [) T{2 s- O( M, l2 m0 {* V
        platform_device_unregister(&da850_evm_tl_leds_device);8 Y; c* y0 R6 W4 S  Z' \; [+ a

; ]% r% a. f) W2 ~7 p5 O        printk(KERN_INFO "LED unregister!\n");
* E2 N" @/ [2 B}& j0 W! Q! H/ w8 y5 k
9 z$ K+ e1 x3 U5 ^6 ?/ M
module_init(led_platform_init);% ~% D+ }2 C- w) X+ j5 m2 h- t) L
module_exit(led_platform_exit);& ?" Y, g8 ?) e* q3 r
. F7 @$ u6 B% F
MODULE_DESCRIPTION("Led platform driver");. |; i1 R5 P5 e; t
MODULE_AUTHOR("Tronlong");+ w1 G  ]$ W6 K3 {
MODULE_LICENSE("GPL");: V2 A7 i! F: X, {/ Z7 V# s: T2 {
7 T0 ]9 ]. |0 ?5 T1 \3 Y2 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 02:39 , Processed in 0.039754 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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