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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
* s* G5 h( U/ @#include <linux/init.h>7 Q4 b* b+ E& m' e2 a; Y
#include <linux/module.h>, ]% ^7 t, ~8 ]
#include <linux/kernel.h>
7 G. a1 @4 ~) @8 M* c& Q#include <linux/types.h>8 x# a- a3 Q8 @. E  G$ T& Z& \
#include <linux/gpio.h># G$ n2 S. B, W1 B/ Q% o* m8 ~: c/ u# i# M
#include <linux/leds.h>
+ d; j6 O1 P! Z8 @- e#include <linux/platform_device.h>
% B. ?& \8 N$ t' W
- {3 C. H( q$ d6 t; j7 I#include <asm/mach-types.h>- S# F" o! L# s* R5 P# s' M2 A$ @" y" i
#include <asm/mach/arch.h>, i& @- e( ^8 q  U$ C, b
#include <mach/da8xx.h>
7 @' R1 E  O/ n1 m0 t#include <mach/mux.h>
+ p0 x' s5 u' `9 `9 x0 M
% E, G  I6 V) [3 @#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)& g1 Y2 `* |5 Q) F
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
2 X% W/ x8 ^# J3 m( A4 j9 Y#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)* j% @: N* \, D  R! M  G
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
5 q* E# k; ^  w8 G+ _" L$ X# J- F4 x4 W. U7 j
/* assign the tl som board LED-GPIOs*/
0 f; Q- Y& D8 D, ~0 d) Q# cstatic const short da850_evm_tl_user_led_pins[] = {
# m+ h/ k- ~' Z4 ]+ z. E        /* These pins are definition at <mach/mux.h> file */( `/ c$ R+ s9 w" [; r
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
1 h$ B* J' c4 h" C" u        -17 E( U5 O- L; f. W+ l4 {
};  X, V( p4 _" N% n7 ~. x. O, u

5 X3 K) q' X2 D4 }- ~static struct gpio_led da850_evm_tl_leds[] = {
# H& x" P2 M6 |' K) s: x        {
- S$ @  @9 W! I                .active_low = 0,5 c1 r( t, ^  o& A
                .gpio = DA850_USER_LED0,) u/ v- T4 X8 w5 h2 e
                .name = "user_led0",; N1 j' v# I. a  n) S' Q4 B; x' l
                .default_trigger = "default-on",2 Y9 d( o) ]2 G1 C7 b$ l
        },; f- a) o8 J; J; U* d5 o
        {. j, y0 O' S) d; f( T
                .active_low = 0,
# }4 T  M, Z, i0 [/ e6 O                .gpio = DA850_USER_LED1,# T" z& P; ~, J5 Q/ l6 b, n6 L- s
                .name = "user_led1",% \. G" R: U% f
                .default_trigger = "default-on",' h# N& C/ l2 X4 x$ W
        },
# x8 E  w4 M4 v. L2 `9 g        {+ h0 \4 u% V7 ^/ S; c9 ]3 `* K
                .active_low = 0,
) I' o5 _2 C5 Z                .gpio = DA850_USER_LED2,' W+ a0 V3 K4 |) y# C# E
                .name = "user_led2",$ x, M% D& o/ f  ]+ z
                .default_trigger = "default-on",1 b4 g& N% c3 U) d
        },
