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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
, P* O1 J, i& H) `$ _$ Y5 {4 y# q#include <linux/init.h>/ Y  ^6 ^7 r0 j% y' R
#include <linux/module.h>- q. h( Q3 [+ o1 y
#include <linux/kernel.h>
- G0 ?# o, m" d7 f7 e#include <linux/types.h>
4 C" S4 x! A: O; x4 u, Z( y#include <linux/gpio.h>4 i7 ^% W4 Z  y# G# O6 x3 \) \" I& b
#include <linux/leds.h>" E, v+ t4 U. ?, y$ I* q9 _
#include <linux/platform_device.h>
. n3 ?4 V6 g3 z1 J: P$ V' K
6 b# ?: v9 u* e+ O/ q6 }#include <asm/mach-types.h>
  x( P* m) c1 a#include <asm/mach/arch.h>
! A" f% q9 @  Z#include <mach/da8xx.h>8 I" I3 S* O4 f  k0 b
#include <mach/mux.h>! q8 p& P& k1 O& d

# p9 y& G. W8 z0 [# w: ]#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
: n7 s" }+ }. B- i( b, U#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)& K0 m  y5 H/ Q6 S  n$ Y
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
+ i' Y* O+ B9 f7 f5 d" m#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
* f* A4 Z7 K5 f% z  C) N. V5 r
) ^8 i: h  }6 p$ d/* assign the tl som board LED-GPIOs*/
! n' Q$ m, }6 _- C( j% {% J4 mstatic const short da850_evm_tl_user_led_pins[] = {
- b& M; L( o* N0 k% [0 {% G        /* These pins are definition at <mach/mux.h> file */: ^% B- D; t0 o0 P; `( q/ z
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,/ G' j$ c2 g1 U6 B+ K
        -1
- B( `. K4 B& }. \. Q};
  J* S8 |$ E, H4 V0 q- y8 t, O' q# r# O* C6 w6 E8 r
static struct gpio_led da850_evm_tl_leds[] = {# p) o; E! R. u$ O
        {
) R5 H% ~% \" v4 a2 S- @! B; \                .active_low = 0,
! B" ]% d6 z% @                .gpio = DA850_USER_LED0,
) i/ P/ e8 t9 S% Q                .name = "user_led0",
/ `1 j; a0 ]+ ]5 ]0 G( g6 F# Z                .default_trigger = "default-on",7 m+ \, \+ n8 N1 f$ I
        },2 d. [( M9 V: A: \' n' S8 w1 a% }8 B% z
        {
0 s0 [3 B" w! B  e                .active_low = 0,
$ T2 Q9 }' q( x3 m- s2 `1 p                .gpio = DA850_USER_LED1,
# d! H- S3 L9 }' O$ ]                .name = "user_led1",, W& G5 N3 J' H
                .default_trigger = "default-on",
( v2 H+ F- B. z# h7 @        },( h/ m# Q; t$ L5 s; T+ A1 m7 Y
        {
0 }& q8 B7 c9 D& {3 p! b3 z" S) e                .active_low = 0,
: p5 a+ g! _  a1 h) ~4 @0 ~                .gpio = DA850_USER_LED2,! C6 r+ U- k! m7 }" d% N1 q0 r
                .name = "user_led2",
- s  P$ B3 z% D4 \0 [                .default_trigger = "default-on",
; ^; L, w' g, _0 e" L( f        },
- k+ [# b0 E( G! r        {  U5 B0 q1 E- R+ ^9 e1 E
                .active_low = 0,
; z2 U$ D9 s1 d5 R9 j( y                .gpio = DA850_USER_LED3,
  y+ e' I! ^. ~1 h3 f! n                .name = "user_led3",
- {9 q2 E+ K, H' R  j" M2 A8 t                .default_trigger = "default-on",+ f) K% r( m+ R+ P3 ]
        },8 v1 Q1 v4 n+ H! s& N+ X. B0 ~7 V
};8 H. f. T& {/ n" `5 m( i7 J9 _7 K
; d# q9 \; u- l
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
' _/ F9 t! y9 x. S/ M, u# v        .leds = da850_evm_tl_leds,+ S7 x( s( l- c
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),, ]' i9 ]8 `/ t2 B9 R
};# `% t6 R- |; \/ w# S
, z. D9 o0 M& B. V  D
static void led_dev_release(struct device *dev)
" _& g5 }; J. M( z* P0 h{
" C! i" Q7 d3 m$ x5 m& D9 \% e};
( s- Q" K6 l0 r% h* K' \- p0 [
( e) q4 S3 b7 R  a5 i+ j) Astatic struct platform_device da850_evm_tl_leds_device = {" K/ \) f8 ^# {1 C0 Q
        .name                = "leds-gpio",9 j4 \) b! a# e/ K9 m6 x
        .id                = 1,
9 m/ }! v: b4 ~7 A% `2 T0 v        .dev = {
4 _. Y& q& e# J0 A* A/ Y' h                .platform_data = &da850_evm_tl_leds_pdata,: C6 o' F" ?; p$ b% L: C' p. F4 z
                .release = led_dev_release,
' p, [! M% u& b; r        }
3 W8 r! r/ P5 V- |% L3 i  R' o};
6 ~9 k' h6 Q8 R) C
; D) Y2 |' w0 v$ T: m* Hstatic int __init led_platform_init(void)
3 O$ j3 l* p) b# z9 v0 ^$ \. X4 I{
* N4 m+ w, d/ |9 l, `) Y  a        int ret;* l& M0 Z* z" n
#if 0
3 I, E' I4 E" z+ F4 ~) X        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
/ A8 G5 V8 D# I        if (ret)
8 b5 E: O4 g" ]/ E/ z                pr_warning("da850_evm_tl_leds_init : User LED mux failed :". e9 g( E# H2 l" F( B. t/ J
                                "%d\n", ret);. N5 {0 Q8 j" l7 K) q" \0 F. Y
#endif( T& ?& H9 \; D9 Y
        ret = platform_device_register(&da850_evm_tl_leds_device);
6 z: m- g/ E6 ~        if (ret)/ A- g4 s* c; P; M. `
                pr_warning("Could not register som GPIO expander LEDS");+ {% B! U2 j  n! N# U
        else1 l1 J) n8 Y3 W/ r
                printk(KERN_INFO "LED register sucessful!\n");3 T: _0 v3 L* p. L1 C

( Q  _1 o; p% ~; g: p0 u        return ret;) O" S( ~- K* B2 J  h& G) o
}" E1 W# b7 j" ?& u& U: d" E

5 X) I9 z- J( i4 l% F' `, hstatic void __exit led_platform_exit(void)" M8 e4 K3 K& C' a: E0 C
{) {' q% K" n+ B
        platform_device_unregister(&da850_evm_tl_leds_device);
- R; t: t- N4 m# ^& ]  c
7 ~, [+ T: v1 G4 y: @7 f; w+ G        printk(KERN_INFO "LED unregister!\n");
& s! K& X9 a! }# ]; f}, g/ Z' C- f7 K! y4 B' W6 o
; l5 G' i1 c# N
module_init(led_platform_init);( K) x1 q  W; P  j" c
module_exit(led_platform_exit);8 C. w  l7 s7 T1 ]
, f4 u$ M8 N1 |
MODULE_DESCRIPTION("Led platform driver");
' S$ @6 Y6 ]/ M8 O" dMODULE_AUTHOR("Tronlong");) }2 o" k6 [9 N. n. Y% W
MODULE_LICENSE("GPL");
7 S1 i) `) k5 p9 p* _5 G
& G8 h; w6 o7 C1 e& @- t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 09:03 , Processed in 0.040119 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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