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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。4 r* I$ f! @9 P7 l' L- {
#include <linux/init.h>& M/ a0 F4 Q) I7 z) o8 z# W9 U1 N3 R
#include <linux/module.h>- O" H! T+ w; `
#include <linux/kernel.h>
; j$ k. u$ p  l/ L#include <linux/types.h>
7 G, C3 h8 e7 K& x#include <linux/gpio.h>
$ z7 D! w' Z/ `0 b#include <linux/leds.h>
" p3 s! B( b4 R  A5 ^2 A3 x8 o1 ~#include <linux/platform_device.h>! a! M  O+ ~! \9 t, v
1 s. B- `: \" k; p$ F& e+ F0 b- J
#include <asm/mach-types.h>
) K3 ^' o4 K# f1 W- _5 q8 i#include <asm/mach/arch.h>& p5 M" }$ _$ N% {- X$ h
#include <mach/da8xx.h>
3 E  ~7 j" \3 f9 e$ v& V5 C#include <mach/mux.h>
' \5 z  {+ d9 I+ ^6 c- W- j, P% [2 B' Q( M2 h, w0 s
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)+ ^! c" q8 ]% }5 G' q# k
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
  D4 s# y" h% X% k( C( A- w8 Z#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
$ T( E  A% u* d#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
: S# @$ Z6 V' ?& H4 \# G$ y- {3 V( e* q; c% T) c( \# V  [* M
/* assign the tl som board LED-GPIOs*/3 o, N1 |8 y! v" X2 i3 n
static const short da850_evm_tl_user_led_pins[] = {7 L1 @) p1 e+ J
        /* These pins are definition at <mach/mux.h> file */
1 A2 `$ W8 F/ i        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,3 W, f, ^3 }, g& |7 J3 n" v
        -1; p) x' Q2 T3 Z- U
};
  d! `8 l, s" [8 `* j' }7 t" c$ X% J) R
static struct gpio_led da850_evm_tl_leds[] = {
( B$ x; p7 @0 A$ L% y/ X0 D' \        {
. U9 y8 v5 a2 G, F                .active_low = 0,& N: Q0 X. D0 t" [! @7 ^+ t
                .gpio = DA850_USER_LED0,
2 Z% }, i9 \7 d/ A- q+ I                .name = "user_led0",  A- U" |" T" P6 l: v2 S
                .default_trigger = "default-on",. p0 e% v  Q4 q+ i2 r
        },
