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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。: n2 b. v; s# m! i: V) g# _
#include <linux/init.h>2 ^$ Q; c3 \( W, V" L
#include <linux/module.h>
$ q1 j$ X: w4 i#include <linux/kernel.h>
: S2 C8 |' _/ M  m5 Z( b8 E0 g& ~#include <linux/types.h>+ v0 l. K, W8 v& E4 E( R
#include <linux/gpio.h>
" Q2 \' ?$ z& f% y& m4 M3 p#include <linux/leds.h>
1 [( L4 b" j1 s2 g" ^# y#include <linux/platform_device.h>
0 F7 p, z4 m+ T$ |% p4 K
& Q3 x8 \* K; n9 F3 l' ~#include <asm/mach-types.h>
0 u) o4 U$ N+ {#include <asm/mach/arch.h>  O& p$ w) b: A) x7 ]! `
#include <mach/da8xx.h>0 m7 U% x; J5 V" P
#include <mach/mux.h>
5 s4 S+ m6 c/ @' z; H
! R5 B9 N" q7 A5 f3 D8 e1 M3 O$ E#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
8 e, `! J" d& x- E+ V3 _+ Y' V6 B#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
9 A) _( j7 f2 f/ N8 b# r. h9 T#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
" |/ L' I6 Y, R/ A9 X#define DA850_USER_LED3        GPIO_TO_PIN(0, 2), `) V* C' U& z% s/ t2 Y6 F9 G- A
1 z9 m0 ~3 q. t
/* assign the tl som board LED-GPIOs*/$ a6 ~& Z& P# r0 r4 L. l8 d4 S
static const short da850_evm_tl_user_led_pins[] = {5 h% q- _+ P% ^8 B# R. k
        /* These pins are definition at <mach/mux.h> file */' V0 `0 ]4 b6 q( B$ C0 F1 q
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,4 X9 k2 ?/ o' w9 y
        -1
1 X# N' G! S5 @1 ]  @# c& k1 y2 _};
$ Y% G! v: u' y8 R2 ]5 P+ n2 e- t) j8 R; k5 D- j* H
static struct gpio_led da850_evm_tl_leds[] = {
% M; |' b% t1 [. T5 `5 b+ g        {/ {8 S0 z1 g" h; L& S6 W5 `
                .active_low = 0,  Y$ x' @6 ~' E3 g9 t' t( H9 H# c1 @4 Q
                .gpio = DA850_USER_LED0,
9 |% @3 ~- _* O. L, R2 O. m2 D6 C                .name = "user_led0",
9 o' @8 [5 H, l: ~# k% b                .default_trigger = "default-on",2 \! z7 n( Z2 f# d( E9 m
        },2 t- L8 ?) A9 ]+ d
        {
" \& l- Z" _+ r' y: ?% [                .active_low = 0,
% R$ c9 v( C! d: D                .gpio = DA850_USER_LED1,
6 \4 c' t$ C  i                .name = "user_led1",$ H% C3 ~& X5 B; }
                .default_trigger = "default-on",
4 r+ Y$ }  x3 C/ h  C8 x        },! l, ?. H  Y1 ?* Q+ j3 U: a
        {
& N/ W% H1 V! L0 Q                .active_low = 0,5 y  T2 }6 D* M
                .gpio = DA850_USER_LED2,
& H. S8 R8 P) P3 }  S/ o                .name = "user_led2",
& K. J  N  }) m2 k) l                .default_trigger = "default-on",
6 s" d; ^$ @& K" S" M- O        },
, a7 t) R& w* h! f        {) Y, q, k( F- s) n  b/ D
                .active_low = 0,
