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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。9 g1 D( P% t: a3 {; Y0 a
#include <linux/init.h>
% S, [2 E' l( R2 A5 l#include <linux/module.h>  g- z9 S* _- r4 m
#include <linux/kernel.h>) z* r5 @/ ^+ z# Q1 q; u/ l& B! i
#include <linux/types.h>5 ?$ ~# B: d: s
#include <linux/gpio.h>
- b* V$ \3 Z& w$ S# e* y: V" V. ?#include <linux/leds.h>% G/ }" P$ i# j$ L
#include <linux/platform_device.h>  F5 m2 Y% t3 e; f5 ?. b
4 n9 k# i; e2 J8 i
#include <asm/mach-types.h>. H; n0 A) ]& d! |2 X- h8 ~
#include <asm/mach/arch.h>
1 y9 C7 `( U7 f' o#include <mach/da8xx.h>7 I: O) k/ _* l, Y8 y6 F; T
#include <mach/mux.h>
; I  ^+ T' u- ^9 m' O5 }. C% K$ W
9 R6 b+ @4 Z% a$ S( I0 ?3 D7 j#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
2 T9 h7 [* C" Y4 L8 f  f/ P9 |#define DA850_USER_LED1        GPIO_TO_PIN(0, 5); H( T# b7 q& n% e2 G
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
0 Z8 Y4 V0 \/ @# Y0 f, Z' B#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)- H5 x) P& D# N) D" x

: B3 ~8 @! n& u5 d" H8 x: g/* assign the tl som board LED-GPIOs*/
/ U. w+ u' A. _4 g6 i3 d7 p6 Vstatic const short da850_evm_tl_user_led_pins[] = {
, v& b; Y' `5 j* I# i5 I3 F        /* These pins are definition at <mach/mux.h> file */9 g# R0 d( t6 e  p
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
: j7 u8 N$ s% j$ A* T( h        -19 Q0 l$ V' [5 I# n9 d" x- K
};
5 b; \+ M% p3 V, I
0 s7 l$ G) P% N- V* q7 J9 bstatic struct gpio_led da850_evm_tl_leds[] = {: k" ]* y4 [# ~- P5 C; g0 t9 b
        {3 o% {5 \% x, I7 Q6 g" e
                .active_low = 0,
& t! S4 u9 B9 }- }! N1 F                .gpio = DA850_USER_LED0,
+ \- P  p1 _* @( H                .name = "user_led0",
& I5 s! z$ g' [                .default_trigger = "default-on",
8 s& y5 Q% {) x2 w( t8 j        },
& O2 G, _& P2 w$ h$ N/ \5 O        {, r6 J/ `" {; `: x0 F7 \
                .active_low = 0,
# z* J5 h1 t0 n+ E( p' G6 ^                .gpio = DA850_USER_LED1,
$ S& w! P" S; Y: z                .name = "user_led1",# g8 ]* \6 R; f8 y; i- n) {
                .default_trigger = "default-on",
: e, a4 Q% e8 L6 b* {/ J        },9 y' h% p& `" y! R
        {* k- r# u, W  v
                .active_low = 0,
3 X+ b5 \0 m  }5 j+ p                .gpio = DA850_USER_LED2," I5 M& l& j2 H( l1 c& X7 Z8 f- G0 ~
                .name = "user_led2",5 C7 L$ {. L7 h4 C: z% G" N) L. c* ]
                .default_trigger = "default-on",* C1 Z" w& ]8 t
        },
: T( M  [, S0 U% M        {
9 S0 i5 s. b: L& B! s- k) j                .active_low = 0,
8 S3 U' B8 v1 z5 S. A% i                .gpio = DA850_USER_LED3,
6 l$ O4 L1 v* k9 W$ h                .name = "user_led3",! n* [6 M9 D6 Y$ T% Q
                .default_trigger = "default-on",
. u' C/ \& L/ F* O- g' W8 ^        },7 D( F7 G  Z6 j3 X1 J2 d" b
};
/ R; R5 y& d1 I+ R% j
: r/ D7 G) @- Q4 sstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {, ]* A7 N9 B) }8 u: f6 `$ r* l
        .leds = da850_evm_tl_leds,$ O9 {6 ?) @8 Q' m* K
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
2 z, B  Y. q5 E* \' |};
, i' X/ I% K0 B4 r% ?7 J  S0 b7 W, U" [9 z( j8 `1 H, r' t
static void led_dev_release(struct device *dev)
" j* g9 T" h! V  G: P# V{, m% ~, o. z5 h* Y3 H8 T, Z' [9 s
};9 X. @5 M4 _. R( _# f# H

+ s5 P  H5 U, U8 [; W0 Ustatic struct platform_device da850_evm_tl_leds_device = {
% @2 z$ X" t& j1 d: s, V        .name                = "leds-gpio",
* F7 C& e* @) ^' G* `        .id                = 1,  C! ?0 F" ?2 F5 _, ?4 t6 c
        .dev = {( Q  R0 ~3 p! ^$ ]  h2 B( n" B, t! h
                .platform_data = &da850_evm_tl_leds_pdata,
2 X. A4 ~) I) D3 r                .release = led_dev_release,9 n" e. p  F0 _4 c5 M8 x0 m4 `
        }
. T/ i9 V, l. C};
  _1 x$ L/ r, E4 M( b, V4 Z8 X2 _9 V  b% c( K& i
static int __init led_platform_init(void)
" X. ]2 e* K9 @3 n% M" |* K{
; Z7 e/ h  n+ L6 @) j        int ret;% |- F2 r' q1 K2 v+ q# g
#if 0
: V& S! [$ {6 s6 r        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
0 k3 h' t  Y2 K# h6 ]- y7 G        if (ret)% `2 B% F, ]* @9 b( R6 Y0 I
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :") ~; Y' z, P: o& D. [
                                "%d\n", ret);  C8 p6 J) X) _8 `) O
#endif1 G, V* R, `  x" p0 @& t4 [
        ret = platform_device_register(&da850_evm_tl_leds_device);
. O" I' \* S* N1 J/ O        if (ret)4 z, e  J; w) b& D" F. T6 N
                pr_warning("Could not register som GPIO expander LEDS");7 y, _9 A4 ~' I
        else
3 m+ D8 O6 k5 }( l) x- \! @1 t                printk(KERN_INFO "LED register sucessful!\n");
% U' N- ]" Y4 y4 J- [$ [; ?3 K+ o$ J( Y; O/ [: l* y& H( q
        return ret;
" h' F( B* x  s; c/ k% H2 V}- R/ @4 E8 o" r
" ]: o6 n5 t1 U2 b! P
static void __exit led_platform_exit(void)$ Y* d1 C, m& G. P! H
{. D3 T7 p* J. c3 R+ o
        platform_device_unregister(&da850_evm_tl_leds_device);
  W. V8 B9 z) Y0 i
$ I  M+ I7 b: B7 l5 D        printk(KERN_INFO "LED unregister!\n");
0 K# p* z+ J' b. M}& t. W- n9 b/ u! j. i6 B% @: Y( f$ C
5 f0 V. I, ]( ~  B, p% z* T; w5 b
module_init(led_platform_init);" v! p# ?' n8 v: E0 h: `
module_exit(led_platform_exit);
, B5 w* [% f. i& l: l1 C" u# s' @, Z: n# P, j
MODULE_DESCRIPTION("Led platform driver");
& D  H; j. d8 K0 V% o/ [3 tMODULE_AUTHOR("Tronlong");
5 h$ i9 T% _4 U0 F2 nMODULE_LICENSE("GPL");
8 q( e, J; N; ~4 b; U9 w' \
. f- R3 j) l  `7 f8 e$ K4 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 20:48 , Processed in 0.038643 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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