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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。6 l2 {* P) @" I  l- ]2 f2 ?
#include <linux/init.h>6 ~9 u8 H8 l$ K8 R
#include <linux/module.h>
9 A  n2 z6 v8 U; O  X/ |#include <linux/kernel.h>4 a' ^3 |$ o  I# B
#include <linux/types.h>! N1 n) i6 S& n9 l0 l* q" Q: W) g
#include <linux/gpio.h>/ B7 q5 P' w0 g, v' V4 E8 g! {
#include <linux/leds.h>
' f0 ^! \  l( w  J$ G  X1 T#include <linux/platform_device.h>* ]4 T# c0 v4 C

" N! @# I; |' C3 c/ q5 y, Q5 e#include <asm/mach-types.h>
$ F6 y+ U. U6 s#include <asm/mach/arch.h>. c& B* k  G1 G5 ~4 @
#include <mach/da8xx.h>
7 x! O- z& ~. |- B* X6 m/ H#include <mach/mux.h>
% s& h5 V( \$ J) @" h
8 E' Z2 [9 F* o9 t, B1 m" H! f#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)# O3 Q) Y/ J; S7 m+ R9 B
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)  ]# {% T9 ^' t4 [/ W  W7 }
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
. l# y4 W  F+ W, }  w/ _/ F% t+ L#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
9 D1 ^9 m! {1 G% L1 s; V5 E  P5 W; f6 W' P
/* assign the tl som board LED-GPIOs*/. |0 t8 E! R7 N8 w# g
static const short da850_evm_tl_user_led_pins[] = {( ]1 p. l; i+ Y2 L
        /* These pins are definition at <mach/mux.h> file */
  q- h6 a$ g7 Z) _8 ?; e        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,3 N5 h8 |! {2 z, _6 Q) [* N+ P
        -1
/ [( V9 m# P/ Y0 }7 p1 S};
  [' L* w* F! t0 ~3 b. ]9 O
4 ^4 d% M' ^  |( ^static struct gpio_led da850_evm_tl_leds[] = {
- ^0 ~  a! o) G, E: Z. w        {
3 f5 K$ s$ @1 `6 l; m. l                .active_low = 0,2 t9 g7 o8 k' l7 S  ]6 d5 v
                .gpio = DA850_USER_LED0,
) `: u/ W# y& A& r7 F) c0 U4 ?$ ?                .name = "user_led0",
# B6 w& `3 s+ E" G1 }                .default_trigger = "default-on",7 i- |# D0 h3 K6 y
        },7 ?8 c0 ]6 |3 h# ~
        {
( Q3 d( O5 X7 j; }                .active_low = 0,
* y; X6 T7 b4 g6 R$ f                .gpio = DA850_USER_LED1,
+ o; `) S- i  p2 U4 c, c# K4 h; Y                .name = "user_led1",
1 X* {' n: `3 ]' Q9 B8 r                .default_trigger = "default-on",7 C4 m& I4 m; \' j9 S
        },
; T$ m* ?! o) R' {        {
1 Q7 f: h1 d/ d' b4 d                .active_low = 0,
+ H5 M; ~$ G5 ~! _9 a                .gpio = DA850_USER_LED2,
' P! h& j4 q! u  x& t                .name = "user_led2",
( ^+ S$ v9 c' @                .default_trigger = "default-on",& e6 |2 t; A3 I$ f8 K: ?. j
        },
' U8 X! q+ ]4 B/ T/ l7 l! U) h        {, ?" I% \( F, ?8 l
                .active_low = 0,& j, n# c5 f, j& E. X. Y' v' p: j& f
                .gpio = DA850_USER_LED3,
' }9 C2 r( L' }7 \- b. D- g  _                .name = "user_led3",
, h! ^( [  C1 L, [8 M" }                .default_trigger = "default-on",2 O& D  \7 m  V# n
        },0 O2 S7 ?' M. _( S" L' n  g
};
9 j5 |$ _, ?$ t/ b) K% ~  L1 I; u
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {$ V  c, N# l$ h9 L* T1 |% M
        .leds = da850_evm_tl_leds,; O  }* C- j5 @( u: s
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),1 g' d, e4 j+ G
};! I8 Z+ l( F& a! P+ @/ R

3 Q9 v. B# i; a: wstatic void led_dev_release(struct device *dev)" Z4 Z/ {, @7 M, {- M% `
{& |0 o3 R1 O6 }
};
( v7 f5 L" Y# y/ v- G) U# N! b& {  G: ]( e2 I
static struct platform_device da850_evm_tl_leds_device = {
/ n3 t# h  F* J) p        .name                = "leds-gpio",) Q( L. y% z8 \; `: h
        .id                = 1,1 b9 M. q$ H' y
        .dev = {
9 E" y/ Z- m" D8 _" f9 G3 L                .platform_data = &da850_evm_tl_leds_pdata,
; n* Z# R# J6 T$ S                .release = led_dev_release,/ @* w4 m) @: s- {9 D, l
        }  O9 P% t& d0 M
};. j0 A, u) [& D9 m( F

1 U! m5 n! O! s, |static int __init led_platform_init(void)* M, u1 D9 z8 G# `* Z! V1 Z+ l
{
. Y' H+ X. F: M- ]! H. `        int ret;9 s/ j4 b) F! Z3 }; y. m/ f
#if 0
: N3 E& u0 B/ b0 P1 Q. _$ [        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);6 `/ B; W- _4 G' @$ E
        if (ret)
# r) T+ Y- y% r2 l2 q3 Z                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
4 y0 l& G3 \  a! i                                "%d\n", ret);! n+ W6 F3 Q7 e6 u1 M. P
#endif: E8 C3 f3 R; K. L- v, S/ P
        ret = platform_device_register(&da850_evm_tl_leds_device);
5 K5 l* O% r3 I8 E3 r5 ]* t        if (ret)( c7 ]' l; p6 O& _! Y$ f6 C
                pr_warning("Could not register som GPIO expander LEDS");) F: f6 n  v- G4 F; r! M
        else
3 E+ p& }% _0 K                printk(KERN_INFO "LED register sucessful!\n");
  ~1 ]' V% d, F5 Q& Z) B$ I# H8 t' t, [8 r* ]9 V+ Z) k
        return ret;' L! N! L( @7 k! f
}$ w3 l. g% n( }0 @* c9 X  b3 K7 C; H$ ^

6 X/ N8 U+ T* D+ o! a; Ystatic void __exit led_platform_exit(void)% n0 W% r: u5 j+ m! g7 e/ V
{
# p7 R- p/ Y& a1 N/ A4 x8 x        platform_device_unregister(&da850_evm_tl_leds_device);
0 }5 Y+ j3 _% M0 e  L% {
! f9 Y, ^$ f: A1 z7 c) ~# m        printk(KERN_INFO "LED unregister!\n");
4 e; ~2 P8 w* S/ I/ U5 w6 V}
$ h( n* h8 _% d0 E% T5 k, W2 ~2 v! ?* f  J6 u0 ]( r' I
module_init(led_platform_init);2 R6 Y+ G  F; I0 _: T  x
module_exit(led_platform_exit);7 P% H% ^- C+ b

& L) K- O1 _. M6 V2 HMODULE_DESCRIPTION("Led platform driver");5 R9 M9 z+ f7 B" {  l* h
MODULE_AUTHOR("Tronlong");
- i, s, \  V: ?3 h" Z  B% yMODULE_LICENSE("GPL");
# c8 T" `- [' W0 t; M4 [; w, h9 ?* p& ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 05:23 , Processed in 0.040152 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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