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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。5 L' O( c% x3 w
#include <linux/init.h>
; j# p+ X- N5 r  H# ]& o% X/ s' d4 r#include <linux/module.h>5 n' A  t' n! [. t
#include <linux/kernel.h>' f' u) z6 l9 P3 z) j
#include <linux/types.h>
! T/ k* `7 t) O# f& p; D/ H: Y#include <linux/gpio.h>; z' ?3 f1 ~6 F% o! X$ {8 z
#include <linux/leds.h>  {0 R' w! b1 v4 L
#include <linux/platform_device.h>( E7 H5 ^9 T; n' }, q8 b2 D8 E

+ Z0 R$ D2 m- p9 A1 W+ t* B5 u#include <asm/mach-types.h>: u) @. f7 z2 V1 o7 U% D
#include <asm/mach/arch.h>- K: j: F. x8 Z" D/ j# p: [
#include <mach/da8xx.h>
# V; q! N( Z- ^; c$ d#include <mach/mux.h>5 M  Q- }1 O3 i& n
% q8 ^2 i% b6 }7 E! _5 f
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
+ B- N" }) {2 `6 o: E#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)5 ]4 a0 c' @$ ~0 R0 A
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)7 E% \; O4 `$ Q/ p, C% c9 E- k! r
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)2 G0 H' k  a5 g& g/ c1 @

0 p, G; E, p0 g5 u9 s. e) C/* assign the tl som board LED-GPIOs*/
. T& d! ~' `' Estatic const short da850_evm_tl_user_led_pins[] = {% L/ M+ ~  V( L" t1 z* z1 ^6 L, F" O
        /* These pins are definition at <mach/mux.h> file */' Y3 \7 g: u$ c! `
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
0 Q1 O8 B2 o1 ~* {- `8 P        -1
0 M5 R3 R7 C' }};) b4 G6 X' i/ |/ V9 A% s

  B0 z, B$ P0 }3 Qstatic struct gpio_led da850_evm_tl_leds[] = {2 t8 t: o0 q. _+ L- }4 ~
        {' _) b* h  q8 x( r. e
                .active_low = 0,
3 N4 ~8 s( W5 ?  X' G                .gpio = DA850_USER_LED0,
! M3 ?$ k8 l# m7 s& Z( n1 n                .name = "user_led0",; S/ n3 D; A1 [" P! \' g
                .default_trigger = "default-on",# [5 t5 R9 R5 q& V! v1 U  w
        },$ J; R) T+ G! W  E0 g
        {
" N7 Z8 i6 Y# U  ~5 q                .active_low = 0,
! N8 `: X: I/ P0 H" [$ V& x                .gpio = DA850_USER_LED1,
& ^( z8 f& j9 f- a& a5 d$ K0 B+ x                .name = "user_led1",
% e2 A- {. |) k. M. M' O                .default_trigger = "default-on",
, j  }' \0 z+ u! F1 u/ M+ P        },% x$ Z, d7 v' X9 J# G" Z+ h: {
        {. D: M& z! Q% r1 X
                .active_low = 0," ^! L( i5 d1 e+ I/ h
                .gpio = DA850_USER_LED2,
! c9 T# U9 h8 I; h& f" s4 g& x                .name = "user_led2",
+ W: |8 O0 M! T; k                .default_trigger = "default-on",% v+ R0 W3 v5 [$ h- X
        },  H/ X; v# V7 J: ^( w& F
        {
" [0 t# Z6 V5 |! G  J                .active_low = 0,
' C+ c9 I- G; f# e* U                .gpio = DA850_USER_LED3,
6 Q4 B- p7 u) Z% \8 D( y                .name = "user_led3",
0 ?# \" T$ N7 O% s4 p' ^% X                .default_trigger = "default-on",3 R  L2 u+ |9 g% r
        },
0 Q  Q9 a3 L# U7 l# [};/ O' l4 e& \: ]3 w$ D8 ^; }$ n/ @; l

7 x, B) z& v, U( v  Q2 H8 T: dstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
, z( o+ A7 l" Z9 U. H# @, v: E/ y& k        .leds = da850_evm_tl_leds,( M2 U. j7 r( T; U
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
. m0 P3 o4 V) v7 H: q2 ?2 b};
: c( @- ~/ R. r3 i
5 m& _- C5 G3 H# x' u( bstatic void led_dev_release(struct device *dev)+ W5 Z- s& k  n, ~
{
! j8 D3 Q) T" [};
( U3 g2 x5 ]6 o# _& p8 U* Q! n( w2 G1 `8 f2 O. C
static struct platform_device da850_evm_tl_leds_device = {2 U1 c0 t0 Z  m" \
        .name                = "leds-gpio",) F6 a: J$ I) z. `0 |9 h
        .id                = 1,
5 Z$ \* x% h  u! f' b, Y# o+ R; B( e        .dev = {
, g; Q5 [( ~! b$ c* Z                .platform_data = &da850_evm_tl_leds_pdata,
( S8 p! E0 `: x- D                .release = led_dev_release,
& u1 B' j3 x  Q9 V. B        }
3 a& f/ Z8 w' `0 Z5 C};
. F* {9 Q0 a$ b5 x( p/ w8 b( }4 ~- V- J" p: U$ M( D
static int __init led_platform_init(void)
5 S: g7 w7 Q: d9 J4 x{
8 I* W! t. Y9 D4 W        int ret;* ?: \" E. f6 ^/ N
#if 0  ~( _" {7 g" _. C
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
1 y. h& H% }, R. ?/ K+ e( N        if (ret)
3 q- ^$ l0 J( _6 ?9 t                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
4 w% p8 W+ w; ]9 C4 ?7 h                                "%d\n", ret);
% g/ a* `/ `% e  O#endif
# C. z" s3 X5 O% P- i. v        ret = platform_device_register(&da850_evm_tl_leds_device);# n5 z4 G; B! X* j" C6 f! W6 I
        if (ret)9 [; Q* O0 X2 H* T* C) R: o* o: O
                pr_warning("Could not register som GPIO expander LEDS");" N8 D- X7 `; G# A. |4 \! V) |
        else
3 Z7 q! n( Y, |/ k: a; u  X                printk(KERN_INFO "LED register sucessful!\n");' S# n/ |1 C- b9 T
# b0 ]& X1 `: z- U; }
        return ret;5 t: s5 n3 `* r6 ^
}
2 e/ E% J2 c  E  @5 t) e. C# x% N; Z0 }. j: `' t
static void __exit led_platform_exit(void)* J/ e% p1 a5 J, @+ U& V  F
{0 _, K. P( Z5 F2 ?
        platform_device_unregister(&da850_evm_tl_leds_device);2 I  F4 z4 [2 R8 d* `0 E' d* U
0 p" k# ^6 F( I$ n( d6 x
        printk(KERN_INFO "LED unregister!\n");/ i5 }2 }/ m" f2 m+ j/ u% Z
}4 k# o' B4 w1 D5 g
: K! j( R2 {7 |* \6 D$ D: N
module_init(led_platform_init);
; w( T4 T# J/ A; gmodule_exit(led_platform_exit);
/ G  `; @) O9 p. n  [1 b) \1 U; n' H5 {+ ~8 m, v: F
MODULE_DESCRIPTION("Led platform driver");
4 c, o+ |% `0 R$ v$ `MODULE_AUTHOR("Tronlong");
6 @% ~2 n& z2 U* [MODULE_LICENSE("GPL");
- Y% X+ U4 e# F% S  i" }/ Z9 Y8 Z% `8 B+ ^7 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-7 00:19 , Processed in 0.042204 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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