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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
5 n* J! H& [9 j; ^6 _- `# I#include <linux/init.h>
" k# p, e) s6 O4 e#include <linux/module.h>% p* t9 `# c0 a6 K5 j, Q" G# x
#include <linux/kernel.h>1 ]1 j' \) c% v+ H1 d' H8 P
#include <linux/types.h>
$ |4 b- E8 t6 D0 w, A( u, n  Y#include <linux/gpio.h>- V8 s8 g! G+ ?, l5 i
#include <linux/leds.h>
7 G, y/ M7 }- |5 S$ A) G* g#include <linux/platform_device.h>
% y0 q; I- U0 h% A' b, q0 d( ~
' e9 ^  M1 H4 Y% U; F  _7 D: @#include <asm/mach-types.h>7 t, E* k5 b9 P' Z  o( u% W
#include <asm/mach/arch.h>9 h/ M& v; l, m& @
#include <mach/da8xx.h>
/ O2 [$ B* M: S2 W: v* \! K( `#include <mach/mux.h>6 P0 }% b* s* y5 i8 _: B
( R, C* V  |1 o& j0 F
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
* t/ ~7 c- f8 t! p. H#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)+ x7 x. K' g; `1 O3 J
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1). a% K" X6 R$ ^5 a
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
' _: T1 I7 T: o4 x5 @" O7 Z6 |( M$ H; ^3 `( s
/* assign the tl som board LED-GPIOs*/
9 ~$ Y7 z/ W* y8 n4 b% s& T9 f! ustatic const short da850_evm_tl_user_led_pins[] = {" U% S/ d( e6 J4 ?
        /* These pins are definition at <mach/mux.h> file */! f7 b$ b2 n# @
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
/ T/ v3 J3 n& }8 k. z! l        -1
% K0 Z% h% v. F2 [# E$ I};' _  m, e0 F( w6 `
" y. Z  @& r, I1 K0 N- Z7 M
static struct gpio_led da850_evm_tl_leds[] = {
9 A# O1 f. _' V" h        {
: _+ I8 O+ B8 U/ y2 q                .active_low = 0,! F& G& f" w% i) o
                .gpio = DA850_USER_LED0,5 \9 e* B( D3 L1 c$ O6 K& H! b/ A
                .name = "user_led0",
( ^* O' B; Z' g: v                .default_trigger = "default-on",) X3 t7 O9 s* @9 V  ^+ z
        },
1 U! A' d! p4 T) c, m7 {4 j( F        {
* w1 k4 E8 H$ M) O  H5 r, ]9 M                .active_low = 0,
5 d4 C  N% E& I/ m0 @                .gpio = DA850_USER_LED1,
( \$ t3 ~1 F) X                .name = "user_led1",1 ~8 o* }; y5 k$ K
                .default_trigger = "default-on",  |9 U& d% o8 D
        },
+ O) J- y) w$ ~* d" u        {" @/ ^- r+ C. l. ?' [7 q
                .active_low = 0,) x9 Z& N' V1 W
                .gpio = DA850_USER_LED2,
  e, G; O% N4 K0 Q! E! B( S/ [                .name = "user_led2",! D4 g  ?1 e4 @+ e4 l- s: n( f3 R
                .default_trigger = "default-on",
8 @! E; ]( W" ]; u2 z- a) @( t3 B        },8 M/ x+ K4 E5 g' q9 t. ^' D- m
        {+ B6 Q4 ]8 t9 X# y/ _
                .active_low = 0,
) l4 H4 |) @, o; y                .gpio = DA850_USER_LED3,
$ N1 z- W2 a- }& {7 F# x                .name = "user_led3",
* u4 k/ m# P0 A" Y) O/ g) K                .default_trigger = "default-on",
$ A+ L3 k' f% {: _( k5 r# Z        },/ s& |+ u0 N4 X/ @. m, r2 I
};
* [& T- g! _$ s* J3 f" o, U+ y" f9 r2 e& X+ x1 Z4 `
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {% g6 C  r! Y0 |9 E! ~  T$ f. q2 ]
        .leds = da850_evm_tl_leds,
2 E7 H- `3 I" b4 O        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),+ Y3 e0 m. ]: P9 j
};
: J: A, t0 V' n
4 v6 e( x& w; l, {7 G2 hstatic void led_dev_release(struct device *dev)" c" E2 u8 R1 P
{
$ [! v) m, g9 o9 N};: p3 i1 g/ t: g; X$ H

1 B; p+ [. S1 I7 q; C; istatic struct platform_device da850_evm_tl_leds_device = {
* t5 Z# f  u8 l3 Y8 E9 G        .name                = "leds-gpio",
4 u( {. t2 p5 {- Q2 w8 m        .id                = 1,( T% f! M4 m% j" o
        .dev = {6 I4 V- P" @' c  p+ `
                .platform_data = &da850_evm_tl_leds_pdata,
* A% O+ [9 R* N1 T9 l$ B, d                .release = led_dev_release,
( V; t& w( P* k! F& D        }, J. x% u  G3 B
};
! r$ {) Q' a# i( t' Q  D& T
- @! ~& j# i; C- M3 {! l6 t. ^3 J) M2 {static int __init led_platform_init(void)9 t  [1 q* A1 u! F/ P% S
{
9 t* o) t4 v" L3 V        int ret;$ K; l6 R- g6 l* X/ A
#if 03 p% x# U7 N2 t& t
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);6 P1 H7 v, K3 \& e
        if (ret)5 O: v2 J* h$ p2 l7 a4 Z$ m$ X
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
$ |6 H$ z, M" j                                "%d\n", ret);) p. }: z; F& M1 _1 L
#endif
0 U9 x: _7 W3 s( ]' V        ret = platform_device_register(&da850_evm_tl_leds_device);
1 W& l0 g( U' `9 G$ P2 A        if (ret)
3 x" E' w- ?/ z7 V  g0 @6 n; S' Z                pr_warning("Could not register som GPIO expander LEDS");
. a, u: n2 N: x4 ?+ V4 g# B9 g        else
1 a" q5 Q- a/ L& s  y9 K2 X+ D  z                printk(KERN_INFO "LED register sucessful!\n");$ p/ u  I$ M; u6 Y3 c  M6 s$ d

8 Q: e( S" ^! O6 L; Y        return ret;
' E2 O: a% Q) W3 J2 `: k}: _$ T2 ^0 t/ M- d7 m" }7 ?
; W" `( W9 \2 c& v# R
static void __exit led_platform_exit(void)
' S2 y8 n" T8 Y/ k2 ^* x{
- [! E. F/ n2 \+ y' a, t( _3 D        platform_device_unregister(&da850_evm_tl_leds_device);$ G6 I+ a5 Z4 ~) t; W& T
! I& f$ B4 [! i9 Z
        printk(KERN_INFO "LED unregister!\n");6 l" q" g* C$ |6 H
}
4 C. X/ A8 e( M9 |4 H0 r% h4 f0 W, z- ?% }: _
module_init(led_platform_init);
( P  e# S" W3 u4 g& L( omodule_exit(led_platform_exit);
5 N( R7 P0 F" g- f  h1 _+ T$ `/ F% @' q6 D5 t
MODULE_DESCRIPTION("Led platform driver");, K( \# G$ k( L: B: \
MODULE_AUTHOR("Tronlong");
7 C8 N3 y$ K3 r0 kMODULE_LICENSE("GPL");
: k7 ~4 }/ d; z. U1 ^
$ L+ z( R8 H( t) ?0 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 03:07 , Processed in 0.053662 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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