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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
5 q1 Y& ?1 i2 x( U#include <linux/init.h>/ c; h4 w9 K; _% d" h9 P
#include <linux/module.h>) L2 J$ ~$ ^5 A! g1 r7 W
#include <linux/kernel.h>  h3 m- Q8 p0 @# W9 B, I
#include <linux/types.h>
2 I/ E1 f' q. z  ^#include <linux/gpio.h>& Q# p5 n+ H8 T9 R2 C8 x/ P
#include <linux/leds.h>
7 n4 H* d; C, t8 I- w1 X# Y- _#include <linux/platform_device.h>
5 {, d5 O+ j6 b) f: |: p. z2 j, Q5 ]  J' X5 x4 k; G
#include <asm/mach-types.h>
+ l& m2 M6 U6 R8 ?# n9 ]#include <asm/mach/arch.h>
/ j9 n4 P& x8 ?9 ?) \* S' f4 B3 U: ~#include <mach/da8xx.h>
7 P! R. L; x- N8 l7 ~* b; B5 ~#include <mach/mux.h>- q9 H( e/ E5 @9 j/ w
; t% w9 V# r  f" U  v# H" E% R
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)/ w* b) D1 J3 i
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
. g' N; y) G& i0 U' `( E# V#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
* e  U" x7 p4 u$ I#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
2 v2 k! r2 Q7 H2 V" d2 X% i0 ~! L  C' V2 C. }" W1 o3 x
/* assign the tl som board LED-GPIOs*/
, J- D: Y" I" R4 N6 X7 hstatic const short da850_evm_tl_user_led_pins[] = {7 X' ^3 h  f; X6 N0 Y6 q
        /* These pins are definition at <mach/mux.h> file */
0 J% v6 S/ {' E        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
/ {( y4 m! K4 q& r- k$ A! V# b        -17 t$ T) }# A' |9 `; K
};+ Q: ?- }: G' W) w. g! a+ J
  l' I' A5 u& s" h# {
