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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
* \5 R7 i3 d& T' H6 S' N  J#include <linux/init.h>$ Y. Q/ i( g/ c
#include <linux/module.h>: a6 a9 @, o  d; v/ L$ Z
#include <linux/kernel.h>7 D" r& t5 Q6 j+ C( z! F; l
#include <linux/types.h>
2 Y" \3 `8 t; T) K: t' y#include <linux/gpio.h>
) Q+ A$ _8 c5 R% J1 y! C0 a#include <linux/leds.h>
4 A7 I6 C9 f9 e5 H% ]* `! ]$ x* o#include <linux/platform_device.h># c) |1 s( i! g2 }6 M
! o) Z% T, R4 A0 X/ A5 G) i. P
#include <asm/mach-types.h>
6 x) H! Y9 j0 V: s#include <asm/mach/arch.h>( _9 M7 `: K  L7 g
#include <mach/da8xx.h>3 T0 ?. M( \0 Z
#include <mach/mux.h>1 ^7 r& }+ O8 X% U/ h: W* W
/ ]9 L5 e, c( A# k
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
" w. K: s6 Z  `#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)& X+ Y) x, m" F2 ^# M9 |/ f( u& a5 r
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)- Q6 s, T0 i2 \% G% k" S
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
" p& H) R  Z+ p* ~1 I& `& t$ g: n$ J8 u* K
/* assign the tl som board LED-GPIOs*/
8 \/ X) l( d3 t3 n' }/ qstatic const short da850_evm_tl_user_led_pins[] = {
: ~, R0 ?; l4 j& e        /* These pins are definition at <mach/mux.h> file */
1 b- e# r9 z/ O# F        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,( K4 x% C. I. n1 e; r
        -1
6 S7 l+ Q! f7 i# i; @0 X5 B  \- C. e1 w};8 G8 O+ }* U: Z5 o

5 Y2 O  q3 ?0 C) v* m$ X% c2 G. d/ Dstatic struct gpio_led da850_evm_tl_leds[] = {
( h' q! }& l# K& y, g        {0 B5 d# E, b% e* q
                .active_low = 0,3 P  a: |' G: m9 t+ V6 O4 u7 r: P
                .gpio = DA850_USER_LED0,) a0 w* @! V( D  _) H: N1 ~1 B
                .name = "user_led0",0 P6 H; ~& P! Q  h2 Z, c
                .default_trigger = "default-on",/ K2 B. P4 l% Q* }  ?6 b9 x( d2 P: P
        },; w* j" Y  D) R4 N9 e
        {6 i# f: T, m- O: x4 y! \# w
                .active_low = 0,# G$ I5 r& L1 {$ `
                .gpio = DA850_USER_LED1,3 P1 d, B; b, Z" _6 p
                .name = "user_led1",
" T5 n" K- r! L3 \7 l6 d9 g9 s( {                .default_trigger = "default-on",. Y- ^! h$ ^: [) k: L* {( x
        },. l, H3 I9 D! y/ @% Y
        {( E1 m9 Y# C9 U1 O8 l5 F6 ^* \
                .active_low = 0,
2 U1 [1 k: P% A8 f! x+ i                .gpio = DA850_USER_LED2,7 y1 W5 p% x- ~2 o$ O) b  r
                .name = "user_led2",* T* g) f6 b* s+ c/ Z; G: Y+ S
                .default_trigger = "default-on",6 y5 b+ [* L/ j: g
        },9 B! F- ]3 c7 }* ?9 v7 @4 y) Y; P
        {
* f1 j2 W: z, e2 ?) {                .active_low = 0,
; _6 }( o$ ]! n# n6 v                .gpio = DA850_USER_LED3,$ d- O, {4 P7 q$ ^  A- N. Q1 B/ o8 f
                .name = "user_led3",
% v0 B+ h2 [- s6 O                .default_trigger = "default-on",
) T0 ~2 e3 Y0 p" \; M        },7 h8 g- \$ ?  N4 \
};
0 ]2 a  X7 P$ h$ [1 \% k) I
4 j7 Z2 l' z* ustatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
( T5 ^" L0 s6 W1 h        .leds = da850_evm_tl_leds,' x. A6 V2 H+ l8 K. {
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),) u9 m8 m) x3 ^) z5 P" G5 t2 x7 a
};
2 B, b, _8 {" {/ n$ K. o3 S8 E: k2 q5 f- c
static void led_dev_release(struct device *dev)* Y  e" V/ g  z# s
{
, y" i( g7 q  w& E% z};. u; i% i- d" k' b

& F, m( z* R3 w9 M( H. l: Vstatic struct platform_device da850_evm_tl_leds_device = {# H  Q2 h( ?9 d9 ~
        .name                = "leds-gpio",
+ c/ F( {; R0 q  Q        .id                = 1,
: I! \) q: Z7 p- O8 z; ]1 f        .dev = {* V" G: j" g) V& m4 D+ g& B
                .platform_data = &da850_evm_tl_leds_pdata,1 t  D4 Q  O8 F
                .release = led_dev_release,: R& v2 Q( b$ r
        }
* E, A  F( a2 A3 u' I9 l- e};' i3 `/ x' H# P, N$ K! W% u* j
4 S# K( b- V4 U8 c8 p& s
static int __init led_platform_init(void)
% N- {" z& ?" |" `& ?# @{7 B+ T3 I; ~0 X8 h6 W: C2 _2 \% F
        int ret;/ N" _) S$ ?2 H! ~; j) k
#if 0% ~4 g7 N( c. T# V3 S7 S9 }
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
: r" y* y. ~+ f7 k- t) s0 \        if (ret)6 N0 m: D3 P. W$ \, n
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
/ G3 s9 e, t9 y4 U                                "%d\n", ret);
! V6 a4 U$ Z/ ~$ _  |& W  O#endif( e6 M  O3 ^/ d8 H  N
        ret = platform_device_register(&da850_evm_tl_leds_device);
  K" E0 g+ u7 F" L# `) ]" T        if (ret)
+ `' L9 k& M: t3 t$ l                pr_warning("Could not register som GPIO expander LEDS");" b# {' R/ C3 P. R$ X6 @+ q
        else6 f/ A& _4 G/ X5 e8 }
                printk(KERN_INFO "LED register sucessful!\n");* @4 K! `; p" j6 o/ g

: U# X3 U3 z- ]& _7 W5 P9 U        return ret;
; B. [3 g8 Q, k6 ~" Y% ~}6 ^& v$ U6 s6 s1 Q/ f% a- ^2 Q
2 N: r4 \) h# o: t; c+ ~
static void __exit led_platform_exit(void)
: Q5 q( p! @3 Z. P" Q( x{
& A1 a9 i9 B6 T: N* O        platform_device_unregister(&da850_evm_tl_leds_device);
* G- i9 R+ }+ d) _2 O. y7 A1 p6 e9 E
        printk(KERN_INFO "LED unregister!\n");) d1 w) i2 k$ F% [. e
}
% @6 ?1 }* G  K5 y$ d. b1 y( m+ `8 a2 g8 S, A1 w, P
module_init(led_platform_init);
7 X8 I# y% W1 w0 c0 ^7 Emodule_exit(led_platform_exit);+ x( y* p$ K3 o4 F* ?" H5 T
; t1 ]2 J% N3 M- w, \4 ~
MODULE_DESCRIPTION("Led platform driver");9 K* n  ]# G( u; G' k  u/ y# y
MODULE_AUTHOR("Tronlong");
. B% X2 s7 `( PMODULE_LICENSE("GPL");* ~$ J" [% q/ b5 S4 H
) o/ b/ W: J$ D/ j1 F, j9 B8 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

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

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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