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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。! A6 a7 Z- i9 m) y+ ?
#include <linux/init.h>3 F1 s) r) e% w
#include <linux/module.h>
4 N% a% M- H" W* ]4 C! K- U4 S#include <linux/kernel.h>
( D/ \) e% E5 W% B# r/ I* s' n#include <linux/types.h>
% _% P% Z5 G* i. C2 W#include <linux/gpio.h>2 U4 I2 y# v) F5 C" d& M
#include <linux/leds.h>( o* y' ^* b( w+ @% @) P  f" _* A5 R
#include <linux/platform_device.h>0 c! u/ F7 g" p& C  N

4 v/ J5 n% d) \" D' i" t9 ^#include <asm/mach-types.h>
  Q2 m% v( e% m4 I2 l( V5 {6 R#include <asm/mach/arch.h>- w7 f% x/ j+ i: Q! c* l
#include <mach/da8xx.h>8 W9 r2 H: a$ Q' N8 ]
#include <mach/mux.h>% @0 F9 `7 t9 ]; t; m: R
% J$ k9 B+ y& H; ~# v
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)2 P0 u* Z' ]# k2 P9 E
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
% @( }% [. p% n* o3 ?' I#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
0 c) k" ^2 _5 T- q#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)6 G7 p% p  ~& p/ c# T8 {8 s

8 e; E. a4 E  z/ ^- u! E3 X6 o/* assign the tl som board LED-GPIOs*/$ b: M, N7 ~" F8 c2 F7 {
static const short da850_evm_tl_user_led_pins[] = {
/ Y  l( D1 ~2 `: k* \% d. M, [        /* These pins are definition at <mach/mux.h> file */
) E2 D. O; E0 G        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
; s( I/ c/ x8 g1 o        -1# M7 A) N, B( Q2 [+ J6 M* s
};
! |' S! c5 I* L5 l: y, l. @: G& w# d% c6 v
static struct gpio_led da850_evm_tl_leds[] = {0 n# D2 {) k, ^. i. e
        {
  S2 n' V( v/ M% z0 s( g5 W' S                .active_low = 0,
" ~! a2 M# J9 T/ v, N' i/ }& s2 c                .gpio = DA850_USER_LED0,4 K1 O8 o# t' s3 A1 u! z( J
                .name = "user_led0",# M" R& p& x4 H# G& C8 O
                .default_trigger = "default-on",
2 S* M: `) b) K$ |7 }* P. f8 p        },. h7 V1 `* o. \% r: v, U! X
        {3 a! w/ @0 H! O/ Z* S2 k
                .active_low = 0,
2 G1 h3 r: W6 }$ ]                .gpio = DA850_USER_LED1,
+ F+ Y. G/ @4 [- w6 l: u                .name = "user_led1",' ?0 x) r# [/ a( w
                .default_trigger = "default-on",2 h- X0 M( P& m  Y/ A  j' F' K
        },* o, T/ k4 X. _8 l/ ^
        {
% @; F- c6 s2 {% e1 ]                .active_low = 0,# x- Y& D: p" P; s% X
                .gpio = DA850_USER_LED2,
: K4 _* I1 a6 {  R8 U                .name = "user_led2",
% y0 J" j. Y4 c/ a" u3 @, I# G                .default_trigger = "default-on",4 ]% {2 U4 N2 x. Z/ q( N
        },
& T8 D, H+ s, V( K        {
! n; W3 q1 A( v! W/ U4 l. b* `                .active_low = 0,' d' q$ H6 b( q0 ?- h# |! z
                .gpio = DA850_USER_LED3,2 r, A3 Y2 f( s+ B
                .name = "user_led3",
- b5 E; o  R# x# Y0 J2 d                .default_trigger = "default-on",# g: t9 O/ V; E) n# m
        },3 r7 I; g0 o: O2 r  W
};
! U( j4 |. ^$ Q% m: |* y( U# k! a7 j* p
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
# t7 a4 T7 K$ S- w$ ~$ I        .leds = da850_evm_tl_leds,
9 R9 v, T; `% z        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
+ \! x) ~% M( d2 p8 N};
9 x4 `  O9 Y3 S! e
1 ]* H* X0 c# w- F3 A: L: R* mstatic void led_dev_release(struct device *dev)
1 _4 u- g* o* o4 D3 n/ {{( r, h- N) F3 E: w/ Y7 ]" }: s% X
};
+ W2 R0 u; }, X' c+ a1 ?6 \
$ j( d( n& n0 b, E* R' k; y2 [static struct platform_device da850_evm_tl_leds_device = {
. C: k( u' ~# w/ B        .name                = "leds-gpio",
  @# c8 f. c$ N) H        .id                = 1," Y+ V5 ?/ Q- x$ k
        .dev = {
7 t9 ~3 a. C4 x7 A9 @* @/ S                .platform_data = &da850_evm_tl_leds_pdata,0 z; A+ w" s! j' l& _
                .release = led_dev_release,
7 j% ?& H9 }9 t' l; j        }
) Y$ c8 n( {" m5 c7 x# J0 u- X- ~};
9 e2 A' o: u7 E/ J) n7 ^: {9 ?6 K; ?1 ]7 f+ [
static int __init led_platform_init(void); b* i" u& y6 U6 u3 `( Z
{
2 S+ D+ [# {$ J; {        int ret;# a3 S' |3 ^  I
#if 0/ d+ i7 ?  g/ G# f% u
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);$ S0 s2 _3 c- ?; `# B; D
        if (ret)* u. Y. ?; E" \- b1 Z
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :". M7 W7 _  j! N0 f/ p" _: ?+ J9 B
                                "%d\n", ret);
1 A9 k0 E# \2 h5 s5 @#endif3 o% Q" ?8 l/ o2 f0 \5 s* a& L! f
        ret = platform_device_register(&da850_evm_tl_leds_device);* ~- H, H, f4 O8 t) Q( x9 L1 t
        if (ret)
4 c9 r- Z/ L. v9 e8 f' e3 U                pr_warning("Could not register som GPIO expander LEDS");
% z6 c/ K( \: H5 H- C2 ~8 Z: S        else
) `: D# l. `0 G3 D                printk(KERN_INFO "LED register sucessful!\n");) i, f6 x  s1 [7 x' y
( ?% l# Y0 e! G% X7 s7 ]
        return ret;$ b, n9 A5 B) K( T6 E: `9 S
}! Z% Z  P, T: y+ f# [3 A* M0 @6 O
( D8 I9 u' j, O1 U6 F) e; Q" D* T
static void __exit led_platform_exit(void)/ A  c* n! H5 N2 v3 b
{
( ]: B3 m4 u  n+ o" ?        platform_device_unregister(&da850_evm_tl_leds_device);
: y+ I( x  W" W$ M5 j2 M/ l: }7 P8 |; }1 J9 B2 Y
        printk(KERN_INFO "LED unregister!\n");' f4 ]' H  d: Q
}
$ R  k# {" y( c7 {5 d( d& T/ e+ q& ?! k! X1 r+ @. {
module_init(led_platform_init);
. i8 z- o3 _. g/ z4 omodule_exit(led_platform_exit);
# R, F- B* @: g1 ~( {' e) H3 X% d
MODULE_DESCRIPTION("Led platform driver");
5 F2 B6 M5 c* j5 VMODULE_AUTHOR("Tronlong");
4 W* P) y: a2 a8 g8 Y8 x7 ?MODULE_LICENSE("GPL");( }' q" k& x$ V+ x  G% \( T& }- N

6 X5 N/ i# [; W# [' w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 22:42 , Processed in 0.046802 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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