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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
8 S0 w6 u* r8 r- i( ~0 \. F#include <linux/init.h>
% d0 l1 f' d: `( v#include <linux/module.h>& |% u/ m2 _/ a( `2 E/ W
#include <linux/kernel.h>: {- j& l; K* Q/ O7 t1 c. E' o# l
#include <linux/types.h>0 V2 U+ k+ E' }5 e. o  d
#include <linux/gpio.h>$ X. L$ ]1 |; U) ^4 m. c6 Q
#include <linux/leds.h>+ y4 I6 |0 q3 \7 P' ~
#include <linux/platform_device.h>
& k. q( k1 J! a8 f
3 y& Z( |% {  Y% B# t3 Y9 ^#include <asm/mach-types.h>
4 R$ Z# X0 \; |. c5 e  x% p6 x. |#include <asm/mach/arch.h>- h* \! S8 b  `6 \+ N/ Y
#include <mach/da8xx.h>7 D  O/ n: c& O$ t# v" V
#include <mach/mux.h>
5 E) `5 Y. J3 h+ B& v! R2 E1 c
- t3 X+ \7 {4 y#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)9 X3 K" B  U4 [: [) F
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)" I8 m. j- r. s$ V
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
" W- R+ a$ _$ K8 F$ j" |#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
: C  h+ |3 x8 \& V( e
9 B+ }+ }7 ^- `8 T1 E$ S/* assign the tl som board LED-GPIOs*/
6 B; z; U( s9 ?$ w  A/ |1 ostatic const short da850_evm_tl_user_led_pins[] = {. z+ t) [5 O' ~, s
        /* These pins are definition at <mach/mux.h> file */- I5 z% {/ m. ^* J
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
2 w2 M9 N1 H0 O! y9 ?        -1
; ]. H  z- e: p};
) D3 c- {# G0 H* h9 a" V
( m2 ]$ F3 [2 @, f: w  r2 wstatic struct gpio_led da850_evm_tl_leds[] = {0 J% h* ?: x: `8 N
        {# ~  R; j6 M! Z% B4 k2 M
                .active_low = 0,
; ?3 G' i, ~0 F) g: ]- z/ {                .gpio = DA850_USER_LED0,
, M, A9 I' ]* D                .name = "user_led0",/ g' |( U9 @. N  q
                .default_trigger = "default-on",
! ^- [& j7 R1 I$ [! w" D! t5 F  {        },
" A- E/ I/ r+ G' w0 L  Y! G        {
3 g- s7 S* Y1 \$ J5 U                .active_low = 0,
" g* E* X# T0 W$ r+ @                .gpio = DA850_USER_LED1,
0 H" p0 i7 z! I6 M                .name = "user_led1",/ e. ~1 I, s6 L* z+ G% `, D% O
                .default_trigger = "default-on",
, U0 `! E! A/ p$ ?, {6 h3 V2 o        },
" R% P  ?  h( j4 ^. q  u        {. {7 y7 Z8 w/ N2 \$ \7 t) S6 Z
                .active_low = 0,& Y* V% `" q6 a8 p
                .gpio = DA850_USER_LED2,
: P8 i. @; Z7 L5 E0 Z2 Q                .name = "user_led2",
2 j9 _& z* k: n7 j- z                .default_trigger = "default-on",
" d8 L* [+ O  C; n/ H- {8 Y7 E# J        },
2 z# |! D! M/ M. z2 s" T        {* ^4 e/ o; R( Z# |; `+ S
                .active_low = 0,6 E% G" T8 b: Y" {, G* C* C& ]+ d
                .gpio = DA850_USER_LED3,$ U) S) T% Y  p/ j1 |: E- l: J: h' f
                .name = "user_led3",
: @9 P7 l, J5 y6 A& P  ], c                .default_trigger = "default-on",% A. [5 H, m. U7 c  l6 U* \) |0 m
        },
6 h" x6 r. I- Z};
. S2 C% s0 g3 d  n0 ]* R2 ]- ~$ ~
9 Q; f) o6 B9 y' `static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
2 o2 p. A! T, v        .leds = da850_evm_tl_leds,, o( t1 J- I. s2 X+ h2 V
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),- r5 [, h$ j5 x: ]; j, r
};
3 C$ }' d* m, E% k; C+ I# H3 a; C' i, o
static void led_dev_release(struct device *dev)% o0 J# G5 ?4 g- }. Q5 {5 \
{
% _/ K  q/ c7 O};0 @$ Z: K5 q. w* m

7 P& v; V: }1 J" C1 p/ s6 hstatic struct platform_device da850_evm_tl_leds_device = {( S; `8 r) G4 d3 q
        .name                = "leds-gpio",0 q- u( M' P8 U  j
        .id                = 1,
  R1 c8 Z" L: d2 Q! K        .dev = {
4 ?" X0 s. B1 W7 I                .platform_data = &da850_evm_tl_leds_pdata,) S0 [9 l' r( J. q9 J
                .release = led_dev_release,
1 j" a7 X1 d" R8 Q        }
2 B! }" @9 q7 h5 F$ I};& d$ B8 F7 C1 V
% @, A/ }5 k& {  e7 Y
static int __init led_platform_init(void)
: p" u! Y8 V0 L* B! v  l: O) Y{
) |5 o7 m( o# D8 N/ x; o        int ret;1 a( y3 w' Y( @; j9 N
#if 0$ i4 a8 Q" P- E* m' B
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);8 |" F# m( f0 f! O
        if (ret)8 @! v- l4 j* W5 F) l
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
7 v0 `, n# h5 a( d                                "%d\n", ret);
5 ~! W% n% C7 \1 i; v, q! K$ I#endif
0 W, M% `$ Y6 k3 B# g3 t        ret = platform_device_register(&da850_evm_tl_leds_device);
0 G+ j# W' }- U3 }        if (ret)8 P7 Q  {( u% v( y! z5 G: o$ j
                pr_warning("Could not register som GPIO expander LEDS");
& J3 [# Z6 i: j; `& A* K        else
9 [/ e+ a+ X2 W                printk(KERN_INFO "LED register sucessful!\n");
, A$ M- i3 y# j( t$ z
# P# Q- R* Q5 T        return ret;5 u, X, y/ w( I* T  l
}
2 h# \* j& v9 i' E% g1 L, C# C  l
/ P1 w4 c# X7 _. J, dstatic void __exit led_platform_exit(void)
2 m. Z& D+ d7 u; i, x{
% J$ T$ q: h8 m4 L8 s2 `6 Y        platform_device_unregister(&da850_evm_tl_leds_device);) D/ ^# i' s# D) h
" f) l" H7 Q/ f" F
        printk(KERN_INFO "LED unregister!\n");
# v. N% A  c! m}
- f( M; N: H/ H4 u, H4 l& N9 I( ?; u0 C. H
module_init(led_platform_init);
) r, w$ I) I% }8 U' Gmodule_exit(led_platform_exit);
9 }$ s$ V$ Y, p! f
3 a" m. Z* m5 W8 a; yMODULE_DESCRIPTION("Led platform driver");
' F. b3 b! D( U5 u$ d' YMODULE_AUTHOR("Tronlong");
4 @2 J$ m- C6 s0 C* [  v" ]MODULE_LICENSE("GPL");( Y( K$ [. V& `0 E8 |

5 a$ D' ~0 G3 }% }$ _8 h6 d; J$ h, H3 O3 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 14:23 , Processed in 0.058620 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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