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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
6 @3 q) ^0 I' w( B" T" k) k#include <linux/init.h>
5 |4 _$ h9 K) @/ _. V#include <linux/module.h>7 v3 k1 Y' N' _2 H4 n9 i
#include <linux/kernel.h>1 |) g7 \( j" a6 F6 V
#include <linux/types.h>
- M# D- ]- Y! n# A#include <linux/gpio.h>5 N5 h) u) Q. w* q- k8 }$ ]& ?! u" C
#include <linux/leds.h>  [5 Z3 q  s( [
#include <linux/platform_device.h>( x9 b% L  G$ o. k2 e  c! p
3 T; Q3 T$ r# M
#include <asm/mach-types.h>
" `4 z+ z- T7 i8 t( `( a#include <asm/mach/arch.h>6 ^, Y9 ^& M/ ], y' N
#include <mach/da8xx.h>0 \# P/ R' ~% n. u# g* u) q
#include <mach/mux.h>
# T0 r. s) }! U( B+ a9 h1 ~( O5 z5 r
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
6 C9 O! I: ~7 G1 {* z/ j3 A#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
4 r2 ?% G9 r; O: Z: N#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
! _# H# E+ Y1 A#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
* s" k9 w9 Y- A( u
. e# P+ d$ v& z) g+ d5 t/* assign the tl som board LED-GPIOs*/
& j3 T( m' k5 m0 A! Astatic const short da850_evm_tl_user_led_pins[] = {
/ E8 S! N( J# c; X# l1 V1 P        /* These pins are definition at <mach/mux.h> file */: z$ @" E/ \+ b1 Z% p
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,  E9 u9 X3 P+ O# T! q
        -1
0 I- V7 c2 ?4 w};) q7 W9 t# c: O, J" ~7 n/ d
/ u) ]8 E5 C2 g, z. m" @! U7 G
static struct gpio_led da850_evm_tl_leds[] = {  c/ U2 h! s- `( g( s' \; g( z
        {8 f0 _5 u3 ~& O/ N
                .active_low = 0,
' }- e6 l$ @2 U  Y9 r) g; {- _5 R6 ]) N                .gpio = DA850_USER_LED0,
3 N/ i+ r7 ]3 @7 L3 t, c7 ]+ ^                .name = "user_led0",) h  y, H/ c2 f- T" M9 J1 j* o
                .default_trigger = "default-on",
4 ?1 \8 M% Q1 H- i( t* G7 N        },- d6 u. Y9 n! G5 `2 s
        {
* _7 f$ T( O+ `                .active_low = 0,. d- a3 d3 H, @# Q
                .gpio = DA850_USER_LED1,  u6 y* [, @5 ^2 ~+ ]# l
                .name = "user_led1",
6 j9 y9 i6 E. F6 h                .default_trigger = "default-on",' F7 R* V$ C$ J3 e5 r5 c
        },& n, u2 u: a  q5 D  P0 P. @* Y
        {! m0 t+ R" x8 x( _
                .active_low = 0,
5 s4 w7 \2 Y5 w+ B6 u8 S: j+ X$ g                .gpio = DA850_USER_LED2,' d6 f& R, z' N, i! L) x) M, O
                .name = "user_led2",
$ h/ l9 I$ j) u, a. x- t. g                .default_trigger = "default-on",4 J1 |9 w/ V& b% A3 X4 h9 G8 U  a
        },8 R( q4 y3 {8 |6 w4 {/ Y) h8 ]
        {8 v. C7 C" ?, b! B8 a
                .active_low = 0,
$ J: b' X$ H$ q2 _' h                .gpio = DA850_USER_LED3,
) l1 {  g  b. ^! q                .name = "user_led3",# A; {+ i3 ?0 u% _  g/ }4 ~
                .default_trigger = "default-on",
7 P: [# G! A( ?6 v8 ]        },
. Q. z8 }! o8 X+ ~};
8 l& x4 w7 e* {! Y  \/ Z
& ?, D& j: S9 d* `4 pstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {. A7 A3 u9 }1 Y9 H
        .leds = da850_evm_tl_leds,
: j2 Z  r9 m' w3 c        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
4 B3 g3 |6 H) J+ w( G2 }  F) o};5 J: W# \5 o& C3 v8 C5 Y) X
" ~; E  H( x/ v) l
static void led_dev_release(struct device *dev); x% J. c. t3 R% V- J& ~# x
{; A: ?+ D' {- g$ F
};
: [2 T4 C9 D' z$ t* B6 \9 J* z
# V# J! v# x( R* }& Z3 e# \3 I& Istatic struct platform_device da850_evm_tl_leds_device = {2 ^3 \7 L: c/ c4 P: Z
        .name                = "leds-gpio",6 Z( B$ f" F9 E  T
        .id                = 1,
# L3 h; |1 p: R$ S7 ]& W        .dev = {+ ]# {/ J" L2 W4 g3 u. G
                .platform_data = &da850_evm_tl_leds_pdata,9 q, E3 U5 E( ]9 O
                .release = led_dev_release,7 T' O: f' A: |1 v
        }
: Z* `4 }) x7 g- _};8 u; i0 C2 G; A
4 z# o( s! B) U( b$ B
static int __init led_platform_init(void)5 c8 a0 @5 p. `: P3 l; ~' u
{
) d0 B4 a4 b$ g% N, N( |        int ret;& F" B4 K: S: s# r
#if 0
2 z: h" I; E! O' H        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
' z/ v+ _8 L/ ?; \, X) I        if (ret)
3 S) u1 x9 B% R                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
& d3 M" ^3 i! E$ q( y( G                                "%d\n", ret);
: _- ]2 E1 I4 T& c1 L5 f& g#endif
; g0 ]1 y, q  b9 Y. V4 j        ret = platform_device_register(&da850_evm_tl_leds_device);
9 _8 o# N, Z. G        if (ret)) D/ x2 \# m. E  @3 I+ ~, y: A
                pr_warning("Could not register som GPIO expander LEDS");
* H2 n) b1 ^5 h2 l; B. b# x6 W        else
3 ]  N" G- K. I) R                printk(KERN_INFO "LED register sucessful!\n");
0 `5 K4 i2 T& e5 c  v6 i  y& C/ s2 F7 D3 v1 S) ?/ `9 q
        return ret;: }7 `% N# t$ H) J8 r
}
: T' Z' ?  Y7 S1 y8 a& N  Z3 Z* ?6 m5 k3 g0 S: ]
static void __exit led_platform_exit(void)- A, ?, `9 S# W! L" X9 a
{, s5 f4 \6 i) a+ {
        platform_device_unregister(&da850_evm_tl_leds_device);
$ `/ f: u$ _2 C! v  ^
2 f# E$ b+ U; m4 C% ^1 @; g        printk(KERN_INFO "LED unregister!\n");- U* y; U% u* s" ^
}' G! w+ X: Q( I" _' j
6 D3 V' _7 P) I; ?# d5 N
module_init(led_platform_init);
8 x) ?' Y+ w. o7 g* qmodule_exit(led_platform_exit);4 ]8 R* I, {) [' C: U

, V4 {  w% p( A9 \# f$ _% sMODULE_DESCRIPTION("Led platform driver");5 S8 f4 N% z+ k
MODULE_AUTHOR("Tronlong");* V" q! N3 z# Q, Z1 d3 ^
MODULE_LICENSE("GPL");
+ [  E+ o* l5 ]2 G; ~- X& o+ ^; `- ^. r9 j3 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 23:24 , Processed in 0.040612 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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