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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
: ^8 p" g: z2 v/ o7 e#include <linux/init.h>
: ^  o/ m$ z0 q7 w, Y" \#include <linux/module.h>
# r  k- @( x) u" m; {: D#include <linux/kernel.h>, p6 Z0 I( y0 z' k0 P0 n
#include <linux/types.h>
5 x- T" r1 L7 p4 [#include <linux/gpio.h>
- V0 b6 x' `1 N$ x  A9 {7 [4 V#include <linux/leds.h>
2 P9 u/ P% c. o: ~5 x#include <linux/platform_device.h>* Z; D: C  ^4 G
- I- C# g; E  V- V1 v% C9 ~$ p
#include <asm/mach-types.h>% @, R6 c) G4 p! `
#include <asm/mach/arch.h>
: G  z% _3 F) D. z$ g2 R#include <mach/da8xx.h>5 g8 J9 _/ }: ?4 b- n) ]+ [6 R
#include <mach/mux.h>( P3 y: ?1 G* ]3 J7 [4 @
8 @4 Q( @; }6 `. e4 e2 m% m2 m
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)  ^3 ]5 z! P, N' ^5 ]0 z- n; J
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
" c) {7 J" A9 G% Q# t- B. d#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)$ w4 o3 V: E& k% M4 G! y
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2); z% E# g# W# p

3 ?) Z- K4 K* I# ~; i# Q/* assign the tl som board LED-GPIOs*/* s" y$ y! p! f, K& l; j
static const short da850_evm_tl_user_led_pins[] = {4 B8 y$ H, g! }6 H# X8 }
        /* These pins are definition at <mach/mux.h> file */# w& `# c$ X- d7 Z& G; n2 v
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,9 @0 ^' P& B% {: P
        -1+ I  s) g) X9 [# e0 x+ l% Q
};) z1 I# K0 y+ `& P
* P/ n2 ?2 _* Q2 i; r$ o
static struct gpio_led da850_evm_tl_leds[] = {* e: e4 @- L; I; L/ @: H. r$ C) K
        {
5 o  d7 |: S, H9 B) z6 u                .active_low = 0,
3 k3 @' l5 h7 B! c/ {                .gpio = DA850_USER_LED0,  d( |; \0 C" Z, X
                .name = "user_led0",4 }- R5 C0 N7 _* k" W3 u8 [: g' a9 R6 K
                .default_trigger = "default-on",
, J3 ^& c9 L. z        },
( B( S7 q) ~- B3 m        {& ^+ ], K# O1 H+ v7 A$ o% T! @$ H
                .active_low = 0,
: {' d' g' L, g6 c, v                .gpio = DA850_USER_LED1,
8 n* ?- ^# i: ]) R/ k2 w                .name = "user_led1",. Q& g' [( y8 M  k% _0 C0 L/ Y$ \" P
                .default_trigger = "default-on",
, U" y* {- T0 D        },
/ X( @  D0 Y' q        {4 K4 h% Q1 G- L; u
                .active_low = 0,# }4 h  r- }+ ]2 C# T
                .gpio = DA850_USER_LED2,
) V! a* x& }/ O8 ~+ I! m                .name = "user_led2",* d& q) o" w  O: S# M
                .default_trigger = "default-on",) W3 \% b$ B8 t2 N( x6 D
        },; e/ U3 @* @8 i2 A) A5 x
        {
$ Y: l) Y* r# {4 T* q$ M                .active_low = 0,8 d: R3 |; i  b& s; _
                .gpio = DA850_USER_LED3,
7 U& F% |7 J6 E' {% a                .name = "user_led3",
! @/ ]0 d! t2 A/ t  c( O, V0 x. D: x! T& O                .default_trigger = "default-on",
# o. _3 ~/ ~6 a0 p( M# z) d( \  ~        },  W7 ?) j2 ~9 Y8 L; R
};
0 c: N; G% h7 n5 H  @
- j" T- X! B# G4 i% _! T0 A/ Ostatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
& s; i( |& Y3 z4 W6 b- ~! k        .leds = da850_evm_tl_leds," O; y% _, R7 P3 _; K
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
; G( o) K' x; {. B4 |; y};
% X! {0 Z- ?: o/ H! P6 }! w
+ H4 o7 l6 W* G! bstatic void led_dev_release(struct device *dev); ]2 p& z9 q6 l' U! B
{6 G4 X( }- V' ~. V) R8 ~- V
};9 C1 Y  H3 r# m$ E0 }% z
, Y+ ~0 T5 y4 |
static struct platform_device da850_evm_tl_leds_device = {8 z& D% u2 S5 _3 F' H
        .name                = "leds-gpio",
! D2 q0 ^2 f) G, R6 F        .id                = 1,
" e" G0 O/ {$ w9 h  e        .dev = {
$ T! S0 {, M  Z# l! H' d. J                .platform_data = &da850_evm_tl_leds_pdata,
, ?8 i9 j0 D2 f  G% z) k$ d                .release = led_dev_release,( n% P+ D- [9 |0 k0 ?
        }
& Z5 [+ ?4 m/ I$ ^};! w% P7 }0 m& A- c- @  C
) g7 {) {# Z5 ~9 I( I* k
static int __init led_platform_init(void); `! `4 i9 ~" l4 N9 B6 `3 B
{
/ Z* @1 ^* g. ]- X        int ret;
9 D6 x  Z0 G- b5 q#if 0
7 ?+ R1 v! B" F  w& v        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
, Y/ }& Z7 e3 }, w        if (ret)/ u+ _7 h' K) _
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"+ ]/ x$ E' G7 m
                                "%d\n", ret);
( z/ A( q2 ?# _#endif
0 P0 a" Y3 `1 C8 K) j        ret = platform_device_register(&da850_evm_tl_leds_device);$ K/ G7 i! G8 E* |- y
        if (ret)+ Z! a$ ?' l; Z
                pr_warning("Could not register som GPIO expander LEDS");2 t4 K2 f5 {  h! H! {5 w8 T* D) l
        else& j. G/ c& k( e( @# ~. \& l( [
                printk(KERN_INFO "LED register sucessful!\n");7 Q2 `. k, t8 q; @

8 }( ~8 O8 F. p1 g        return ret;
: ]) A2 E6 {# W. f7 O}
! j: A9 A$ i7 y9 d  f% L" f! V1 |9 ^
static void __exit led_platform_exit(void)( @2 {0 f* f5 m5 y  q5 p- a
{
0 N6 G9 T1 O' f5 b* t; y" z# D        platform_device_unregister(&da850_evm_tl_leds_device);
9 b, B7 v/ C0 E! a6 J  T: _) g7 o) C- B( X
        printk(KERN_INFO "LED unregister!\n");7 [. H. {8 Y" \5 O- n- Z( L
}
# z& X# d2 B4 x2 m( o3 J' H) j+ R3 H: o
module_init(led_platform_init);1 `2 v- A4 U. h3 v
module_exit(led_platform_exit);
% ]4 Z* ]% J+ N3 S* O
1 z7 N0 o' ]  @8 w# l+ T! O' YMODULE_DESCRIPTION("Led platform driver");  t. v! ~5 Z  g0 F( v) |
MODULE_AUTHOR("Tronlong");' \) H" Y) {7 T3 [/ q) D& U) j/ W
MODULE_LICENSE("GPL");( B5 n. a7 j9 c. k
  V: [% u7 `. d  N( y! X* b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 03:56 , Processed in 0.042425 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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