% i4 R2 z- W$ {2 H8 C        {- P- K! H/ X: s& K8 l* i# X
                .active_low = 0,
' n/ o+ e3 A6 h/ K% s8 E2 e/ k+ v                .gpio = DA850_USER_LED3,
% K& m1 s# w% T. h) S! x2 ?1 W" \! `                .name = "user_led3",
, i1 Q+ s0 ~% s                .default_trigger = "default-on",
: z6 Y' i, A1 D6 g        },
; f0 H8 D- J; J/ r1 N8 z( x};6 a2 d5 F# V/ O) d$ |) ^8 `

0 K+ Q! D- v# n9 s9 i( ?static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {, a9 f/ x9 o' R2 Q, A0 E
        .leds = da850_evm_tl_leds,
# t, \  b" H% a9 s$ W$ R0 k% z        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
0 G9 h4 ~, V- C) f$ X2 |};0 s0 V8 m& x6 F2 X
2 G6 u2 N5 V4 Z# r* t2 Q5 F* b
static void led_dev_release(struct device *dev)+ `. K. }) f1 C0 {( z
{5 t+ T9 n8 ^9 k/ _! c4 f3 D
};
! Y2 z- u6 H; S5 ]( r+ c. M0 C3 O/ J" z1 L4 n3 g
static struct platform_device da850_evm_tl_leds_device = {
7 u( ]& }( ]" `% O# Z        .name                = "leds-gpio",$ g9 p5 o6 N% Z
        .id                = 1,
9 t5 H/ \' o- X6 t& M& L        .dev = {: `: F2 {" {6 D9 a# g2 c- r* a6 ?
                .platform_data = &da850_evm_tl_leds_pdata,
, ]) e8 a0 Q3 E1 L* W# _$ c: r                .release = led_dev_release,; \9 Z  G8 x( t; R5 _# I( j
        }, b4 _* m7 w( d; L" Q! y
};" E9 w) s$ o- A6 B2 F; R
& f2 ^- ?2 `6 `# Z/ m6 w" A; d& _# f
static int __init led_platform_init(void)( @& G" h9 ]/ e9 Y, {' i
{
) d5 M2 @# k8 x0 _        int ret;
3 Z. Y# n1 n4 U6 U) C& B#if 0: y: t" d: ^' Z8 D) w6 u/ j
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
4 E! b7 g$ |" t; B! v. @0 [6 }$ m        if (ret)# O# `1 c& {1 y3 Q# u: x5 I- ]
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
4 x! C, y' A, T' \" f                                "%d\n", ret);
- Q: E$ @8 d: ?1 B8 p1 H#endif
& S7 z: f& w6 h4 m. |- N; r) u        ret = platform_device_register(&da850_evm_tl_leds_device);
( b' L+ b. G  v) H        if (ret)
/ X7 H9 E: g! n0 p3 L) k. D                pr_warning("Could not register som GPIO expander LEDS");
& ?) \2 a3 A1 Q# O1 n        else' Q) R/ ~" V  e5 F3 D
                printk(KERN_INFO "LED register sucessful!\n");3 e; f+ i2 p  x: S# G' j

5 i5 [! _7 i) |7 @: w0 E        return ret;
! I% N8 P4 n! l$ L! \! d* l4 A}: W9 k+ ^2 z% d( U

7 w( y1 @5 t- K( Y0 \static void __exit led_platform_exit(void)1 j6 h; l  z/ i, a5 l
{* {: ?! p4 u" J3 n. h
        platform_device_unregister(&da850_evm_tl_leds_device);; s0 w3 C# P5 Y7 q
0 C  l" s: x& f1 ]  M& t* E
        printk(KERN_INFO "LED unregister!\n");
, D/ e8 U$ V+ T/ T( W7 s- @}
# U! J2 F( y; d0 N
, M7 _  B/ X/ ~4 cmodule_init(led_platform_init);- ]+ i' ~* x% q0 F, f7 h# K8 \* L9 g
module_exit(led_platform_exit);
; f# Y: H6 S+ Q1 W3 a1 V9 c$ `7 S9 F+ N# t. j
MODULE_DESCRIPTION("Led platform driver");
9 ^& y( ?2 s0 r7 v6 P3 lMODULE_AUTHOR("Tronlong");
& A2 }/ H% H  uMODULE_LICENSE("GPL");
! A' G, p1 i0 v
: y" k# p! ^3 ?6 ^; F" @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 07:23 , Processed in 0.038901 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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