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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
- T: k3 h' [4 ^9 _) x* o#include <linux/init.h>0 x& ~, J- r) m% c3 [: M
#include <linux/module.h>3 r% o' f, L* K% Z) p% W! h2 e
#include <linux/kernel.h>6 E3 S8 _! I: W) j1 w. {$ ~% R
#include <linux/types.h>7 Q" W9 I" K/ i  K
#include <linux/gpio.h>' W5 {* b* P; g9 A, H
#include <linux/leds.h>
8 X$ v3 E; u- I4 v& u- o* w: a#include <linux/platform_device.h>
( t1 C( r# j$ L
4 B9 c) b5 k$ r) N#include <asm/mach-types.h>
* A# c7 ~. Z* e# B3 u1 v3 F#include <asm/mach/arch.h>
3 V* n8 v2 P, l" v! M8 J#include <mach/da8xx.h>
& Z' w) ]. p! P8 r1 V#include <mach/mux.h>
" ]& w3 h7 U! P: Z. c' g3 A% ~: m9 [! B  o2 @( }1 @: \) B6 @
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
  T0 f2 {* f; K9 v* o) y: d#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)! b4 i8 Z4 j/ g2 K5 K+ d. d& w
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
# @  \& S+ n& D. C- ~4 J#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)5 F( A4 t4 R% `- o
0 {& C) ?6 }( v
/* assign the tl som board LED-GPIOs*/, t) }: s/ c- A) C, O0 P
static const short da850_evm_tl_user_led_pins[] = {# P0 I. d+ ]& w3 k7 y8 J
        /* These pins are definition at <mach/mux.h> file */
# {3 e4 ?, A" w- d' ]* S        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,0 D% F9 A- r+ A* F" L
        -1/ h% d- \! j2 _. Q% [! `7 m
};  S; e$ f7 x9 R- T4 p- @, N& A
* C# f8 E- {. W: k+ j( Q
static struct gpio_led da850_evm_tl_leds[] = {$ ?' g$ B& n* I& ?: O+ v! z2 W8 p- C' t$ t
        {; ]+ V& w2 O6 N; u: N
                .active_low = 0,
0 I) m+ Q) {, v, B                .gpio = DA850_USER_LED0,0 s  ]& |, Y0 M8 v- Y" ^; l
                .name = "user_led0",5 ~2 [! E/ c/ `6 g' q0 K/ _
                .default_trigger = "default-on",  h- y2 ~& n( _& r' a  z" P2 [
        },: ?9 [# \7 _9 P2 f" [9 {" B
        {/ D6 j, j) E2 Q; `/ g8 S, G
                .active_low = 0,: a* b0 ~$ n- G& {8 W% X
                .gpio = DA850_USER_LED1,
/ ?/ W" \5 ?" l6 a3 M- g+ i, O- M                .name = "user_led1",
! D, c+ i' h) Z/ l; D6 o9 T. b                .default_trigger = "default-on",% B* @% s, x% H% p8 u- P1 B
        },
0 |/ g2 Z4 R2 G- Z        {$ C- g- E: J$ o
                .active_low = 0,2 T9 U* t+ F8 O5 o: |, l$ P
                .gpio = DA850_USER_LED2,
6 a8 x$ x# `+ S0 \0 g                .name = "user_led2",
) ]4 W7 j  M8 b" ^# E- U                .default_trigger = "default-on",1 H7 E' [& N* u" m
        },) R5 o/ q  Z) R; u4 _
        {6 `+ j: l- f. c5 m/ M8 G. X/ j
                .active_low = 0,
" J7 D( S' {5 p7 \5 w4 l                .gpio = DA850_USER_LED3,
* x# f; ]2 v1 H1 K" G/ I; `                .name = "user_led3",
9 s9 r6 i3 n% L4 A3 a, G+ V* Y! i! n; |                .default_trigger = "default-on",$ }% \9 L/ \/ m6 ?) X  E8 Y+ M
        },
  k( {  ], L, l% a$ y' n' x};% q! U* ^2 K  K. u( t" F

. `/ d4 M* {: B' b2 z5 @: estatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {$ y6 ^% [. p7 h2 U
        .leds = da850_evm_tl_leds,7 n% t7 {0 w) z5 I" m7 o. O3 A( G
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
9 X# }. [6 H9 o4 |) Z5 Q};  ]. R# Q# [( u
$ E0 g8 j2 }/ f$ d% Z: `
static void led_dev_release(struct device *dev)! Y) ^' |7 }- J0 i* h# C6 h
{# g, E, Y' l2 R- R
};: Y- y) j9 }7 o3 }) x7 p0 k