static struct gpio_led da850_evm_tl_leds[] = {
9 Z4 h' y* j, j. W. l5 s        {$ o3 [- w. t1 [1 }) d
                .active_low = 0,
& i& N+ n. I2 b0 Z- a' }! V. a                .gpio = DA850_USER_LED0,
! a9 ], H8 |; S5 i                .name = "user_led0",& Q( {9 x7 r1 o7 f
                .default_trigger = "default-on",
3 G% [- `2 P  D& T# s" e. ]0 P6 X: e        },# s* o) n1 V* M/ K5 Z1 w
        {% N7 H9 z& T, Z- F* j) s
                .active_low = 0,$ _9 ~; i" V6 h( W: e
                .gpio = DA850_USER_LED1,2 h! Y7 E: }1 ]0 G
                .name = "user_led1",
4 m+ D( L: s& T6 C3 F+ d; v9 y+ O                .default_trigger = "default-on",/ Q- U$ _* k1 f8 G
        },% j( `- g, B& v( ~3 ~
        {
) w! x2 G$ ~, T3 ?$ E3 B$ M                .active_low = 0,7 Y1 [# \7 k, _; e7 k$ N% F
                .gpio = DA850_USER_LED2,
. `) l/ v8 M2 Q0 O) H0 J0 w                .name = "user_led2",
2 f. Q: b5 @8 D% X3 V* d8 {+ }2 c                .default_trigger = "default-on",9 Z5 v; W3 {# H  C( R2 L6 Q% Y# d
        },
( u2 m+ @5 R7 l: D        {
4 s- O# B* }3 F& O                .active_low = 0,
- z6 }( C  J1 \3 {6 H+ H0 s3 h                .gpio = DA850_USER_LED3,) H( t8 x3 F' f$ r+ t; D
                .name = "user_led3",$ U/ E9 S1 W" U: e6 u& R. ~
                .default_trigger = "default-on",3 Q, n2 S6 b' B7 c. b/ c
        },
) C3 s) V$ k( _. P9 }3 Z};2 `- Y  j" E1 X4 q3 z& S. o- s
0 U+ s5 w& z; ~- s
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
: ^1 K0 Q* N$ o; F% j! ?8 _0 b" E        .leds = da850_evm_tl_leds,
+ u1 n0 }/ ^+ q5 X! x1 E! Y6 ^  l, ^        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),4 [1 f. u) }1 w# x# v& n
};
: T- u7 C2 S0 R4 K- R! M' k" p7 Z8 z" U
static void led_dev_release(struct device *dev)
2 @# [+ I- U0 Z% E5 m* n9 Y{
' F7 r6 B2 O& z% F4 G5 f; X};* d" C2 p7 S0 T8 W" w

' P" V: F% B, ]6 k/ rstatic struct platform_device da850_evm_tl_leds_device = {
5 ^; R$ c/ {: v, H, N        .name                = "leds-gpio",
. n1 p3 A+ p* H! W        .id                = 1,
* D# J4 [& S7 K! S5 O        .dev = {
: w! L" ^( [% w6 w1 A                .platform_data = &da850_evm_tl_leds_pdata,
. U/ z+ i5 o3 t                .release = led_dev_release,% @8 S" O& o+ T' `# S6 a
        }
3 P, o- g7 |. w' X" ^};
) W% l# z1 @9 V9 R8 n- T6 s7 D* S- m5 `- \" R
static int __init led_platform_init(void)( d# }6 ]3 X; W$ T4 B) M
{0 u* n7 F. P7 |% b
        int ret;
* {# s# Z+ v& d# `5 l! J5 V#if 0  e2 L2 V+ b5 Z7 Q  w# _
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);, Z% g) q# m6 [1 _1 i3 \6 r" y
        if (ret)9 ~, B. @" G# L0 d2 E# f! R
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"* [0 \& Q* \+ R5 R0 S
                                "%d\n", ret);- X4 R4 U1 z* K) F5 Q
#endif
4 V7 {" u  e- d6 U1 R4 o/ N! B) k        ret = platform_device_register(&da850_evm_tl_leds_device);! I! P9 S8 s( \  K  r# \; J4 S
        if (ret)/ A4 E6 q& Y9 E5 X! F
                pr_warning("Could not register som GPIO expander LEDS");9 }% V# y0 w% D3 a6 H
        else
9 ]) L+ T) E- @7 r% Y                printk(KERN_INFO "LED register sucessful!\n");
# N% `! z  S. T1 c3 |: e6 i
8 y( R( y& z/ n        return ret;0 |! U! j, ^$ e3 W
}" X1 |6 |0 L& C/ I( j/ h

& O7 g! z2 @. \9 i/ c6 [* estatic void __exit led_platform_exit(void)3 o" A0 x7 u4 i; e% j( ~
{4 p1 s# c  k& G  |/ G' J
        platform_device_unregister(&da850_evm_tl_leds_device);* f9 [5 ^: i; T, i
2 h5 W& S8 i+ l  G
        printk(KERN_INFO "LED unregister!\n");
! A9 A8 h3 G" {4 H}
9 E4 q' Y/ h& K7 f* r4 S" }+ T, D, J7 j9 U  E4 P  K2 O3 B
module_init(led_platform_init);  a# j; ~( s6 x+ o
module_exit(led_platform_exit);; p( E6 z1 E) \; n: k3 Z

, G/ x7 g. b% n, ~& d! zMODULE_DESCRIPTION("Led platform driver");
, ?* Z4 s( z3 Y9 i1 g  O# gMODULE_AUTHOR("Tronlong");, g. O+ M* A0 b. P2 @0 {/ Z; H9 H4 c
MODULE_LICENSE("GPL");: ?( M' i# R( X3 }8 h# H

8 k( w6 I% A! T& @/ U7 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 08:51 , Processed in 0.039706 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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