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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
) Q  z' m0 _' U' }, S* r, o#include <linux/init.h>; B  P. F+ F* V; c3 T- S
#include <linux/module.h>1 ~$ X" \7 X% O* K/ u2 `. N  D! O' C
#include <linux/kernel.h>& ~. c, S+ T5 _) p% S
#include <linux/types.h>6 e1 L4 h4 ~& Q1 M* Y2 M4 Z( {1 H
#include <linux/gpio.h>
/ N4 X" E/ X) ?#include <linux/leds.h># q) _2 k! O) }* v3 [
#include <linux/platform_device.h>
. {2 M$ }7 X/ ^& \4 k; r& u5 E+ Y% i5 N/ B5 ~7 n$ e' k$ O
#include <asm/mach-types.h>/ g. L# _; j2 w9 `9 ?1 \# n0 y
#include <asm/mach/arch.h>9 y( r+ X' V6 J' D/ ?: @
#include <mach/da8xx.h>
( z# m% p. r& M# F" j#include <mach/mux.h>
0 w/ `2 R- G" }1 P4 v% S/ I# D* G, O3 Z) [$ ]
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)/ I+ n# z3 o' ?8 I3 X) A- O
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)7 f6 [" K$ S& r
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1): P6 H0 r  `8 r0 P0 p7 Z, `- `
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
1 A$ v1 _, s: ^  v; ]! A+ Q" c: J  H" q+ I0 K5 ], F
/* assign the tl som board LED-GPIOs*/
: y6 J  k# q# t4 ]/ wstatic const short da850_evm_tl_user_led_pins[] = {" q) {# C. u. a9 ^1 C% K# k
        /* These pins are definition at <mach/mux.h> file */4 I2 P$ r2 j) o' m9 [3 t( N
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,% A9 e, L0 f' V4 _+ M
        -1
$ t# x6 L$ d. n# ?; _: Q9 }) L};* j( s% Q* H0 w& b" d

/ I- f& s6 f5 G. W3 N- }% astatic struct gpio_led da850_evm_tl_leds[] = {
# u1 O& V' F: A8 C        {8 V# ^. _. b' v; I: r
                .active_low = 0,
7 {; y2 Z" H( c  }# W7 Q% }1 a                .gpio = DA850_USER_LED0,$ y* ~8 ?' R. ~9 E4 O
                .name = "user_led0",7 e' R6 \& |% S  A* B$ U7 r
                .default_trigger = "default-on",
3 h' }6 ~8 I: s" Z7 n7 e# b        }," W: D! T5 R. |: e/ G
        {
, }0 F) g# j" n7 R2 ^; m7 Z3 W- `                .active_low = 0,) B) Q5 w7 ~* Y/ k4 M. v
                .gpio = DA850_USER_LED1,/ L2 i5 o) y' @6 E: U
                .name = "user_led1",
