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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
3 ?0 m$ h8 k4 o$ I- {#include <linux/init.h>
, q; d& a" ]* G/ G#include <linux/module.h>
- |& j8 f' ~3 E4 H+ n1 k#include <linux/kernel.h>
5 U" M# @% H2 G+ I6 l3 z#include <linux/types.h>
" u2 J+ [# Y. l7 j, N) A+ o#include <linux/gpio.h>
$ [& K( H" j  {" Q# L5 N5 g6 F' m#include <linux/leds.h>) b. i- U5 {9 `! P- L" f
#include <linux/platform_device.h>, ?( r  t& ~4 ?7 \. [- V8 q
3 h. i+ L0 g3 Q2 Q8 W1 w9 L6 e
#include <asm/mach-types.h>  C5 z. m: Z: _1 R9 R
#include <asm/mach/arch.h>
( w7 T, K  ?0 E+ D  D+ B% u#include <mach/da8xx.h>) _9 L3 Y. v/ i" \4 L+ [# c2 w
#include <mach/mux.h>7 M2 k& Y- U9 A
: t5 @, x3 {( c) t% ^
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)/ _7 |5 l( `; A/ W6 a9 E7 o
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)/ {8 ^3 {4 M2 O! L0 h
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)$ _* e) t5 `7 U* s7 U# l$ ~
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
- a  V# Q! M) D0 y, z
- O, W6 j* i7 a' |4 P3 s  w/* assign the tl som board LED-GPIOs*/
9 K% J$ g* Y3 rstatic const short da850_evm_tl_user_led_pins[] = {  X; U. M1 g% o
        /* These pins are definition at <mach/mux.h> file */
' }# G6 v( `* Z* V" I$ a        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,, n. T# ~+ n' N7 B8 _5 L8 r
        -12 q1 X& H$ y6 c6 D$ o) t, z) p/ o
};
+ v6 u& l& X' w1 ?* y; _+ e" b3 i( ]( w
static struct gpio_led da850_evm_tl_leds[] = {
4 \$ k1 V& H* M  }. [        {
  E0 y  S, L% w$ \  h                .active_low = 0,- u2 g# c' o! W$ n7 R
                .gpio = DA850_USER_LED0,$ [' D% H9 ~$ N- @7 e
                .name = "user_led0",
" E* K( }9 O4 Q/ M5 y7 i0 ?3 V                .default_trigger = "default-on",7 [+ R  R, R, n. L8 y
        },
" `( M; Z5 P' u2 Z% r: Q; o        {
8 e$ s" k& K/ B6 o' T- j                .active_low = 0,5 s7 E( k) a& g+ X) M
                .gpio = DA850_USER_LED1,
1 P0 {3 d2 \7 u                .name = "user_led1",
/ K  f( t$ ]( R( L                .default_trigger = "default-on",
7 D; Z% H( ~3 D. _: C        },
1 J5 G% l) o" k/ P( L/ o        {+ e3 b! I1 W+ [
                .active_low = 0,0 `1 A6 W* E, |% z- N+ A. n
                .gpio = DA850_USER_LED2,2 @3 `' h. U# e$ U0 e- a/ ~' K
                .name = "user_led2",
5 }$ {! o  m) J% m3 P+ P                .default_trigger = "default-on",
# a7 d- g0 b2 b. Z# v6 |# p# i3 y        },' {" [5 F1 Y" o: g
        {
! _6 D/ C4 Z& R  h) @& {1 l; l                .active_low = 0,
! Q' [5 ~5 }7 r7 ~                .gpio = DA850_USER_LED3,
+ y+ [) v' J! I                .name = "user_led3",
9 q9 j; n9 _+ |: s; k$ B  u+ ^                .default_trigger = "default-on",. u" a, [7 U' [( M1 Y
        },
4 A% |4 T; _1 ~3 T/ k! z};
1 x4 q+ M  U: ~2 r, n4 u! L! F: ~; v+ D# @* i: i$ Y8 N& u$ o9 j) ]6 w
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
  K+ C' S6 J: w( Q# k- S, J        .leds = da850_evm_tl_leds,( b% c' D! J; F- l
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
" V( T+ ^- _# G- q7 }: x4 K! M};& y) t3 N% @% A6 V) b+ q

: X$ j- R- T( d4 K/ Zstatic void led_dev_release(struct device *dev)) n- f( \  A5 h; X6 i$ j0 A$ I2 D
{  B5 I7 V4 s9 A, o
};
8 A) T7 W# x) O( s  h- Y# H- N) k
( j1 a1 ], C) W$ }% a+ w' O' F4 Nstatic struct platform_device da850_evm_tl_leds_device = {
  p4 p% o3 j9 L' {! G1 |7 o        .name                = "leds-gpio",
/ q; w8 X8 G4 n$ J+ m! p        .id                = 1,' M5 [: w( Q3 ^: z* Z7 i' U2 L! s! z
        .dev = {
6 a9 l9 b) l- ]3 R, d                .platform_data = &da850_evm_tl_leds_pdata,
/ ?' K3 p" f% K9 h: S% N6 n                .release = led_dev_release,
0 A* ~1 C! ?' W5 N9 q" f: i        }2 R0 q1 n8 V8 _; t/ s
};
+ \. h8 U: f( i6 r6 @+ r
; z; @& L0 k3 g9 u3 qstatic int __init led_platform_init(void)
9 `/ t: B* k( B3 ]- x. t{% t  l; `7 ^: ^! K6 F2 t. c
        int ret;8 n* r( r1 D9 g2 L
#if 0
  Y% r- K/ h# f, B. a        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
' S6 v  t# E5 O1 x* }+ ?        if (ret)# a$ ~* o$ ^! Q& C" O
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
4 N6 m; w3 S2 [) {! u8 d0 l9 s" u5 }                                "%d\n", ret);
& ~4 S( e8 w  r3 \# I1 T9 u' p#endif
9 S+ s3 ?, s) B# Q2 w- M        ret = platform_device_register(&da850_evm_tl_leds_device);
9 s* B9 K8 a! ^$ W        if (ret)
( n: \" r/ X2 z! c4 L0 t2 L4 a                pr_warning("Could not register som GPIO expander LEDS");
5 [* w, [+ \' f" G6 U        else
: o7 i7 p  b. w4 A                printk(KERN_INFO "LED register sucessful!\n");5 u0 e% Y2 v1 q9 R' P
! R) G' R4 A" U% [$ Y. i4 t
        return ret;) t7 j4 h) l+ C5 W9 C( T6 y
}* D! W- c% n' u! X6 l8 ?4 K. }
, L0 F% f4 l) P( M( O
static void __exit led_platform_exit(void)+ m% {. w# a% F9 z$ h
{
0 J  b9 @, E9 H2 u+ A% j        platform_device_unregister(&da850_evm_tl_leds_device);+ K9 w) F! v' T" l6 A

) y8 q% }+ n/ K& H! Y) o- J$ h8 Q        printk(KERN_INFO "LED unregister!\n");, L2 R. A, F/ k) n) D
}. z- p0 Z- R! B3 e

7 ^0 Z  l) n* j7 G, _$ cmodule_init(led_platform_init);- M# m  I8 k/ g4 I" ^( Y
module_exit(led_platform_exit);
: j5 t! |8 h) E7 N1 k  A$ J4 B/ F( A5 `4 H8 o8 W3 M
MODULE_DESCRIPTION("Led platform driver");+ L3 m4 K; V/ w4 e0 ?" R$ I
MODULE_AUTHOR("Tronlong");3 ]# B- b# ^7 N. p$ F- s
MODULE_LICENSE("GPL");
' i6 H+ H6 }" [8 Y5 s* C: @1 B* K1 \6 I7 e- r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 03:04 , Processed in 0.040688 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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