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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。1 l. x  a) V: Z1 O$ y  G. W8 P
#include <linux/init.h>" a, S! n% f; ]6 Q
#include <linux/module.h>9 \6 J% m$ j# L/ y
#include <linux/kernel.h>
7 h) A3 r" _/ E4 J* Y) s#include <linux/types.h>
* g* e% K/ L+ ^. H1 a9 L4 N) I#include <linux/gpio.h>" M6 E% X7 B9 k) k8 X' n, {+ L
#include <linux/leds.h>0 G/ z0 Y5 L4 Q3 ?! x+ g
#include <linux/platform_device.h>; ^% {, N7 h  A0 i
% i- ?0 K. Z4 \1 y4 @
#include <asm/mach-types.h>
+ _; _9 S: c: C& r$ p7 R* k  \#include <asm/mach/arch.h>, G6 [, Z2 Q  z" x; x/ X& ?, b
#include <mach/da8xx.h>
. c) e+ n0 O9 R. _#include <mach/mux.h>7 s8 o5 U  F  ^, z" w8 x6 ~$ g9 C- E
- z8 p* y" e% [+ K9 M/ O, y  N# z
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)3 P0 ^5 D5 Z0 i
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)4 ?% J8 n# P3 F( _" e) O
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)+ R& ]- ^, p# ^. ^
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
8 K4 R% d* j7 F7 u- n, n+ A* I3 I  |1 f
/* assign the tl som board LED-GPIOs*/
& h2 b" v( y8 v9 n5 Istatic const short da850_evm_tl_user_led_pins[] = {
: Z8 A( g3 F0 |- U+ ]" s! I        /* These pins are definition at <mach/mux.h> file */6 t; b/ B3 V9 V4 W  `
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,; I. `& M7 {2 Q8 M0 j0 X7 P- ^
        -1* T; v3 V$ M7 ^
};) e: L- `+ t, I! R# m

0 \3 H& D5 N" n. b: Astatic struct gpio_led da850_evm_tl_leds[] = {/ D5 r- R( i* Z' l! A( H# U
        {% f0 P& |8 x- r, H" r3 n
                .active_low = 0,
& _$ S; l4 ~/ L                .gpio = DA850_USER_LED0,) j( k; ~) l. @4 d
                .name = "user_led0",% @! v$ w' `% V
                .default_trigger = "default-on",0 v! Q$ N# x7 x9 }, o: v& D, t
        },. ]9 p! [. X7 _1 {. \& O, V  Z
        {
4 f5 N+ Q8 X' m% n* L  k: W) V                .active_low = 0,! j4 Z9 t. x. Y: x6 H
                .gpio = DA850_USER_LED1,
8 a7 m/ x2 d9 C9 m8 x: j                .name = "user_led1",
* g' v; x. ~8 }( ]3 t2 b% J- _                .default_trigger = "default-on",3 j# {7 j% y+ j7 S1 d5 a
        },. H- r! Y3 ]" N' M
        {
: T" j2 N5 w7 C( {6 `& K                .active_low = 0,' ]* p8 q) h4 ?' J+ F' ~0 T9 G% g
                .gpio = DA850_USER_LED2,% D9 f3 \! e* g, N, @0 L! a9 P
                .name = "user_led2",
7 R: `' \5 ?: r8 b- D3 ]# X- b: M                .default_trigger = "default-on",
! E( k  V4 G" m$ ]0 z* L        },
8 W# x) b, B0 ~  o5 X        {: k, K2 ^( x; Z! l
                .active_low = 0,4 w  }) y) o3 M' z/ b  I; i
                .gpio = DA850_USER_LED3," |% J& V/ f/ b4 _$ O5 ?' Z: J8 Y
                .name = "user_led3",
+ u& T+ _) j9 S8 w                .default_trigger = "default-on",
* D" J% I! {5 C- ?        },$ ^) |0 J/ i/ v+ P" Y4 j5 d
};& `$ I6 E+ W5 u* Y
, p! r; H& X! z" b3 q; x, ^2 U
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
+ T6 q# D: D; ^$ q( {* u9 x        .leds = da850_evm_tl_leds,) _% P, T; \- _1 g
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
% s$ U, [) O1 b/ l0 A};
8 k& p) t9 Q% c! u- [' F% w  a- t# m8 U; E7 @9 |
static void led_dev_release(struct device *dev)$ F7 ^3 ~4 V! T: o9 K
{
1 A, U6 S! d) _$ e1 p* ]};
# A' R* @& z8 X+ _: k9 j  x" g/ n2 |2 `6 k
static struct platform_device da850_evm_tl_leds_device = {
4 `3 W+ L4 l% u! m* H/ q        .name                = "leds-gpio",, A: K8 n* k- c% k
        .id                = 1,
9 r4 b7 P# l" @1 {% N8 `        .dev = {
/ H7 A3 `* `( P                .platform_data = &da850_evm_tl_leds_pdata,
4 v9 y( o; [4 m% R) x                .release = led_dev_release,) d9 m5 E& j+ ]
        }
2 d. `$ Q1 X& I; D7 I9 J};
( j# U0 H5 E/ [  {, B7 Y7 U
' p% H+ d7 [! v0 O0 {& l5 Kstatic int __init led_platform_init(void)
6 l0 H4 `5 ?4 o6 G5 `; \2 c; J{
) i! n" [  ]& z* ^3 ^/ M        int ret;
! t# `, ~" h+ r) @$ e* L#if 06 w" c6 n5 U6 l- z
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);, F* E# U6 u: O9 c0 {
        if (ret)
