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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
0 }+ {! s; Y) i$ S! Q) w0 q#include <linux/init.h>8 y3 u9 i3 [3 e: T' X4 R* m% ?
#include <linux/module.h>
5 R0 N: _# j6 m# W+ F#include <linux/kernel.h>7 p2 I+ X* x! V
#include <linux/types.h>$ q% c( x6 k4 f  V$ b
#include <linux/gpio.h># N' b1 m/ \; a
#include <linux/leds.h>
; a7 ^7 G0 Y# U6 j( e& y#include <linux/platform_device.h>* y4 a, r4 G0 f& u

! `! T% v5 x' A7 i9 _- j#include <asm/mach-types.h>8 C( q( I! D3 x. x1 _9 B" e2 K
#include <asm/mach/arch.h>' Y9 {! O, c  r, b
#include <mach/da8xx.h>
- Z, _7 j, y' [. U#include <mach/mux.h>
; e( M% ^1 _# A) P% b7 e2 p. H6 B: s5 c/ G( w
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)* R  s# u- U* h7 w& P* P
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
; f3 _0 m, C) X. f+ Z! ^#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
5 R; e- P" @  D+ v#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
6 h- y; P7 Z" |; ?
6 {' f8 {2 x& J6 G# X/ w$ p3 u8 ^/* assign the tl som board LED-GPIOs*/
' G% A. u5 f5 [( e+ v' bstatic const short da850_evm_tl_user_led_pins[] = {" c# R# |+ y; j3 a7 M
        /* These pins are definition at <mach/mux.h> file */7 T# V" {0 N+ {
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
* }* N! M& @& ^; @  e4 X3 W        -1! W7 z5 O! X- S1 h" l1 p7 J
};
' k/ a+ k! G( o2 l( b
8 [8 R& t2 a6 f0 B" d( A- b4 q: pstatic struct gpio_led da850_evm_tl_leds[] = {0 w0 s8 y1 Q& \" {3 e6 g1 e9 ?
        {9 J0 T: X% N& `9 h4 i; t; l* q: b6 W
                .active_low = 0,
6 `: e( I1 W$ k- E                .gpio = DA850_USER_LED0,
  ~' L+ K: i" {- @                .name = "user_led0",
$ j! O9 N8 n( i+ Z- G, e4 B                .default_trigger = "default-on",2 |# F, q+ T4 e' c/ c( t5 i) X' i7 x( m3 S9 L
        },/ O2 Y# x$ l( ^6 T* z( [3 [
        {& n* l& g, b/ |8 Q" b
                .active_low = 0,
/ f0 e* u( u4 s! ?9 A2 l                .gpio = DA850_USER_LED1,
6 e& u$ o7 P5 n                .name = "user_led1",
+ m5 |5 c& X" ^4 F) r* Z5 c                .default_trigger = "default-on",
& n/ W3 `2 t4 X5 |+ Q' f        },+ w- u2 r; ~2 X1 t" S
        {0 o: }  \$ T+ M/ _( c! T
                .active_low = 0,
4 f( ^, |2 n5 j. p5 V2 T                .gpio = DA850_USER_LED2,; b, b9 i4 E+ Y0 K* {
                .name = "user_led2",9 O' |' ]* k! q/ V2 e. b; O0 ~
                .default_trigger = "default-on",
: N) _: W/ N* e# R, R2 ?& [+ v        },6 X$ m) j6 y, m4 M* X* `3 {5 X
        {
& X! \% b0 w: e5 g' \                .active_low = 0,* e" Z6 |+ D1 i, B, W5 l
                .gpio = DA850_USER_LED3,
: V1 c' a; G% X% q4 ]' N                .name = "user_led3",9 K8 ]# F* o* g
                .default_trigger = "default-on",+ j; e  F. b5 x& p( y; `
        },0 {9 A; J8 \8 r, k( a  n
};- D' J* N, e# |% F
& h4 r5 B( w" G- h4 d5 g
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
  v7 T% B0 d; y% F/ x5 n        .leds = da850_evm_tl_leds,
( C/ m2 Z  b1 p* O        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),7 {# E* r+ ?" X  Y1 U: g9 N. v
};
% K6 G- U7 s* e: l5 M4 P) b9 A; @$ T
static void led_dev_release(struct device *dev)
7 _3 Z' a* Y) E% y9 e{6 ?7 q. O+ B, b$ u2 k
};- N+ v* P# R' Y1 j, n

+ q, |0 Y! a, L7 sstatic struct platform_device da850_evm_tl_leds_device = {
2 D9 h/ B( J: \$ K        .name                = "leds-gpio",9 s$ \! E# g7 S
        .id                = 1,
! G% n! ?3 g, i$ R4 w; E        .dev = {( n$ b1 R' r; i
                .platform_data = &da850_evm_tl_leds_pdata,
* h% n/ G. }4 |5 P                .release = led_dev_release,8 x7 t  O% E! w$ q8 ~( u" Q* ~2 k
        }& e' R1 d! A# J0 [5 ~( `4 F) T: ]
};
7 a" U; d+ n: M) w
$ G1 V2 _$ I9 e7 T/ T8 W3 o' M! Wstatic int __init led_platform_init(void)
. w0 D7 T: F# i( v1 }- t{
" ]; @! ]  b# ]- u0 l. [# s        int ret;* e6 {. d0 V( P! [! Y7 b! G0 T
#if 0
/ [' Z/ b1 q6 O- a& N% `( I2 K        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
) s  E1 N$ o" S# e; ^        if (ret)
$ N6 X; @1 i) f( D7 W) o                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
& L! V& q& D2 u( B                                "%d\n", ret);
! W6 P9 l$ g' ?& M, [#endif
: H; h4 w2 I5 Z9 x1 |6 j! v        ret = platform_device_register(&da850_evm_tl_leds_device);
9 r3 t' K6 P8 N        if (ret)
" c6 B  J: e8 J/ Y7 p5 P9 |                pr_warning("Could not register som GPIO expander LEDS");0 Z* g2 [! u* H1 T' v- R9 w
        else1 S3 E+ [3 s+ y
                printk(KERN_INFO "LED register sucessful!\n");
; T' t; q& r. g8 t/ g& [+ q6 B
2 D, X: u1 E8 S" _" z0 b        return ret;1 X; R5 u5 p, i5 t
}
- L" `7 a% b- L# C
$ G6 J9 W9 P8 J4 r" u! _9 [7 Nstatic void __exit led_platform_exit(void)
- S) ~  k1 ~* Z) E1 Q" D3 k: J{! H% y* o; x/ k- W. }( F6 }9 y
        platform_device_unregister(&da850_evm_tl_leds_device);
$ x1 r3 c* I3 T( X* p5 z9 G( l# E# K9 S6 f
        printk(KERN_INFO "LED unregister!\n");
5 d1 j% k3 z5 L" ?! p" H}
) [- i: r& J& ~1 Q
; h8 E; z- X) E# J2 \, ^- cmodule_init(led_platform_init);
% [, _4 t+ v7 b+ @& t) F% c, Kmodule_exit(led_platform_exit);
4 K( G7 i' s' t+ {
# P9 T8 |) c2 [6 PMODULE_DESCRIPTION("Led platform driver");
' i' _+ W: |3 Y6 y, j$ G. \+ vMODULE_AUTHOR("Tronlong");" X9 x5 [; t5 n1 x2 {9 L
MODULE_LICENSE("GPL");
# i+ I7 w2 h# `" T) i* n. F, S" C7 @8 P0 T- c% ?& I- Q. H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 16:08 , Processed in 0.039798 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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