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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
2 \2 S5 E6 j2 u2 y) I#include <linux/init.h>
2 [8 o: k# s- r! o2 x7 Z1 A8 {#include <linux/module.h>6 t: c. P1 r/ V+ j! s% V
#include <linux/kernel.h>: o* G3 o- T8 V' y
#include <linux/types.h>
  s5 P' @, U  H8 V/ A2 b  ~#include <linux/gpio.h>+ s8 ?6 G  T4 @. y( H7 p
#include <linux/leds.h># Q6 p1 X: A1 k+ U- w
#include <linux/platform_device.h>4 g5 c5 g: v) N+ y4 _! |
6 `# e1 B, P8 A  J( l( ?5 A
#include <asm/mach-types.h>
; [3 s2 a- ?/ D, l' k0 \#include <asm/mach/arch.h>& e+ J& e( g1 _
#include <mach/da8xx.h>' `1 I& A+ B+ {, B  G2 `- H9 l
#include <mach/mux.h>
/ ~, u& {* X2 @, ?/ `- g7 J# Q! b, a  y" ]" z
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
9 L& a: A/ {$ S$ T8 _3 ^2 V#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)7 I6 R( s# R2 r/ {
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
7 o  h) S, }. r4 a#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
9 _/ O0 b1 u/ u2 @/ v2 v" ]7 x- w7 Y4 s0 d% W, k9 E' c
/* assign the tl som board LED-GPIOs*/- Y3 J* \5 \, n- q
static const short da850_evm_tl_user_led_pins[] = {$ g" ~% D9 F4 O
        /* These pins are definition at <mach/mux.h> file */
- O1 f3 J7 N" R0 I$ K! U  _/ l# p        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,9 A" l2 L' X. X0 y3 C% z
        -1  k/ q9 f8 o4 Z/ D4 L
};
# R" G# x: d6 y8 V4 N- |. U
- p0 Z2 ~. |1 I/ P9 Xstatic struct gpio_led da850_evm_tl_leds[] = {- Y; ~' D# ?) E% |0 u& K
        {
; l5 {. d% v& W- o                .active_low = 0,' L) Y% e. Q) |% J: V' J& F
                .gpio = DA850_USER_LED0,
; M) V  d3 ?" B, M  Z6 U6 S                .name = "user_led0",+ ?4 |' N9 C' I
                .default_trigger = "default-on",
. G# c' ?3 p6 h) o1 J% C        },$ u0 u) }. j  y; D( Q
        {: S9 p  a: x. P! U
                .active_low = 0,5 P! B7 X8 c6 u' A9 K
                .gpio = DA850_USER_LED1,
" E5 \9 B+ y+ _- l( L! y: |                .name = "user_led1",5 v' G5 k) u( L6 b
                .default_trigger = "default-on",) \6 i+ y$ S& ?1 Z) l' h
        },
6 P, h/ m9 ]7 q0 k/ ]4 z        {
' Z, f9 `( a4 }4 T% q  a                .active_low = 0,7 x) K& @* D5 Q  r3 {
                .gpio = DA850_USER_LED2,9 d4 D# G1 Y  d. ~  Z
                .name = "user_led2",, |6 h( U3 z7 ?
                .default_trigger = "default-on",1 d# z9 z6 m" k1 V
        },
4 L! |( s9 F5 A+ e# h' Q& R0 ]        {1 ?( |9 x  N0 B) Z1 N
                .active_low = 0,( a  I# W" Z" z- S& C
                .gpio = DA850_USER_LED3,* ?5 T1 ^5 I6 m. y8 F2 _
                .name = "user_led3",& a. U) [7 w2 n$ ^. l1 ?, _" }+ T5 a
                .default_trigger = "default-on",
+ D/ T9 X8 s# s: `2 E# u        },0 z: {& y; |) F7 y( t. e
};
4 M% @$ `" T) T' ^" `+ m- }3 ~. C$ s! S7 q3 U  D* ~* T
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {! t* l7 E! U" G- l( ~, H
        .leds = da850_evm_tl_leds,
" z& \$ S$ ]; @/ Y% @# }& m        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),9 T9 _; S9 F4 f$ D" u: h% p3 V
};
! j; r) v1 z, |
8 K* t5 _  m8 vstatic void led_dev_release(struct device *dev)& ^" W, t% z; e" v+ _- d( q
{' D3 u; k9 y) j$ S* H$ Z
};
" p" }& |# b) F" g- v+ B0 j
. ?$ O7 w) y4 ^static struct platform_device da850_evm_tl_leds_device = {3 Y$ T: t6 E0 a0 q8 w% l
        .name                = "leds-gpio",( w2 K! z* u6 G: }
        .id                = 1," q) p& O6 a/ U+ C& P
        .dev = {
7 j7 Y$ Y" u* }! y4 V$ p                .platform_data = &da850_evm_tl_leds_pdata," N# @1 U8 X2 r+ V
                .release = led_dev_release,1 `0 ?* c/ A  j9 [5 b
        }5 J  j  U2 l& e& z  F$ P
};
( ]8 Q7 ]1 \% r/ P7 `1 }" j' H$ s
static int __init led_platform_init(void)# x+ @; K0 S* i" c- E7 y! X
{. {3 E' Q: t4 g9 J: v$ @- H8 A. p
        int ret;7 @  ~6 c3 L9 \8 \) X& |5 o  {
#if 0
! N$ X5 O% k% D' P4 u        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);( g% M& L; R: f  F3 Z# J
        if (ret)  `9 X& L5 U9 m
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
3 z4 d8 o" U9 T- J                                "%d\n", ret);
) M9 `5 I+ v& n$ G#endif
  _9 z- [  Q0 S1 B  V, _        ret = platform_device_register(&da850_evm_tl_leds_device);
/ `5 j  S* k8 i        if (ret)
) D  t' A+ h6 n# ^* y! g  A. v                pr_warning("Could not register som GPIO expander LEDS");
- ]( P+ O; ]' a0 r        else5 B+ k0 T. x3 `# I/ x- U
                printk(KERN_INFO "LED register sucessful!\n");
2 H# {" p4 M$ E
2 ^8 f# x6 Z1 R% B' I' h        return ret;
3 q1 _8 {2 h4 M% M  K% ]. @}
+ q; [) e, s$ c. j; }% K; [$ q6 k+ m. S3 T
static void __exit led_platform_exit(void)' H6 c# B, W6 n& h) P8 ~  v( g( S
{% t+ O% q* }+ n& H& u, @
        platform_device_unregister(&da850_evm_tl_leds_device);
2 b+ O+ i. i( S' h2 T/ Q" Q  `- P5 D' b
        printk(KERN_INFO "LED unregister!\n");
0 M2 t8 p1 O; J  ]& C2 v' b& a" ^' B}7 g5 Q( A) b4 }& y/ ^1 f* g
  b- R$ _: {9 i: N  S& o
module_init(led_platform_init);5 @9 _, K3 y6 t" x% u0 N0 F
module_exit(led_platform_exit);& E) m2 w( y0 ~! a7 A2 G
  w) u, _/ B  C+ X# ]" T. h
MODULE_DESCRIPTION("Led platform driver");
" f1 B( i& o1 @8 [3 K+ j; g/ W- y9 WMODULE_AUTHOR("Tronlong");6 L% N& ?1 v# U; W3 j
MODULE_LICENSE("GPL");
+ \  X# A: ?+ L8 Z
0 F/ M% w5 t! R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 09:31 , Processed in 0.043504 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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