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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
9 ]( f, |; G) Z, f  x9 k#include <linux/init.h>
+ G' R+ I4 F' T, W+ z) y#include <linux/module.h>
/ y- n9 R' Y( F% p#include <linux/kernel.h>1 U# v. z8 ~' q0 S
#include <linux/types.h>
1 b+ _. o# k( r. D& b$ K4 y$ j#include <linux/gpio.h>, @* p6 k* D& [, G7 n- J
#include <linux/leds.h>" R% M# J3 E) y! s
#include <linux/platform_device.h>
" j  [/ v+ I2 g* R/ C& S5 H
4 L$ o; K, g1 y# |6 i4 c#include <asm/mach-types.h>4 O9 h* T6 m' {: x7 ^% R% @( o
#include <asm/mach/arch.h>
4 N; f3 w% ]2 a5 O* t#include <mach/da8xx.h>' P. w+ }6 _$ ?+ g) S, c( Q2 \7 f
#include <mach/mux.h>
7 `; M9 x& j# ^6 I, t& T% ^) o  a3 Y* T9 P/ c7 }. P
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)% A- N/ \( u  F$ G. C- R
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
  b0 U& \" }6 A% X4 ~7 h/ s$ U2 e$ e% m#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)0 c. D, J9 S$ r, }3 J( U* D: k
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2), g! H! q, S- D, L6 r) s- e
4 S( m* V2 @5 {7 Z$ ^. T
/* assign the tl som board LED-GPIOs*/9 X; `$ o' u, L, i- }; }- v
static const short da850_evm_tl_user_led_pins[] = {8 U0 ]- {$ e1 P- B* F- A
        /* These pins are definition at <mach/mux.h> file */
' N! p/ F5 l; |% U  `& ], [        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
( V8 q9 Q) c# Q* Q        -1
7 \3 u4 ~+ l. X4 e};. R' J# n. I5 j8 ?) _! r7 B
5 d# Z! {# u5 w9 B. C$ u
static struct gpio_led da850_evm_tl_leds[] = {
5 L3 w2 g, X1 }; t" G0 s' y        {2 h% L9 M( O3 a3 \; T* x
                .active_low = 0,$ Y# A3 @7 K" N, C
                .gpio = DA850_USER_LED0,  c/ N& g+ T+ B6 j5 ~
                .name = "user_led0",
, C: S% \: S% R0 }                .default_trigger = "default-on",
6 u! Y, d; F( K% A1 W' \- U        }," `7 P8 v% Y# z0 A% S5 \. b" w
        {
* j0 H% G. g5 s3 x$ X! N* y. j                .active_low = 0,
7 T6 \. T5 b( J4 @8 D                .gpio = DA850_USER_LED1,
0 f: D3 ]: l9 V8 C. a* b, O                .name = "user_led1",
$ J5 a1 L+ Z7 G+ }% P/ G- }                .default_trigger = "default-on",
7 L3 a! T/ M0 m( S; R: l        },
9 E5 U. ~7 h2 A4 q' S2 ]        {
" q" d. G% m% q: U$ b0 R7 g                .active_low = 0,' L6 O  U$ I: y! q& F: q# p/ `
                .gpio = DA850_USER_LED2,
; j$ m8 y3 U: b. @# ~) b; _                .name = "user_led2",
  W% V% ?/ P8 G6 }% u, L/ Z& Z  k                .default_trigger = "default-on",
