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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
- \' W3 [8 D- H2 ~; g8 l  m9 \#include <linux/init.h>
& O/ O, D, s- ?- j/ l, V& T; U#include <linux/module.h>- R) z" f- ?7 b% m4 a* R7 @
#include <linux/kernel.h>
6 ]+ C% B' w' c9 b& p1 o) t#include <linux/types.h>9 k% z6 E; @- |5 K2 x  S
#include <linux/gpio.h>! ?; @4 {! n; F$ M
#include <linux/leds.h>
8 n2 c, m8 s* Z; O) |#include <linux/platform_device.h>7 I1 i5 U# _9 x: c0 j' g' k4 B5 }

# J0 l5 ]) K$ R9 Z) g5 G9 U#include <asm/mach-types.h>
* `% c( H) }' s3 U#include <asm/mach/arch.h>$ J- Z  |0 M! w* f6 ]5 g$ t
#include <mach/da8xx.h>
6 T8 l% i& i' d! _6 T( a#include <mach/mux.h>8 g, s- B5 u: V0 _

5 F5 @7 {& a& B  T- J#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
- `& v2 d( ^% ?) M9 m$ y/ d#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
' T9 g, O) x" t3 {" s5 `% f#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
6 d$ F8 P, @0 }#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)4 Y7 E" i! a2 B% `

