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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
5 @% w0 X  w- C" V6 |$ \2 U5 r#include <linux/init.h>
+ N  s5 L) w0 V#include <linux/module.h>4 Y: m( I; W, J' E& M4 k" d7 m
#include <linux/kernel.h>: R* A* e3 A" ^4 s" \
#include <linux/types.h>; _( S0 E) m# W# h7 t5 U
#include <linux/gpio.h>
% i+ Q$ p1 x# t#include <linux/leds.h>2 M! U; ?' H2 `) T+ f. g
#include <linux/platform_device.h>6 J& s% H: C1 c7 z2 @9 r% B

. T& u! o8 P+ Y7 [+ K- i. ~#include <asm/mach-types.h>5 A1 B! {5 ?4 ~" z
#include <asm/mach/arch.h>
! R2 p  p$ j5 f8 W  [$ S/ ^1 t: p% t( e#include <mach/da8xx.h>
( B) F5 g, w! w* x$ Z* H6 E& I0 g#include <mach/mux.h>  z! r! ]) \% Z2 t3 W

% p, ]3 @3 U( s0 \2 W4 ]#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
3 F3 q1 x  \" N+ P& F' N#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)8 d% I* E' ]* R4 x: s% y
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)8 k! d9 O; Z" {/ ~; p7 E
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
/ N6 p8 {$ U, y5 `% \' ~! A. w& d, t" p; r
/* assign the tl som board LED-GPIOs*/
. w. M! |$ q( e. G$ m9 [static const short da850_evm_tl_user_led_pins[] = {
4 g+ {2 }, Y+ r0 p. h5 S: a7 {( b        /* These pins are definition at <mach/mux.h> file */7 K) J( P5 p* h8 P! T% v5 y
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
: l( r5 J; X9 |2 w! Q        -12 F8 r5 x# n7 O% ?& }) F' O+ o, x7 O
};8 N0 C2 W  d8 _3 Q) R0 x
7 P# M+ |/ @+ R" M3 y) x; F- G1 P4 @
static struct gpio_led da850_evm_tl_leds[] = {8 [$ B  _2 `: A% }" G
        {& ?: q8 D4 n0 |- M/ [" B8 [' }6 t
                .active_low = 0,3 M8 q% T0 T) L# ~
                .gpio = DA850_USER_LED0,
+ z* d- O% I( y                .name = "user_led0",3 W' O+ Y+ c- v( b3 D0 @
                .default_trigger = "default-on",
4 k% h$ t/ [0 ~4 E4 x6 \        },/ f; K* d( f! ~# |4 k$ E! j% O& h6 H1 i
        {
5 y+ I9 X5 r  G9 e                .active_low = 0,7 H& Y- T' G" H9 V
                .gpio = DA850_USER_LED1,
% S) E0 o; P0 r                .name = "user_led1",
, q' [, L; H% Y/ h1 \; E( v4 r3 ]                .default_trigger = "default-on",
4 h/ `: F- a* z% P1 q( ^) y! g        },
5 Y0 O8 R% g( g5 j0 t        {( |$ f# {) {1 A# Z5 Y- A/ F# o/ N1 P
                .active_low = 0,: ?; V; ~% q; {
                .gpio = DA850_USER_LED2,
( ]! y. {' e5 r( d2 v! ]" x0 @                .name = "user_led2",
" g! V/ S" M: g8 U- m' X                .default_trigger = "default-on",- C3 P; y2 ?' O: }( u
        },, M, X  g$ `" ?/ b
        {$ Y$ i# @1 K/ Z6 P
                .active_low = 0,
; s2 u  ^' \7 L                .gpio = DA850_USER_LED3,6 q6 ^. G* Y& c# ~. f
                .name = "user_led3",8 R2 g( {: A( w! p4 j2 s% t
                .default_trigger = "default-on",8 G, Q2 Y# ?- y; Q, S
        },  z) b/ `& v9 x- R4 ~
};* r5 a$ _  E! g: A; Z0 t% A
' Z& _  s, o$ ^/ o1 p( k
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
( ]% A% s' a3 i0 K        .leds = da850_evm_tl_leds,
3 S% ]) s$ y  I4 V        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
4 K3 V) n4 j+ Q  `, q};
$ z; _! q- J  U% h7 K% w$ I  V) s3 D( X+ D# \4 F& {; l/ h( p
static void led_dev_release(struct device *dev)' k, e. @# [/ j) v* _7 S
{. R/ l3 z+ I; W7 G  B3 V  A
};8 p' Y8 I/ V$ P$ ~
6 B% g3 C3 F% r' O  o
static struct platform_device da850_evm_tl_leds_device = {! `% o, `3 o; ^/ C% I) ?
        .name                = "leds-gpio",
% J9 ]; w. p! J3 B  ?- ~        .id                = 1,, ]$ f, C6 r! O; K2 l  x
        .dev = {
' e, C) f; W% S/ Q, o1 C( x0 @                .platform_data = &da850_evm_tl_leds_pdata,; w7 }; `! m3 c  R5 y
                .release = led_dev_release,! ^% q0 ?! p0 a7 r; S& P, z' x5 t
        }2 }( U" Q" |, {9 f9 u( o; l
};3 t3 |! |% m+ ?1 q' u+ v
5 @7 Z0 U$ y" ~+ R
static int __init led_platform_init(void)9 F0 I) T1 j0 C9 R' c7 W% X9 G
{; b! L1 S( d" R# D4 F
        int ret;$ {+ @5 z& q3 u3 |/ v
#if 0
( I. G, a3 n! P        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
% e1 Y+ o- z3 a. [7 h        if (ret), S" z) H6 S) z- J
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"$ @- J% }/ T+ U# u2 O  {5 ?- k
                                "%d\n", ret);
" Q3 b* W& G8 G6 w# \/ l#endif# E- z# c( e) h& e7 k' }
        ret = platform_device_register(&da850_evm_tl_leds_device);
  Q" L# x+ j3 B5 {5 ?3 L        if (ret)7 n' K# [% w: O& G4 D! t% F
                pr_warning("Could not register som GPIO expander LEDS");
" z' y: A( A+ |        else
! H1 F& K0 u) W! V% l) u                printk(KERN_INFO "LED register sucessful!\n");
, N% j8 z$ t8 {
" y$ N9 B! |* B& c8 m0 H  ^' x        return ret;
7 w6 }8 W% x+ m7 j0 S) F/ Z( r}
9 T9 Z, ]+ O+ c
* K; j! D/ v- u/ @) `+ [static void __exit led_platform_exit(void)
& C/ ]1 k8 X. o$ [' R2 |{9 ]0 M7 q7 p; I& u3 O# D  Q9 e
        platform_device_unregister(&da850_evm_tl_leds_device);
' ~7 _: v! L4 P6 e
: ~# i- Q: o, l8 z; [- b( k7 N0 }        printk(KERN_INFO "LED unregister!\n");5 n( i8 D# y2 u3 W$ r8 Q5 n& x
}
. V5 O* `) G# v! _" ^/ @+ j) Q: i  Z' \
module_init(led_platform_init);
9 K. r! y5 w- [! Y0 Pmodule_exit(led_platform_exit);
% q. q& v1 x$ Y" G2 k& R3 U3 u
" L% J7 f( P7 x/ \4 {9 e+ ]MODULE_DESCRIPTION("Led platform driver");2 i6 A3 o3 w, V: i, s! k
MODULE_AUTHOR("Tronlong");3 f6 ^$ X1 C+ k1 L# J
MODULE_LICENSE("GPL");
1 s5 ]# |) ?7 z. w! K- z6 d# C; [4 m2 p/ {  F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 12:22 , Processed in 0.046847 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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