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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。: R: H: ~8 S% V: O
#include <linux/init.h>1 Y( t( r( E9 y0 p- [
#include <linux/module.h>
- H7 k9 r) T4 H#include <linux/kernel.h>
  M- n9 z5 }% [8 n# \! y" j#include <linux/types.h>
9 \4 g# S+ `% ?0 ?#include <linux/gpio.h>) \5 ?+ H, B( M6 T- @7 d& \$ ]- p
#include <linux/leds.h>
4 ^- f0 W) r# D! j  O#include <linux/platform_device.h>& h" _- ?  _) k( M! H0 s! B

7 ^  p5 k+ n3 c! Z* M2 k' d#include <asm/mach-types.h>
2 h5 A3 M! O- y$ K# g( }; @#include <asm/mach/arch.h>; Y) Z5 Z) w  T+ S: X' m4 v
#include <mach/da8xx.h>
4 A! L. [# B2 Y! o/ n3 U  Z#include <mach/mux.h>: G! V' k- C( m1 y+ g8 N

$ V( L! V8 h$ \, s/ R1 [#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)9 r; W3 {$ x) E4 r. S7 Q/ J
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
) E! V1 S% p) Q) a* v#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)+ r* O" A: v& [! C$ t- h; i
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)# |! H5 M' }) }/ j
& i. a3 E& G# w6 S8 w) |: `
/* assign the tl som board LED-GPIOs*/. r& [* b8 e4 N( Z
static const short da850_evm_tl_user_led_pins[] = {# c% j5 C) l. ~# |7 j" g$ g) p$ T
        /* These pins are definition at <mach/mux.h> file */$ p$ x, |3 X+ R7 w; Q+ z, P0 Z
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,2 J8 c, x6 v* q+ b. q
        -1
& i* y4 i" s* r+ i};( I; i! I$ Z+ `( M& B5 {  r6 c
3 E3 v# m! u' l$ O. f( W( @
static struct gpio_led da850_evm_tl_leds[] = {
6 y- k: Y: a- A        {% w% J  S" M! z3 V- o
                .active_low = 0,
1 V7 l, c. h8 \2 k$ W6 P4 d; H                .gpio = DA850_USER_LED0,4 }8 V: u  E' \9 w
                .name = "user_led0",9 Z, O) F  P) U3 {
                .default_trigger = "default-on",
) F/ ?1 U& B1 s/ }9 D) T& b! L3 H        },+ ?6 o$ i6 ~4 e
        {# ^. ], f1 q+ l  x1 x1 V2 N
                .active_low = 0,' C2 A( Q7 W$ ~/ f) L, }2 W
                .gpio = DA850_USER_LED1,$ L2 f! R; l- S" o: D$ c5 h
                .name = "user_led1",, e5 A& _/ ~7 K3 Q( A3 O
                .default_trigger = "default-on",0 g" @# W( @+ ?4 B+ N/ N/ w3 `
        },
: K& P3 |8 A! A* v: g        {9 k2 c3 w' q3 |% r5 B
                .active_low = 0,% M& j4 b& P4 o, |6 A
                .gpio = DA850_USER_LED2,
; f, ^4 T3 Z) Q                .name = "user_led2",
9 ?/ l) ?, }8 x                .default_trigger = "default-on",
* o. `( |6 f  U' ~# q& W        }," O. m2 R9 D2 v& w# p
        {. M/ j0 s' {8 }8 y$ i
                .active_low = 0,3 U. n( R4 ~) @) {
                .gpio = DA850_USER_LED3,+ z% J6 g0 H* z2 J! N9 a
                .name = "user_led3",
! K* S2 |/ u- `6 m: e; C3 {4 B, G                .default_trigger = "default-on",
- |4 B  F+ Z$ R        },6 z5 N9 o+ m9 Y
};5 P% [" I8 }$ l; F; F
. {# g* Y( @. g
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {: v2 C0 g5 W' n9 v" {% h7 L
        .leds = da850_evm_tl_leds,! I+ L) D' \4 Q( _2 h" n
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),/ p/ m5 D. c3 w6 X( ]$ I/ C
};
2 `! _: i$ Q- S& n1 s& i( T. d7 l5 O: W; G3 F( o. I/ D
static void led_dev_release(struct device *dev)/ C( u) Y% `+ s  U" K, O: x
{6 H9 y: o5 B( `0 L) D' x1 M
};  k) c, E1 p/ j) t' u3 R5 N; a

( L8 \' ], m( c) Q; Ostatic struct platform_device da850_evm_tl_leds_device = {9 j9 P7 @9 O9 g
        .name                = "leds-gpio",
% _! u# ]6 l: u        .id                = 1,
! M. q9 F& t3 b2 H) q        .dev = {( D4 f' J/ m0 r6 _% z, K$ h
                .platform_data = &da850_evm_tl_leds_pdata,
6 K/ D9 \: u9 y, O, z( ~' l                .release = led_dev_release,
% z1 v7 O! y0 s4 D' y2 N# {4 P        }
0 f; t4 ?$ G$ c. c};
6 k. o8 i# n7 l
. c. s* Q% T: m9 s' Xstatic int __init led_platform_init(void), y- ~; |; c8 |9 [* D$ N4 \) _
{* J& r! n0 L5 P0 F4 ^
        int ret;) S, Y1 ~$ S8 |8 v
#if 0/ K4 M/ O7 f0 @8 }
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
$ U, d" b: m  e. Q- c        if (ret)* s* [' y5 a2 _0 Q% Q7 A8 O
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"- j. w1 B: v9 m* J$ y
                                "%d\n", ret);* t3 C& F1 B7 i+ }8 s# W
#endif
$ `- T7 X" Z: z+ O- V: o( n        ret = platform_device_register(&da850_evm_tl_leds_device);. r2 S! O/ r& \5 H
        if (ret)% N2 j3 D- n+ b% s- V7 U- D& b3 R
                pr_warning("Could not register som GPIO expander LEDS");
6 d# k* j3 B0 `1 b5 ~: l        else6 q( d; t4 `# ^$ `
                printk(KERN_INFO "LED register sucessful!\n");8 o# v5 A1 u/ j7 q  r

! _) X3 p+ h( `! R* B( A        return ret;. y. F. J0 q  Q# l; L/ Q& n: w
}
& V3 m) I  m1 L6 `9 i- X% Z- D( `- N' N3 G# k
static void __exit led_platform_exit(void)- M% `& J! N8 a- t, [3 v
{
; {2 F* j# f* q- m  b) C) @* L        platform_device_unregister(&da850_evm_tl_leds_device);
6 W9 N& g7 X% w3 l* k; {+ L, U. z6 ~: t2 G4 p4 y
        printk(KERN_INFO "LED unregister!\n");
% G9 u* K- ^- I: q* i" s}
: s7 R6 p# T5 _. z! L+ C5 |6 \. e; D) q7 @8 w" `
module_init(led_platform_init);4 J) K  w6 |. p0 L/ U
module_exit(led_platform_exit);
$ }' Q& X# X, q% k) V, g& t6 A$ p" \: E* n( h1 m
MODULE_DESCRIPTION("Led platform driver");
! W/ H( w! ]1 p9 y+ P4 C, eMODULE_AUTHOR("Tronlong");
4 x" {) z4 V- t2 e% f  o: EMODULE_LICENSE("GPL");/ \) R& l/ H# L

! t/ W5 n& R0 O; k7 t9 x7 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 14:11 , Processed in 0.040263 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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