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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
* I# B8 W* s9 l0 b6 i8 l#include <linux/init.h>
+ A5 }0 S' T- Y4 f2 b( m- R+ F#include <linux/module.h>  X6 g% T' z% V
#include <linux/kernel.h>6 ]! j0 P& v  F; o9 ?) h
#include <linux/types.h>) `; t5 Y7 h; Y7 O% S
#include <linux/gpio.h>
+ L+ k7 e9 k. s3 d! S9 `#include <linux/leds.h>8 u" i% Y7 R  N$ _1 T# g% V3 }
#include <linux/platform_device.h>- X  ?; s3 {/ {
6 ^% E5 S9 p3 O6 b
#include <asm/mach-types.h>
- S: Z9 ?) j8 w- @  j% O. Y* |#include <asm/mach/arch.h>
4 d0 `) E- @8 X9 d! J#include <mach/da8xx.h>
4 N- g! ?+ Q! ?" O' a; P) a#include <mach/mux.h># N: B" v& d- T4 O

6 R, v$ S3 J" P4 y% q#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
- q) n$ D+ q! M2 U#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
& o3 h9 Q- C6 g2 q#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
, p7 n" ]' @1 S* O2 b#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)! k  |! M2 w3 A- Z* V' t
: s5 @, F$ y% j  l; ?0 |7 k  F8 p
/* assign the tl som board LED-GPIOs*/
; |# c' {3 k" k2 ~; M& \. Istatic const short da850_evm_tl_user_led_pins[] = {% _2 X4 D, x! T- Q
        /* These pins are definition at <mach/mux.h> file */
) I- k& B% X& b1 x/ R: N8 @        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5," [' B  u0 o$ o  n3 r
        -13 L, ]: M1 E. r6 h& [" L6 n, y
};- {# d: D1 ~7 B* Y
( p7 D) Y; ^+ ~4 A, P! g
static struct gpio_led da850_evm_tl_leds[] = {6 g+ Q" Q$ X  r4 ~/ T# G, g
        {
: s* [3 `; s! W& S1 z$ R4 c# X                .active_low = 0,
3 j1 c4 M: Y7 u, p$ x  t                .gpio = DA850_USER_LED0,' l: o/ {; x1 Q* n9 H, t- l
                .name = "user_led0",0 k4 h  a! C- ^" L4 a
                .default_trigger = "default-on",
' _- y3 O' v; d1 I! P3 g8 b        },
3 u: Z8 h) s; P% Y8 z) w+ f        {
. w- T- n6 v1 O, d3 `) b; {( Q                .active_low = 0,: i. ~( h7 i: S& Z
                .gpio = DA850_USER_LED1,+ e& r/ j' F% x$ }
                .name = "user_led1",
6 _' i2 C) @+ X4 ^6 U                .default_trigger = "default-on",
+ o+ F" u# L( F9 h$ t" P, Z        },9 P: j0 j. r# R2 h6 i2 b
        {
2 c7 a8 [1 W% w& N2 B# R) y                .active_low = 0,
; H4 Y5 ]/ \1 T* o                .gpio = DA850_USER_LED2,9 }* X- \  Q7 N6 ?( o
                .name = "user_led2",
$ I/ d& V4 C6 K0 o- o+ A" S                .default_trigger = "default-on",
0 J+ h! {/ ?9 x, C* ?' E        },
* g% ~( V8 j& U1 E1 H. p        {
1 g& _% L0 g8 K  ^9 T& n                .active_low = 0,
4 `/ z+ {4 j9 A9 E7 E5 [2 Z                .gpio = DA850_USER_LED3,6 N' R9 H  ^# P! K% T
                .name = "user_led3",
3 S7 K9 b7 `' ]; ^' h, Z                .default_trigger = "default-on",
7 P0 y& C( K0 N# _        },
! ]7 y- U) P) e& r};) ^: Q3 m% Q* L) e+ H" k
) F* E! u) K  e& l
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {0 W4 J) G; D6 b, L
        .leds = da850_evm_tl_leds,6 g+ H) r, F" A- U# w: H, O: U
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
$ h- Z4 A) p$ `7 K* g/ p};
% c& s* N1 e# D" R  s4 D+ m* q# M. ^' B
static void led_dev_release(struct device *dev)$ v8 w1 c. n5 T. G% t
{
" F7 U. }6 p9 c- ^4 Q1 E};/ m/ x1 m* R- B8 D
# e( V7 R4 |5 h7 |2 m
static struct platform_device da850_evm_tl_leds_device = {
0 |0 `1 c, i1 a2 t. X: L( @6 n! W        .name                = "leds-gpio",
8 w. M5 O' L5 E/ B# q0 {/ h        .id                = 1,% [$ n# O3 y/ E0 X
        .dev = {: P! m$ H/ @' u$ {, x8 a  A" }
                .platform_data = &da850_evm_tl_leds_pdata,7 w" B1 p: a. B0 g2 w
                .release = led_dev_release,
/ }3 A, A7 v4 ~! `$ A        }* z/ \) `/ u$ V$ f9 p, d. u" Z4 Y( S
};
$ |7 M  ^# _9 l# F& B% d$ ?1 H1 A
. G* y1 c; B1 T6 Wstatic int __init led_platform_init(void); ~3 G* m# o2 ?" b/ Y/ J' Y6 i
{
! r" E. Z* H( U! ~        int ret;
' i# Y* b0 R- a8 l#if 0
$ Z* P2 j8 F8 L5 z$ d9 r9 S: G        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);, A! O  Z6 J3 B4 E6 O! I
        if (ret)
3 [$ `, J. S1 D+ j                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"+ q- G8 f& x0 n3 G- u% f  Z
                                "%d\n", ret);" o' M, n- z& F" E5 r2 @- q
#endif
7 v+ E- u& _: |# q! U7 S        ret = platform_device_register(&da850_evm_tl_leds_device);* K5 I. }# Z- a4 S
        if (ret)8 k; H9 j& `2 U3 N% N
                pr_warning("Could not register som GPIO expander LEDS");
8 ]5 P! d- b" b5 t6 e" O0 U% F        else
2 A* h2 i' ^: Q# Z                printk(KERN_INFO "LED register sucessful!\n");
. d- o) o0 n6 g: e/ _% n8 T5 Y' \' w" J3 z9 `
        return ret;1 W7 A% \8 `. @! f9 \6 Y; @
}2 g3 K1 i% @# a3 j! A! \- A
, r$ L, G& |  j' z7 e
static void __exit led_platform_exit(void)5 A0 t) a! J% q) Q& U, Q
{' Z4 \! l5 b9 g5 X# R* u+ T
        platform_device_unregister(&da850_evm_tl_leds_device);2 n% w! L. V9 O
" d; Q% Q7 j$ @$ g0 Q
        printk(KERN_INFO "LED unregister!\n");, p% m! [' W1 _0 R+ E3 o' ?6 Y. z+ h
}
, d& Q: G7 v# r0 \) {) T6 D- f- n
1 Z! b$ a( z- |( i1 Imodule_init(led_platform_init);7 M# X  R) v# p3 _1 ?
module_exit(led_platform_exit);' _2 X9 i' l: A/ s/ _* _

* j9 l1 Z) M& h4 a, gMODULE_DESCRIPTION("Led platform driver");% s( E+ P9 s/ ~! T% H6 f
MODULE_AUTHOR("Tronlong");! T: q& P% E9 {4 S2 ]! o7 I
MODULE_LICENSE("GPL");) M  ]% f5 P; b+ K' L
2 v' z4 |* {) u& T1 L- K  l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 15:12 , Processed in 0.039645 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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