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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。3 f1 T. H3 f( y
#include <linux/init.h>
6 F  e7 S$ S, a" U- x7 x#include <linux/module.h>' P% e9 G; i$ ~4 Z# r
#include <linux/kernel.h>/ \7 o# t3 ]- E
#include <linux/types.h>
- l3 G+ I/ `2 D% W  f9 B- ~#include <linux/gpio.h>
" ?3 A$ t. d* {# a" R#include <linux/leds.h>! h0 y% ~; a: o; V/ ]4 O
#include <linux/platform_device.h>8 d* O3 L" M' `( P

( `  W% B- o, l9 F4 V+ \, p#include <asm/mach-types.h>
4 @, y" z* V8 v+ R7 Y#include <asm/mach/arch.h>, y* [8 p  W* Y7 l! E
#include <mach/da8xx.h>
( i+ y9 T. E8 T: ?' @#include <mach/mux.h>
  Y- L2 a& V& f1 d# f$ }
  {: F& M1 x- A1 {#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
( n6 l1 D5 o: o. U" W4 {' X#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
; H; o7 t/ |! B6 m" G#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
9 A* v7 L9 {7 F: Q8 n5 h#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
( l; b/ O  N  T% a0 X
1 j* [4 n: a- j6 c% L/* assign the tl som board LED-GPIOs*/
6 |! m! g4 e4 k& @, ostatic const short da850_evm_tl_user_led_pins[] = {4 @3 A0 \8 _& u5 c  p
        /* These pins are definition at <mach/mux.h> file */1 O* F( q9 a2 i" z  J& L
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
3 f5 Y: U- M$ G+ J) l        -10 m+ h5 t8 a2 K6 [
};
5 F, F+ F1 a& ?0 S9 |2 T" l, A- T/ y" d  K( S
static struct gpio_led da850_evm_tl_leds[] = {9 y) w  H1 a5 f# g) p' n
        {
0 Q) G7 B$ p, O& H                .active_low = 0,5 W1 x* ], H. f
                .gpio = DA850_USER_LED0,1 m; E: Q) R# Q1 F. j
                .name = "user_led0",
2 {9 Y( Z2 C7 `7 I                .default_trigger = "default-on",
$ C0 e  f6 F& O7 @% {        },& j# ^# [) o# A) Z) a. P1 e" D+ q  I
        {$ a; k1 n% B  x* o) |* N
                .active_low = 0,
' y% ^5 h" @7 _( \5 r4 h" r2 @* W                .gpio = DA850_USER_LED1,8 H& ^5 {8 K' M8 z
                .name = "user_led1",) U& m6 ?/ s( Q+ [
                .default_trigger = "default-on",
5 G/ [2 i& ?; Y3 X) [; D0 l' v        },2 I4 n  |# ?5 y5 C) ]( ?% U
        {
8 D: X- I; }! ^                .active_low = 0,
! U  {4 e$ z, C2 ]; g+ l                .gpio = DA850_USER_LED2,4 _% y5 F+ k1 w' L3 |5 q
                .name = "user_led2",
0 ~, i- S* p+ c5 r# B/ R3 r. X                .default_trigger = "default-on",6 V! M3 J: y  ]1 y: j
        },) g) B9 r) `: J$ a) t
        {, J( ~$ S: V9 s# }8 b6 b! Z# Y
                .active_low = 0,
% i: b1 Y1 q3 x5 l# s9 V( T                .gpio = DA850_USER_LED3,9 p3 _0 f( o" u1 E8 T
                .name = "user_led3",8 @* ]* W. Q/ [- |- Q" o$ n" L& z
                .default_trigger = "default-on",3 P9 i6 a4 }* V: E2 g( S
        },% w  z1 D; I+ q. ?
};6 u2 T; y" h! x4 a9 G
' R0 u! l* h- X7 Z. g0 n+ N
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
8 O9 v, k! ]# y2 m0 R* Q        .leds = da850_evm_tl_leds,7 Z: }. j" J$ _. I4 }) K
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),1 R3 t! v) _6 k* c% |1 t
};2 h" l+ i: A0 ^! Z! n% e

- P# s5 z4 u; W' gstatic void led_dev_release(struct device *dev)! A9 p: T2 |; H& [  N
{% l9 p0 [, K& P2 o* {$ F6 w
};8 ]5 H7 s/ ?$ c1 o- c" {& z8 T

+ b4 C: p* S( m/ ustatic struct platform_device da850_evm_tl_leds_device = {
9 ]" c6 }) F3 }7 t( a4 M        .name                = "leds-gpio",
7 X+ F" W0 _' _% C: H7 X! \- [3 C        .id                = 1,
; r* Z9 t! A- S/ a. |        .dev = {
: Y+ @0 p" y, \                .platform_data = &da850_evm_tl_leds_pdata,4 r) @3 p1 `  _# o& G+ n1 Y. M* x
                .release = led_dev_release,
# E8 S) m$ W; c, g( u" v0 I. c% T        }
0 \7 r6 Z" P  `};7 a3 o' _4 ^( Q" V

: |: @) T8 n8 W' {; Wstatic int __init led_platform_init(void)
- I) y, Z- n. d{; e; q) Z1 Z( E; U8 a" P  f% P
        int ret;
+ T+ t0 B2 n) I$ Z  T* C* o#if 0
+ p( O; w! J* _+ w        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);3 S# |2 A, A7 c& e/ T! F7 f+ R
        if (ret)
3 `* L! K7 i. M5 O% L. [; d                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"  L/ `0 |$ g' L, `+ Z+ y8 |
                                "%d\n", ret);1 b/ q5 \6 k5 s6 w: D  D, l
#endif6 m% N3 ~# o  b2 k- l
        ret = platform_device_register(&da850_evm_tl_leds_device);" {3 @4 P' N4 v3 t4 r9 G
        if (ret)' x- r" e, n0 P. i  y" j$ z
                pr_warning("Could not register som GPIO expander LEDS");2 v* r4 ^& z6 U5 Q% A& i
        else
+ u- G' o3 O) Q                printk(KERN_INFO "LED register sucessful!\n");1 w. p0 |, a/ g; f0 {9 e, Z
! [: ]+ H. w9 |7 S% C4 y6 d" F
        return ret;
( Y  b# S5 F! T* g}
8 i8 x4 x- _- \
$ v( t; g* h; |! g, f0 [$ estatic void __exit led_platform_exit(void)/ n' X" `0 k2 |! k
{
/ K& ~9 m* ~* S/ s" t        platform_device_unregister(&da850_evm_tl_leds_device);
1 p" |" U9 e; F9 T
4 L# o8 R4 A: x' e0 E) M        printk(KERN_INFO "LED unregister!\n");
$ ?; O3 T: s1 X8 I% X- y. `}
, U$ X; ]% q0 m+ L3 U; A9 V* Q+ G  l" L: {
module_init(led_platform_init);
; I  g! w+ [5 e. ~3 N4 D. Mmodule_exit(led_platform_exit);5 w( v. O0 F7 G% I: ^$ O/ b

) r+ \% c  ~/ PMODULE_DESCRIPTION("Led platform driver");
$ c- d9 G0 W4 M$ o  D* g- cMODULE_AUTHOR("Tronlong");
, }! P1 a; m2 \5 EMODULE_LICENSE("GPL");
1 R% G/ o# t6 E; `7 A" u% R+ p; u' o8 j6 B/ u" t$ Z3 _8 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-29 05:56 , Processed in 0.041095 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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