程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。) A: z3 V$ f& ^1 x% t6 H+ j4 V
#include <linux/init.h>- r9 ~6 ^* _, f2 }. r6 N
#include <linux/module.h>
" u  z! Q0 z5 K% u' ~; K#include <linux/kernel.h>
" O) h; \4 {  t; i#include <linux/types.h>
% ?% Z- `; L, S1 Z# m) q7 E#include <linux/gpio.h>
% t- d8 A1 p0 Q0 P% V7 x# o#include <linux/leds.h>% O6 M) g# x1 b
#include <linux/platform_device.h>
1 Q8 ?6 X8 {$ o3 ~
% l# _4 c* Y" A% c2 r0 h; r8 D7 a#include <asm/mach-types.h>7 M: O# Z7 L! V- B% \6 S8 }
#include <asm/mach/arch.h>
( }6 {8 @9 V& q2 l. V( T' t* g% i#include <mach/da8xx.h>( q+ v: W3 J( p- F) r6 K3 q
#include <mach/mux.h>
  q9 ^7 Z! d  u5 w: E. `% `& b4 R- J: t/ p! L4 I) K* |. b
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)8 x: Z8 U  P: j/ A! E4 V$ g0 n
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
1 ^2 Z( ?% a0 h5 j#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)9 l$ b: L* X8 B/ d$ d0 O5 t
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)/ }5 q( {5 m& F+ n6 `% R
- E5 [2 M# n& A- E! U9 A, n
/* assign the tl som board LED-GPIOs*/  r$ {* Y+ y' V' Y( g$ y7 o  Q) H7 O
static const short da850_evm_tl_user_led_pins[] = {
1 k6 ^- W1 T( i  ^0 y4 c        /* These pins are definition at <mach/mux.h> file */( x  j- ?+ j7 \) J
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,# V2 O; y* v- P) A
        -1
! ~9 S: s( p8 v  v8 h' n8 u};
/ w5 o9 T# x2 V  |' S- X
- N9 B! V* V* U( Dstatic struct gpio_led da850_evm_tl_leds[] = {
9 Y& N/ ?* `6 l  P        {
8 K/ u, {/ X9 a1 b: b$ \- U                .active_low = 0,% k* |" ]2 {6 U; R- X
                .gpio = DA850_USER_LED0,
" P/ c0 G: t2 R% x: I                .name = "user_led0",% `- [' ~. W7 ^% `. o2 h( X7 @
                .default_trigger = "default-on",3 v* n! n$ J' O! M5 B- I
        },8 I# W* R  `% |1 q: U
        {
' a7 F" z6 L# a& }6 f                .active_low = 0,
8 \+ k6 }/ I2 S7 o7 q- ~2 \. T                .gpio = DA850_USER_LED1,0 p, u$ s; G8 K6 n  z9 d8 i
                .name = "user_led1",
) g6 Q$ T0 ^7 _) G7 J                .default_trigger = "default-on",
$ f" Z; x6 d: L; k: n& [+ z: G        },
4 u& M9 @  t! ]8 h        {; f- P# z% p& h; ?% ]: i! z: d
                .active_low = 0,3 r$ \* O3 }- S) |; d- P
                .gpio = DA850_USER_LED2,
$ q& U* n- j2 h7 _4 {  J                .name = "user_led2",4 u; y4 C3 B  t. G7 o; ~6 n$ g! Z7 T" u& t
                .default_trigger = "default-on",0 z4 r  W" [& c+ {1 a+ K' ?) h
        },5 I) [3 N' H1 `. U0 m% V" J
        {
8 A9 B+ q8 i) n7 n. Y1 F$ h$ \. |7 I; h                .active_low = 0,5 N  K7 \, b9 I( N- t
                .gpio = DA850_USER_LED3,2 k$ x3 v1 b1 e; U2 }; i
                .name = "user_led3",) `; a( o0 N2 k' h
                .default_trigger = "default-on",  F/ j; t" _. m: X! C; H
        },
+ ]8 n6 R3 Q2 P8 m};
% X2 c& W/ d, m  M6 x5 T  f" ~+ b7 m- L3 F
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {% L" {) p% E7 o4 w( f) P
        .leds = da850_evm_tl_leds,7 c/ w; x# o6 A7 X5 v2 |
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),* m6 \/ X0 A  ?/ F
};
; _0 M  w7 h4 u' w( m0 {: p9 i2 H: A) q1 M2 [" n
static void led_dev_release(struct device *dev)
7 o" m; F3 J- V/ a{) R* |( [0 q) Z7 V& w9 ~, ~
};
4 N+ @, D6 [8 u$ q9 O9 m0 h
# L7 n& S! ]: J5 [static struct platform_device da850_evm_tl_leds_device = {- k& ]; y* ?1 _
        .name                = "leds-gpio",
" E5 m/ T& i- Z0 O' ~, T3 l        .id                = 1,' c) A6 ?3 A: O% J2 e2 _
        .dev = {9 X% F' Y4 _6 Q. H
                .platform_data = &da850_evm_tl_leds_pdata,- j9 ~& J; Z# v0 X: U# \0 M* I, m
                .release = led_dev_release,/ p9 {( i4 Z+ {- \5 w
        }! T- `% j/ a# s1 _. S3 Y
};9 d5 g8 p# t3 ~1 K

; |3 Q2 G* ~! I, p- W  ^0 kstatic int __init led_platform_init(void). S; n, p# X- C' p" f# j( v
{4 `6 t1 U$ }$ \8 l- A( s( \
        int ret;& `* k% ~( ]3 A3 v
#if 00 K8 S1 g. h0 t  ~' b
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);9 W9 i1 M$ x) Q5 |8 @- Q3 I, Y7 ^
        if (ret)
