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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
/ `7 X# Q7 c" n* Z% V* C% b#include <linux/init.h>
9 G- @+ P2 p0 [" I( K5 M7 {" G#include <linux/module.h>
, u$ Y; E( N  m7 ^) u% v7 p8 C#include <linux/kernel.h>
" b! m( r0 K9 h5 N  a$ t1 q#include <linux/types.h>. x5 |" j% ]4 x$ E* O, g( \* w! J
#include <linux/gpio.h>. d; s! C) h+ ~) t: T
#include <linux/leds.h>
& H5 B8 L+ L! O% t#include <linux/platform_device.h>; Y' w% U8 a) Z9 s# Z

1 j' Q! e  X: K#include <asm/mach-types.h>+ [0 {, A4 _* ?1 k1 Z; e' V
#include <asm/mach/arch.h>
# a/ z% U3 d! x( d7 W7 t% }#include <mach/da8xx.h>
- b3 @# @: B7 Z- b! u- g' h4 p. H4 K#include <mach/mux.h>+ Z0 q. d9 z$ F4 Y/ @& [
! e  n" J* Q1 J* r& \- `
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0). g4 d- K1 r: A
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
0 W  W: f( N4 G6 P/ `. `#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
0 B  K4 K9 z) N; P& d#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)7 p; J5 {) h+ e1 g3 c) c- A

7 V( C7 Z+ N, Q8 {) C/* assign the tl som board LED-GPIOs*/
6 P- q# {/ H4 V+ K" u; m# tstatic const short da850_evm_tl_user_led_pins[] = {1 }' v# k+ ~% h. f" `
        /* These pins are definition at <mach/mux.h> file */8 y; a$ |% p& C  k9 O% m; u/ K
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,, u0 X7 u# _( |3 d" Q1 D
        -1* A6 b8 z3 v/ B4 f5 f: ^8 r& @4 w# q
};: i, N4 t% a: {4 Q' }! x: S

5 l. }; p7 {: O3 R9 |9 istatic struct gpio_led da850_evm_tl_leds[] = {
# \* c7 `  }! V9 l+ w+ w! F        {
: U4 o2 p2 V# Y; Z' L                .active_low = 0,
9 R# g, h9 ^/ N/ @1 J+ Y                .gpio = DA850_USER_LED0,
2 S$ ^( e( J6 y* `                .name = "user_led0",
, D: Q7 q- U2 B                .default_trigger = "default-on",% f6 l, j# @: N0 k& o/ |' I* y. G
        },
, @3 W( B% q( N. h3 v, z9 H1 B        {; K: Z  s! Y+ a. X8 ^. H
                .active_low = 0,
: M* N4 J5 V& @7 k  s2 c5 i                .gpio = DA850_USER_LED1,0 l! E: n, L& o1 @$ x5 ]
                .name = "user_led1",* n. D* S% ^* e1 F8 V
                .default_trigger = "default-on",: i- i0 R9 b4 Y) A
        },
, z5 O0 p/ s- p  `6 o        {
9 w4 n* R4 o! a$ y                .active_low = 0,
- ^; _1 M5 C4 Q  z                .gpio = DA850_USER_LED2,
. |1 W) x9 h" X# R                .name = "user_led2",4 t- H; v- S  l% f. x- J8 ^
                .default_trigger = "default-on",+ C8 A) Y2 ^* _' ~! M# Y7 U
        },# R9 G% T. E2 n6 I' ?. k- k
        {% g* o2 o' }6 X2 [' H" E5 ~" [% T
                .active_low = 0,) K. ~: k1 ~# e6 D
                .gpio = DA850_USER_LED3,2 r/ t7 J. x" c3 X9 B
                .name = "user_led3",! ?8 r6 V  u. f6 L; d# @
                .default_trigger = "default-on",
+ N4 N1 ]0 ]' M6 k# W- a. v) j        },( x. |% D6 Y' o  H
};
6 c2 l/ h% N3 F3 t+ U+ e+ J, O' a) F4 O7 U) B" U5 v* |! W
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
+ X& }) j* D3 w6 H        .leds = da850_evm_tl_leds,
. }  ~  F/ V6 h* S        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
3 V+ M* |5 a/ x4 P8 K};! n1 w' R) F! r& E  F3 G/ z6 _( U