+ r/ f8 o( ^( ~3 Y( k                .default_trigger = "default-on",
2 W# }! ~; h& W% p9 b        },5 M( a2 i% M8 f% Q, U
        {
  r- x, |- l" \; \, L$ L8 p                .active_low = 0,
; P$ F, W2 E+ r% e& A1 {2 j                .gpio = DA850_USER_LED2,
) ^! E+ V* s/ ?& q- M7 `                .name = "user_led2",1 O9 Y* I- W6 A- ^$ v3 o
                .default_trigger = "default-on",  b9 X9 U; j! y& i
        },4 H1 @# i7 v0 C" Y+ \% P* Z. b
        {1 Z- B; m% T% I3 d+ E; O3 b% A( V3 w
                .active_low = 0,
) G$ `8 ~1 x6 w6 A4 _                .gpio = DA850_USER_LED3,
8 \" A# A9 x, b$ i1 u                .name = "user_led3"," ]) V' l; D$ [1 s4 R
                .default_trigger = "default-on",- q4 X0 z/ S" k- O; X0 M8 Z
        },
* T$ H( X9 _7 {% @) T};
2 D& z  t# }  d% z
8 T; b  R; _8 _6 k1 d& Kstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {+ ~+ x3 ~! R% i  V4 n6 @* j
        .leds = da850_evm_tl_leds,
& B1 _+ d1 D, j; n6 D        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
. _1 t( e* a' c1 U};
3 q$ c% q% p4 Y3 f. G! X+ X+ n3 Q+ S
static void led_dev_release(struct device *dev)
8 l! l0 {+ z$ |5 z2 ]2 k{; v& K* B) Z1 m3 ?. G8 q- _4 w0 M
};" n/ {9 i, E/ Q6 F7 X

3 x6 S. f; S# z! m) X/ Astatic struct platform_device da850_evm_tl_leds_device = {) Z# r4 U' ~( k. A
        .name                = "leds-gpio",4 B/ }) z% X3 E
        .id                = 1,& _: I% h2 l+ U% j# P3 e, j$ j
        .dev = {/ H, x5 g9 k3 @. M' f7 D0 }
                .platform_data = &da850_evm_tl_leds_pdata,7 U: v' E, p7 r4 X6 @( e: j1 T8 J
                .release = led_dev_release,4 n( V1 s' u# M" b) H8 @
        }
9 v9 r3 t0 F% ]2 B& r5 e3 j};# ?3 p* h* }. F9 O' F/ ?9 J( y" ^

6 _, R$ N- Z5 zstatic int __init led_platform_init(void)
6 h7 D* P5 X/ f{* N8 `$ M6 A' B6 s; {
        int ret;
0 H& M7 U) L/ P# E+ Z#if 0) a/ G: B) R8 J' S
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);  S; ]) y1 ]+ ?3 @. C* B  t
        if (ret)" C; T. d+ X( k# _0 I
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"" ]& j1 v+ B' \3 P
                                "%d\n", ret);
; G* D3 e9 g* g1 b9 V#endif% S3 R. B" G( U1 [2 a% X+ O
        ret = platform_device_register(&da850_evm_tl_leds_device);
7 R4 l6 k$ w! p! ?, _6 O        if (ret)+ z* i0 h7 l# x- S. {$ q, w
                pr_warning("Could not register som GPIO expander LEDS");
  V* V3 g, I2 H2 j; q8 I. K5 E        else
6 A" a1 Y% x. [+ k" @; s                printk(KERN_INFO "LED register sucessful!\n");/ f: E7 |8 F' ?

; C5 x" N, v/ n- T# y        return ret;" o8 B; d# O" R" B0 h, K' y
}9 a/ x# R- ^# c( {* ^8 u. ^* P
  G- }  V. I; K' ~/ d! o' F
static void __exit led_platform_exit(void); L9 p; c3 Y: F$ G: ?! {9 I
{# T, y9 K# x, H1 t) F$ [
        platform_device_unregister(&da850_evm_tl_leds_device);" I8 {" ?8 s& h9 v/ S/ A6 V

0 P2 L4 J, i7 k& ~# {0 ^1 S+ e( s" O        printk(KERN_INFO "LED unregister!\n");
6 a9 @. j2 z; V! h' t7 i4 B  g}
) R. m9 i% y9 U( N+ ~  Z% k: v1 e3 u
module_init(led_platform_init);
4 ?$ R. R8 P* e  l1 y) j4 M: `6 Pmodule_exit(led_platform_exit);3 |  r- u, Q3 q: t; n( P* I
4 y( Q9 F  M3 v/ H
MODULE_DESCRIPTION("Led platform driver");
0 t; u) H7 d& `4 Z- G# jMODULE_AUTHOR("Tronlong");2 Z- g8 e1 P  j: ]7 _1 j0 m
MODULE_LICENSE("GPL");
8 \  C+ C0 ?5 u) o7 ~9 C$ L+ H8 V0 D  @( j) p+ W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 11:54 , Processed in 0.039956 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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