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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。# X" I6 g* G; W" Q9 ~
#include <linux/init.h>
9 X! V  F- U6 J! b; M#include <linux/module.h>
' ^5 ?6 Z& _1 V9 v#include <linux/kernel.h>; `3 O  r  b! G) f1 F
#include <linux/types.h>
; ?/ r/ s  q, K5 r#include <linux/gpio.h>
% W8 \$ k& E* e5 D. r#include <linux/leds.h>8 T% d# r9 W) u+ v
#include <linux/platform_device.h>
9 o/ j$ ~4 d3 J& ]& a; m4 ^2 _: j, d, T3 @7 {1 ]) Q
#include <asm/mach-types.h>6 ?) R( X" H; k
#include <asm/mach/arch.h>
5 H) J4 J  j0 i& A9 e( Q0 V#include <mach/da8xx.h>. i0 s0 ^6 p) q9 z$ `# r. ^
#include <mach/mux.h>
* w; l% T- O9 z* D2 [0 h0 p$ Q0 z5 m4 R! E6 F; w9 `% v# L7 i) U
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)/ l3 a/ U( k5 P4 C8 m+ H
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)* h+ z# f- d1 F0 A& e$ j  _
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
1 u: u% v) ~! a* l4 s$ w8 x#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
- ?8 Z& O! s$ e" o* p. e$ @& o8 p% S, a; t* L: j
/* assign the tl som board LED-GPIOs*/! H5 \! f) G* f! t: n
static const short da850_evm_tl_user_led_pins[] = {
4 R' ^& A. V3 n( }. M, y        /* These pins are definition at <mach/mux.h> file */0 m% d( ^) Q+ p$ @# J$ u$ Y
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
  J+ H' }+ P" n9 }' Y' Z& {        -1
0 q5 y% s% x% @) }; L5 }9 ~7 @$ l};7 e8 w# J1 y" h8 z
$ r* Q* t  }0 g+ z6 x
static struct gpio_led da850_evm_tl_leds[] = {
  J, r3 X& O) e3 `; w/ _        {5 |: g" Z# G8 I, d* Z
                .active_low = 0,+ F/ _8 m: D6 ?! j! A6 v5 ]
                .gpio = DA850_USER_LED0,
  C4 k* l0 {# H: C- u1 B4 `+ b8 g                .name = "user_led0",
3 x1 T5 c$ ]3 Z                .default_trigger = "default-on",( s* D* }3 x' g  u  L8 i
        },( Q" U2 i+ ?4 `/ C
        {
2 G6 m' W2 V- E3 u5 ]( R1 N0 a! N1 }                .active_low = 0,
* L  }& P8 B5 S1 v4 L4 b, u' H                .gpio = DA850_USER_LED1,
+ S1 B+ ~% _! r6 Y. y1 {3 [                .name = "user_led1",0 y1 j# x3 Z9 u7 f4 ]/ V+ ^  k8 k2 h
                .default_trigger = "default-on",  f8 d: A# G3 e& m6 G/ s) {
        },
5 [0 e: K  k4 k- I        {
( w! Z2 P2 R' \' ^                .active_low = 0,& d" S) l7 J. a; d/ y
                .gpio = DA850_USER_LED2,4 e) t5 n% x3 |# B( J
                .name = "user_led2",; F3 h6 F: s* G( {1 j& Y3 U
                .default_trigger = "default-on",; n3 P9 n* [% [4 f) y  ?: ]4 G
        },4 e9 B# h6 N; X+ r, E0 @2 K1 ?
        {
; s' u: H; F# u1 r4 J3 q% `                .active_low = 0,: {8 I3 s2 U4 I
                .gpio = DA850_USER_LED3,
8 g) S$ t1 c# S                .name = "user_led3",1 H  U" `+ h8 j8 ?8 ]1 @  n
                .default_trigger = "default-on",
* t2 e' ]# ]. F! U2 ]6 c0 A( V        },* M: ~; M/ x" V3 @0 R  W
};- ]" h8 n+ C, d, B+ j" D- Q# u
( S, T7 w- ~3 Y; E2 d9 u
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
$ c# {5 \* g9 `: O1 J7 T! M        .leds = da850_evm_tl_leds,' W0 |3 J* E! x0 x" [
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
/ W7 R7 a6 B/ j. M};- n3 N: W7 z. A2 T0 b3 w" a7 d2 g

8 m, D5 @. E6 h, p% estatic void led_dev_release(struct device *dev)) N& B$ Y! M" O# N
{
! T% W- p1 {9 q) ]};% E; o8 z) i% p1 J9 r+ y. t6 P

% _2 C: t& V8 ~3 A' a% Fstatic struct platform_device da850_evm_tl_leds_device = {
" f+ N+ u1 l* i        .name                = "leds-gpio",$ R) p* m: G: m+ B, f  G
        .id                = 1,/ ^4 s( P: P/ n3 b" W. F
        .dev = {
2 ^( U5 M' E  z; I5 z$ D" i  O                .platform_data = &da850_evm_tl_leds_pdata,0 ]% M5 y% g# v+ S# o. x7 i# y5 D) a
                .release = led_dev_release,
* P# u0 _; O, e( [        }& X/ w  G% H2 ^! G( Q6 A; u
};) h" `* Y: ^( j0 N0 o
, F0 a  ]( Z  a; {4 I
static int __init led_platform_init(void)
; E) K- b7 @+ e{
* ~' f6 t: a" ?$ r        int ret;% S6 _# A( Q' B/ V- z4 V( ]0 a: T; A$ j
#if 0
  [0 U# n" @. F+ O        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);) m8 b+ S- V( v+ l. t0 `2 u+ I% P! k
        if (ret)+ r/ W, P- _; f- w3 A8 o8 A
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"$ F: j$ ?* t/ |0 l
                                "%d\n", ret);& S4 A# X2 H# Y& \1 {
#endif
! U7 c5 ?3 L1 i: V" w        ret = platform_device_register(&da850_evm_tl_leds_device);
3 ~# [( U# Z4 K6 o5 F# J$ z        if (ret)
  _% X; M7 B5 _7 T2 H. p  F                pr_warning("Could not register som GPIO expander LEDS");2 h; M2 y5 O! b# _( v
        else7 M/ x6 Q( g& L
                printk(KERN_INFO "LED register sucessful!\n");0 ?2 }3 q! m" a" `1 N$ X* r. C% ^

- g8 B/ X  U2 K8 n. N& u( a        return ret;
7 W. q; e3 G& I8 n& N# e0 s* d( b}
) k( |/ s( z/ r$ U% R2 Q
9 ~0 m/ Q! f$ V" ystatic void __exit led_platform_exit(void)
' d0 `( n/ ^' x8 U{
$ X7 _6 N# E5 O3 {: ]! d4 N        platform_device_unregister(&da850_evm_tl_leds_device);
7 G6 ~- D# ?9 {5 U* _4 @( e4 B
- D( O& f" j7 _7 h- Q        printk(KERN_INFO "LED unregister!\n");
3 W( `; r  |$ p: e}( r& W  {0 Z+ ?' S
- J. |' @( I: r4 w( e* x! ]+ q
module_init(led_platform_init);
' U' |5 G- R+ v4 @3 ^$ O  o9 J2 ^module_exit(led_platform_exit);
" s/ p9 C9 f1 ^
7 e8 y* G+ |& [MODULE_DESCRIPTION("Led platform driver");
* T% j0 R/ J7 h. z) I4 x2 K6 C3 w$ wMODULE_AUTHOR("Tronlong");
# d% Z! R! `* Z0 x1 c8 pMODULE_LICENSE("GPL");1 m! F$ k7 h- g9 S% s

8 G. P4 x$ f8 i+ m# E+ [9 t- H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 11:56 , Processed in 0.038868 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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