: f" S1 F  x5 q  N* J, W/ q& Ustatic void led_dev_release(struct device *dev)+ ?* t1 m) A4 I
{% A% H3 h0 X" `+ l0 x( A: u, g
};
$ R5 Q9 q- a9 Y% _0 O. g. I  d) f+ q( q9 |
static struct platform_device da850_evm_tl_leds_device = {
, V& q$ v! _4 k- i% O5 D        .name                = "leds-gpio",
2 n- h+ x, r5 L9 Q$ ]' H3 ^5 k. s; ]        .id                = 1,  k" B5 V) g+ [' K# \% l2 [# h
        .dev = {
3 `- e* v# I+ x& X6 @0 D8 \2 m2 x                .platform_data = &da850_evm_tl_leds_pdata,7 y8 W( d2 Y, Z3 T$ Z5 o% \" `
                .release = led_dev_release,+ j# E8 l7 J7 \5 q
        }
' n; ]! o, c* x+ S4 g. h1 P};
8 r# k2 G( a# c, p3 K' B; C
; m1 M  t4 `0 G/ E- B- @% j( A6 z" xstatic int __init led_platform_init(void)
6 W9 C, Z' o% X2 U% o{( t$ C6 H+ _9 s* ]/ i( s7 q0 k
        int ret;
$ |' U% a4 v. u/ \#if 0' }5 J7 v6 L# E) m& q
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);/ Z) [% N1 N* N2 V$ U* E& u
        if (ret)
. y! U  j) @& J" s8 q                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
: H, u" V) l, v+ e                                "%d\n", ret);6 w) ~' A3 J$ t3 T8 ~
#endif
: }+ W. e6 }# F) _: e) R        ret = platform_device_register(&da850_evm_tl_leds_device);, A; f8 f  P+ Q! m# d1 j+ C1 S
        if (ret)9 C' \2 V' Q" d4 p7 A
                pr_warning("Could not register som GPIO expander LEDS");
# o7 {7 G5 J" x% q! Y        else
) K, b- j- k% S3 |: N2 u                printk(KERN_INFO "LED register sucessful!\n");
# `% ]( f3 V, c! S$ X- _. s9 s# V& ]: @+ M
        return ret;
, @9 ?2 b$ W! p0 ?& G}: ?% A7 M( x" k( O5 ]# s, W0 v
" a4 ~( Y, i* y" V
static void __exit led_platform_exit(void)& l/ ^0 _. v6 ]; G1 x
{
# M: z, y6 X* K5 l, f) K3 J1 t4 j        platform_device_unregister(&da850_evm_tl_leds_device);3 D5 `% f9 ]: h: B
" E! ?$ i, |7 w7 [% C9 p7 K. ~
        printk(KERN_INFO "LED unregister!\n");
. c# ?, V9 `' N- B}) a* L: g& R, d5 V, H

$ W. q' Y! W% K8 s7 `, Imodule_init(led_platform_init);, ?1 m. n$ c2 [6 j' G& q9 O" f
module_exit(led_platform_exit);3 _1 Q) x( \0 T$ @, _* K4 e; O. o
' x* B$ r8 L4 S/ X/ A. r* b
MODULE_DESCRIPTION("Led platform driver");4 [$ E, a, M4 @2 k' h- }, s* G' @
MODULE_AUTHOR("Tronlong");
6 o, u' V, j- Y9 |6 MMODULE_LICENSE("GPL");
2 G" l8 p8 V  Z* ~1 D" `" i  n# S
1 R5 t1 H+ O8 P: g; ?; Q% B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 14:52 , Processed in 0.037223 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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