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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
/ O( w8 V' W9 m* F% Y& ~#include <linux/init.h>3 s. `$ y( G8 A0 D
#include <linux/module.h>! `: |& [* H5 a0 \' Q' y
#include <linux/kernel.h>
/ x3 }9 J3 c/ I, h0 @#include <linux/types.h>
% p$ P3 s4 q# {#include <linux/gpio.h>
6 I7 N3 d/ e1 }& _  B- A% F  R! _#include <linux/leds.h>
9 J9 w  [- _$ }#include <linux/platform_device.h>- A1 f: V% R# P$ i8 p8 [5 s

& Z5 h" O) G+ G7 {#include <asm/mach-types.h>9 Q# T+ }# R7 C. H& y; D3 a
#include <asm/mach/arch.h>9 M2 s+ Y) o# @" F
#include <mach/da8xx.h>
4 C5 s% Y- y) h' o/ r/ q#include <mach/mux.h>% @! I, O2 d( E# M0 m& Y

- R% E% o! }; h( T! k5 H#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)5 i5 D5 U+ C: U  K3 t4 b4 V- {9 W
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
- z* N: ~% G4 s' M6 j# O9 @3 o2 J#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
* ]- T, _1 w. x! G  a# Z, Y, i#define DA850_USER_LED3        GPIO_TO_PIN(0, 2); q6 b7 R1 \1 w2 l+ O+ Z6 q2 U

' r' A' T" {" \/* assign the tl som board LED-GPIOs*/
7 x, P% |& s! y* N- R4 estatic const short da850_evm_tl_user_led_pins[] = {
3 o: B: e! T; }/ r" I$ Q        /* These pins are definition at <mach/mux.h> file */
- M! g, m' f/ b2 |        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,& p6 U8 b0 E- ?% K4 X
        -1
9 x" b0 A# f2 E2 U- p6 \9 i3 ]};( a& j, D+ N' B: u9 }9 ]
. z! N# H7 l- A9 L* H0 ~
static struct gpio_led da850_evm_tl_leds[] = {
* D) I* f4 f# j        {
- ^- ~& a" v# z: c4 L                .active_low = 0,, g$ \2 @, u" W+ x
                .gpio = DA850_USER_LED0,4 p" Z3 C' ?9 J/ ?$ m' e6 R3 O8 j0 B
                .name = "user_led0",
* x7 |1 ^( h; I  B: e$ m" Q                .default_trigger = "default-on",
* f/ ?: Y  J) ]* o/ ]+ G! b        },
' }6 p, R# R8 {! S/ H# l        {: r" ^# o4 V' M5 |+ `% t
                .active_low = 0,5 |6 t0 Y  Q+ f, v( c0 t5 K! `
                .gpio = DA850_USER_LED1,' M8 R* q' h/ V7 T" ~, b
                .name = "user_led1",: r1 q  l* W- C  X' v7 p0 l
                .default_trigger = "default-on",
