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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。6 ?( g4 a( N9 Y
#include <linux/init.h>: \7 j+ J7 _0 [  b  M9 n  A5 j- }. v
#include <linux/module.h>( [& \9 `5 n! X
#include <linux/kernel.h>, `8 A  m) V0 I
#include <linux/types.h>6 J0 n! z& j5 n9 G
#include <linux/gpio.h># J0 f8 `; M+ L
#include <linux/leds.h>
$ \6 i/ j! g) t0 Q/ F1 _#include <linux/platform_device.h>4 a+ ?8 p" y# p# C( D7 N! v. d

3 I# ]& V# ~+ |' t" y4 U. p8 k#include <asm/mach-types.h>$ W0 Y/ ]6 A% j: \$ e2 i2 ~# u
#include <asm/mach/arch.h>
5 A+ v, P- Z2 ^- C* v#include <mach/da8xx.h>
$ Y- u  Y) B2 S& `+ b#include <mach/mux.h>1 K& }. n1 s; b# X

+ s" ]+ N) Y( h( {% R0 i. J+ R#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)' l( i7 A. d! b
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)# n2 T# l9 R( X
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1), x% |& f4 z/ v/ H3 @
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
/ j( S3 r9 Q; }- U; R) I, ~
' S3 I8 `# `- j' A) s/* assign the tl som board LED-GPIOs*/
0 `& O( {" U+ z% {4 rstatic const short da850_evm_tl_user_led_pins[] = {
; D8 E1 ~+ r1 h# e. I  N: `. p        /* These pins are definition at <mach/mux.h> file */0 g' h6 S% i( S/ r
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
: O) Y; `1 c& I  _% p2 L+ {        -1
! R; Y9 k' E( R& l};' E( s6 t# O, b, [# H$ L

) R$ s# k. G- u+ @$ i5 h4 e- D$ vstatic struct gpio_led da850_evm_tl_leds[] = {2 K3 @* f+ t- r9 B! G* ?
        {+ b- V5 x+ }" j1 m7 o% \! p
                .active_low = 0,; f' d# L  O: |3 Z* F
                .gpio = DA850_USER_LED0,
! X& F$ W/ _) t8 A) S                .name = "user_led0",0 S! f3 x$ f& o* K4 l0 f0 O
                .default_trigger = "default-on",
. s. v/ k+ G' F9 A        },2 O) ?/ C' c/ c8 M0 p
        {
1 j  n3 l% R3 }& Z% r                .active_low = 0,
! h. a) K0 s! @                .gpio = DA850_USER_LED1,6 w( l4 ?. O. X) I6 a) t
                .name = "user_led1",
2 v3 C9 }8 b% G                .default_trigger = "default-on",7 P- p8 \& L( y) c5 S: a
        },. Q1 h; \5 M, ^& |9 N& V0 ]
        {
3 R0 A2 i. Y# V7 l                .active_low = 0,$ G% u5 ?- e/ q* s# Q5 Z0 ]) |% w
                .gpio = DA850_USER_LED2,
. B) y9 {* g6 ?. S! k                .name = "user_led2",  l( A" G6 H. z: @
                .default_trigger = "default-on",
' q! X' C3 R% j3 P& ~$ j7 A8 g4 z        },
1 s: {% e# a1 f0 h3 G$ j, s        {. A& D* }1 o# M" L* y/ B5 Z
                .active_low = 0,6 m0 m8 ?& n# t9 T* t# A* M/ n
                .gpio = DA850_USER_LED3,. f4 `& q6 b/ r) r7 }
                .name = "user_led3",
  R$ F* k8 B) F! t: ~. F' |0 o/ M; {                .default_trigger = "default-on",6 |; T; t" ~% Q" K
        },4 y6 A( E! j% O; F4 z, A3 E
};
5 e% Q$ T, Q- g! k) [: }3 s
& J+ _6 u0 j" R& e+ U, Bstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {- N4 |- U% o4 l/ B; r4 _9 S
        .leds = da850_evm_tl_leds,+ s+ h: d2 j# v2 ~# C
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
4 X* h/ E0 N0 d3 F# d7 o! z  [};, b( `5 `9 q* K% p* E9 K- ~0 i. p/ D

0 L9 I" `" j7 k2 Z  }3 `static void led_dev_release(struct device *dev)
- o8 g( `& l5 p/ k{
: |- `0 J& k: W, w7 J! @# S1 S};
/ `  u; G0 N5 K3 }" M- ]9 d! ~( k4 D% Z
static struct platform_device da850_evm_tl_leds_device = {
" k: N4 _  C! j+ v9 \, J        .name                = "leds-gpio",
* h: p. i* G! _! L; o' x        .id                = 1,3 {. y9 b7 J1 j! k/ |; I
        .dev = {
+ L, C* v; [" X4 N7 V/ b+ F3 f/ ^                .platform_data = &da850_evm_tl_leds_pdata,5 p" V: u+ ]3 q$ f' d$ a0 R
                .release = led_dev_release,
, {+ [4 X& F8 M: w        }
- w' d$ G2 x' j4 z, Z};4 {4 w1 D% P/ p# m/ m( w1 A0 ]
0 T3 g2 `) g3 A/ R# O, K( _
static int __init led_platform_init(void); z0 k5 M2 ]  Q; m
{
4 t! r: T9 e% X5 g# H# p        int ret;
( F: @8 l% i% h8 ^( u#if 0
& }. l, p  H! _+ X        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);- y5 `, ^- K( I, @/ q
        if (ret)( o1 m: X! q# C3 l; b: V
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
  I2 H6 C7 x+ ^4 O                                "%d\n", ret);( Q8 u) B; {3 N' }8 r- E( M' L' s
#endif
* j7 u# A# {0 S$ A$ q0 ]6 V% K        ret = platform_device_register(&da850_evm_tl_leds_device);
6 P0 V; f. R- g$ i5 f6 `3 d" X& O        if (ret)
5 `* G% Z) Y  M: t" V6 W5 y- H                pr_warning("Could not register som GPIO expander LEDS");
, Y$ I# Z2 [1 ^7 \        else
. g$ W7 u) L9 k6 _                printk(KERN_INFO "LED register sucessful!\n");9 \; y! H& r- W) m& R9 Z
5 [9 j  h: K4 R- @7 e% s0 X
        return ret;
8 D/ H! M3 p8 K) b/ {7 _}
2 i, `1 W6 ]1 W3 h  Q; y& {: i$ a5 P0 T: v" L
static void __exit led_platform_exit(void)3 b; ]$ e' Q: Y6 m4 M
{
" K. M/ I: e8 V( `  a        platform_device_unregister(&da850_evm_tl_leds_device);% W! h0 M, ~& y, r, [

- k. y; `& m0 O3 h2 l2 g1 t        printk(KERN_INFO "LED unregister!\n");+ J9 G. f- n" s  h$ l
}
0 {% G! P  E" O3 I# K$ C+ e* d% `1 I1 K& V; W8 l' Q, t
module_init(led_platform_init);$ z  c6 f& V. s' D. m6 z0 V
module_exit(led_platform_exit);( d' ?% i0 P. t! F- }5 a) W& s

  j/ f1 M" M  N& S+ mMODULE_DESCRIPTION("Led platform driver");3 n+ T% R' ]" @) I
MODULE_AUTHOR("Tronlong");  H% l8 }& O8 m$ O2 l- |1 A
MODULE_LICENSE("GPL");
& ?( Q' J6 j# j% L0 D, U1 O- i  E) x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-7 21:12 , Processed in 0.044651 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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