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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。* }7 d0 E* S0 I+ E" I1 d
#include <linux/init.h>, i! G! e  {* O, D% v# p$ @
#include <linux/module.h>
7 V" z" Q1 q- ^- X/ k/ Z8 H#include <linux/kernel.h>0 z: G9 _5 @! h! X$ K7 P
#include <linux/types.h>( n* l$ Q/ A8 m5 J
#include <linux/gpio.h>
/ K6 \. l" m" L. Y  k#include <linux/leds.h>& c4 I# w- P  g( F
#include <linux/platform_device.h>$ @# A3 n! S: C$ V; R  {

6 E3 }4 @, z, D& B/ N#include <asm/mach-types.h>
2 D1 [( E0 K" `' C/ n, w#include <asm/mach/arch.h>
( q% i& t' R3 ?. v1 O#include <mach/da8xx.h>( s/ y# K% ?5 D; A5 A7 W  A, v
#include <mach/mux.h>
" B5 B& Q4 O2 j1 j, ?! T: K+ F( O4 f5 y( Q7 e. J# f) Z- N. t# c
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)8 Z  L& q# ]* G: L- D9 W
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
1 P8 J8 i, G1 c& `#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
  [) P; I$ i9 Z: _#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)$ }8 Y- R. D. d. Q- P' N

* h7 \) x4 F2 X8 I/ p/* assign the tl som board LED-GPIOs*/- N: {# c6 F$ X  a3 u, Q( y
static const short da850_evm_tl_user_led_pins[] = {6 ]# k- L9 d7 x$ |: ]
        /* These pins are definition at <mach/mux.h> file */
* e  Q7 A) V0 V- O* x& l4 W# q) E        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
- f# W6 j8 H( y5 N5 {- w: C1 S        -1
8 U4 Y0 G$ e' U5 I};- d$ [) p  _9 `/ m8 H

" V" i* f: w  ~& D, t! ?" K7 _static struct gpio_led da850_evm_tl_leds[] = {
$ Z8 \2 [% n  Q  y( @  m        {8 _- t) u4 K) C! P0 l
                .active_low = 0,; w4 c8 K. R3 F( r/ H
                .gpio = DA850_USER_LED0,8 E. A+ x* r* y- k  u8 I
                .name = "user_led0",
6 d) Y6 F" g' m. v/ T7 k                .default_trigger = "default-on",
; C' i9 A' J, b7 {        },' y# X' g3 |; I. _/ r2 t$ ?9 i
        {5 V$ [4 g8 x2 g7 B4 o+ m5 B
                .active_low = 0,
0 B; A3 w6 [) e# ~/ e2 u                .gpio = DA850_USER_LED1,
7 O5 {- Q! @# j0 ~* [1 n0 {% M                .name = "user_led1",  v7 q: b$ R1 W/ W' A$ S# @
                .default_trigger = "default-on",6 @$ n# k$ g2 l3 S3 E1 T/ D% \
        }," l7 H2 f% @+ e
        {
: ]1 p% d3 b3 G6 s' c* ?& ]2 C                .active_low = 0,6 D7 b! M9 {3 [! ]' |' T# k0 r
                .gpio = DA850_USER_LED2,! k$ `7 s) _9 h, W5 \/ z. Z9 P
                .name = "user_led2",/ I: a( T4 B0 a( ?+ `; _4 E
                .default_trigger = "default-on",1 l0 t& ?+ S0 [9 h( K
        },0 V$ [" J# I1 g- c, J3 ?- V3 e2 ]
        {
0 Q& o9 e- _( P" M7 A- H                .active_low = 0,
9 i+ q! g. g! l                .gpio = DA850_USER_LED3,
8 [5 u3 w" ^* L; s                .name = "user_led3"," Q" J- S" B9 S* N0 T
                .default_trigger = "default-on",
0 O% T7 g+ g) J        },
) k2 z% W" U- N& J2 t};( v% d2 y2 j3 K+ @" S) r, i
) g5 a0 J1 S! n# K- G
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
( k- f: m/ U& t7 z; @7 p/ j        .leds = da850_evm_tl_leds,+ x6 D$ C% h  h4 l( }7 z
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
! o/ \- P- s8 I};
/ C8 Q, G) g9 Q! M- M
. D! q4 A5 G5 Y; ~: |static void led_dev_release(struct device *dev)
4 Z/ B* K4 a2 R* S: o) [: ]' C{
( V, }5 M+ k3 t7 b; N};; R2 O6 d$ c& u

$ F  O, T1 T; ~% B  I/ ^/ u! h. vstatic struct platform_device da850_evm_tl_leds_device = {
, X4 H2 f; a" N4 Y        .name                = "leds-gpio",
( A9 U& f, t2 T2 S8 n: g3 ]        .id                = 1,
, Y% U  [3 g- \+ |+ b/ \        .dev = {
) A# S: C5 r, Y; W2 C                .platform_data = &da850_evm_tl_leds_pdata,
$ o: f. V7 }2 K" J# o5 W                .release = led_dev_release,% a! Q  K2 {9 R' @6 Z; ?
        }
9 {% S; |' M) p) w! V};3 i3 _, S4 g2 @
6 K1 c$ n/ h2 N" K
static int __init led_platform_init(void); ~! X/ L. `: ~5 ?  n- B
{
0 U$ q1 \8 W) l! k- H2 k        int ret;
0 M; V* {5 p! u$ q0 Z/ d#if 0. ~% e  b$ E0 O6 {* H
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);( t' ]- U5 e: L  F
        if (ret). X4 M( Y! c8 ]  s' d  `
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
7 h" t9 u+ H2 p9 D) U& A" I4 n& C                                "%d\n", ret);$ c( D5 W* m2 W1 [% z
#endif
6 O- M; C$ ^) J' A) b' T        ret = platform_device_register(&da850_evm_tl_leds_device);
. v6 [! X1 b3 N) |( d        if (ret)' p( Y- v0 [5 @$ |
                pr_warning("Could not register som GPIO expander LEDS");  m  L* ?/ S3 _" s. R0 V; v
        else
7 n: ~+ V# F/ s9 p$ X4 Y/ D: n8 Y7 h                printk(KERN_INFO "LED register sucessful!\n");
! L2 E$ w* O# t9 U/ H6 P4 n- _& B
        return ret;
4 n0 K3 s6 D/ I& ^- m}- n7 L8 G4 L2 R6 F3 i. @
8 Q5 A3 Q  s* t- [$ b& D
static void __exit led_platform_exit(void)
7 O4 v+ Z) F  _( W  P! r1 l{3 e$ A- V! f; \/ J3 V! H
        platform_device_unregister(&da850_evm_tl_leds_device);) q/ q# h( @" {- y5 E, t
0 I4 b  [  w2 }! ]# z/ T
        printk(KERN_INFO "LED unregister!\n");
) ^4 ?; Q) R+ x- n  L, ?/ U' g8 C}
+ F1 e' Y1 Q' w; {& q8 `# ^  ?% g: L. c
module_init(led_platform_init);
) ~! }" X5 Z5 p$ x9 G" g% ?) D. ymodule_exit(led_platform_exit);  }; I& }$ l- m- Q

% K- ^- w" y- L5 l  uMODULE_DESCRIPTION("Led platform driver");
9 x  F8 j6 o% j; c8 J3 `MODULE_AUTHOR("Tronlong");
4 G6 g* X4 U) S8 R1 }; `( ~MODULE_LICENSE("GPL");
5 f0 c0 h7 P' T' E+ |! F$ A, B2 e' V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 05:06 , Processed in 0.063121 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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