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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
) e  L/ x: U+ x9 U  I% |+ q0 c#include <linux/init.h>2 }# ^& H5 n  U- U
#include <linux/module.h>7 a- r* D* ~- b7 C* A. U2 m
#include <linux/kernel.h>
: S; c8 X$ _9 ^! F4 J8 K#include <linux/types.h>
9 S7 f$ }3 f% g; D, ^9 L; t#include <linux/gpio.h>
, r+ G- \! ^3 Q7 b" l- G8 ^#include <linux/leds.h>0 u* Q# b0 B1 I3 W# M$ {
#include <linux/platform_device.h>( j3 A1 P  R8 e+ }( b
; M; n9 ]# `/ k" Z
#include <asm/mach-types.h>  @0 q& L) @( B7 j, a( ^
#include <asm/mach/arch.h>$ w8 o6 _2 ~' p5 J# ]1 B
#include <mach/da8xx.h>9 v: y8 u, t/ G. ?; A% Q
#include <mach/mux.h>
  Z0 U1 h% a% d# ]
0 K  K8 @3 Q  n+ X# ^#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
3 j2 t! O! `6 Y" z" s. z! r& W#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
! t9 E4 p. \  J' e. m: r7 g#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)/ O8 ?9 \  ^' k
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)+ q  i; o  ]0 g! b0 W+ }) M

4 ?2 X/ W1 S3 F3 l% w/* assign the tl som board LED-GPIOs*/
: \8 ]! z; R. R' I8 b. H& bstatic const short da850_evm_tl_user_led_pins[] = {
# p' f/ X) e5 i) b7 \        /* These pins are definition at <mach/mux.h> file */8 i6 N/ H+ P1 A! o/ K# i3 O; ^# }
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
7 |& ], O. {, H6 c  j1 E/ F        -15 B$ {/ U, l2 ]
};
/ F6 Q0 J6 ^+ L' C% y6 w% a, o9 O7 f$ o8 ]. y7 Y
static struct gpio_led da850_evm_tl_leds[] = {$ O/ h$ E" z  I" S) h7 i
        {/ G$ H- U6 R; L
                .active_low = 0,
) f; T% k2 Q0 H! _5 @' {& H                .gpio = DA850_USER_LED0,# j+ r; A. c; E* Y
                .name = "user_led0",
& G, A, s8 M3 {8 S                .default_trigger = "default-on",
  R" G4 [% Y/ G; x* J! f. k        },* J/ x' s* X0 l4 a
        {) _7 o& x" Z7 {+ q  t" {
                .active_low = 0,3 K; W& ^2 d& l. v  ?
                .gpio = DA850_USER_LED1,' L/ m( N* L) d' x% u
                .name = "user_led1",* [7 a. L! z2 G
                .default_trigger = "default-on",9 T" D3 f1 I) I4 ~/ T
        },
1 g8 e2 |" e% x* _0 i* G1 H        {6 J7 @( n- a8 H
                .active_low = 0,
; D4 L" X. _# t( f                .gpio = DA850_USER_LED2,& d0 q  a1 y- f1 S5 z
                .name = "user_led2"," Q. f0 D$ V$ Z& X
                .default_trigger = "default-on",
6 G- Z" V3 U! S$ G9 ^# b        }," c5 |& u% C% X3 T8 Z) \
        {
  K/ E) `  [" H' t6 \7 d                .active_low = 0,% ?3 ?3 T) L/ b! R5 }0 O
                .gpio = DA850_USER_LED3,
% k3 I0 f' U& i# p/ p9 A                .name = "user_led3",3 a' L' Y( D7 z
                .default_trigger = "default-on",. [7 X% K0 m% g( T
        },
8 H& ?# b  a0 s8 p+ @7 ?4 }, j  I};
; Z! f/ t. H  f
" U& d- n  p  Lstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
4 O- V  e1 t% m5 ]0 G7 b) X        .leds = da850_evm_tl_leds,: r7 u9 u2 I4 b: c/ e# k
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),5 Z9 x/ B* V9 P- |
};5 g8 |# C5 R; x7 _2 ?& K6 K

: k4 K# a- v! Z! _8 Y) F$ @4 E0 x, U# `static void led_dev_release(struct device *dev)2 H! l- j& m# u; z+ F1 T
{$ q: r: C. C0 p) R
};
0 \8 ]! {  N2 c& g' T0 h/ |: Q! K! j9 S  p, I& u, n
static struct platform_device da850_evm_tl_leds_device = {
& Q4 I# W- X2 @) f0 b        .name                = "leds-gpio",( j6 C9 @% i$ A" @. b
        .id                = 1,- A) U9 A, g$ {/ s" U
        .dev = {
- d2 K; a6 c9 O                .platform_data = &da850_evm_tl_leds_pdata,/ q8 g& I2 g( |
                .release = led_dev_release,% L. `% L. h$ e
        }) y% g1 b$ p& {1 V
};
2 `% G) ?" \! H8 G; H
0 _' t( l9 u( m# lstatic int __init led_platform_init(void)* e: `- h- `/ G
{! w8 B" C! H# x' c0 v) a5 w: U
        int ret;
9 g# N5 X3 O: J3 L. w) b#if 0$ C( y& E/ h) u
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);& J7 J: Q, e) C3 G$ R
        if (ret)
- {" {! m/ t0 m+ K                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"1 H5 `" `1 d( q0 L8 a- y
                                "%d\n", ret);
. y+ b- M; `: E/ U1 Y5 r7 p9 o#endif
2 L6 _7 r6 i- Q6 y/ w" A        ret = platform_device_register(&da850_evm_tl_leds_device);: }( k5 p7 i  ~' M6 C. z
        if (ret)4 r$ m( l4 b2 H8 O( R
                pr_warning("Could not register som GPIO expander LEDS");% j( {) U( l1 g4 S: K
        else! p! I3 B" }! K7 q
                printk(KERN_INFO "LED register sucessful!\n");
) x2 H6 A) Z' _
& v5 \% G7 X: B7 `8 I! C        return ret;+ P2 T& e" T# l: u4 b
}; x4 a5 |' m" }* ?% n+ M
! w5 |4 s2 y# t
static void __exit led_platform_exit(void)7 o; v! d9 {8 M7 I
{
6 x1 Q8 C" b9 O+ Q/ q, n* ~        platform_device_unregister(&da850_evm_tl_leds_device);' i. x% e  _: E  N

9 [: ~, C" r) {, x        printk(KERN_INFO "LED unregister!\n");- n! _4 T( M1 ?( O1 w5 X. n
}# R2 A* H% H9 h) |) Q
; J* Z+ C& O, }4 ~- q7 M
module_init(led_platform_init);
2 |2 O$ ]) e' i4 u# Emodule_exit(led_platform_exit);
+ P( |- g$ k# v  M2 W7 t* D8 C  i! ?' H! B* o
MODULE_DESCRIPTION("Led platform driver");& h4 z6 O- y* ?; `
MODULE_AUTHOR("Tronlong");
' F- x8 x3 v6 g3 KMODULE_LICENSE("GPL");
  \7 O2 ]0 t; ~0 x, L) w9 E( C0 W+ O* Z, N) |) n7 C0 h$ D1 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 11:03 , Processed in 0.037989 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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