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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
( j: Z2 l! d5 X$ }9 q* z#include <linux/init.h>
. D5 R4 a* Q5 o8 z#include <linux/module.h>
3 P" G* q" D( z" e# }  i" A#include <linux/kernel.h>- o  i$ Q# a, C# h: X/ d
#include <linux/types.h>
9 w4 a6 B5 c; V( {! o1 P#include <linux/gpio.h>+ P: d$ h* z% b, ]1 w/ n+ [5 Q4 a9 z
#include <linux/leds.h>1 C. Z9 O3 T* \3 f' G+ g
#include <linux/platform_device.h>
' }1 M5 w  D7 I# \% _; g0 p: v% |$ \$ c, }+ Q
#include <asm/mach-types.h>
! ]6 [0 x5 b9 Y#include <asm/mach/arch.h>& c3 y6 n$ n$ k
#include <mach/da8xx.h>- T' t- Y+ l) i
#include <mach/mux.h>& X* U* p. h1 z" w$ e" \+ r
, ^5 F: `# U" k1 X0 g; N7 k% B& f
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)$ `+ V" ~; ]+ ?, G
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
% m6 v3 @9 N! n2 C$ [#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
4 }6 N/ ]* i4 J+ I  J  A#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)5 {+ @! s% T8 P4 T
4 |) B9 ]' e$ @% m! {
/* assign the tl som board LED-GPIOs*/
+ w4 ?) E7 J1 j$ h) J1 S8 Nstatic const short da850_evm_tl_user_led_pins[] = {
* I: k. c- @4 v        /* These pins are definition at <mach/mux.h> file */  M, m8 X; N; M5 \: |
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
$ }6 ~0 S/ x' V, e& \        -1! G/ f, S9 b% r7 u$ n
};5 P4 w, B9 `2 @( U2 p

9 P. v7 y, O& f! ^static struct gpio_led da850_evm_tl_leds[] = {3 \, ?7 r6 C9 j- A
        {
+ X6 W. W" N( E" Y! `                .active_low = 0,( P0 k% p, O2 {' ~' _2 N
                .gpio = DA850_USER_LED0,
# }" A7 [  n8 M/ e( d  m5 f* D  a+ |                .name = "user_led0",) Y2 g  b) C6 j$ W3 m
                .default_trigger = "default-on",, H- \0 Y6 g$ b6 h: H) _5 c
        },
8 T6 E; e8 P& u: w- m7 [        {3 x" ~/ }' p6 p- j$ o" p7 L
                .active_low = 0,) R* \( G* d+ ?
                .gpio = DA850_USER_LED1,
' e0 C/ c% y1 ]2 J* }" o) x5 v: A8 X                .name = "user_led1",
" K! L, _! I: o                .default_trigger = "default-on",+ W* u* Y, R8 ?6 J! s( I
        },. c: }2 U7 Q( C) A8 [; A) J
        {8 B' s7 ^% q3 h& x/ B: v7 w+ u9 i* K
                .active_low = 0,
; e+ H3 L2 p. j2 \$ Y# N+ p                .gpio = DA850_USER_LED2,% @) _6 k9 c/ y% h, G+ d
                .name = "user_led2",: N. ?% e: n$ o' p& P4 z
                .default_trigger = "default-on",/ R  a- u9 U& T! i
        },
4 K+ Z! V! G+ N9 ~" \$ K        {
& o& V9 @* ^# c# J0 J0 }                .active_low = 0,
" D8 o$ Q! ~+ i( X3 z                .gpio = DA850_USER_LED3,( G* M/ r# C' S8 i1 h
                .name = "user_led3",
9 O! @# \( D: h/ ?8 A& k                .default_trigger = "default-on",) D: u8 V7 ]/ R/ f$ Q9 {  z
        },
) G, i/ h# w3 C( W5 K, ^};
. `; u6 c5 y. e# {! R1 A. z* R6 V7 i0 J4 K
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {& R+ P# U5 v9 N
        .leds = da850_evm_tl_leds,# Z6 l6 _  q5 c% w! b5 N/ W
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),$ e+ \4 J1 h' N( h) t
};
. w# H' R+ d2 _1 h0 x( C- K) n3 [0 z9 a
static void led_dev_release(struct device *dev)
; Y1 S' |- a0 f- l{
7 N( k( n$ o; f* ?! a- w0 {};) _2 L! h8 M; S

, E- Q3 A' X- Q' m7 P5 N/ y  tstatic struct platform_device da850_evm_tl_leds_device = {& X' `' j  W2 g- U0 a+ I
        .name                = "leds-gpio",
0 T) f4 b' z+ B$ D+ {. U, E        .id                = 1,9 v2 M. [1 F6 Y- M( p8 w0 P# Y
        .dev = {
0 W5 x, }- w: w" H$ ^                .platform_data = &da850_evm_tl_leds_pdata,7 T. ]. e# Y0 w$ O4 U  u3 ~/ v
                .release = led_dev_release,
1 A& K8 r6 _; t$ C        }4 }" W0 _( k6 ?/ K8 b
};1 s! j+ f9 {0 `( \
5 l4 ^* o# S3 {  Z' U4 ^2 O: D" R
static int __init led_platform_init(void)
& c% ?1 I/ V% M{
; A  H7 ?8 S" H2 N        int ret;* M: g, X! P; C, f& b1 r: C
#if 08 v7 R) b( E$ D; k  x" h
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
( G* o& \: g! a# H7 |        if (ret)0 B% A4 T5 P/ Y8 M+ T
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"5 b' T! {3 j( o  N0 r1 Y
                                "%d\n", ret);+ f1 ^# u2 [1 `
#endif
  Q# I8 A" F* A% u7 Z, S        ret = platform_device_register(&da850_evm_tl_leds_device);
/ `+ v% f1 n0 |+ n! v' r0 Z1 [$ x        if (ret)
, k' c$ C; ~5 r5 o5 b' B- H                pr_warning("Could not register som GPIO expander LEDS");1 u4 J1 x+ M9 @) e  z: h9 o
        else
7 K! n4 `' i, G( m$ Z- E  N$ h                printk(KERN_INFO "LED register sucessful!\n");" G; [" z% i+ y
, a6 X- W# M1 Y, t
        return ret;0 q$ E; f7 s. G# R: P8 G
}
" |0 h6 E/ k: P3 A& e
) w/ }. T( I+ |6 C$ H( Y' Zstatic void __exit led_platform_exit(void)
7 g& }* _! O- }7 [5 q) ~) P{
5 b5 O8 R0 v- V+ G- e2 `& S        platform_device_unregister(&da850_evm_tl_leds_device);- e2 x0 z) C/ J# t6 s7 D& P

9 G9 W$ e% \* P4 @# b8 V        printk(KERN_INFO "LED unregister!\n");
% w7 E: z) a  v1 s  Z9 J}
; h* J% K' G1 w: O& z7 M. y6 y6 d2 m5 [( M
module_init(led_platform_init);# i+ w# c% w4 M, N+ l1 P. F# \
module_exit(led_platform_exit);
* V, b0 N+ p) Y7 |. ^# ~# l+ ]% T" p4 X* @, h% ?' ^: {
MODULE_DESCRIPTION("Led platform driver");) `; {6 F4 ~: Q- M( x5 w/ G: C& ?
MODULE_AUTHOR("Tronlong");
- s* N6 Z9 ]" Q9 ^4 N2 fMODULE_LICENSE("GPL");
1 p. @) P1 i5 N( ^5 a
, n% H# k" Z" ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 20:35 , Processed in 0.040414 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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