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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。$ V+ l. ~& q4 V1 f# V5 @8 ^, Z
#include <linux/init.h>
* n5 l! S' H, x+ m6 h* W#include <linux/module.h>+ Y4 ~) X4 G( L; }
#include <linux/kernel.h>' u' {9 v; @! K; F: B
#include <linux/types.h>
5 w& w) {8 x0 c#include <linux/gpio.h>& [' m3 c1 ^# x
#include <linux/leds.h>. p* j4 m; ^. A2 z' w0 Q, K
#include <linux/platform_device.h>
; V, ?1 b: G$ r" X6 H9 L7 v0 l& {0 g) a+ t2 N- s# O, _
#include <asm/mach-types.h>
" t( u) z0 j- [/ K6 x#include <asm/mach/arch.h>
) c7 F5 j; ]* K* d; G#include <mach/da8xx.h>! `% f" r4 n/ f; X% o
#include <mach/mux.h>
) j: P4 Q7 F! e; f) K8 u1 V2 |9 t0 L# _0 u& L! y& A" Y0 x
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
" n5 l8 m9 |# ^' J$ y% ^1 ]& j#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
' s( `4 K3 o) u5 I) d! s, v#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
; c5 {- R5 O5 \2 s4 W* _7 P#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)- y' H# @  ?% R. L

" `' l3 ~- O9 I; j: f% _/* assign the tl som board LED-GPIOs*/3 i, a9 f' T3 v( _- v8 I
static const short da850_evm_tl_user_led_pins[] = {; ^( K8 i4 |) |  {" T: b5 \  A
        /* These pins are definition at <mach/mux.h> file */
" ?7 M2 v0 I6 w: }        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,3 D4 |! J) _9 l% I
        -10 v, y+ Q. V; C1 I1 s
};  L, T$ i* N3 Y5 i9 j

: T# C. n% S" n6 }8 ?3 ?8 b& Ystatic struct gpio_led da850_evm_tl_leds[] = {) l4 c8 h' |0 T; W7 u& M5 A
        {
: i, M  F1 t  b7 J$ Q5 @                .active_low = 0,
! j) A& g$ N' _3 c                .gpio = DA850_USER_LED0,' L3 A, U! k$ {% O& ~' D: |: p
                .name = "user_led0",
) ?" p* p: t; o- O( V& E                .default_trigger = "default-on",
( i1 s7 m2 F3 a6 s) L! S        },- j( U- H! n- D7 A, {
        {  Y. X* v, s& [" L, L- t. q
                .active_low = 0,7 u! E' ]4 }+ j' Z+ k
                .gpio = DA850_USER_LED1,$ X* c  Q% M! {! G  q
                .name = "user_led1",
9 |* p! n7 h9 M+ b7 C2 L                .default_trigger = "default-on"," x) O' a8 J; C* S
        }," p; L1 d! `) d/ Z& q( z
        {
. b2 K4 h+ M3 V0 O- F/ o0 v5 @                .active_low = 0,2 X6 q+ d0 q! Q
                .gpio = DA850_USER_LED2,
3 @' {" G* x5 K+ g- l- E" N% o- n                .name = "user_led2",. S/ M" u/ S4 R# L/ E
                .default_trigger = "default-on",
% ^& b, `+ f. @4 y9 p        },
6 h$ X! h! W$ T        {
' P5 t6 f% \9 U7 B1 ]& z8 b; f9 K% G                .active_low = 0," u" R# b" }# M* J* H2 t- d
                .gpio = DA850_USER_LED3,
& U. O/ g' x/ f" J' E                .name = "user_led3",3 v8 h. |; J' S3 d
                .default_trigger = "default-on",
( K9 D0 ^9 A! j        },
' m. z. y5 l" I. c};
+ D- p' o1 `- g9 K# M: J3 \" ?3 v+ X8 a8 M
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
/ \: j- y" v! U4 T& s" r        .leds = da850_evm_tl_leds,
7 Z; y( h7 X8 V. @' o5 A; f        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
. x( C: t5 h1 _* ^, t/ n};/ F9 d8 o: O  k+ I! y
' E/ L; r# N$ \" {1 `8 H
static void led_dev_release(struct device *dev)
; p! {. P( K% {{; e7 Q# U% q1 `
};
0 q. f6 I" ], ?
% O4 m  R2 I2 @( fstatic struct platform_device da850_evm_tl_leds_device = {
& w  A: x% q& s( ]9 G        .name                = "leds-gpio",$ i2 g7 ?9 R/ z" o5 ~! V
        .id                = 1,
; w0 B0 t: p) Q/ |0 |        .dev = {
' r+ P4 c, Z1 P% N/ b8 ?: i7 }                .platform_data = &da850_evm_tl_leds_pdata,
+ X' @$ g) x4 e                .release = led_dev_release,
8 f5 B/ U, ~5 o4 {+ P3 f        }% l; J1 N0 t7 I$ q
};9 E3 u2 Q7 X; B2 S. W( T6 Z9 H$ M2 N! g
2 L) J1 Z8 r* l  y) }- V1 P
static int __init led_platform_init(void); v2 \8 z/ [* x, d) _/ n
{
6 D7 |( U4 |2 ~# L. m        int ret;
6 L4 S3 ~" D6 S1 h8 f$ m#if 0( Y6 O  J2 U6 \. I
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
( t7 s) @4 K& v& T        if (ret)
9 X0 j. }' q- s# u& I. c) r                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"/ |. e& X6 Z: ~( c: \
                                "%d\n", ret);0 _- ^; i- l( O! m" f/ K& S
#endif# E8 ]0 A. D7 R, J! l2 ?6 F$ `
        ret = platform_device_register(&da850_evm_tl_leds_device);- J9 `0 F1 B" g6 o
        if (ret)6 P: C" `4 s% e; R' f0 c, Y: l. B! P+ V
                pr_warning("Could not register som GPIO expander LEDS");
: S; A; v, d/ E; X        else1 e2 D3 ?% w7 \- c% W: P, D# }
                printk(KERN_INFO "LED register sucessful!\n");, `3 E! Q6 X% E. k* z) r

6 A* Q5 s5 K* K0 _. |  M/ R" p        return ret;" n7 z+ P  i7 R6 n
}
) b( U- I& d2 x8 b6 s9 @1 g' @/ t% p; O0 ?8 Z- q3 _4 u" R
static void __exit led_platform_exit(void)
- F: x$ C9 N$ [% a, V5 z' u. ]{  A# b! h0 C# v" p7 E1 f" l
        platform_device_unregister(&da850_evm_tl_leds_device);
$ `7 F  b9 Q4 m' [# p9 @
* x& {+ a8 c$ x        printk(KERN_INFO "LED unregister!\n");
- Y: J8 m% r  W% r) a. @! _7 ^" v# e' ^}
) ]: R0 D, A) ^% g9 |
2 x5 f" L/ g' y1 [( p: L! T/ tmodule_init(led_platform_init);! X( Z0 J+ V5 y% S
module_exit(led_platform_exit);
) s7 @4 d6 B  Y0 ?. v/ ^6 u
% s: q( W( u: p4 j5 v- f$ LMODULE_DESCRIPTION("Led platform driver");, U+ {3 ?( D+ f6 ~
MODULE_AUTHOR("Tronlong");
' Y, d7 B+ M- SMODULE_LICENSE("GPL");
4 T* l0 r$ _" F+ i; H) U" K) J+ O8 Z- l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 23:38 , Processed in 0.040624 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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