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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
9 e$ A4 L4 A9 f- j  p# \! Z#include <linux/init.h>- v# c4 O. n. F0 c1 E* O! Z
#include <linux/module.h>
6 k! C4 u4 B% Q9 m2 H#include <linux/kernel.h>1 K0 n& u% }* v5 l" M
#include <linux/types.h>2 J  p9 c- e4 x4 F+ Q& v
#include <linux/gpio.h>6 J) v7 u) ^3 R* M: ~
#include <linux/leds.h>7 S" \, S! m- S
#include <linux/platform_device.h>
! P( S) |/ [& n, v' h
' q8 P( m# p6 @5 Q& }#include <asm/mach-types.h>
$ ~5 c2 B! Y: @1 Z( ?7 ~#include <asm/mach/arch.h>0 q9 U- y* r2 B
#include <mach/da8xx.h>% |; Q. R- v8 S
#include <mach/mux.h>
* A; {4 e9 v+ Z8 \
8 n1 o% R0 Q) N#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
) B" t# K4 }8 L" R#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
' {! n" L1 Q; Q) `% Z#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
9 [; [' X9 {, p/ J" `6 H2 F#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
! e7 B. Q% |% @2 w5 a5 D" ?- b, N+ }( I( Z7 m% P$ Y
/* assign the tl som board LED-GPIOs*/- K4 E4 V7 o* y
static const short da850_evm_tl_user_led_pins[] = {
* b6 q5 H6 o8 k( V7 ]# }0 n0 @        /* These pins are definition at <mach/mux.h> file */' R$ s- }( y2 b# O/ x
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,) S+ b8 R3 l4 ?% h, E2 e  V3 M
        -1; I$ a9 J% ?0 a0 P9 z4 }; w9 {
};
, h& H% o5 E! B! X3 a
1 Y. R' q# u/ @7 r# V. @4 kstatic struct gpio_led da850_evm_tl_leds[] = {
. O' |) i  [$ I( U+ D$ S        {
1 |) i; |; c7 f, I0 [                .active_low = 0,
. Z, S' M- z$ v) s9 K                .gpio = DA850_USER_LED0,- A( T1 Y) W7 R9 D2 I
                .name = "user_led0",4 e0 c% v/ ^# b+ d2 F
                .default_trigger = "default-on",
- p: a0 {3 ]4 x2 `+ j6 a, N4 n; w        },
* O. c* a6 |1 j3 b        {# y& r- ^% X- @; Y, L: l1 v
                .active_low = 0,
  r" V! `& r3 f, H$ Y7 j                .gpio = DA850_USER_LED1,
2 N2 D- M0 J9 D# k8 b8 A4 q                .name = "user_led1",
7 J* j( N; y( r                .default_trigger = "default-on",0 z0 h3 P; j/ [& s, ^
        },
) U4 |0 K3 z+ ?, ?% I% K        {
: S- Y$ s: b$ m# f                .active_low = 0,1 t1 O# d" g1 |# O9 ?$ k  R: F
                .gpio = DA850_USER_LED2,5 q: y% Q4 g' M# U+ \. s. z
                .name = "user_led2",
( Y/ O9 j3 t$ @) m                .default_trigger = "default-on",
1 H% [% d& j* O        },
& I4 m* g- b* K) A; R5 g) r1 |        {
4 ]6 @5 H$ B, Q6 x# m7 ^  i                .active_low = 0,
& ^1 S+ L3 I' I" o                .gpio = DA850_USER_LED3,
) a  O+ ^) R8 Q: A                .name = "user_led3",' U- [0 U/ D) p
                .default_trigger = "default-on",: u6 S- M( ]: V9 m
        },
2 p: O8 x0 P9 `% b, C* H};
( ]; Y4 Z3 R- I( j% C2 `8 Y2 `4 m* g9 D5 ~/ U; t- t8 K; v  f
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
8 Y0 w7 z9 D3 z: d6 L! e        .leds = da850_evm_tl_leds,+ j# y! l3 x3 c1 w1 Y2 \5 a
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),; s' g0 m0 _' E. A
};$ R: P$ k: Z9 D" M# ~2 s

9 R. M8 d: F, C' ?/ xstatic void led_dev_release(struct device *dev)
* y) d: V) o; N{
% A, S/ |: h0 y: O% n};
1 y8 @; t* ?+ L3 e1 p
& S; p% I# p7 H: ustatic struct platform_device da850_evm_tl_leds_device = {
2 |" V4 r; f$ L4 _2 ~5 M        .name                = "leds-gpio",
# v6 f  q1 |$ \+ U# U- Y        .id                = 1,1 s6 z& v7 T/ ]/ D
        .dev = {/ ^$ ~5 ^& W6 }* F5 \" }
                .platform_data = &da850_evm_tl_leds_pdata,2 g# T* |7 S! U2 W6 c
                .release = led_dev_release,
' v( t9 m  k0 h+ b7 S( E# y        }
' q, G( c# P5 \1 O- I};
) S. a" r$ ^1 k$ I/ d  S* q8 B# N
static int __init led_platform_init(void)% N0 A1 E& o& Q  f& d0 G
{6 k. F( M* O& @
        int ret;" _  L: D1 Y/ b$ b0 Q( o- S
#if 0  T' r2 X- f( M- K3 c
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
0 c0 a& V" ^3 e: U8 f  N! S9 A        if (ret)4 z+ A: D: u1 [2 Q' S
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"- b+ H+ x3 j$ n( J8 M( f
                                "%d\n", ret);
6 d$ ]  N6 Q3 m" w1 O#endif7 F& i; F. ?; f# f
        ret = platform_device_register(&da850_evm_tl_leds_device);
8 L* |; T6 F  o        if (ret)2 a* @+ a+ T  I* P% F
                pr_warning("Could not register som GPIO expander LEDS");
/ h1 v7 ^5 l6 v6 [! U+ t6 z' ]        else
- ^% X1 b3 Y4 \0 G* W# k7 A                printk(KERN_INFO "LED register sucessful!\n");
9 y$ G# U5 q1 b+ f  J, Q' W- N$ m* d9 e7 H# g
        return ret;! B- |7 b0 t, Q
}; O6 G: a' j4 X5 E. w

  w1 |) r! [+ p2 cstatic void __exit led_platform_exit(void)
# @. \/ G& V  Y, x{( Y7 e; J5 E5 {! p- Z  H0 W
        platform_device_unregister(&da850_evm_tl_leds_device);# U: W1 |9 U8 F; |5 R7 W
' N9 g, J2 y) h3 z' l1 H! f
        printk(KERN_INFO "LED unregister!\n");3 g% @3 T% Q* [0 ]+ b
}2 N3 r6 t* V" t6 _2 K; [4 ^3 b8 \
/ _8 c5 [* v8 M9 K6 h7 n
module_init(led_platform_init);7 J  h  s, v$ e9 `, D: Z% Q
module_exit(led_platform_exit);
6 h+ v( q4 Y: }9 W, R- K& l* ~1 `( Z3 _9 K( S+ [
MODULE_DESCRIPTION("Led platform driver");/ ~7 D4 }% S+ Q7 S2 Y
MODULE_AUTHOR("Tronlong");
& n3 j+ C7 e* g6 I% fMODULE_LICENSE("GPL");2 f0 Z) L2 a& |+ v! k% r" G
' }. Z: ?8 ~; o5 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 19:51 , Processed in 0.039850 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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