" H4 r9 l! l: \# q: J0 y% v                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"" N& Y9 k4 }" N% |/ \* \
                                "%d\n", ret);
  @1 _5 F0 O4 M! c#endif2 t5 l2 H, k1 ?
        ret = platform_device_register(&da850_evm_tl_leds_device);
0 j2 _5 Z7 }) P8 e+ K' O        if (ret)
5 o8 {# d2 t: ^3 i                pr_warning("Could not register som GPIO expander LEDS");! T0 L! x: |' C# S8 a2 f
        else
& j) P) V; ^, a& ]/ S0 j% d% W1 n                printk(KERN_INFO "LED register sucessful!\n");
, w- A8 z3 @  W* j7 `9 b# t3 M6 Y+ r: K$ `% G  t/ Q
        return ret;1 J8 ^4 y3 Q! P$ O0 m3 G9 f
}; e, m4 w/ F. H9 _+ `. X% b
' c! v; ~# P4 Y, p! U
static void __exit led_platform_exit(void)
/ l' d  ^7 ?7 D, [5 n) E2 N{* M5 m* s) C- \7 L
        platform_device_unregister(&da850_evm_tl_leds_device);
. Q- J) ]7 }- [/ |& m( B) t
! ^1 x) f5 i, o- h% b. P        printk(KERN_INFO "LED unregister!\n");7 ]. W7 @2 B1 g
}
4 f- f: I3 d" F/ x# Y+ t
# F0 X1 c6 |. r) O! V$ G! l4 Imodule_init(led_platform_init);
# P$ K4 @  g/ V$ U: hmodule_exit(led_platform_exit);1 y  s( J  D4 H+ Z+ j
+ [! K0 C" F( S5 Y. _
MODULE_DESCRIPTION("Led platform driver");9 R6 ]+ i, \% L! W6 k5 L! c' W
MODULE_AUTHOR("Tronlong");# M* U# c+ c- c/ k4 w
MODULE_LICENSE("GPL");
# W+ h* {5 n% g1 @& ~5 h  n
! D; ?& m( u8 N7 Y0 }8 o/ \5 J) r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 06:53 , Processed in 0.037675 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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