2 Q" b  \. L- B" s        {
7 f/ Q" z. f/ W7 ]3 a% i5 ?  A. |                .active_low = 0,
/ ?, S* t0 A8 e, J                .gpio = DA850_USER_LED1,
2 e* C4 u0 G: l) I4 t+ o7 M" p2 K                .name = "user_led1",
% q! D3 D" ]8 S  p! V4 z) T) Y% w* d* l5 @                .default_trigger = "default-on",
. u1 G5 ?/ `& o3 V! @" J% O        },
( g2 f- q0 N+ l8 u# Z0 b  C        {3 j. p" X. @% z  a
                .active_low = 0,* O5 G  H% v) ^% Y
                .gpio = DA850_USER_LED2,
! [) X& x! ~0 ]; ~- C8 [9 u                .name = "user_led2",* _$ b9 h- d2 R
                .default_trigger = "default-on",
9 Y# k8 R7 m- t, q8 J: p        },
. F2 D' L; O' s+ `" y2 q9 Q        {
0 `) S, h% u: F, k, U                .active_low = 0,
9 m* P- T- r, m$ V! Z                .gpio = DA850_USER_LED3,
; v6 Y  E1 [  G& o0 x                .name = "user_led3",
" k6 F+ e! G6 d# M$ |( z                .default_trigger = "default-on",
3 E4 C# s; P3 d, W        },
) n8 E# g( B' F0 B6 t};
, c% c4 f8 l: w
" a+ o3 a. V5 L4 Q* a/ C' fstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {% A5 f& X% O- B0 a. t3 f. Y( s1 S
        .leds = da850_evm_tl_leds,8 W- Z  Q( y9 A9 i( Q7 R
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
4 Q( E; f% p& R};
! k1 a% ?- U; Q; w2 h9 Z$ v( `1 b# w, o2 Z: w1 Y
static void led_dev_release(struct device *dev)
$ i: O1 ^& D! {# v* X0 V0 Y{: ?; H6 ?8 n4 k. w5 X
};
- |) o  K6 X+ K9 d- I: b/ f6 O* C$ v
static struct platform_device da850_evm_tl_leds_device = {. B5 V3 }, `8 {3 S
        .name                = "leds-gpio",
0 m( e$ ^+ c8 l1 _        .id                = 1,
; u+ z+ X+ `9 C+ [8 ?9 A2 V& s1 v, \        .dev = {
5 H8 _2 C* |5 Z9 k3 M                .platform_data = &da850_evm_tl_leds_pdata,
, s% z) [+ o, k                .release = led_dev_release,
8 |1 R, R4 m. g; v. B1 `( v        }
0 `& I+ |& i4 J) x. d- X6 S+ G- F};7 _' ?4 G1 C( p7 O6 Q" Q$ q
6 i0 j  f6 }4 m( l. ^( m
static int __init led_platform_init(void)# [% p/ g  P- |4 h! i) q
{) o0 A" ~, {# K3 M% @  S, a
        int ret;
" O+ {# ?# B6 k3 ~; L0 d7 ?4 a: M#if 0
' f" p- E  y) W! L& G0 E) }        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
& L3 b; w$ Q$ P! J! y  [* l        if (ret)
1 y+ _( p& E  J                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
3 L, y! _1 |" r$ S# e/ _/ P, z! a                                "%d\n", ret);( \3 z7 y+ `4 e% p0 H- J7 I1 Z2 C- |
#endif
  u  E! c: }% g& b( g% ^, d        ret = platform_device_register(&da850_evm_tl_leds_device);5 c& A- I/ q/ ^- n
        if (ret), I" V, `$ R" d) U
                pr_warning("Could not register som GPIO expander LEDS");
3 q0 h# i1 q4 e( R' l7 V6 F        else
' S; d5 }  D* Q7 J8 w3 Y                printk(KERN_INFO "LED register sucessful!\n");
1 B6 f. S# T1 `8 Q: r+ e. t
2 P! m  c  m: j  Z) ^8 a2 I        return ret;5 O% C8 \4 D( P% M8 C2 m
}
2 s$ A' G6 }/ n7 u) D* E: y8 |5 z! D1 ]  v, o
static void __exit led_platform_exit(void)! C, \- R2 O5 P$ E+ O+ ]
{5 t- j$ M' d5 T5 {/ C$ U; ^5 C
        platform_device_unregister(&da850_evm_tl_leds_device);
) S2 A1 V6 `* M( F, H0 `9 C
& Y2 P9 V- a: f# ~: g! e/ W$ {0 l        printk(KERN_INFO "LED unregister!\n");" j7 {: \: Y, y' j0 d2 q2 n
}
7 d# R9 G9 H& a
  k  ~* v0 a6 Bmodule_init(led_platform_init);" h# p! A0 e! w1 a4 V9 t
module_exit(led_platform_exit);7 S. E2 }& P. y2 v0 C0 ^/ S9 P
+ @" ]$ b# u% z
MODULE_DESCRIPTION("Led platform driver");6 @8 p8 \, f) d# g- ^7 Y
MODULE_AUTHOR("Tronlong");( q) P+ l9 U) O4 f$ P
MODULE_LICENSE("GPL");+ U* E8 o! _. T2 S
) H3 t# [! _6 r. j- H8 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 04:54 , Processed in 0.038499 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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