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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
* B! c$ f/ U8 z4 z  b  l2 j: ~#include <linux/init.h>3 o4 B, l4 d4 A% W( `6 {
#include <linux/module.h>
" A6 ^9 R2 Y* i$ t#include <linux/kernel.h>9 h: u4 D3 K# v3 P
#include <linux/types.h>' f& T. y9 w# u4 M
#include <linux/gpio.h>- X5 [3 O( k( Z$ U% F$ y
#include <linux/leds.h>
# [2 R0 O2 j3 |/ Z2 G8 k: l#include <linux/platform_device.h>
: n8 C4 p$ p3 _' v0 i! t
% f2 m! N) D2 x#include <asm/mach-types.h>
0 W5 V; i. [" ?4 N% F#include <asm/mach/arch.h>
# m% v3 y1 W8 o#include <mach/da8xx.h>" J' z6 U/ v$ a* w
#include <mach/mux.h>
: d/ G% A- s9 I4 c( ~5 U
) }4 Z3 Q( o1 \# m#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
, b& }/ T0 S  X& @9 \#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)+ p3 N3 A* T4 A
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1). c& |; S) G! A: e
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)2 x9 R, F: i. X4 _  Q" d
% ~0 T& a/ d0 X( n5 }
/* assign the tl som board LED-GPIOs*/
) H2 |+ }' z4 j% H( M) @static const short da850_evm_tl_user_led_pins[] = {+ F9 p) F7 E$ U2 l/ X
        /* These pins are definition at <mach/mux.h> file */
8 [5 ^9 |; [) G        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
: Y. {( @) z% E4 p6 N        -1
) i! O( ]6 y& n$ D2 L% q; t};* k& @( T5 q- {8 M% l
/ C: y2 I& D) Y" y# F# S2 G
static struct gpio_led da850_evm_tl_leds[] = {
1 s8 \4 d7 K! f' t& R& X        {
% m. `7 z( Y" v+ d                .active_low = 0,& |9 l5 e. m9 V  u+ q* L
                .gpio = DA850_USER_LED0,& _# y% u. a- @0 y' a) {
                .name = "user_led0",6 H$ y4 r: T) \0 B
                .default_trigger = "default-on",: _* {1 w' \9 Z
        },/ q5 q. K% d( S. e
        {& w' U8 T/ y0 n9 X# y# F( I
                .active_low = 0,
8 g. W( {; |# o; ?+ L: |                .gpio = DA850_USER_LED1,
- b$ n6 @- J5 U# `# J7 i: F                .name = "user_led1",2 H- m  e2 o# }" E) K4 p* b
                .default_trigger = "default-on",
# y, U, }& ^/ |/ i0 p+ j        },
6 C+ j% \0 F. O; w& y8 C        {0 a, G7 y- T8 g; F
                .active_low = 0,% J% M  A- u( y6 x$ [) H
                .gpio = DA850_USER_LED2,
; x! z9 R, j; H* X2 x2 M) O                .name = "user_led2",; V* b7 }& {9 K2 t* g0 E: H$ B
                .default_trigger = "default-on",+ V/ }; d+ X8 G; H0 ~
        },
6 B/ ^0 d; I$ k) R& g. |        {
8 }* B2 P, ]) D# {+ U                .active_low = 0,# y7 a% D/ u3 Z4 d+ s0 q$ |6 u
                .gpio = DA850_USER_LED3,
! w5 r. r4 c: H, I                .name = "user_led3",
9 G9 D: ^  N/ x$ X% }                .default_trigger = "default-on",7 c1 z! m6 G' m2 h& _( \
        },
, S( Q( D2 C# d: O};, c" ^0 u8 e1 x4 w6 u

  l4 J& [  r$ i! O& C( \static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
/ P2 {; G  A2 V6 K% D) R        .leds = da850_evm_tl_leds,/ \1 q2 n% z. P3 d& O! E
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
$ J, Z) U( e, T, ^. [+ [7 V# _};
! b0 |0 D( @& b5 O0 o5 o' l. T6 k6 B5 U* f0 F5 i& {$ m: q
static void led_dev_release(struct device *dev)0 w: s  f8 Q4 W7 H$ B
{/ X9 }1 e  u- V1 I5 L/ b' `
};
1 ^# C! |) {; @, g! X% Y- q9 {
7 |+ ~; q4 W# m- Estatic struct platform_device da850_evm_tl_leds_device = {; y8 p4 Z9 y+ a! {/ A
        .name                = "leds-gpio",
. m" D. y7 b  `% a) N7 N        .id                = 1,
2 U/ E8 X) t: m: T& c        .dev = {
* D. B. ?. ]5 e% q0 D' [                .platform_data = &da850_evm_tl_leds_pdata,2 c" C" P& H$ M" u7 J
                .release = led_dev_release,$ v" `) E2 }  K
        }
7 \. j  ~  \8 }$ j};
: y+ V3 X: ^7 S% O7 i
2 {3 ^& |- p  `' `static int __init led_platform_init(void)  s2 U4 |( Z  p. Y
{  ^6 [% r9 e. X& ^+ Z6 V) P: l7 b
        int ret;# D) }1 B2 e% Q7 _" f' A( Z
#if 0' z% S8 v/ u% w' o
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);( Q' L; i# Q$ j
        if (ret)
0 F# s8 @$ F- m1 U2 `                pr_warning("da850_evm_tl_leds_init : User LED mux failed :". y5 u5 Z, n+ ^, [" L
                                "%d\n", ret);9 c: M1 j1 @, a# N8 V. ?# y6 S
#endif
  `9 \4 Z4 r1 c" D1 T3 T/ \6 [        ret = platform_device_register(&da850_evm_tl_leds_device);/ f7 [8 E& M0 O5 ]! s7 K4 @9 ]
        if (ret)
% M* o% Q# ^$ J# z' X$ g8 ~/ d                pr_warning("Could not register som GPIO expander LEDS");
9 m+ r: Z# R# x2 b        else- A( o, W) }& [0 J9 l
                printk(KERN_INFO "LED register sucessful!\n");. O; u, i9 C; G: i8 g, X( }

: a5 |% U: G7 g  P8 B2 G# \4 E# ~        return ret;
- o7 F8 a% F2 o4 V" i8 p}6 g( T; J0 j: @* G4 s. Z
* ^/ c: q) B7 m: E8 [, e8 c+ g
static void __exit led_platform_exit(void)
" F% ?# b7 \; u{* P& E( T) ^- i+ g$ R$ L& }
        platform_device_unregister(&da850_evm_tl_leds_device);& M6 i5 C$ d2 X' c; X" X$ K9 l
4 t/ [3 U8 h# d# \5 m: P( ^
        printk(KERN_INFO "LED unregister!\n");" `; z% ]6 E8 G
}+ E" C1 m" L+ H6 f

7 C- L1 p+ D7 q+ fmodule_init(led_platform_init);
3 y# T; T" Y0 U5 i% g& Rmodule_exit(led_platform_exit);+ h; R6 o. ^, \% l$ L$ b+ t% N

/ C! K  t# ?& |6 XMODULE_DESCRIPTION("Led platform driver");
) ]; B- W+ l, N. `  {' l3 Z( r6 V6 H7 TMODULE_AUTHOR("Tronlong");8 A, s* M9 ?5 H( P7 B
MODULE_LICENSE("GPL");% l4 n$ P4 L! [
" I) F7 e) C( j7 b/ V9 K3 A: K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 18:58 , Processed in 0.037182 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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