/ S- t/ T( P# E        }," O% E, V* A; G5 H  |
        {# P& H. c3 y: b/ _% l4 {
                .active_low = 0,4 N9 q; L5 F6 o2 h  F' L
                .gpio = DA850_USER_LED3,
0 h1 b; T# U7 U' P                .name = "user_led3",
7 l) j! [% r  Y1 m, J$ |                .default_trigger = "default-on",
: [+ C! K8 Y2 X. P" [4 J$ L        },
+ A9 [) p4 w+ |5 @3 y7 r+ X};
& n/ u% g) m: J  N) p
6 b: G# `* i' K7 z+ m6 w8 Z7 Ustatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {1 C0 @) w, M- X8 {4 h
        .leds = da850_evm_tl_leds,$ p) N( w7 g5 a( K
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),2 Y2 Y9 X$ n( }$ J7 V& q
};+ J' f1 s; ^/ p
+ O) z, p( Z) \1 x9 R2 U* L
static void led_dev_release(struct device *dev)
7 M( w5 Z2 h. _0 V' U# M" _; T{
5 ?; m' q$ Z9 {1 A( O* o$ t. {& F$ Q& }};1 b+ A2 n3 R- o2 }/ j& `4 _

, p# G! F* x* Y6 c8 t/ Bstatic struct platform_device da850_evm_tl_leds_device = {8 Q9 W; D, L: N9 |6 l
        .name                = "leds-gpio",
- ]) K8 U) [* n        .id                = 1,- V6 @4 b; J# G/ \$ M% |
        .dev = {
* [1 w1 h7 V: ^, P/ F                .platform_data = &da850_evm_tl_leds_pdata,: h( r& M. J# S2 k9 E
                .release = led_dev_release,
% N' d+ m0 d  M# w1 c        }0 z4 q5 ]* Y6 ]4 ~) m$ S# G8 C: f, [
};# `" Z0 Z3 Z% q) I  r
  b. J" K: z! c1 A( M" C- `# q
static int __init led_platform_init(void)
$ H- }6 a0 I4 u{3 u' c  x9 J+ a8 N' b
        int ret;
3 E" ?2 [  s1 e7 |8 \& Z#if 0
3 d4 P. x  v, |* b2 {4 A        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
: s+ s- S8 E7 n1 Z        if (ret)
. \% _/ p5 q% y                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"; ]. c1 `! w( s2 }4 @
                                "%d\n", ret);
1 O+ w! f- Q, j! ~#endif
. @  p  }& s+ i6 o6 T        ret = platform_device_register(&da850_evm_tl_leds_device);3 K+ n0 s8 V5 z( y. a8 t
        if (ret)
" G6 b" I- o% c( Q+ B                pr_warning("Could not register som GPIO expander LEDS");
. y. \: ~) ~$ K2 |        else% k- [; K$ y: z6 M3 y
                printk(KERN_INFO "LED register sucessful!\n");
/ l& W- N' Y% F7 b6 h
; X3 B1 O+ U/ \( t6 |* L        return ret;
$ h. N0 L4 i5 c% _6 H2 ?}- W. M, q; w. g# f' R
5 d" Y6 ?: ?) G2 `) A5 S3 s
static void __exit led_platform_exit(void)) F! ^5 k! B- m2 h7 N3 B: f
{9 `' I! a# T0 T! l6 e9 ]) w! B4 E
        platform_device_unregister(&da850_evm_tl_leds_device);
  ^, v, a) ?/ N0 q4 [5 u6 Q& `1 |4 o" ?% F, ]
        printk(KERN_INFO "LED unregister!\n");
7 t/ N- Z7 U8 h/ I8 x}
" }! o  i# W5 x4 n
' G! s8 g$ q; t# Q& Nmodule_init(led_platform_init);. B! {3 D& W5 o5 b$ @
module_exit(led_platform_exit);% }& d. K8 h3 s3 E2 K7 W9 \

+ T; {  p  Q; R, _2 ~" r. AMODULE_DESCRIPTION("Led platform driver");9 f2 N; p# l) l& T- _3 ^% _# ?
MODULE_AUTHOR("Tronlong");
3 {8 K. m+ x1 q, R1 OMODULE_LICENSE("GPL");
7 t1 L4 e* J5 x4 X- Q; P
8 L# q7 X) F" h3 P9 g+ a* U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 18:43 , Processed in 0.038907 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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