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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
: k( F5 t% L( d: ~6 K5 V#include <linux/init.h>. A6 M5 ]4 Y1 c) ^
#include <linux/module.h>. h! ~1 w% ]" V4 Q- f  @! I
#include <linux/kernel.h>
+ C6 C% p' e  F#include <linux/types.h>
: s& f8 ?) k$ ~#include <linux/gpio.h>
: ]2 ~: o, B7 y' `$ o2 g9 a#include <linux/leds.h>) k) N" g9 g6 ~9 M) }. K  g  X
#include <linux/platform_device.h>
% c& L/ l: Y! s5 c" I* b, ?
+ E1 q0 B/ {/ @6 K# q2 F! d#include <asm/mach-types.h>
- _8 o- z* `2 A( Q1 ^#include <asm/mach/arch.h>
( j8 {' I9 L; \+ |4 s9 `#include <mach/da8xx.h>% y' y0 G' h" `
#include <mach/mux.h>
- n' ~; v. M* o" Y0 @$ K/ R& q) L! Z: f* f/ U: o
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
7 E' c# ]5 {- T( p. B7 b6 t0 @#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)+ h6 W! c/ H: n5 E1 ]
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
0 W  S+ f3 x+ V" O" P! f1 x#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
0 b$ G* B& L2 h- D  U2 u# i, n: L
/* assign the tl som board LED-GPIOs*/
- N- M) v# P: G- @- P2 \static const short da850_evm_tl_user_led_pins[] = {* G# P: N+ E  u% a
        /* These pins are definition at <mach/mux.h> file */1 K# h. O) k+ E8 q! G2 i
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,+ a4 x. v$ o& _& J& |) d% T
        -1/ g& |* m4 A' c7 S6 g- p- ~9 }
};
9 O4 P9 S1 K+ s, \* A+ B7 g' A; N9 X3 B' T
static struct gpio_led da850_evm_tl_leds[] = {
* c2 H: [5 m/ K4 m        {- l/ M8 e2 H& |  H! \
                .active_low = 0,6 Y9 i) i0 {4 U0 B
                .gpio = DA850_USER_LED0,
; K8 L/ r3 t8 x6 C9 ~( I                .name = "user_led0",3 d! ?, }: X2 x+ y: X! s' A
                .default_trigger = "default-on",
. {( S* M; G% c; x        },
/ Y1 [* O0 |. ~+ D        {
  {/ e7 f% r, d& G$ \                .active_low = 0,
/ k, r+ n* N$ U5 T                .gpio = DA850_USER_LED1,& N4 ^  U4 J& a9 ^, w" D4 ?! g
                .name = "user_led1",9 C4 e+ x1 x. W' m
                .default_trigger = "default-on",, D! [; w/ T/ f' U' L' X, E
        },* P8 k0 w0 K9 H6 n  v* V
        {
& `2 g4 v8 `+ |9 P3 ]# e                .active_low = 0,
% V% R" U4 Y8 Q+ a( Y                .gpio = DA850_USER_LED2,: A* i& K+ J( M. Y; _9 X9 K2 U4 E' @
                .name = "user_led2"," }5 i6 z* j5 R9 l3 W# d- c9 M* H
                .default_trigger = "default-on",
  |+ o9 t6 O# R        },; t( U$ F" d1 @0 S: w
        {
( \& D3 _+ O: Z7 m1 f: A) b                .active_low = 0,2 \9 c( `- _2 ]0 k5 Z5 J" ^- t, }$ T
                .gpio = DA850_USER_LED3,# q3 C# h8 U+ t7 u
                .name = "user_led3",* P) f" Y, l  `4 I  W# c
                .default_trigger = "default-on",
: n9 L+ K) `& }$ A        },( I" N, n+ @5 W' e1 O: }
};
/ j( a) k0 ?" p! l$ B$ k& P2 z: N0 M8 n' O( a% v- d+ P/ N+ u
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {% f4 _) k7 b/ j+ X8 ]
        .leds = da850_evm_tl_leds,7 \& x1 X* J; Z0 x9 e6 l& x
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),0 Z/ }. N+ z% X4 _- D
};5 R' a. w0 {" q6 h) F4 G

; J$ @1 t' ^0 K- k* }2 a. Xstatic void led_dev_release(struct device *dev): G, @; M2 N! b0 a
{
, n) M' L& w9 A  P' W' ]};
4 B6 o! `( J+ l' R: E' i7 y  s
1 n% Q. b' {2 `static struct platform_device da850_evm_tl_leds_device = {
2 U  R- ]) r3 `8 W3 F( d        .name                = "leds-gpio",
; V( V* [. o- S/ E) m# c% M8 b        .id                = 1,, c( }4 _( l, ?& I' [9 f
        .dev = {6 F$ t/ z, X3 z
                .platform_data = &da850_evm_tl_leds_pdata,% z: {% E2 Q+ K9 i
                .release = led_dev_release,
: N4 B/ g9 l2 e# ^+ q        }
. Z2 a0 B( h6 x1 @4 r2 P/ `. Z};
7 l% m2 r, C; S% ~. f7 M( N; g/ o! b
4 g1 G1 |* D% e0 f7 `# cstatic int __init led_platform_init(void)1 W/ |' m9 ?- P4 A" c! a
{
/ j2 {$ R* n- @* {. I8 [" B        int ret;# V) F' \! B* n) t. A- D0 D
#if 0
) E' F! J( A5 R2 X' W        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
% w5 w: l) b  [% [% I0 e, D8 v        if (ret)- J$ L0 v, [5 v* [5 h
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
& z7 b1 t& u0 D) D  M' P                                "%d\n", ret);/ w0 v* r+ |' [0 w, Q) e0 W
#endif6 n' c1 @2 _" W  t3 P" I
        ret = platform_device_register(&da850_evm_tl_leds_device);
9 c, E  J" G2 ^/ }        if (ret)2 B" X3 T' ~5 }* F) o9 T
                pr_warning("Could not register som GPIO expander LEDS");
0 w. p& h: X$ _. J        else
  L  k1 F8 r1 a. M9 }1 ~$ D5 s                printk(KERN_INFO "LED register sucessful!\n");
+ K. S* g/ l$ _! I; J1 i) V0 d( S, w
        return ret;
: A' T. ^3 t  E8 D: F}' d. `7 [4 e3 f8 {3 Z0 c  N/ @$ V2 n3 Z! g

* I9 W; L2 B/ f/ ]  k! _static void __exit led_platform_exit(void); r5 j( ~4 d( _8 r
{
9 |, d; u; b3 S4 R" {        platform_device_unregister(&da850_evm_tl_leds_device);1 B& H% }# j3 v4 u' x3 b1 W

( H& J- k5 w; ]9 y        printk(KERN_INFO "LED unregister!\n");' `1 ~- f  ]4 z1 G6 z3 z2 u  M
}& b5 Q2 [8 ]7 V3 l9 H

* F3 \# S- J0 J" ?* f* C- p1 [$ wmodule_init(led_platform_init);' U% ?" M% \" @2 S
module_exit(led_platform_exit);) ^3 u# t9 ?6 b$ j/ y% S

" ?  W4 ~+ N. e* z$ }" Y& T/ MMODULE_DESCRIPTION("Led platform driver");0 t) x$ U* d5 s4 D: F' y  ?
MODULE_AUTHOR("Tronlong");+ G. e, q5 ?& k& e5 r: |$ `# ^$ W, ~
MODULE_LICENSE("GPL");
' `7 G1 Y; F3 c+ b) }1 t% @7 ~8 H2 t3 Y' M( W9 |% F+ b! U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-17 00:42 , Processed in 0.041489 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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