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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。* D- D# y  `: R" d
#include <linux/init.h>; [  B8 f4 V: [
#include <linux/module.h>: g$ T5 o; ]+ z5 u0 y2 _" Y
#include <linux/kernel.h>! j! M- y0 k1 b7 i$ J4 U$ U
#include <linux/types.h>
, g' {! `' S+ i8 G# O! b; c7 H' V#include <linux/gpio.h>
! o2 _+ |$ H% L#include <linux/leds.h>. G. G7 X2 F: S
#include <linux/platform_device.h>
) U# h. `, O# U. U: X9 |( `- f+ P5 s5 [+ p4 z
#include <asm/mach-types.h>
! {" ]1 Y' z% i# K' E$ c#include <asm/mach/arch.h>. I$ u/ q( L" M
#include <mach/da8xx.h>
: ?4 ]! w$ |! U( \#include <mach/mux.h>: G  T/ r; h( D- S, Z) t
6 q) y* {6 p2 a. f" O$ W
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)1 {' p, w. O0 V6 V' R) N
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)$ y. i# m/ w  E1 v) C8 ^. l
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)! O- }: C; {, x8 ~8 l
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)2 C  b, O; g5 C5 t3 D8 C6 J

/ E; u9 P4 {; D3 P/* assign the tl som board LED-GPIOs*/
, Q; G4 j' E4 b0 fstatic const short da850_evm_tl_user_led_pins[] = {; N3 ^3 T: V; U$ R8 P
        /* These pins are definition at <mach/mux.h> file */; P$ ?, X/ f9 ~. T) ?, y% R
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,# Y! ~1 a) ~( r* Y" g1 ]
        -1
% O( A. _' ]# x0 I3 ~};
/ ]6 x( G* H" G
1 K1 _$ P+ u. G/ D& Lstatic struct gpio_led da850_evm_tl_leds[] = {
( `: q7 o- ^4 I0 U- R1 q* j        {
  q8 f: s, g* u% d                .active_low = 0,
' w; A  f# F6 s                .gpio = DA850_USER_LED0,
/ y1 k& {2 ^: i5 l4 z2 @                .name = "user_led0",0 u5 L  Z8 y3 J$ \7 v. y
                .default_trigger = "default-on",
9 x5 a* b! `3 ~4 C: o& t3 w3 N        },
, u/ Q4 d5 g6 [. C  I6 M        {
% U; x4 ^1 O9 o; Z) O  N                .active_low = 0,! s2 e, X3 f: V
                .gpio = DA850_USER_LED1,
1 g& Z$ _  V# B* L6 b6 L                .name = "user_led1",5 V$ l% G+ ^; ]* |% F8 h& |8 B
                .default_trigger = "default-on",+ {5 l; M' U* G% _
        },4 O- u# E% L. g$ h% A# n
        {
& U. S/ K# {1 b                .active_low = 0,
) A# D1 u$ v2 ^+ o, O/ W/ B                .gpio = DA850_USER_LED2,
! c7 Y# z8 l1 r. o3 T3 S% p  l                .name = "user_led2",
( J9 ^8 R; n- l( A( Y6 ]. E                .default_trigger = "default-on",
0 H$ E$ J6 e) j) `2 w# {' W9 ^        },
4 d% u5 D; r+ i, U! Q7 X        {
& j$ g& Y, g; h) u9 S, h9 w& d                .active_low = 0,
! M( o8 v& J: y                .gpio = DA850_USER_LED3,
7 G6 U. l  ^( B/ A" O8 o3 A5 R                .name = "user_led3",
/ R; _0 k( T3 s( e                .default_trigger = "default-on",
/ H9 c0 c( i: L4 }, O9 k5 d& W        },  I3 Y1 A2 \) U8 I) c1 @2 V
};
( k, K& K: _7 i2 c; G' q
3 p3 q  l1 G& q0 x7 x5 {/ m7 Tstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {+ e4 Q% v. ^: C# g4 K
        .leds = da850_evm_tl_leds,, I0 Q9 ~& T( X' ~/ A# L
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),9 Y; G4 a$ {" E1 [. ~
};
4 p/ o  K9 [- w9 l2 H* J
# _/ q  F( @" ^% s% bstatic void led_dev_release(struct device *dev)
: `( t9 _$ p, ?9 w9 M/ c0 _+ E{: ]- ?- q' ~# Z8 m
};, Y7 Q* l7 @; V! X. e8 x* i3 E4 H
0 [- b. @/ x2 K5 S2 h( L6 ^: U
static struct platform_device da850_evm_tl_leds_device = {0 E9 ?- ~6 |2 x' }3 G! _8 l3 v: k
        .name                = "leds-gpio",
2 b6 |# f4 N9 I- q0 i( H        .id                = 1,& s. B" J5 e; c
        .dev = {( i3 I  ?  L2 u/ {  U3 G% n4 x2 x
                .platform_data = &da850_evm_tl_leds_pdata,
9 W' a3 k+ r2 t) T9 n, Z                .release = led_dev_release,2 E* c# ^) Y+ d; }$ T
        }: h) U3 e7 v# U
};
- K: O1 |7 N- Q! o0 W' j1 i. j  F2 ]. s4 Q  k& D
static int __init led_platform_init(void); ?; J  P( ]( t' Z/ t2 n* @$ e4 ]
{
, {. k+ z6 v; T1 ^        int ret;+ g" T# ^/ x) ]5 u. {% a+ u
#if 0
0 {* F4 i( Z3 Q; F+ ~' G# c        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
/ _. w6 `% _  ~( Y- z7 t+ L( k6 T        if (ret)% z5 k0 k" C* P9 V0 a: C
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
9 m) {( C) n: l                                "%d\n", ret);) q2 p) T' a! L* H6 n' U: A
#endif
' X5 W% u% |% O: L        ret = platform_device_register(&da850_evm_tl_leds_device);$ x# E+ f1 a+ @; S9 r8 h- p" f
        if (ret)9 R# w, r3 S6 z# {" W
                pr_warning("Could not register som GPIO expander LEDS");
! t- l) G% ~) I* m        else' b) E  O, W+ H0 z# z  I0 r' d( J2 }
                printk(KERN_INFO "LED register sucessful!\n");
8 K* G. ~3 e* h' o1 }7 N
' E9 f/ `) v2 I) c+ C2 n        return ret;& f6 p' m+ k8 ^# ]# V
}
" Y/ ]+ ^8 i  a$ q$ N5 J* {, S/ b8 e
static void __exit led_platform_exit(void). p2 D$ L- G% Q
{  i1 o4 z+ P  q' M
        platform_device_unregister(&da850_evm_tl_leds_device);' X" S, M8 K9 ]) N4 r( k! A: \
( K! x* |7 L7 {" E$ _5 M
        printk(KERN_INFO "LED unregister!\n");
0 y; n( v6 H) v) ~: b  t. t}
1 ~& ?" N6 X& b" k3 U' ]$ ^/ |8 h1 n$ q
module_init(led_platform_init);3 o2 b1 Q' g1 z$ O
module_exit(led_platform_exit);
/ r$ D3 R$ p8 X# o8 q
* p' F) |, ~! u; HMODULE_DESCRIPTION("Led platform driver");
- ^& d+ p& H/ k& l) cMODULE_AUTHOR("Tronlong");
7 \0 F0 B) X7 oMODULE_LICENSE("GPL");
2 y6 H' ~! u& l- O; k- N- m1 T: N* B: J3 d+ }1 J7 Y; d+ @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-24 00:03 , Processed in 0.038664 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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