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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
! l* q# v, G1 ?) H) U2 _#include <linux/init.h>* a, R* f/ }+ D8 D  U* n
#include <linux/module.h>
+ y: a* O5 i: o; O9 @/ d" E#include <linux/kernel.h>( ^0 i) l7 B; H. j0 o
#include <linux/types.h>
8 m4 j$ B% D0 `: x/ T* N#include <linux/gpio.h>1 B8 Z: x% c$ @
#include <linux/leds.h>
3 x4 B& w& T3 l! n! c#include <linux/platform_device.h>' m& ]& f9 T4 t
8 E1 O2 B( r0 K1 C
#include <asm/mach-types.h>
' k2 K( j4 A, s% c8 w( c( Z' E#include <asm/mach/arch.h>  @, u: q# V: r  k# v$ y/ @
#include <mach/da8xx.h>5 c5 \7 M5 B. z6 U9 q
#include <mach/mux.h>, ^. c3 E& c5 d5 h
1 |" p6 P8 M8 u0 y  y
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)% [' G: u" X% F' s) I4 ?
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
5 Y% N7 b$ x- U$ }* s* Z; k#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
! `: j& m2 E6 D3 ^) D#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
- t& [8 Q, B1 O4 I$ b/ w& m! R' r9 x
/* assign the tl som board LED-GPIOs*/5 m1 p# w1 Z+ D# [+ f% M. H: x1 r
static const short da850_evm_tl_user_led_pins[] = {
) |: q% J: N# u- v3 k! O7 U( O        /* These pins are definition at <mach/mux.h> file */3 u; Z4 O6 @' x' p$ }2 \
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,9 \" m' V& y) l3 e
        -1
  ?0 }+ L0 i3 A/ x};