! [! S9 b" w, C, }. m/* assign the tl som board LED-GPIOs*/
- f9 p% b- u2 Z1 _4 O: C6 F  t$ pstatic const short da850_evm_tl_user_led_pins[] = {; V5 `) h- d  |3 h' v/ d/ l  }+ H
        /* These pins are definition at <mach/mux.h> file */5 @1 g! l, L8 _9 s0 x
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,, |! }3 ]7 X) M! o4 Y/ @. [
        -19 c' C7 Y+ J% H5 n; g4 j
};
: H$ e3 [. H+ ~
- G: U3 L. D+ t" m+ qstatic struct gpio_led da850_evm_tl_leds[] = {
9 u* J- e& ]8 N        {
" x+ d# a6 }+ L, X2 X                .active_low = 0,' @. Y5 q; z9 C" w& j
                .gpio = DA850_USER_LED0,
9 C2 }" [+ ]- z                .name = "user_led0",
7 o" F* i. j0 ]" ^; w                .default_trigger = "default-on",  e8 ^# H6 p* Q% ]1 q$ d  I& P3 Y
        },
# x/ ]- F' l; I3 K        {, `& T, D0 ?3 W  B& ~5 a
                .active_low = 0,  T9 _1 \& H) f8 D9 H
                .gpio = DA850_USER_LED1,
/ i0 F* h* i+ K, Y* y2 [$ r                .name = "user_led1",: r0 E4 d' S. e1 f
                .default_trigger = "default-on",
3 d6 E1 m4 k) y. }; T2 R9 [- L        },
) H& T' g. n2 S( z' s- V% A        {! P! V* z( |* z' j
                .active_low = 0,1 d' z$ O  g) |* K* }  f
                .gpio = DA850_USER_LED2,
1 o9 H6 c( f! s$ u  d                .name = "user_led2",7 g' X8 @0 u3 S' j/ ^9 f
                .default_trigger = "default-on",
( \9 L9 p- G% E  I' F  H. n2 V        },# m, I0 F# N% G
        {- }9 a8 T& x: b& v6 x9 U
                .active_low = 0,. Y8 S" b) ~$ `7 R+ O/ s
                .gpio = DA850_USER_LED3,% ?) w( E8 l% @# s
                .name = "user_led3",
: y4 c; j3 ]* ?' D                .default_trigger = "default-on",
/ s7 c5 O0 O1 B        },
. M1 F+ u- M/ F- M3 U};$ \' v& T7 T6 t% O/ z, ^

0 _% D! ~9 G, o; qstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {1 P8 ]! Q: w0 A
        .leds = da850_evm_tl_leds,- I1 N4 z- M6 Z3 J' i8 S$ P5 \) }
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),+ k9 m6 K; Y4 i( h; o
};2 z* z$ G6 D1 Y2 N* R  [: w3 n

* L4 ~# P) T$ o  s: k- P; hstatic void led_dev_release(struct device *dev)5 I; {: X+ u- X7 X) ~
{6 f' l* P& J# J- Q
};  s7 X. W1 X& Y  r+ t/ A4 ^" N
$ o( h2 \% M7 A7 }  g
static struct platform_device da850_evm_tl_leds_device = {
. C0 w( G' ~6 b+ E8 k        .name                = "leds-gpio",2 k. T' l; X$ s5 L/ [/ n
        .id                = 1,( ~/ e3 x: Y* s& }& t
        .dev = {. ]9 L3 J1 l( }9 j9 e7 v
                .platform_data = &da850_evm_tl_leds_pdata,) l8 M; f. Y+ R6 \4 Q' @$ H$ @
                .release = led_dev_release,
  D$ F$ M/ A2 }, _        }
2 B: u8 a3 `: b) v) m' d1 j+ k5 m};$ V" }# S# `* l- x( F5 L% E

0 @/ C. v& |9 a6 k2 I9 `static int __init led_platform_init(void)
" |4 e( r8 a0 z$ V4 e/ M{9 z. A1 I% [, P
        int ret;
3 h1 d6 R4 A. k" i4 U" r! n) }#if 0
6 x5 g0 E* J* {$ z9 [6 w        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
2 C# X* E4 o: Z/ X* n1 I        if (ret)8 m  x% C: n  g4 n% M# B
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
0 T/ A9 U, Z' s) f4 s! s, L                                "%d\n", ret);
$ O" g) L; o' f0 u2 M9 \  J5 ?4 a; ]#endif
4 N4 `' A( w4 g" [6 r! p6 ~9 T$ X        ret = platform_device_register(&da850_evm_tl_leds_device);% X* Y9 P' S! q0 y+ D, [* O1 i2 d
        if (ret)5 L5 J0 @4 M" [9 Q
                pr_warning("Could not register som GPIO expander LEDS");
/ U& }9 R: l1 [  _        else5 Z; W+ Z. `8 b# H0 t7 h6 Q* \, N  Z
                printk(KERN_INFO "LED register sucessful!\n");+ O2 e' H  e9 \# v% a" c

" b1 ~! Y6 i5 r# U, m        return ret;( L- l' M' l' @9 y# c; h" s" ^4 l
}- L9 S- x' {5 ~+ Q# R  L2 m
: ]& ]! l9 j7 D& Z6 ^5 V/ a
static void __exit led_platform_exit(void)" v0 e/ _4 E: Y/ Z9 q2 m' Y- O
{
. q( z4 g/ W" o) p/ G        platform_device_unregister(&da850_evm_tl_leds_device);7 W  i3 Q  ]& R) M1 s6 A& f& S) V3 a
5 N5 F3 u! k' T$ t, `
        printk(KERN_INFO "LED unregister!\n");
. P+ G1 O' B$ |}
4 Z: D0 I* \( h  y* t  f7 w6 A. K  c" h3 t; ^/ J7 A, K' J& M1 D
module_init(led_platform_init);
% V% l2 k. q3 G2 b; E; _module_exit(led_platform_exit);
9 K' n' g7 ^2 O, A" g+ m5 e6 g) K
- `+ O! [: E7 X. \% DMODULE_DESCRIPTION("Led platform driver");
! l. @: G) y! J' Z1 yMODULE_AUTHOR("Tronlong");8 v1 @8 s/ s& I
MODULE_LICENSE("GPL");
5 }3 G- f9 Q! z* w5 I5 |% l
' z  S& ^1 V3 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 07:49 , Processed in 0.040261 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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