1 Y* [1 c* K* C/ ~8 |" t) {                .gpio = DA850_USER_LED3,9 e4 C7 |/ o' P0 u
                .name = "user_led3",6 ^  X2 J# G, I7 O6 }0 ]& C
                .default_trigger = "default-on",
. d0 x" B7 d1 }  ?+ n% a6 f        },2 r4 a) _; X: E9 j
};& H0 q+ `1 M8 K7 u& Y% ^) u

4 @8 Y7 c4 j# y: x5 f, @9 sstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {. P0 {9 \& s6 ?' a: _1 I  G  j
        .leds = da850_evm_tl_leds,
, ?4 ]1 r0 I3 @& f/ [% E( K1 J' _        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),2 e3 d4 L6 A' l" O0 Q
};! P, t6 o% a! V) Q; q2 w

+ {5 o1 f" @5 i! Zstatic void led_dev_release(struct device *dev)7 \( O: @1 E% d) {
{
; S3 @3 z1 L) E- S! R) @};% O5 p1 P1 t! B4 `1 W3 z

( m' y  x6 ]& l! @) Y; j8 nstatic struct platform_device da850_evm_tl_leds_device = {/ O8 ?& Z1 k1 f2 ^# h
        .name                = "leds-gpio",
% E+ e. A) P% K; e8 _: x        .id                = 1,
$ B: e3 K4 P  e  D( Q8 q        .dev = {/ D) u& N" m5 }! H
                .platform_data = &da850_evm_tl_leds_pdata,( x7 j& L5 ]7 O3 B' O
                .release = led_dev_release,
/ w$ ]* Y/ t. n1 |1 ?5 ^        }
9 ~/ b7 C5 x: A# U: Z  z};
5 T" F8 q* q- V: _/ m' k: G; Z- e- M. L3 ]" p: t9 I) R( d- g
static int __init led_platform_init(void)3 U4 A  J' [0 P. c5 r) `' q$ Y2 G
{; ]) _. P( O! [- w# E" W4 V
        int ret;
  F4 D3 E# f% T" {- D/ w: ]7 s* m#if 0
  s/ G# T1 F% M) `        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);, p. l- [, F: o% C. V" W5 O3 d
        if (ret)) v8 P  p4 r$ `
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
' U9 e' c; ^: a4 R( K                                "%d\n", ret);
' ]( z" \# {- P( L, E! `; z#endif
9 q, U& V& D" A        ret = platform_device_register(&da850_evm_tl_leds_device);; d# E! \% H/ E+ K  P6 U& v$ k. |% M
        if (ret)+ F* t! a2 b7 {3 h# l/ x4 g
                pr_warning("Could not register som GPIO expander LEDS");, y9 g3 Y7 Q5 @6 q9 @# @: g
        else& l: y- D' n; m$ c5 }8 y; V
                printk(KERN_INFO "LED register sucessful!\n");1 ~. O: t; q  w% N2 U

  [' h- W& d5 C- U        return ret;
) q  C, ~# m5 p0 X1 P}+ x! A% N- D) j3 J
" n) \+ s# v7 A. Y- z
static void __exit led_platform_exit(void)
! t! h! [) n. I$ F! k/ o. Q{6 p0 X0 r7 {: f' |
        platform_device_unregister(&da850_evm_tl_leds_device);! U: ?* e; X: l4 n

8 ^2 @$ M7 S0 X/ ~% O$ K# }        printk(KERN_INFO "LED unregister!\n");
$ v! T; }. x. z: ]9 V3 t}
: I. P" p8 b( ]  I& B$ {7 b7 h9 _0 h' ?, y& c7 i& ]
module_init(led_platform_init);
3 ^6 P: ?3 \$ h$ i# O1 Tmodule_exit(led_platform_exit);
/ W# c% k0 _1 Q- }9 s
  q  S# x9 D; V- v) K% WMODULE_DESCRIPTION("Led platform driver");
! B; M9 m) p2 n9 H- U* A) H! p; dMODULE_AUTHOR("Tronlong");  A+ W/ I7 L% z! o$ c
MODULE_LICENSE("GPL");
0 P7 Z- L0 i+ @; F: C% V$ n4 x, X: g/ h3 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 09:10 , Processed in 0.065067 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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