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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。7 Z$ B! d8 u3 p# [7 ~' n
#include <linux/init.h>
/ p6 `: I# `' U#include <linux/module.h>
" B  L4 I: O1 P#include <linux/kernel.h>
# P( Y: ?) v' X! T7 V" E#include <linux/types.h>+ F# a4 o- D3 t5 i4 K$ K! ~  p
#include <linux/gpio.h>; b7 E. K) }4 y1 v& |. Z2 `
#include <linux/leds.h>! b' Q1 `* ^1 F+ u
#include <linux/platform_device.h>
8 k" ~4 r& m. R/ H5 l& s% ]4 T1 V/ G2 D  c2 T+ l# C3 g, |
#include <asm/mach-types.h>. T0 R' I' g% h" p% r4 v. x
#include <asm/mach/arch.h>
: t; p2 V4 G3 `2 i& n6 R#include <mach/da8xx.h>
6 \9 J. K! r  p+ H+ `2 }2 ^#include <mach/mux.h>
( W) I7 H7 ^* o' b+ Z5 ]8 S0 R, L/ N9 k8 s. G- S) `
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
4 l2 ~+ q, ^2 J; S+ h$ e#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
( m. Q' C5 T  V! U# Q  U9 |#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
. Z) ^3 k! g- g$ I+ B2 ~! y#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
# G1 o" S- k$ l" z0 z
8 o6 f9 `, Q3 u/* assign the tl som board LED-GPIOs*/% _& ?: y6 g* K% H
static const short da850_evm_tl_user_led_pins[] = {8 \4 `7 f7 d( q# U8 y* T' {
        /* These pins are definition at <mach/mux.h> file */3 B6 |6 M/ X/ K9 v/ M$ D+ N
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,+ L$ E% J# m# R
        -1/ b* b5 O, _2 C7 o0 H" W% ^8 c; B
};
- C5 @1 I; K* `' a6 u$ t
! k0 w4 T/ l- W* }static struct gpio_led da850_evm_tl_leds[] = {5 l9 S" o9 n0 o6 \
        {, L3 @( M4 u, O% I! o0 X
                .active_low = 0,
& [0 \, `+ z* @) P; k                .gpio = DA850_USER_LED0,( \, B: S) m/ \) c# D- ?1 H
                .name = "user_led0",# f9 G' G6 Y7 ]8 w/ K( @0 O
                .default_trigger = "default-on",
# p; M% ?' Z) Q' u3 f        },! D: v& b) T' b
        {; A& W9 M' f  k/ z% v; S: j4 v( M
                .active_low = 0,
( A+ f' C3 s, g' r1 ^4 H. I/ [                .gpio = DA850_USER_LED1,. b$ A, Z% d7 ]/ c. i# Q' D
                .name = "user_led1",) L0 O. S+ M0 J
                .default_trigger = "default-on",
2 u" w  Q& ?% F/ A2 U6 k; {        },' [! g1 W+ o  i. S; Z6 q. E% [" K
        {
, n, d  I, {4 F                .active_low = 0,9 U$ d2 h& s, A
                .gpio = DA850_USER_LED2,! L! W* e6 Z5 P: G. \2 h( J; D
                .name = "user_led2",
6 l1 J$ q, `0 `. ~2 _2 l1 B0 t                .default_trigger = "default-on"," X5 A) \8 ^* \2 m# y
        },5 N0 i4 j- Y( d4 U! J* o
        {* M  q) J$ P. w: x
                .active_low = 0,- V  ~8 I) _) c+ @1 P4 D0 z
                .gpio = DA850_USER_LED3,
8 r7 A6 t3 F' z# j, @# X+ h  \1 L* \                .name = "user_led3",7 d) r& x5 `9 ~+ n8 d& K
                .default_trigger = "default-on",/ A9 [1 G* ?/ Z3 u
        },
, S5 m) K) i( _5 a" u};
  F" h3 E6 N2 r+ I: B# q8 a% p- G" w7 C8 H9 M
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
+ t+ O- i4 F4 V4 l; H7 N        .leds = da850_evm_tl_leds,
. S8 k# J9 ~# T9 V3 }        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),5 e4 F( {' a$ T; {5 a% N
};
. t# J3 N: K  P/ |' l; k
% j; Q: b5 D" ~  }2 V0 m+ i% ~3 I. Estatic void led_dev_release(struct device *dev)
6 U1 x; S, H- j{
- ~1 d) Z) K# K4 E};
; d7 \; @$ P& N- l# D+ s7 I3 n  n& e2 T% R) e4 V+ W
static struct platform_device da850_evm_tl_leds_device = {
1 E8 Y5 d& H0 \) X        .name                = "leds-gpio",( b- I% `- W7 A9 Q
        .id                = 1,
% i' |" K9 A# _- b# K        .dev = {
2 F# i) @, v2 M* f                .platform_data = &da850_evm_tl_leds_pdata,2 ~2 M2 f3 |2 H( [- C0 Y- |3 f
                .release = led_dev_release,
$ B. ]9 x- p' i1 t0 I" L! s+ V/ s        }- y& v  \4 H) Z! |% D/ W
};1 d8 f% C% u1 P( z5 y* c
: a% w! u; t2 l& ?$ X
static int __init led_platform_init(void)
! F9 h( T( `! a9 p$ W4 E7 w" h{
7 q6 t3 P5 a& Z! s4 b        int ret;
9 `+ ~" Y8 E% K3 U- g#if 0
. \1 A) M1 r1 G* [        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
0 b2 w# A+ B5 d: O$ a; k' K3 A        if (ret)$ v( @1 I4 Z  k8 g. `# R/ L; `
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
% y' R& A7 f% @5 B5 E) k                                "%d\n", ret);
3 M& ?0 g; n$ l#endif. N! }1 ]% m/ ?$ v) M
        ret = platform_device_register(&da850_evm_tl_leds_device);& `. D3 r% X' O8 A& D# u
        if (ret)
6 _* B0 i( r7 O" ~* H                pr_warning("Could not register som GPIO expander LEDS");* X( G" P+ R/ C7 u2 d
        else6 W5 L5 _. P0 U' l- @4 O2 n
                printk(KERN_INFO "LED register sucessful!\n");' h/ Q+ r6 L& u9 g
' S0 t0 r. x" D) j# o( u' \
        return ret;
& a# I1 M  ]( i  b* w8 p}; m) d. m; N& _' b/ @; |' n

8 _2 k+ M6 d0 i# s! ?static void __exit led_platform_exit(void)
  B* D  h8 v1 s: s7 y; r2 Q+ C{
7 D; i9 f; z5 E4 i( v. C        platform_device_unregister(&da850_evm_tl_leds_device);. B- Q/ W* \- x4 @# Y0 N

. i' L0 {; [$ c$ L. f        printk(KERN_INFO "LED unregister!\n");0 O9 P$ X1 K8 Q. }9 |& N7 r2 K2 n2 z
}
- J- a  \' f+ }. f
7 G. f, a$ D4 \6 ~- @1 bmodule_init(led_platform_init);; m/ b  Z# S8 U9 O
module_exit(led_platform_exit);
( H& s" C" u* s6 S
' W( }) ~2 C# }; U  y: tMODULE_DESCRIPTION("Led platform driver");
! E5 `# U( u+ \6 I2 `MODULE_AUTHOR("Tronlong");
+ d3 d# ]2 _7 l, s# `3 [MODULE_LICENSE("GPL");
: N) o. k: |/ c/ {: Q# i4 F4 ]* ?/ u9 v$ H* k+ u( O6 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 02:25 , Processed in 0.038700 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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