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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
/ }3 C) O6 R" D$ z2 y- `( F* b#include <linux/init.h>
( ~  R. A2 q/ H' B$ y. O#include <linux/module.h>
7 e% i8 B* R) @/ n7 K#include <linux/kernel.h>2 I4 X6 ?  _. J9 N3 v% c2 Y
#include <linux/types.h>$ E1 x2 d7 c% E+ c+ R4 `7 h4 m- Z
#include <linux/gpio.h>8 S' d& A# E  G
#include <linux/leds.h>
. r3 B* x+ I! @1 F, a#include <linux/platform_device.h>
; v+ L$ c- n" ]) e* l$ x: [3 F
: Z. R6 I0 i( d* `" I. L#include <asm/mach-types.h>
; x8 c; c, y, r% U2 {8 `& F#include <asm/mach/arch.h>' e+ z7 T2 x0 ~* y% C
#include <mach/da8xx.h>8 L( E+ }# b# g$ H8 h6 N7 H! ]8 n7 N
#include <mach/mux.h>
& A( E  u  `! u  Q6 A# B
2 m3 _8 s1 f4 X) ?# {9 D: d#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)' Z* f8 O9 g/ f7 R+ E, I
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)! W$ o& W. D6 L
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
' M9 \. {; b9 ?* n0 `#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)7 ]) z( Z7 N6 D* Q* F
7 n6 x( a6 _: b2 w/ h) G
/* assign the tl som board LED-GPIOs*/0 D9 f; y3 l7 ~+ {* ~
static const short da850_evm_tl_user_led_pins[] = {
% `8 y- l( S" u6 L! |7 C        /* These pins are definition at <mach/mux.h> file */- e: s5 @4 ~: E- ^' q: B2 [
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
* U" a$ r  j6 S; H$ }        -1
  V5 {; w6 Z1 b};
3 Z+ ~2 K( }: u/ ?
7 T" t& c$ y- g* N/ Tstatic struct gpio_led da850_evm_tl_leds[] = {
% \. T* c1 b; D! i0 t) C        {
1 l' j) D3 Y5 w. V9 `* a                .active_low = 0,( X9 Q; ?- L4 B- `  _$ A
                .gpio = DA850_USER_LED0,8 O/ B% o2 |$ t" m6 M
                .name = "user_led0",: _2 k" b2 g. a5 Q* h; V  V; b
                .default_trigger = "default-on",# b4 h7 X4 t; U" z5 M0 x! L
        },$ q" `) Q/ `) [- f7 f% G
        {
+ p7 ~9 h1 O$ E# S% [; {                .active_low = 0,
+ ]( |8 s/ ~4 L! N                .gpio = DA850_USER_LED1,
% L( b3 v$ [0 d0 b  n7 y9 g: T& n* o                .name = "user_led1",1 r! p4 K+ x: O8 s8 P
                .default_trigger = "default-on",
7 |/ s+ G% [4 D- u        },/ I1 A! K9 J$ I* p! r. K1 v
        {
- G' X5 B1 J5 i                .active_low = 0,
  ?2 l" Q* [% c/ h                .gpio = DA850_USER_LED2,9 m& g2 m. d+ u
                .name = "user_led2",# r# G/ X9 k' ?9 Z* N/ {3 Y
                .default_trigger = "default-on",
+ r+ R/ U1 K  v( M2 R        },6 G, F, l" c. X! w
        {" C- l$ r! x1 m5 R0 V) y
                .active_low = 0,( O% g5 ?: X$ a, X' W
                .gpio = DA850_USER_LED3,5 t0 I# u6 ?) A  c5 x* k5 B5 j& \# r
                .name = "user_led3",
3 q2 w& X8 I$ L+ A: Y! p                .default_trigger = "default-on",( f- S# {! s: t% z+ B
        },
4 g, j/ G. P5 S' F% ?! b% ~};
/ c) R4 `  [% ~9 U
5 U% L8 y7 B9 J& [" k4 R' l/ Ystatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
5 w6 U! _6 }; U, k0 }        .leds = da850_evm_tl_leds,
5 G1 t9 X0 a8 V/ M3 ]0 S0 w        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
8 H( T* s' H/ d  K) L; |};  |. `% s5 i8 L0 o9 C
) D. I* w$ i) K2 l# D
static void led_dev_release(struct device *dev)2 \9 y5 G' _- `1 w3 K- E7 f: q
{$ D: K$ d( z6 t1 h1 i: X+ F* b
};
9 A6 g) e2 |- _- u8 L2 J4 N0 U3 p$ a# _' c5 M! Z7 ]
static struct platform_device da850_evm_tl_leds_device = {% V7 u- u6 a% K/ A$ b6 }
        .name                = "leds-gpio",
  E4 q! Z* }) [% W8 q        .id                = 1,1 K8 J7 B) P1 U9 }
        .dev = {
: x) Q7 C6 O1 y5 w+ A                .platform_data = &da850_evm_tl_leds_pdata,. N  K/ t6 m1 n8 P. d; u/ H4 e
                .release = led_dev_release,2 m" ~; q( H$ X& o- I' g
        }  r' s# r  R3 |- X$ Y
};) I2 H. A) K4 G* R& @3 L' w

