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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。0 `% D: r/ e' O+ w
#include <linux/init.h>9 W  [- t8 e, P; ]  R- i
#include <linux/module.h>2 Z; H) o5 X( x) D# s5 F2 h9 d
#include <linux/kernel.h>; r( G% {; U" |0 ?: A
#include <linux/types.h>
% s, J, F+ {) E/ c0 T  o#include <linux/gpio.h>
5 i' I( j: K! T1 {#include <linux/leds.h>5 D) c% \/ g7 q' v- D; u& S- C
#include <linux/platform_device.h>
6 P% s+ T' }; l: y1 K
" J% p: h8 [* }' j/ S( c1 S#include <asm/mach-types.h>* }% B( S3 T* {8 F5 X
#include <asm/mach/arch.h>( W, `  ^5 K( C! C& h
#include <mach/da8xx.h>
0 G7 n- Z5 {: ]) a1 P; x2 O! q#include <mach/mux.h>" }; l: j  c4 r% @3 j
. }' W. p# Y3 ~% S- K
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
1 Q6 j0 Z9 _/ Q7 Z/ n#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)9 F  l# {. ]  R* D0 L$ k' K
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
3 ~% ~, ?& B& q8 P#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)# E8 j; L. I* V7 m) y

6 z% V* v& n2 t/* assign the tl som board LED-GPIOs*/
5 {" C7 Y( N# R7 dstatic const short da850_evm_tl_user_led_pins[] = {/ l7 @! Y* f9 c3 I8 N7 [
        /* These pins are definition at <mach/mux.h> file */
6 e$ ^( O7 k4 c' u        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,- z1 P0 ^5 R8 _. I$ R- r
        -1
- ~# Q, J* X6 Y  G};
+ q) x1 R9 A! ]( o4 M
* s% ?# U9 n2 d$ f( f4 pstatic struct gpio_led da850_evm_tl_leds[] = {- N& [6 W& t& Y) n
        {- ?1 E1 H: `# h7 U
                .active_low = 0,+ J) x& ?3 t2 E' {- q' k
                .gpio = DA850_USER_LED0,
& w, B$ l; h  q+ i* g% u                .name = "user_led0",
/ p- e  e5 ~% h                .default_trigger = "default-on",
$ c) o) C2 t) W7 D        },
% ^8 \0 `: l3 h/ i+ l        {
' ?8 m( J7 m* L5 B4 `* p$ a8 s( a                .active_low = 0,
; _* S. N2 t0 j$ y+ O& q* h                .gpio = DA850_USER_LED1,1 Y. b4 Q+ E$ }. s
                .name = "user_led1",
* j. F1 T' a1 z& Z                .default_trigger = "default-on",
7 V0 e$ R( T) R( x$ [! N: c        },
. u9 n2 M+ v! |- ~* d3 S        {9 ~# a) U7 x8 a: ?' Q  ]5 l6 r( O
                .active_low = 0,
# n5 G0 Z8 o3 Y0 ^- |# o8 s                .gpio = DA850_USER_LED2,/ |4 O2 k+ P7 u6 c9 s
                .name = "user_led2",8 p! T# `* ?8 G8 I
                .default_trigger = "default-on",- p+ f, ~; o9 D& v, S& J7 c
        },) F6 x! {$ H8 ?
        {
1 k6 A8 Y# l9 `! P) j0 _6 m2 ^                .active_low = 0,/ g- W. L" K9 N( w! {3 w+ E
                .gpio = DA850_USER_LED3,
% r3 a* u7 X3 R% d# ~3 k                .name = "user_led3",5 @# |% T4 m% E; r
                .default_trigger = "default-on",
; o; K  V, K% f& i- v! q        },2 o) o/ k" m0 G$ j( {: e* t- ^4 B9 i
};
+ l/ t, M0 a2 M$ w" Z7 H) ?: g- K9 P! o% P5 i( e1 W( w. ?
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {. E/ f2 `! L3 {1 e) Z9 c( E! ?
        .leds = da850_evm_tl_leds,' Q6 ^7 W- g9 p7 i- u5 X
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
8 Y/ n7 f5 ]% e};  l9 h; b- Q; o, ~% B

! r, ?% e  g$ _+ Tstatic void led_dev_release(struct device *dev)
- e, v8 b0 D; b% I{. @  Y. u6 l7 h$ N- m
};' t) ?5 J) o1 i
% J- W+ b3 q' d, x$ z& Z
static struct platform_device da850_evm_tl_leds_device = {) Y. Y' W' ?' F7 F6 p- H8 E3 |
        .name                = "leds-gpio",
4 l3 _9 e7 ?, f! s% [7 w2 S0 n( [0 I        .id                = 1,
( `. M" m9 P- t+ b        .dev = {4 Y( L0 \) Z% X3 S
                .platform_data = &da850_evm_tl_leds_pdata,4 w  }; M4 W2 J6 M" y( c
                .release = led_dev_release,. \3 W9 U  j, m5 r. S. K
        }
  J" f' E* j: a  R8 Z! g};8 R1 X8 g2 O$ y
% [1 B! Q2 e0 e: E3 n: K: e
static int __init led_platform_init(void)$ y2 t9 W' n3 s& v- k2 d, r
{
' P; Y  x/ U" O  c2 J        int ret;/ G# ~4 W# G& @
#if 0
% g/ v$ k% }% q; \# u! S( `. R! O7 m        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);0 W$ O4 H5 V( Q$ q9 _
        if (ret)
  U4 k* n& E. _* e3 k                pr_warning("da850_evm_tl_leds_init : User LED mux failed :". R  J; s; D& a/ Q
                                "%d\n", ret);
" x2 a& T( ?, \, n; M/ `/ k& \; @# H#endif
6 j# ^8 a7 d! c" _1 d1 `% M        ret = platform_device_register(&da850_evm_tl_leds_device);
/ U$ R  |: }! P. J) A6 D        if (ret): F+ P& r9 |/ t4 o' G; l7 w
                pr_warning("Could not register som GPIO expander LEDS");3 m% o& Z2 ], z4 Q7 N0 p$ N
        else- L  p! L, v* K
                printk(KERN_INFO "LED register sucessful!\n");
" F% @$ w6 h/ }" p) Y7 b0 E4 I, k1 V7 i1 H2 ]& V5 E" s
        return ret;
3 R' [' D+ p9 ~}( ?0 W: L3 p% I6 `; D* K

) w% n6 y7 m4 k: j2 n7 Astatic void __exit led_platform_exit(void). z* {% D9 b5 {& o+ B  f
{/ F. q" X7 j5 [6 X% K9 ]6 @( e4 T
        platform_device_unregister(&da850_evm_tl_leds_device);
, Z4 D# b! w7 J- P0 G
3 }3 ^8 l  o+ O% e& J2 m2 b        printk(KERN_INFO "LED unregister!\n");
5 @# D5 Y- k# ~, H' ?}5 ^: c" M6 l% j! @+ K, S

- P5 v' `$ Q& O5 g6 C. tmodule_init(led_platform_init);
2 Y8 {; I5 R5 ^% k3 X& H2 nmodule_exit(led_platform_exit);* _- q) u" I7 C5 `' A
: ]: [& F  q7 D
MODULE_DESCRIPTION("Led platform driver");
8 D9 @/ Y2 T4 C. Q. M" v3 ?7 D5 bMODULE_AUTHOR("Tronlong");, U1 m% |# ?  d
MODULE_LICENSE("GPL");
3 v, |  I7 G; I( b6 {* ]3 z" }  q- ]0 h0 a  q# w4 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 15:04 , Processed in 0.051513 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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