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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。* d2 V% o5 f+ M; U, v
#include <linux/init.h>
2 P" V0 Q; E7 x. v8 K#include <linux/module.h>
1 ~4 x4 o5 K. c- G. m4 I8 t+ [& L: }#include <linux/kernel.h>$ s9 N  ?- r) m1 w) M6 {
#include <linux/types.h>5 S! a) M6 T# A- \! S- B: {
#include <linux/gpio.h>$ ?: n* }4 I0 G3 r. Y
#include <linux/leds.h>! @! h) i. i! D2 {) r' A
#include <linux/platform_device.h>1 e8 e: J" O4 l- ]* W
: J( `2 u2 L" _, K- }# M8 _
#include <asm/mach-types.h>) M* c- h+ r% f6 ~, H! R) b$ |; l
#include <asm/mach/arch.h>& F# P$ p$ ?7 o7 g! k8 N$ k) H5 b
#include <mach/da8xx.h>
0 }. d5 X1 q' h- G2 F. _#include <mach/mux.h>- L5 P  i2 `3 Z0 I4 _

* u! H! T) z& c; Z* P#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
: e* s* I" U. @1 F#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
: K( t% o/ p& ?#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)9 @, M- a6 t4 H6 P
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
* h  i7 z+ _: n* g. q1 J: F) i
/ V6 p$ [3 t1 t  J5 M/* assign the tl som board LED-GPIOs*/
) X7 e' U& d: s" b/ x7 n3 Zstatic const short da850_evm_tl_user_led_pins[] = {' y4 F! c5 K' I! f" O+ D  }
        /* These pins are definition at <mach/mux.h> file *// v' m  @; `& J1 [8 a7 C
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5," B) B' F- A- z% O& g& k
        -1
$ A! Z4 W4 m  |1 L2 G' D- U};; Q0 ~' e* P% O7 j5 Z0 F. _
* w2 }; v) }5 h) y+ a
static struct gpio_led da850_evm_tl_leds[] = {
) h% z8 K1 \) v( ?. f& W        {
0 s$ B, i  x, y                .active_low = 0,
0 A( p+ g+ D& p# [1 l, U                .gpio = DA850_USER_LED0,
8 L, L0 v: R( \                .name = "user_led0",- A* g: ^3 |5 {; b
                .default_trigger = "default-on",, Q3 ?7 U8 V; J% Y0 [7 b4 [5 A
        },
. M: }4 j8 C8 \        {# t3 U! \" q  Q$ e+ N
                .active_low = 0,% }& ]) l4 n0 l3 Q
                .gpio = DA850_USER_LED1,
! k2 X6 y  M) l0 H( }* z$ s( K: s                .name = "user_led1",
6 K2 Y# K' f7 }" f2 q  N- w                .default_trigger = "default-on",3 E' u- y1 \+ M$ v! s
        },' S6 C, C+ v* _, |+ a6 O) }
        {4 z/ s& l1 \- f" F
                .active_low = 0,% N. ]1 ?$ L; n+ I6 \
                .gpio = DA850_USER_LED2,' [3 T; P3 |8 z4 n% ^( i7 w. w% a
                .name = "user_led2",
7 |9 V3 \$ u" H6 X6 m3 j                .default_trigger = "default-on",: Y: ^' y; G7 x# `( a5 Z
        },/ v4 h1 {+ [1 @5 V' f" q; l. J" K7 u
        {
# j' g0 I7 K0 S$ P% [$ p                .active_low = 0,
. U: U5 S  @4 G; u                .gpio = DA850_USER_LED3,2 J6 n- X  {( I) ?- {
                .name = "user_led3",9 m4 S. x* J1 W5 n$ \  B* d! A3 r( u
                .default_trigger = "default-on",0 @( m8 Y9 j* Q7 M% r. W7 _
        },
# s8 j' ^0 U( l; S5 Q& Q  [, c- T};
& x  |% f. A1 V5 u0 l( e' G. Q8 o" k- C5 T4 l) O
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {' r! y7 @9 f( Q1 \, m
        .leds = da850_evm_tl_leds,
. |% G8 Z* X5 @8 R. ~8 e        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),4 U. D% n) `3 v  d/ I2 X9 G
};
  Q/ j# T! O. n
  L! Y  @3 ]! |+ Hstatic void led_dev_release(struct device *dev)9 W# I% U4 {* T  G. |4 T
{2 ?: }; E0 f2 e2 L1 s
};
# v5 p) V7 Q! u- v5 l, v8 r) \9 }
static struct platform_device da850_evm_tl_leds_device = {
' N" \  K+ C0 {% \7 p1 c  d2 b7 ~        .name                = "leds-gpio",6 H& p2 y( |- C# o
        .id                = 1,( z4 {' O9 I# w  ]
        .dev = {1 q3 `3 d5 w1 f5 R4 @
                .platform_data = &da850_evm_tl_leds_pdata,3 S5 x7 m1 ]: N0 p3 A
                .release = led_dev_release,% c0 `* w! `, R5 _9 M4 s9 [6 m5 V
        }4 u$ ~! c$ v) k# ~
};3 p3 K( z+ C! G

( ]/ V1 n# ^  P) d" \static int __init led_platform_init(void)
. h  Q5 ]9 f8 T+ I) T{
4 M4 i; A+ l( d        int ret;6 c" A6 g. e- A  m* z
#if 0
, M' H. t( H3 S: |3 h        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
. t& e; A& |3 `, j* \3 F        if (ret)9 H0 ~( U; q/ T7 l/ z/ H4 i! G( ?# f
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"/ a) D) n5 @! c/ P3 o' D
                                "%d\n", ret);
; V0 M, u7 s7 g' Y# v9 U+ B  G#endif7 h; n' B8 q7 Z+ ~. a7 I$ L( G0 G
        ret = platform_device_register(&da850_evm_tl_leds_device);$ d1 Y/ ~4 ]8 V! @! S
        if (ret)7 z( r6 Z7 k5 e8 P( R6 I8 n) A
                pr_warning("Could not register som GPIO expander LEDS");
. O$ Z, A6 b3 F3 J% Y3 C        else
. A# l' x2 W2 w6 K                printk(KERN_INFO "LED register sucessful!\n");
6 t6 B) X! _! [* f, {" K+ d  d
, a+ {' |8 j3 x" X4 G8 ?        return ret;
( h, ~4 i* n) X* F0 x7 M}8 w" i% H/ x" z/ w1 e; x( V4 p. J

) I. i/ G& L0 \) N: rstatic void __exit led_platform_exit(void)
' t8 T4 z. _% T; m, q) g% q{9 A5 ]$ x3 l5 c( y7 j
        platform_device_unregister(&da850_evm_tl_leds_device);
1 C7 u; M) f/ r- f+ ?. U( Z
0 h5 [% [% |. G' M        printk(KERN_INFO "LED unregister!\n");! D: a2 s. W- B# c  A# {9 I
}
) L' ]+ q) o) I3 g: |
4 v: ]7 H) h! n  u0 W- `% dmodule_init(led_platform_init);
" n% `, M: T$ F7 [module_exit(led_platform_exit);% @$ X. c8 t0 U
- v% N5 @& a0 b1 V1 H- D- I
MODULE_DESCRIPTION("Led platform driver");, z  [+ G) f! e
MODULE_AUTHOR("Tronlong");: C4 }6 I2 m5 h  n; Z& _
MODULE_LICENSE("GPL");
' R) n4 b. n, w( l% q0 r. t' F8 W: f7 W, N0 r$ o5 f  t  A% [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 02:34 , Processed in 0.039523 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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