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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。, b( f+ {. A" h# f
#include <linux/init.h>
4 [+ e+ U$ l3 G9 h. A9 e" B5 L#include <linux/module.h>8 j* U# X6 L. T+ |
#include <linux/kernel.h>* N' L3 W# T0 y. q/ d) l9 ?* i
#include <linux/types.h>1 D1 K2 [) K. C3 f% `
#include <linux/gpio.h>
. c; O0 f# g% Q$ o( v1 g3 {3 f" o#include <linux/leds.h>7 W- M7 @, M% @# E4 `# J
#include <linux/platform_device.h>
6 s& A. U- U' Y# ]  ?$ [
  J, w/ [  B# Z& R, b#include <asm/mach-types.h>7 M" |: [" G9 E- R4 J
#include <asm/mach/arch.h>
- r3 Y0 v. z  B, Q7 B#include <mach/da8xx.h>
' M& q7 [' ]; _1 x$ D$ I! U#include <mach/mux.h>1 G8 d3 g' S/ G* I% N. a( e! S
) r4 v: m% ~: |- P
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
  J2 v5 b0 `5 `; I/ P$ P#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)* @/ h9 Q1 D/ I- q
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
( m6 H5 D% `( q. v1 c, Q( G#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
) @2 W! W& X5 x( H2 k0 \
% v; `; G+ h+ }/* assign the tl som board LED-GPIOs*/
2 v8 L: t- V2 _7 m1 K. I, L# sstatic const short da850_evm_tl_user_led_pins[] = {' W: U7 w! f& W$ B- c8 v
        /* These pins are definition at <mach/mux.h> file */' u- f( n: P1 O8 p6 h
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,0 }6 L' O& N( z5 @( D
        -1" k* p( P3 a4 x$ L5 Z
};2 w8 v$ q' K" M9 ]- y$ l

6 l3 r' f' w+ l8 ^! Nstatic struct gpio_led da850_evm_tl_leds[] = {4 W! p$ F. u7 j  W2 f
        {
6 o* T4 U! p0 x                .active_low = 0,# r# K: M. X0 {% b+ x1 ?2 W
                .gpio = DA850_USER_LED0,, i. f+ }' @: K1 A- p& L; c
                .name = "user_led0",6 H% [0 W6 {5 W
                .default_trigger = "default-on",, {* Q+ M0 `$ L# b* }
        },
. _4 H" @1 N' P        {
* }9 Z0 I" c! Y2 j                .active_low = 0,
4 U' N5 C/ ?- O# ^                .gpio = DA850_USER_LED1,
' Y1 u: n+ C; v. b                .name = "user_led1",- [/ r* L1 O1 O4 Q9 V$ X7 c
                .default_trigger = "default-on",
2 z3 K  ^6 }# J' c        },
/ D: t: Y. |. x2 ?* S        {. u2 x% B6 z& _4 P- J2 G
                .active_low = 0,1 U" S- @2 j  x. O) ?# `% ]
                .gpio = DA850_USER_LED2,6 [- ^' B- R. b! z
                .name = "user_led2",/ _' e# D0 q# H7 |; M
                .default_trigger = "default-on",/ G6 Q$ Z  w% z
        },
' T( \& X  b, }  e  y) F        {
- Y( Q, L8 |# S. N3 C6 c: G9 _0 D4 K                .active_low = 0,
. U+ c6 a0 X. B3 J& D                .gpio = DA850_USER_LED3,
# O% @6 m) m- }* K; p                .name = "user_led3",. j2 A  T+ @- w! ]
                .default_trigger = "default-on",! O5 ?- ]# o+ X1 a1 y
        },/ f* O# X4 p# N( K. x# G
};
0 F4 X- b& m& D+ M) m/ U. a) f8 J) H' r$ H$ ?
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {1 r2 Q% {8 _$ V- R# n8 |3 M% x1 ^; \7 z
        .leds = da850_evm_tl_leds,, Q' v4 V; t  b! t* R8 M" j
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
, {3 m8 Z0 g9 Q" B( ~2 `4 d};' W# u6 ]; \$ J: L' m5 n1 l, P4 m
2 ]1 ]! n2 @+ d! C8 i* h
static void led_dev_release(struct device *dev)$ v1 e+ T" W' C# c) T- a0 h; O' u
{" I- j" A4 g2 o# [9 O6 _4 }
};
: _1 e. s* s- _# t8 u
0 c) \4 h. k, z1 ystatic struct platform_device da850_evm_tl_leds_device = {
) P) z" F' h  ?+ ~8 a6 `        .name                = "leds-gpio",5 ?$ M* i# i- O3 K
        .id                = 1,
1 q; i! D0 ?0 q" |" W8 B/ w5 A% |( }8 w        .dev = {4 t- X: l% {7 K: X5 u% W
                .platform_data = &da850_evm_tl_leds_pdata,
0 B$ t# @# m: t, L' y' y! E# O                .release = led_dev_release,2 x  k" R1 w  s# i- `
        }
. m  e# l' }- M1 q" P};3 L0 s- O# z# c' ]; b) m" s( p

& [0 d  e1 j# D6 T4 R/ _; d3 u/ tstatic int __init led_platform_init(void)' `  m& M' J0 _+ H0 |
{
8 ?  u% f" q9 b. c. ?9 c% `        int ret;6 Y! @: S7 r* w. K: j- E
#if 0
! P9 C) S/ N0 u! }( E7 x        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
# y, H  k* r0 `. g5 ~+ z9 @' N        if (ret)
$ F5 m. ~- n# e( V0 C                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
$ d: M' d! |$ I                                "%d\n", ret);
8 U# H0 S; B/ N! Z8 {! ^#endif
; ~; c( p4 j0 t& R( H- x        ret = platform_device_register(&da850_evm_tl_leds_device);( P; Y! W' h: W4 F2 ?9 m
        if (ret)
6 \; g, o5 n# c! Z; ]' H                pr_warning("Could not register som GPIO expander LEDS");9 k. `" n0 \- K% y; P
        else
7 H% S( r$ J2 z+ a" a( H* N                printk(KERN_INFO "LED register sucessful!\n");* h- L: i- X9 {  m  {1 h4 w

( |# i1 C0 J8 e+ S        return ret;5 `7 S6 ?% o+ ~" J
}! H4 ^# N* p, D: F4 G( ?

: `# _2 x. @& P' Q. bstatic void __exit led_platform_exit(void)
0 d9 c" X, p- g' y{/ U8 q* F  U7 V! \$ c1 q9 v! g
        platform_device_unregister(&da850_evm_tl_leds_device);! y, \& b, x. w6 t6 X$ N5 O2 R
& A. F7 D+ I0 m" S
        printk(KERN_INFO "LED unregister!\n");
! j* a9 g- E/ ^- m$ l. m, Z7 b}! H4 J  B3 G) |. h. Y
' g9 v4 u+ Q3 L' C
module_init(led_platform_init);$ ~( Y7 u9 J- e  g
module_exit(led_platform_exit);- D% p2 V+ ^6 |( W  e4 Z# Z9 B

/ j; Y& ~  m/ E) LMODULE_DESCRIPTION("Led platform driver");9 v; I% W( o3 k, a
MODULE_AUTHOR("Tronlong");
( \& A  N  g) N4 dMODULE_LICENSE("GPL");
7 a0 z+ L% g9 p9 \8 l, @2 T, O6 n  |2 J! k3 e! `9 [& x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 01:44 , Processed in 0.042433 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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