' A; ^' z2 s, a9 ~9 F2 ?
) E( H" r  x' \; Cstatic struct gpio_led da850_evm_tl_leds[] = {1 S0 v! M+ m& ?: w2 B
        {+ l5 p, }2 |% k' L
                .active_low = 0,3 o% S& q& h% X( p/ i: S: O( L9 S
                .gpio = DA850_USER_LED0,. j) O8 F1 n( ~* l) k# d; ]3 b
                .name = "user_led0",
+ p4 X/ s0 A1 y/ b6 z$ b7 U                .default_trigger = "default-on",
! L1 @, H) K( z4 M0 T0 l6 i        },
3 z8 O, N) _! F+ y: T2 h        {
$ E3 |0 t% u! M3 k! e* P& z                .active_low = 0,
* ^+ E/ s& ?! z                .gpio = DA850_USER_LED1,
0 y* _7 y+ l) j4 E+ |5 i- e                .name = "user_led1",/ H. v7 N- ~1 I! Q0 Z1 r* ?
                .default_trigger = "default-on",9 g8 I2 {9 a8 E% [
        },
' X0 k* t% d+ L+ o: I' X        {
( I6 u! v- O3 s. V: ^                .active_low = 0,2 A# E: Q# l0 F3 \6 y. [
                .gpio = DA850_USER_LED2,7 ~. ^0 f4 g7 }6 W1 f  y
                .name = "user_led2",  f; `8 b' Z5 |' L2 ]+ @4 S' i
                .default_trigger = "default-on",
& n1 C& c6 n% |( J3 ?  x" n5 r/ q        },5 l- U/ e6 J) L; V" k+ x- o1 R- D
        {
3 a9 k) p+ F7 J8 W5 C* ]3 @                .active_low = 0,8 Q8 T3 @  @" ]8 q4 P$ ?
                .gpio = DA850_USER_LED3,
: I$ h. c! E1 k2 J                .name = "user_led3",/ f7 \' D6 o+ l/ p8 W
                .default_trigger = "default-on",1 p7 Q, S: V* Z2 M% u+ A6 D/ X
        },
, [. ~8 v# W5 @% P" I4 h6 c};
1 r% s1 V9 _2 D( i+ J4 B+ U+ h8 V: {7 x- }- y9 a& P+ T. e1 e: l$ c
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {* |% S. ~! T8 g8 u% b/ P- ?
        .leds = da850_evm_tl_leds,
3 r$ G/ O7 X, t6 a+ H! H& Y        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
, J: `% h$ h& F/ J( r; p1 n2 A};
1 ^6 v. t/ E; r0 ?# [$ @. M7 H' S4 C3 U# f
static void led_dev_release(struct device *dev)
  g  _* I" w$ `" z{% Q+ y7 f1 s7 H1 q9 V5 D+ f" y
};- a7 Y" Z* H, O7 V
. D' L$ I' A; `9 l: O
static struct platform_device da850_evm_tl_leds_device = {' s+ Y, g; _$ H! f
        .name                = "leds-gpio",
0 t3 t& }6 h, V7 ^        .id                = 1,
" q# a, A! g& U/ E6 A# I0 y        .dev = {
( E) @+ k: }( f                .platform_data = &da850_evm_tl_leds_pdata,# }1 `% K. r: r8 Q: D" u, x8 {
                .release = led_dev_release,
0 c& l9 N3 U6 w3 h        }
. B% `3 A$ ]4 Q$ z  @};
9 }" ~$ d3 S; e( [% z: ]
9 T6 |; j* T0 a0 y$ ?$ @! gstatic int __init led_platform_init(void)
. _1 w2 t, l1 ]* _- h{# r6 Z0 @9 f+ U/ |1 d& d; B% W
        int ret;
/ W& @. h- b. v+ k% e- t2 c1 ^) Z8 j#if 0; o# V, @4 ^& G
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);' J2 y; Y( k4 L
        if (ret)
# v" J: \( Q) p& k4 x+ l                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"* I( k; C0 B  S' f* |0 D
                                "%d\n", ret);
8 n8 c/ U3 @, b% w+ U2 ?/ Y#endif
+ {" W# m9 b, Z' ]. ], V4 S        ret = platform_device_register(&da850_evm_tl_leds_device);
+ q8 w1 p; I+ f+ M2 ~' l1 I/ x        if (ret)
3 X( Y& }+ D# u! k& Q8 Y4 R$ i                pr_warning("Could not register som GPIO expander LEDS");
% b. |4 v( |" c7 X- B8 e& ~        else0 `# n) J( M! P+ L% E% {% g* i9 N/ h
                printk(KERN_INFO "LED register sucessful!\n");
/ m4 P( w% z& M) {
; r9 k$ W6 ^7 a1 U        return ret;( f" T% A* K; j" `" v
}7 b/ k% F! k! c% P9 U! F

! h/ T0 b# p1 W& Y" \static void __exit led_platform_exit(void)
% ~# n5 M0 w! D6 v9 a  ~7 c# L* C{% A* v! Q# K& E) q5 n( D* B0 Z* g3 A
        platform_device_unregister(&da850_evm_tl_leds_device);, J( z, ?1 k9 D' m$ E5 o3 {
+ |- i8 Q* n1 ^  _! n! E: C
        printk(KERN_INFO "LED unregister!\n");: X) _7 M1 Z7 _
}
9 v  s  y( P# m- p- W; f, x. t# L1 S5 y3 Y. V2 J
module_init(led_platform_init);# U+ k! k: |5 n, p7 D
module_exit(led_platform_exit);
3 z- @! F9 R' J( l! {3 U2 M% ^
. o9 w. D  N; S4 L" U( C8 lMODULE_DESCRIPTION("Led platform driver");
3 y8 y4 _4 [* Z# m9 LMODULE_AUTHOR("Tronlong");0 R' |* V, x  H5 D( n' F$ E) x
MODULE_LICENSE("GPL");) X' T, }- w7 K6 p: b: e
0 b  `' a, _) J5 n, K0 u( \& Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 19:29 , Processed in 0.039120 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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