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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。. h5 @3 y* h, C' P* z0 j( o
#include <linux/init.h>
9 R: c, `# n( w; z: R# Z5 m#include <linux/module.h>% Z( ]' T( L3 u  e5 c9 [: L
#include <linux/kernel.h>$ ^" i  X: t4 a9 C
#include <linux/types.h>
. _8 R( {. \/ u#include <linux/gpio.h>! e+ \5 h# [( i' _' O% I, P: C
#include <linux/leds.h>5 Z; \/ t8 U" j  D" w' c, D$ @$ m
#include <linux/platform_device.h>
, P2 W, A! g9 s  c& X7 N
3 S% U' r8 y1 j8 B# l2 |  Y#include <asm/mach-types.h>% c3 F+ }: S3 K% _/ ]$ P
#include <asm/mach/arch.h>. N( E& u8 L0 |% j: L3 \
#include <mach/da8xx.h>
- _) Q7 U8 @7 ]/ H( x" g6 \8 t#include <mach/mux.h>
, d& ~1 Y  W. M$ O& {
' p7 H  e; L5 K/ r( b0 ]' |: t#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)+ M6 D: ]5 `' ?
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)9 M" v/ c- v/ k7 z1 S9 l+ w
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
$ D+ J' Z# n! {3 Z0 f8 }#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)$ E* p: r/ e8 X4 k& U
$ I7 {% g' }( W7 M  e
/* assign the tl som board LED-GPIOs*/7 `$ M9 ^* O) ?, c, Y) e* ]' }
static const short da850_evm_tl_user_led_pins[] = {
/ {1 X0 v9 u$ n  a7 s        /* These pins are definition at <mach/mux.h> file */, ~5 v4 q: S5 T' Q, \
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
# `, R1 ]/ U, B5 I9 t        -1
' V( n' z) R+ x; C! ^};
( Q0 X5 H5 d( Q. i# {; S! U# W2 N0 c
static struct gpio_led da850_evm_tl_leds[] = {
' M1 X# [/ @* O0 C; }        {
5 r- O6 V5 a" C  p( d                .active_low = 0,
( N- ?7 y5 B- j                .gpio = DA850_USER_LED0,
; g' |. m8 K1 n) X# ?9 o# g9 Y                .name = "user_led0",3 _2 c% a$ v7 X- L0 t
                .default_trigger = "default-on",
( ?/ I; C4 `" l        },8 H8 j. t( b* o5 f* p( [- b, H1 T
        {
+ E! ]7 @& x; X. o                .active_low = 0,
: Q  [  [+ Q" V                .gpio = DA850_USER_LED1,2 ?( P, E/ _1 q& y& N
                .name = "user_led1",+ W3 C- S$ Z3 D( C2 y9 `
                .default_trigger = "default-on",
+ i7 B% j  J5 ~' w        },6 k" V( r! W- x: Z; J# X7 F& V
        {. S1 U  r3 p/ ?" e8 f3 X& O
                .active_low = 0,/ I* s3 K& q# v$ ^, S
                .gpio = DA850_USER_LED2,* J& v: _/ ]) n$ w8 X
                .name = "user_led2",
: ^6 o/ {& [; ~                .default_trigger = "default-on",
: Y# k8 T+ _# i        },9 H# ], B% u7 \% @+ A3 ~1 X2 o: K5 ?
        {
, J& Y( {: ^/ D5 Y                .active_low = 0,
* w/ g4 S3 A: ^7 _- B' e' ~                .gpio = DA850_USER_LED3,
# O/ g! {  D9 T  R9 c7 A3 O                .name = "user_led3",0 I- Q$ D) D; Y  x( ~
                .default_trigger = "default-on",6 |+ ~/ E. Z0 h) W
        },: _0 [, B* Z& x6 F1 E+ `+ K
};
, A) h) T4 r5 @) C7 Y
! t/ \  O7 N/ Astatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
# F& r1 ~4 ?+ R; m5 p% }        .leds = da850_evm_tl_leds,2 ~5 p# Q2 l6 W' P% H, k
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
/ G6 v+ W) ^! b# p* X8 m0 n};
% A! d% Y/ u. d6 {
  K  d' x9 i# S$ a4 @" Nstatic void led_dev_release(struct device *dev)! H" [, o/ y8 W' @9 u
{
' ~/ Z- m. r$ X' ?0 j* b* n};7 q. V* L+ ~+ a4 Y
% g; d! ~9 o% D2 O) B' ^' P9 _
static struct platform_device da850_evm_tl_leds_device = {0 ?$ l  ^% ]2 Q1 |" I; ^  U
        .name                = "leds-gpio",
" [7 [( p2 z! W1 u7 J( X        .id                = 1,! S. T6 M0 N# r! [# _3 g2 Q+ Z
        .dev = {
- [6 R8 D, ]9 x' ?3 G# _4 n# u$ G                .platform_data = &da850_evm_tl_leds_pdata,* F  N' ~- A, V
                .release = led_dev_release,
; X! D4 Z; W, \4 c8 K" x) @        }
9 k  w( g/ L  C};
7 z; g- B1 J( U9 p. [0 q( `$ n( k) Q9 R2 f+ r- M
static int __init led_platform_init(void)/ Q# ]- ~0 k' q: m! w
{3 V0 h  W# \' \( D. o3 Y# m
        int ret;4 E6 U2 Q: R/ J7 K6 z4 N
#if 0. v4 U9 L( |" Z* D
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);- W/ L! V9 a1 Z
        if (ret)
  x4 s8 c& e# _( x' J$ Z9 y7 S( e/ g) Z                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"( G' \0 e! u! h; A- h
                                "%d\n", ret);& R7 W# X) s( @# O2 e5 ^9 [
#endif
/ v0 C8 L; O6 s0 t4 p        ret = platform_device_register(&da850_evm_tl_leds_device);( {2 E2 m: s+ w/ @: j+ _6 G
        if (ret)
( ]4 Z+ c4 ~3 p  E1 }( h                pr_warning("Could not register som GPIO expander LEDS");$ Y- m  f0 n% d5 S* o% s/ A  d
        else
5 C3 m/ q# l6 I7 T0 }6 I" s                printk(KERN_INFO "LED register sucessful!\n");
  a! \- W1 t. h; C6 H: l3 R) R" o! w& y8 D
        return ret;+ S: `- D/ P+ n# }* K& ]8 V1 q) i
}3 U& o! I' u8 v  N+ V

2 L4 b' p; z3 I: J0 c. gstatic void __exit led_platform_exit(void)# ]$ {6 z% ?1 a2 Q9 r
{! o& ]" ?# e4 h% P% Z9 H
        platform_device_unregister(&da850_evm_tl_leds_device);
# c8 a6 V" K" R0 d. z0 c
4 |- M) M. ~* O( L9 D        printk(KERN_INFO "LED unregister!\n");' D2 D3 ?) x0 K
}2 Y9 _6 f! _% X  _

3 w( t% h1 U* u# s6 z- Z3 y. q, P* Umodule_init(led_platform_init);
6 {+ Q& E4 d! G  F; ^5 ^module_exit(led_platform_exit);
; r% t* V  U# @
8 j+ I- O5 O7 JMODULE_DESCRIPTION("Led platform driver");
2 i5 s$ C8 K/ r$ D# B" |9 sMODULE_AUTHOR("Tronlong");
7 }2 ]* k: z8 \9 z! [7 fMODULE_LICENSE("GPL");
6 U5 B' i8 z* H) Q4 T$ l8 m! w& `: E0 k7 L# v/ S+ s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 19:45 , Processed in 0.037001 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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