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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。3 Q3 [7 D2 @  Z- A
#include <linux/init.h>
2 u! D; [" j( ~& b5 B#include <linux/module.h>) a* Y5 L6 V: j) G; F
#include <linux/kernel.h>
% [2 ^7 S: [6 C' y- p( Q# H' \8 Z7 R#include <linux/types.h>9 ~0 }% v# @& K! f( M
#include <linux/gpio.h>
, r* ^; `) [0 Z6 p+ y#include <linux/leds.h>
  E, f  ?; e4 H+ s9 g#include <linux/platform_device.h>
( J0 \( N8 ?  B; t5 i2 T% l% B! D5 L0 ~8 J
#include <asm/mach-types.h>6 X' ~/ F! G7 N- `: H
#include <asm/mach/arch.h>
+ p. F# P6 ]% d# u; `& p* T#include <mach/da8xx.h>$ j$ }9 y& t  O8 S; _" n7 R
#include <mach/mux.h>& p: U7 q. O7 W3 M1 o& g+ N8 {
: q; u* S5 H3 h" ^
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
6 V% H& C2 Y6 h! ~8 e1 A  J#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
- [+ C2 D# e7 j6 D#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)$ W. H& g8 q' @  I. l
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)3 [# d6 R) ^% m2 M
+ D6 E0 u) \4 X
/* assign the tl som board LED-GPIOs*/8 H- z2 {1 x  [
static const short da850_evm_tl_user_led_pins[] = {  `5 |7 F7 Z5 X/ p
        /* These pins are definition at <mach/mux.h> file */: y6 g! }+ }2 p8 {" ~& @
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,* M/ K7 E/ I% E/ P& P! b; A* W
        -1
/ @& y* M! N( C* a% u. [) A};
7 T, k% O; w% j$ W5 q$ L5 x0 T- Y3 x# [# H
static struct gpio_led da850_evm_tl_leds[] = {1 k: }5 _1 B" {% h5 s' n! W
        {
! }3 L+ F1 h& c3 |) }6 g                .active_low = 0,+ C$ y7 ]9 w) d( z5 ]% D7 d
                .gpio = DA850_USER_LED0,
4 V: ^4 Q" m' w: ^! q6 L1 E$ I  d                .name = "user_led0",$ \, u& p8 B1 |9 M! q" C
                .default_trigger = "default-on",
1 k* ^5 L* U. s) ]        },& \4 ]0 t: ?* a+ N& S
        {
+ m" v8 z) `  g; K                .active_low = 0,4 w. m2 d  y  A
                .gpio = DA850_USER_LED1,8 Z( K% c- m& P/ J: R- o, \
                .name = "user_led1",
" f8 b+ s' f6 J7 f, D* d                .default_trigger = "default-on",* E! @$ X3 k- u  }, _
        },
! ^  n  Z: ~* r        {1 _- F) u4 S* M1 R1 \+ D# g
                .active_low = 0,7 W# Z0 k2 Z! b, @3 x
                .gpio = DA850_USER_LED2,9 H9 Z/ p4 k" ?
                .name = "user_led2",& l8 P, W' R  i9 v# C3 ]9 y0 `1 d
                .default_trigger = "default-on",
/ K* Y) X5 ?! \. s0 s. W+ S: I* }* H7 _$ V        },3 K9 @1 [; }1 Q$ B5 G& o  L
        {
1 f1 t0 o- o8 z6 h& `  X+ ^7 R! ^                .active_low = 0,$ u; \9 B# N& |; ]$ Y! k* L* J
                .gpio = DA850_USER_LED3,
3 V& c2 R" U# B2 k/ n0 t                .name = "user_led3",
: G2 B& o  s; x                .default_trigger = "default-on",
1 W) P8 D# G4 B# a5 Z# M        },0 G( }! s0 M' Q) a# U
};
7 S# `: x9 z6 n1 b' x, ^$ Z- B: {. L
3 w( z4 _- x+ `5 |3 z) |static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
  E# M, o0 H, Z% f. Y) s* \& a! x        .leds = da850_evm_tl_leds,% @- m" C% y; t& U7 `4 Q
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),% Z5 l+ s( z3 }
};( H5 W! [% H$ v, h6 O8 @$ N
, J" C! d0 ^4 Y. T' D9 {
static void led_dev_release(struct device *dev)
' }- L5 ]' @) Y. W{3 s* |7 }1 T7 y* r
};6 ~7 y3 r( ^* l1 z: q' E" {2 j) N
" H4 `! G4 b" q
static struct platform_device da850_evm_tl_leds_device = {
3 }' p/ H4 n* ]2 t& M; T: Q! T        .name                = "leds-gpio",
  a, k3 r. D/ |) ~        .id                = 1,. e' T. a: T3 s" V, R# w3 j4 I! n; J
        .dev = {% d1 [# f0 A( z4 ~6 J
                .platform_data = &da850_evm_tl_leds_pdata,4 A6 R5 I* ~% \  h
                .release = led_dev_release,
5 v- `# s4 s- @4 {        }9 P$ u$ m5 ?8 Z- [* d) B0 ^
};$ B' X2 u) @: t( e

" Z4 n3 C: y" O! `static int __init led_platform_init(void)& t- |5 V' N. B" q
{
7 X0 Q1 a& N. s. L, Y        int ret;
' y+ H% ]) X3 l. Y#if 0
: {, N) {% E7 g& n* M. V8 v: Q; F        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
) s, s3 G$ K* q2 W& c        if (ret)
4 M9 o' {, L. V/ L                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
+ Y8 p) ~2 b; j7 ^                                "%d\n", ret);3 i+ D$ R/ C: H, g
#endif; _4 a& z4 \+ f
        ret = platform_device_register(&da850_evm_tl_leds_device);
2 A/ Q7 P7 A6 O- p        if (ret)
# e" ^  Y4 N5 Q4 d9 d# |9 X                pr_warning("Could not register som GPIO expander LEDS");
, J( }+ Y& a  B9 F9 w: C5 W% c8 \8 X        else
9 P# h; O6 H  N                printk(KERN_INFO "LED register sucessful!\n");
+ T# t+ G; N" K; X; Z2 w* S: y/ A3 ]/ R- J7 L( M! j! n
        return ret;# z: L$ K( Y" ^4 L3 A7 I
}) `# }+ d5 I0 j) o
* m0 c  ^  m* a" B: J
static void __exit led_platform_exit(void), K1 p  z% `% i* u7 ]
{" b. F  K' e' d& G+ u
        platform_device_unregister(&da850_evm_tl_leds_device);
" p6 a' [. B6 T5 d8 \: F7 M$ _" b  g, m6 k+ ]( i
        printk(KERN_INFO "LED unregister!\n");
6 @' r' |1 m; w- Z# N3 x& Y6 ~}5 Y3 g2 r: e! }0 u
2 y8 u8 v, m, c! t
module_init(led_platform_init);$ \0 J6 o2 u+ A' Z8 X  A& N% F
module_exit(led_platform_exit);
! E! s- k9 K/ I: {9 m0 C
5 u0 P9 y* G+ b. R) L& D+ XMODULE_DESCRIPTION("Led platform driver");
# \4 N- ]2 x  A/ c* r# w! MMODULE_AUTHOR("Tronlong");
/ W6 |5 w5 M: Y  e+ E) RMODULE_LICENSE("GPL");
! ~+ \" O! Q; c  e8 y% o- v! E* H/ S: d# l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 16:41 , Processed in 0.039008 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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