! h- }, e% O8 Z7 M- u3 B) z0 j2 t- fstatic struct platform_device da850_evm_tl_leds_device = {
; F; s, g6 @3 C+ I" ~$ Q9 n        .name                = "leds-gpio",
/ B& S4 m% C8 z, G        .id                = 1,
, @  F$ U. T1 l        .dev = {
- ?3 g$ y, I6 t% W2 H  {1 U                .platform_data = &da850_evm_tl_leds_pdata,
' T& \5 n1 j! O7 r/ O3 E2 q                .release = led_dev_release," M; `0 A& @( ~# I, H- Y$ v
        }
6 X& W( m+ q9 {3 U};
1 r& q! m( Z# N% x" j/ x$ `6 D) F8 S! Z0 C! f+ {
static int __init led_platform_init(void)  Y( \  ^4 N0 q* o0 t7 m8 ~7 y5 u
{3 p  a' @$ c3 X+ R6 q
        int ret;
4 `7 ^  F4 S9 k" a#if 0, p# g5 o# `7 s2 _
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);  \& E: H8 m1 L+ q3 w
        if (ret)1 h2 E& i. i% j8 @! a# \* b
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"4 q3 `; e# [) |- G
                                "%d\n", ret);
% w) z  }2 j. S* Z0 A1 `#endif
! K) E7 X) c9 H" N# d% }" ^        ret = platform_device_register(&da850_evm_tl_leds_device);. g* u# \' a+ [7 R8 @
        if (ret)
. |3 d8 |$ h% e; X  [8 A# ?( _                pr_warning("Could not register som GPIO expander LEDS");9 x3 l, V! Y& U, R  x: |! j* G
        else* F8 U( z6 j) f3 u
                printk(KERN_INFO "LED register sucessful!\n");5 e  I( o2 L; t+ d( J. r! d6 b
" c) E; `7 U* f
        return ret;) O! x. \0 K6 R7 [
}+ ^  i3 G: o! Y+ G

: u; w* t% I8 p4 c9 wstatic void __exit led_platform_exit(void); W( A4 @6 R/ Z) |) r6 X
{4 i$ N3 i; x: ~* l# ^" t3 v1 b* Z
        platform_device_unregister(&da850_evm_tl_leds_device);  h' C: q7 r8 I: d  l$ S7 H

  e  A) E) `: U: w        printk(KERN_INFO "LED unregister!\n");
- C9 j* i" J+ g5 I# [6 z( r}
) q) D& O, ~1 M, V: ^
, B% `8 b3 A$ n5 n2 H/ ?module_init(led_platform_init);
# E& ]" V& h! u1 o, s. Bmodule_exit(led_platform_exit);$ U( f, |' v0 G% Q" X* \4 i

; |' L$ i9 X* j: y) [MODULE_DESCRIPTION("Led platform driver");
9 W4 V! u( J9 G- ~9 |7 c# J" RMODULE_AUTHOR("Tronlong");2 G7 z1 @4 z+ |8 Y/ l* v; {
MODULE_LICENSE("GPL");9 h5 q+ o, N5 w4 q0 J

" _+ c; Z' j/ V% \- s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 11:20 , Processed in 0.041319 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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