, j8 U- E& C& C" G5 T  [& lstatic int __init led_platform_init(void)9 w! C! E. l* n) H. {' J5 R6 z
{5 e3 a5 a0 u; X% j6 m
        int ret;6 X4 O. _  F) z3 _$ J3 B
#if 0- Q0 i2 d+ {, ~7 a( {' Y  I  ^
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);5 \* E& B+ `6 E- T. K% a4 J
        if (ret)
) C2 t' r. n! E  `                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"* w+ i! J' @8 R3 W  C0 H8 ?7 s
                                "%d\n", ret);% z3 T' W+ z6 j! Z6 s/ ~9 a
#endif
, G& C& F( q2 Z/ j" T        ret = platform_device_register(&da850_evm_tl_leds_device);
2 A# q8 x& n3 ]: m' A1 }$ b  M        if (ret)
7 V! g! J3 m% m! E                pr_warning("Could not register som GPIO expander LEDS");
7 [8 ]; j9 Z  `, ~5 L5 N' @/ y4 K        else
& O  ]' |, P" [2 a8 V0 |1 l                printk(KERN_INFO "LED register sucessful!\n");$ Q( u% D' h* m% w" |/ ^+ r

' q; a3 I& G2 q7 w% B: @        return ret;
; V+ \' t0 a: [/ X6 L3 ^}) q4 h" @' m2 |) c* {) {- o) K7 W  C
" J- f8 L3 ?3 n, I3 U
static void __exit led_platform_exit(void)
( H8 o* ~$ b9 Z6 o{' Y5 u2 q5 Z  M6 Y1 z; ]* G  P
        platform_device_unregister(&da850_evm_tl_leds_device);
8 R3 d+ ^( k; o. s# @) u& _# B8 |2 u) D- ?
        printk(KERN_INFO "LED unregister!\n");5 q* L3 C/ j& g
}: [- J. @8 {7 U  V* B

4 N6 o$ t% q0 S& J, }/ L" l/ Amodule_init(led_platform_init);! c& C9 [. t; c$ H/ T
module_exit(led_platform_exit);# D* ]  A" Q; L( N4 A0 p/ L
; J: m# q/ C' a& p+ ~
MODULE_DESCRIPTION("Led platform driver");3 D8 M1 b) B4 e1 G
MODULE_AUTHOR("Tronlong");
8 y9 ^0 Q, _- i5 QMODULE_LICENSE("GPL");# B9 y8 E6 o1 {: |) Z

% e  i' P, R7 a5 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 19:57 , Processed in 0.045435 second(s), 29 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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