5 l4 V6 E+ x, K* w* U7 O8 k        },
0 K& e: U. M5 y6 U1 Y  {& V        {
8 C* w; P7 h9 b' Q4 M                .active_low = 0,8 _0 O. {/ O3 Y$ w) c' r/ K/ e
                .gpio = DA850_USER_LED2," n( }+ N& c; `, C
                .name = "user_led2",  x. {+ X# W2 s* b( {5 [6 Y' c6 t
                .default_trigger = "default-on",
& S( @/ K( T* b  Y9 J1 F8 _, x8 C! i        },
3 a; I# h! ~$ Y2 S) g2 i1 D        {+ ^. ?, I* \7 F3 s' w
                .active_low = 0,
6 O( B  M* P) I0 [+ Q2 [- N, s' \                .gpio = DA850_USER_LED3,2 s  B. u" m; B& b: a( m3 ?
                .name = "user_led3",  B" J! T: C1 O1 p8 W3 S. Y) ]
                .default_trigger = "default-on",. N' l9 c8 w5 K  T" }0 b2 L
        },$ G: O: n1 h6 s7 H' L. u3 v4 S9 C
};+ P0 m) g- K& |5 M. q- n8 q
2 _. `7 ^( E% W% `1 B& S* N5 t, s
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {2 }6 A2 V) y7 e
        .leds = da850_evm_tl_leds,
# f" W+ t1 Q1 Z, H6 P( V6 d& V. ^        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),; |6 j7 `8 O  p0 O3 X# l5 G
};
( K2 c# z- z0 i) U1 \" o' u
: ?5 J4 `- B% f9 u2 r' U6 ?' L' Jstatic void led_dev_release(struct device *dev)& w0 u! A3 P0 [5 {1 c0 W6 A- k
{
* g# Q- C* V! A6 q};
! a" p  b' M  a) b$ t) ~  M6 ]; X3 U" _: o' @" ~: B; u
static struct platform_device da850_evm_tl_leds_device = {
4 Y& e. K! @7 X/ X        .name                = "leds-gpio",
0 p! J$ q/ Y( H        .id                = 1,
  x' {. F  g2 k: y- b, Y        .dev = {
& V' t& u2 @) I4 R4 Z" G6 l                .platform_data = &da850_evm_tl_leds_pdata,
' _+ W- z( \' D/ q; I& c  h                .release = led_dev_release,
' L8 c' n& u6 T4 D  S- V1 ^8 d        }6 d7 {  ^9 s' T
};
7 ]$ u' a. ]" W- p& O9 f* e( |4 N+ e" j
static int __init led_platform_init(void)
' ^6 v' [# V0 b/ B  i) [{8 N0 C0 E' t. T4 @7 O0 M: U7 i
        int ret;: T* J, ~1 ?# k  B1 q5 T1 c
#if 0
4 ?# ^) A; j! ^$ h  l/ l+ P* [5 M        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
: V' O9 v( A! D) H        if (ret)
9 N7 l1 ~4 t! u1 M$ j                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
3 x! v. r1 R! d0 D0 S) l0 W- Q: b                                "%d\n", ret);. R. R: R% h" C2 M7 Z; d% M. h* ^) Z
#endif6 W$ U5 a* [- w! r0 P
        ret = platform_device_register(&da850_evm_tl_leds_device);' M5 x' Q, T2 K" L: h: n
        if (ret)
, k" ~6 X- K1 C0 w( F6 E                pr_warning("Could not register som GPIO expander LEDS");
  Y( J6 z! s( ^. E2 q% J- `2 b* k        else% h  J( k; w: J$ a: ~
                printk(KERN_INFO "LED register sucessful!\n");& u1 P& s! k' g% Z

3 j* s8 E1 X6 v* r        return ret;3 c, H. }( t( p1 h' s
}" f- \9 k0 g7 C+ G# x5 w

: f5 k  @: U6 lstatic void __exit led_platform_exit(void)
* M$ v. g1 L1 k% f{
6 I6 ]' M9 ^5 R7 ?( f& T        platform_device_unregister(&da850_evm_tl_leds_device);! e$ C. p! r" a; \
7 ~; n6 {) Q( N
        printk(KERN_INFO "LED unregister!\n");. A: X) Z8 b' e% I8 _- m
}
# F) d" S. s; |
+ T3 [5 t& \6 w* N9 a" M$ Smodule_init(led_platform_init);% \( X) `1 o3 _
module_exit(led_platform_exit);
' n( U9 D  s9 {: ^1 O: e
: ?* ]1 j1 Z8 g6 V8 B% UMODULE_DESCRIPTION("Led platform driver");
$ A' \' H  v4 j: ]7 O0 [, LMODULE_AUTHOR("Tronlong");
+ c) V# G, j% S. G% S% sMODULE_LICENSE("GPL");& W8 E" Z9 x8 d
7 \4 f2 \" y9 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 13:14 , Processed in 0.040106 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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