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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
6 u# m; A' C- m; g+ e#include <linux/init.h>" U+ |2 l, f+ H* f
#include <linux/module.h>
! S# S/ T4 ?. Y2 Q4 F9 }8 ~#include <linux/kernel.h>$ V' Y% L0 p$ [! P% [
#include <linux/types.h>
5 W3 x3 J, ?9 M, `2 r( o$ }! Y0 _#include <linux/gpio.h>
* d1 O; z! v, o#include <linux/leds.h>' U5 d/ ~; ]3 [1 [$ r6 ]* j+ T. a) S
#include <linux/platform_device.h>! n1 S8 D' M8 J+ C* ^3 I

" L3 {' e0 o7 t3 T( [# [4 j: E#include <asm/mach-types.h>8 p# s0 S! F( e3 G
#include <asm/mach/arch.h>
8 r8 G) K. m) }7 Y; n' m$ @0 Y- i#include <mach/da8xx.h>
2 X: [# D3 |! q8 g7 J  k#include <mach/mux.h>: c  k$ l% @6 Q- `- b
5 e7 \3 \4 c) X
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0). @6 q* X7 s1 {7 @- r* T
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
, O; w& S% n5 _3 \" @. U2 ], ~#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)4 x8 W; t" m3 j( \. m3 O# w
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
' C) n1 [& f+ a  J5 s" B/ A$ C; v6 K! p) c" p6 B
/* assign the tl som board LED-GPIOs*/
* }1 ~( x0 Y& z% mstatic const short da850_evm_tl_user_led_pins[] = {
/ s. P7 J0 l2 A5 r, U, ^        /* These pins are definition at <mach/mux.h> file */! ]% w" T9 s, D$ r* H) _* C" k2 ?3 c
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
: j; o9 L' n) l, z+ B1 Y( Z        -1" |- X) c' x7 |
};
7 s; W) ^6 x5 F" J2 _# J( D2 ~  c4 Z' C+ |3 C1 P- z* ~/ v
static struct gpio_led da850_evm_tl_leds[] = {
5 L) Z7 a7 D1 E7 A        {3 g- O/ b( y2 g# o1 J* \
                .active_low = 0,
/ g/ B# J' _; W' f7 s                .gpio = DA850_USER_LED0,
1 r0 t% R/ f: v5 F. z* Y* C4 X                .name = "user_led0",
; }/ x$ S; p2 M8 v                .default_trigger = "default-on",0 `8 \; L8 H1 O
        },
, j& z, w* c+ I5 k; E3 w9 m/ ^        {& L7 U. |! w5 s1 f
                .active_low = 0,
3 e+ a% ^* R) C2 K; u& t9 |( |' G; t                .gpio = DA850_USER_LED1,/ z/ j) V& W3 @5 @+ x. m1 J
                .name = "user_led1",
$ h9 {; }( R' i3 J9 o4 x                .default_trigger = "default-on",# P3 j) |! }0 ^. j- L) L
        },
( |' {* N  E, {& x4 w4 |        {6 p. B$ I( ^9 @0 p. w$ s
                .active_low = 0,* @4 s5 }! p+ a6 y4 ?
                .gpio = DA850_USER_LED2,
* j; ^4 G4 G% N# U) k  b# l" ]                .name = "user_led2",
# ^$ M  M1 x# C+ Q) W                .default_trigger = "default-on",+ k9 S) R) L/ S: d: @
        },
1 v6 X3 _' _: v; T# g# c9 f% g9 S" {        {, z, {+ P1 l2 P" B$ n
                .active_low = 0,# d" Y) G9 G$ a; Y/ x9 u: \
                .gpio = DA850_USER_LED3,
, c+ i  D/ P( L: M; Q) \1 C1 }# q                .name = "user_led3",
* v9 S7 v& h/ j( V; `  m: P% W                .default_trigger = "default-on",
+ Y2 ?  [. i4 V        },
5 @4 q" l, j5 W4 V% H};
; j4 L. v8 ]7 m8 U- }0 v
* c9 j# u0 z8 W0 ~' G1 xstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
/ o& K5 I% G" d: u7 B: B; M        .leds = da850_evm_tl_leds,
( b  \: g: g$ I1 m" D, [        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
  D$ P$ l( e) r3 b};  u5 A' n2 P0 X0 Q# o. F

4 o- J% S1 Y' |& b, }- ]0 @  ]static void led_dev_release(struct device *dev)" S$ P, d1 j8 E' O% B' e
{- m# n7 N# _* t' |
};
: M" |' Q, V7 [6 D# G/ J* N4 V- k. X. w- r
static struct platform_device da850_evm_tl_leds_device = {
2 d- b( g9 n" M4 J# f9 E; m; B4 Z" m        .name                = "leds-gpio",8 g. d# `4 K2 H% z! j8 i6 y! B
        .id                = 1," [( s- z0 ^" j. \
        .dev = {' }! D# ~! j# ?
                .platform_data = &da850_evm_tl_leds_pdata,+ J+ \1 a2 z$ V8 ?
                .release = led_dev_release,) i3 k8 ?, x. W9 S( x
        }. ~, E  k- n! h7 m5 O+ r) U- ~
};5 I7 m; X) N: z! q! e1 k1 B
! U. ~# L. u4 z* q6 C0 G
static int __init led_platform_init(void)
7 U6 ^# H* `1 c: x/ g* W4 i% g{' \6 m$ }6 d8 l9 s
        int ret;
* J- q0 r% m& s/ _& [8 a1 Q#if 0
( p' ~7 K# B, I$ k: W        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);- T! R' [+ Q% Y% y' M
        if (ret)
" I+ ]# I. h7 k9 x& s                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
& i& W& L. C5 f1 a! c, _# |                                "%d\n", ret);
9 d: u0 {6 N- c$ N#endif
/ u/ ]- J) y. X" G3 s        ret = platform_device_register(&da850_evm_tl_leds_device);( `8 y6 w2 Z5 x. P, L! f
        if (ret)& t; g: X$ Q8 C  U* n% S
                pr_warning("Could not register som GPIO expander LEDS");5 E2 \3 W0 Q# ]5 i6 t
        else
2 ], C$ {" v# c                printk(KERN_INFO "LED register sucessful!\n");
, y0 `' ^5 n) d+ @  W& {, |7 L/ H, X0 d* z
        return ret;
  P9 q# d9 h5 R}
0 b+ Z' l7 D* k
) }3 `7 |0 Z2 l0 c  {' ^6 v/ vstatic void __exit led_platform_exit(void)
. X. {. p, ~5 M) O3 b{" X. P2 `( A' P8 [0 q
        platform_device_unregister(&da850_evm_tl_leds_device);
' V8 p. q, b. n  |
8 |" y  ^0 {" x/ [4 N        printk(KERN_INFO "LED unregister!\n");
1 m: Y3 @" t( j}
8 J! G! D7 t$ o( M1 k
  W8 P& N. c7 U" Cmodule_init(led_platform_init);
, m5 k1 L( h% w. j% Emodule_exit(led_platform_exit);
# M" F" ]( U1 R9 L2 r
& v# |- [$ s3 }6 p: dMODULE_DESCRIPTION("Led platform driver");5 l" P7 c' c$ U/ V( G
MODULE_AUTHOR("Tronlong");; H& `( e6 P9 O8 V3 [* ?* o  y+ p
MODULE_LICENSE("GPL");: ~  h' L, K, [4 s" a6 P! }  H) o
# d, ]$ W/ s/ E. x' B& Y& R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 13:23 , Processed in 0.057749 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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