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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。7 g: ~1 n' `$ k1 B
#include <linux/init.h>& z+ X8 C2 Q1 z3 K: a0 s
#include <linux/module.h>
* D. E* j9 B# P; ]7 Q% c  Z#include <linux/kernel.h>
2 q) e  O) P- p#include <linux/types.h>
+ Y- E# b% y4 }6 t: q#include <linux/gpio.h>
8 `, o+ T3 B2 l5 z4 n# D/ V: V#include <linux/leds.h>4 I5 y) E( ]/ i' F+ r, |  B6 l
#include <linux/platform_device.h>
' r! G8 q/ q+ h% P' V2 s! T' A, d- Q) |
#include <asm/mach-types.h>3 v6 R' ^, f1 ~& s3 M6 f2 T" Q9 ^4 O
#include <asm/mach/arch.h>6 d8 V: l* x: a* a2 u$ _! g
#include <mach/da8xx.h>  @5 d. p- B3 f5 B: R
#include <mach/mux.h>8 @% T; s6 \% ~% P7 ^9 J

0 U) `- E% n" y" B8 l#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
  `: i0 |1 X' ^. V3 E& o#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)& x1 B  x: s* H: {3 O5 t
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
8 J) o  I3 Q, B" {  ?#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)6 S) \! X0 c. F0 w! C6 T
+ J& ~1 H+ x% i' B- c9 U# [
/* assign the tl som board LED-GPIOs*/
6 U3 W! ]/ F- U3 estatic const short da850_evm_tl_user_led_pins[] = {! |" s0 F, c& C0 f4 t/ I' h5 `
        /* These pins are definition at <mach/mux.h> file */& ^) s) p2 ^4 o: M& T& ~
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
- c' y/ t7 P; }( p        -18 J. C4 L, x; O2 s
};
* B+ z( t# [$ \% W6 a5 Z; q* Z4 Y* p) B7 j/ }3 D
static struct gpio_led da850_evm_tl_leds[] = {; V& N1 T7 ~$ U
        {! t4 P- o/ ~, U2 C6 G
                .active_low = 0,/ k# n$ L! Q/ W0 O- ~% S6 A
                .gpio = DA850_USER_LED0,: W* L: X  a: Y! j
                .name = "user_led0",
. g+ z8 S/ [" k3 J# F                .default_trigger = "default-on",; e0 [/ p+ d% M1 n- |) t+ F7 ^
        },* S# u/ `* u2 y4 d1 i! J% r
        {- J0 b6 A$ N2 g* y
                .active_low = 0,
# ^% r- l3 O, `" E3 \; F                .gpio = DA850_USER_LED1,
1 q* {3 R$ c& X2 j5 n                .name = "user_led1",
4 T8 o: E2 F2 ?$ V                .default_trigger = "default-on",, a9 N) R9 b' h3 I. c: O
        },8 x7 l6 R1 C9 C4 A9 h/ R. b1 N
        {
; I  f1 c! T4 I- @                .active_low = 0,  D- f' i0 f# P1 B9 W" |$ @$ E( ^
                .gpio = DA850_USER_LED2,
# N7 s8 {2 B+ s( }8 I                .name = "user_led2",
* U* b3 w/ f- k1 n9 N! s/ |                .default_trigger = "default-on",
8 L3 [# L, _! A        },# B! `2 V1 h: x! A- q5 W% o
        {8 f, H  B  n. v2 C3 \5 A! [4 a+ _
                .active_low = 0,
1 A/ T8 y) n, i                .gpio = DA850_USER_LED3,
7 J- D/ _" P$ q6 {                .name = "user_led3",% j3 d: F& w' i" F5 _1 f
                .default_trigger = "default-on",
* F% P4 f4 l" |        },, d: F$ C/ x2 v5 i2 V4 U( f  w
};' o8 C% Q- C) r% W9 \, M( O& Y
+ h( D8 i5 _. A. H% f! ], c
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
0 `0 |* K( I+ w' S5 Y% N9 Q        .leds = da850_evm_tl_leds,3 D. {4 v+ H" w# G8 @0 n; N  q. h
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
/ a& a- s- S* c/ o. Q};
0 S3 `8 F. L1 K, ?$ N! e4 d( s. g! t2 ]( b: H2 J9 G4 ?! n
static void led_dev_release(struct device *dev)" P+ I  f  }% v5 `% `
{
- W( K$ R: W; |! k% p2 G4 i/ T};1 D- b. H+ h5 N4 \

7 _8 B: {/ y! ?# _static struct platform_device da850_evm_tl_leds_device = {0 o# \0 Z/ B! I2 p: q
        .name                = "leds-gpio",
$ M" S5 g* f/ N; j3 v        .id                = 1,
9 e; O1 V& m/ ?, I# O        .dev = {
. w3 `# X7 O. {                .platform_data = &da850_evm_tl_leds_pdata,  I6 m+ \# H7 R4 T
                .release = led_dev_release,
  d3 l" c5 G. q* x. Y        }
3 S  W2 B: q, L};9 f$ V1 ^9 d: o- [6 W$ g: h

) f% E' k- x- h; t8 ]( b% Astatic int __init led_platform_init(void)
5 I" Z) o& _; b! D( I+ n{
2 o3 |8 b! Q, v( \, \4 ~        int ret;% ^! E2 z! N5 [3 [) L& l
#if 0
$ `7 s% F/ `: @. Z: v        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
( d+ |+ A0 E/ Y  B        if (ret)7 V1 f1 R5 L# }
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
3 D  _+ j  Y. x3 ^4 t                                "%d\n", ret);, j/ [. J$ k. p, j9 p
#endif
1 x" J. Z) [5 j. S. q        ret = platform_device_register(&da850_evm_tl_leds_device);
* K- v2 q0 S) g4 O" p& n        if (ret)
8 O- R2 W" e+ J/ G: R4 B9 ~                pr_warning("Could not register som GPIO expander LEDS");
$ }- @+ e! _* g/ @" g        else
9 a* ]- _, _* |                printk(KERN_INFO "LED register sucessful!\n");1 [+ U( D7 |) B' o; W

; @9 i& Y$ O- [" s4 K  Q. S7 ]        return ret;
. x! a6 P  @# t: J/ ^}
& k" [" C; f, H: O
4 k4 F. I. F7 A$ vstatic void __exit led_platform_exit(void)( Y5 ^$ R* Q6 N- D7 M
{
+ p) L, j' y+ a# B+ _- p        platform_device_unregister(&da850_evm_tl_leds_device);
$ i1 `% {' U7 Y  H0 O8 {( ^
  `/ p  L' J% U2 E5 p" X        printk(KERN_INFO "LED unregister!\n");
! ^& C$ a9 f3 F+ k* T0 W- |1 K- P}
3 I2 v9 U1 D) P( I8 _7 X6 `2 Z  O/ r% F! P  L, |
module_init(led_platform_init);+ F4 V/ \8 {- Q# j8 h% Y
module_exit(led_platform_exit);) ~1 y8 i4 f  l- q
4 h3 w3 v. T5 }; ]* R" L, J! n# k
MODULE_DESCRIPTION("Led platform driver");
8 o2 M- J6 J: e/ NMODULE_AUTHOR("Tronlong");
7 Z( w% B. i: W4 ]' kMODULE_LICENSE("GPL");. P% }) W# P9 c* m
5 h( W6 @( |* H* F' |% X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 21:29 , Processed in 0.038606 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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