& U9 J7 }* h3 H6 T+ A- H3 k                pr_warning("da850_evm_tl_leds_init : User LED mux failed :") r2 H# w- b6 |* e' S$ L
                                "%d\n", ret);6 B% k! |3 [) h9 ~
#endif
- R1 P7 l( w1 t  v1 P- ~6 g        ret = platform_device_register(&da850_evm_tl_leds_device);
& y2 x' Q" S) ~: [: Z* f$ K        if (ret)1 @' B) N! _$ C0 f
                pr_warning("Could not register som GPIO expander LEDS");
- ?4 G( j, y5 [4 m9 X6 n        else" @) i+ w9 R. X  W. V5 K: v7 n" {
                printk(KERN_INFO "LED register sucessful!\n");
  i. B# G8 E8 F% b) ?
( t( R8 i2 t4 c6 k5 t# i, f        return ret;( e" \' M- a; l5 Q0 g
}: s5 _; g6 i5 u- r7 k5 e$ Y' h
' T8 u) ~' x" C5 [& I
static void __exit led_platform_exit(void)
1 A% U& x; C! N! T& `{6 W# D1 i' Z3 }. f( M" y5 i
        platform_device_unregister(&da850_evm_tl_leds_device);4 U1 j: D3 A! e1 l0 Z$ X
: H# g+ j, _9 C. Y! P( f3 L
        printk(KERN_INFO "LED unregister!\n");6 U9 x2 c/ @9 w3 J+ n8 c
}
0 C6 P" Q2 @( }' j* o! k% D6 z; w1 |3 v) X- [8 M
module_init(led_platform_init);  K) y: O$ B# J: l, v- f$ K* r
module_exit(led_platform_exit);
: x! T6 d  Z1 R9 @: f
: B6 T8 P# K9 n) VMODULE_DESCRIPTION("Led platform driver");
7 ^* ~" A/ Y: `( LMODULE_AUTHOR("Tronlong");; [% N' @  s8 _& N9 k# k3 L
MODULE_LICENSE("GPL");
; ]- ?& b  ?* z7 e( _7 b7 t
2 P: ?. k7 |$ i! w. U* R- d) z7 Y( N' q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 00:14 , Processed in 0.041226 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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