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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。, M; A: |$ ?2 H7 O
#include <linux/init.h>
3 a5 U( ]8 p$ T0 B* B: Z) c#include <linux/module.h>
" K+ o7 d0 O5 e) E5 J#include <linux/kernel.h>
1 z5 a' o+ Z4 p9 C! k4 x#include <linux/types.h>4 F6 |( f. _. R
#include <linux/gpio.h>- n" }. F; E( k! D$ `( ]
#include <linux/leds.h>2 U. j" x6 s8 W& o8 g/ `
#include <linux/platform_device.h>% i' j2 r4 t% w/ F

) Q* A4 n5 m1 L3 S( H#include <asm/mach-types.h>
2 o7 q/ _, G/ C- n" @. g9 _#include <asm/mach/arch.h>
8 G- L8 H7 m9 c- W0 R#include <mach/da8xx.h>
: \5 h: u8 {  J! t( [- d2 l- {#include <mach/mux.h>
/ H" ]7 Y0 y2 M0 Z1 X6 f0 x
+ u, ^9 Q6 x5 y9 ?#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)8 |! E3 Q4 G6 J4 a) D) t8 s
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
* V/ m3 C3 q# q#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)8 u1 t1 }0 `$ w0 q3 @. D
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)) A" _% \+ R9 h  m4 y2 b) A/ ~

9 G4 b: m5 {% ~! e/* assign the tl som board LED-GPIOs*/
6 D  J  b; P$ b! O: m2 }+ h, I4 Hstatic const short da850_evm_tl_user_led_pins[] = {$ j" N/ z3 L, K# D6 P
        /* These pins are definition at <mach/mux.h> file */
4 j7 U6 D4 M0 n' l, @+ B4 @, ?        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,; u1 y* p& }" c6 u
        -12 B$ I" ]4 p4 ]5 P5 w8 q2 _
};
8 L. e- O, @/ F* ^( K( S! z
8 s- ]. S5 C; F/ T: L( {/ mstatic struct gpio_led da850_evm_tl_leds[] = {2 r( A; I" F) f$ ?0 }
        {3 v& M7 r3 \5 o# O
                .active_low = 0,* `: z& r( P( n) R3 l% C8 A/ x
                .gpio = DA850_USER_LED0,
! I7 K! L' V3 G2 v# H! U" v8 K                .name = "user_led0",
# h, |, q. a$ N                .default_trigger = "default-on",
; k' b9 d) d' R% Y5 d& b; |( P, c        },
8 I9 `, _, A( g  E8 G: z) b- T        {
2 o% ]& `2 s: O( s1 i                .active_low = 0,; _) H9 X9 _% ^2 I" l
                .gpio = DA850_USER_LED1,( z& ~+ B  O3 w( U, a
                .name = "user_led1",
4 _6 T2 Z" Z! \9 X9 P                .default_trigger = "default-on",
9 _" {8 \8 W% C0 b2 z" j6 f3 @        },
5 n/ f, D4 v4 r7 a' O: m: u        {0 b3 n4 b- C9 _
                .active_low = 0,
3 `" \& s$ [" C                .gpio = DA850_USER_LED2,+ T! ?; ^- z" o3 [
                .name = "user_led2",: u' I3 p! _: d8 C# A* A
                .default_trigger = "default-on",2 d' C" W* k; d* X6 g
        },* `: V4 e6 `5 Q/ w- L
        {; r! k+ c8 i, j7 k9 p
                .active_low = 0,6 C/ N. h1 [) O4 Z& [2 |, N" U7 C
                .gpio = DA850_USER_LED3,
' D: c/ d- ]0 _8 v6 K7 p+ }; o                .name = "user_led3",
5 |/ U( b- S7 r# K9 |; |9 U+ u                .default_trigger = "default-on",) t- O7 f7 t! b! f
        },
" @. A  K3 w( z; F9 j- ]6 H% c};4 S$ q  Y# q! M2 X

+ l- R' K7 @  y; f* |* e# D& Cstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {, G$ E; c+ s& v% }0 r# E6 T
        .leds = da850_evm_tl_leds,
3 x; X+ u3 d3 r        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
6 @' v! O& p! r  e+ M; y};
7 H/ d4 h4 y% W
3 V, Z( U& J5 w2 w4 D6 ^: qstatic void led_dev_release(struct device *dev)6 j4 y& J" y  `0 H  A+ P3 E
{
3 h+ y) [* c. p: v};
; i+ N  I' e% O) r0 X
7 ^! k' M+ ]5 D9 astatic struct platform_device da850_evm_tl_leds_device = {  T4 t4 {' O6 _1 Z3 `
        .name                = "leds-gpio",
  ?4 h6 S) ~% G/ h) c% h. f3 |- s        .id                = 1,
% q; x/ j  M3 @2 p$ N        .dev = {
, s, p* s7 ^0 k9 _  v- D                .platform_data = &da850_evm_tl_leds_pdata,3 @) d8 S% e) y- d  E
                .release = led_dev_release,8 v% L8 m6 i0 O1 w! d
        }
+ k2 i9 J9 d2 X};$ y' I4 N- B3 G. q" d$ D& o
" h4 E7 q& Q% D0 D: i/ ~; K4 C5 F4 ^
static int __init led_platform_init(void)) R& e+ R7 O" z3 T, b: x% a' ^) I
{/ p/ S9 O: Y8 p* X* b" I) g
        int ret;3 W$ \, G, r, n: R$ J8 r
#if 0- E! ^9 h7 T- G1 V
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);# e0 x+ d! A7 u3 ~% h) V8 K4 c
        if (ret)
2 [5 n/ _- ^8 e7 f" K/ Z                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"5 ~9 ]! a4 Y2 P8 n" c$ F5 C* t# p
                                "%d\n", ret);
+ ]: q/ T( V; U+ n6 d7 L2 `#endif
9 O# n% G% U% y        ret = platform_device_register(&da850_evm_tl_leds_device);
$ f% I# R/ @( Y: L' {        if (ret)
) }0 u0 J' e* n                pr_warning("Could not register som GPIO expander LEDS");
! k+ d1 i7 |6 a# q( `, E1 p        else
0 u! n; o7 e1 N  |2 }$ Q  r                printk(KERN_INFO "LED register sucessful!\n");
9 Z0 f3 Q0 M. Z  B  }5 I! G3 W! j+ e  G: q( {
        return ret;
3 I; _; Q) h2 q3 H}
' L# c/ D. T% |9 b( t9 i% B
" @1 L; X! O4 [& Gstatic void __exit led_platform_exit(void)
( t& f0 U1 ^4 ^9 B  q; l+ k{
' y: L+ e# a* d6 w+ p6 c        platform_device_unregister(&da850_evm_tl_leds_device);
/ P) M' t, H" U' M! A" V* {8 w% F) ?- k+ \
        printk(KERN_INFO "LED unregister!\n");
) e: Y' A6 P) r6 V& H% ]% ~0 y}$ n7 y( E7 X% n+ Y- }& a9 U+ p8 A, s

; d# d9 M1 u3 O7 G# Imodule_init(led_platform_init);
9 `- q" b  p. n; o6 @$ S' Cmodule_exit(led_platform_exit);' T3 d% b4 y& M5 F
: ~+ O( _' A  S: y( i: J) y9 v
MODULE_DESCRIPTION("Led platform driver");
8 ]. N) a8 |  n# D- K0 Z# XMODULE_AUTHOR("Tronlong");& Z; T7 x" g# d2 V& a
MODULE_LICENSE("GPL");
  S/ x! Z- \6 p/ H! N  ~" M; F* U6 E8 f" b3 v  w; o; o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 02:53 , Processed in 0.044835 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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