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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
/ W1 A$ X1 G. ?1 b& x  a% @$ \1 ]#include <linux/init.h>: o0 \# p7 l$ H
#include <linux/module.h>
& M5 e3 O+ {2 e  C$ B; Y: i- [' q4 z#include <linux/kernel.h>
1 M* F' y5 H7 N2 s#include <linux/types.h>2 ^% g) N& W" a8 G. D# N0 J
#include <linux/gpio.h>
- a' V8 d: z* S2 w! A#include <linux/leds.h>
# T3 P: a) S; D6 P" G#include <linux/platform_device.h>8 H2 U$ t- P* d: x0 S! k3 h0 b
$ `1 s! \4 J) t! Q, z; o
#include <asm/mach-types.h>; S+ T5 U! ?4 x, ^/ R4 e) U
#include <asm/mach/arch.h>
7 s- @: ?" W! C3 U- f) ~  p#include <mach/da8xx.h>
" X' X* Y9 q% g) s#include <mach/mux.h>* H. Z  g  B1 q, ~# R  u
5 [7 X9 N' C% B) |0 M, R
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
7 |$ `5 v9 v0 g, v5 y: \5 H#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)* d( J; J+ {/ {- W% y# ~- K- G
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)* R$ b5 R% R5 ^
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
* l8 s, s% ^7 }5 x& j6 T% F' E+ y0 s; ^" s/ w" K; ^  J+ @
/* assign the tl som board LED-GPIOs*/+ W7 y! I- D; q- i
static const short da850_evm_tl_user_led_pins[] = {
2 h3 y7 S7 Y- z; c( Y        /* These pins are definition at <mach/mux.h> file */# y5 |+ j9 u- ^: A' r  x
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
7 R# y  O# L3 b9 x# k4 r+ |        -1$ `/ g0 }3 E- x& d- r
};
- t& P/ I* x( h3 |0 N& n
' K. S) P3 x* M+ B+ U9 Sstatic struct gpio_led da850_evm_tl_leds[] = {
- ]8 `2 L; E% ]! h        {; C5 f7 J. y! a6 m9 o
                .active_low = 0,
1 v  w. D9 a6 U/ w5 S                .gpio = DA850_USER_LED0,% k# c$ U# I' z" D
                .name = "user_led0",( P6 Q" o3 c: e9 @% ~8 }: }: A
                .default_trigger = "default-on",
$ r5 L7 D7 T- m$ g# D" I- Z6 ^        },
% U& `7 ?% x4 d) @; T        {
4 g: J+ O1 e5 ?1 J4 h                .active_low = 0,
: U5 F( O, t$ t  R1 ^% k3 \, W                .gpio = DA850_USER_LED1,
: w8 J5 T, m' j4 z# |- N' W                .name = "user_led1",' z+ b6 H$ {' f% w5 N3 a; |
                .default_trigger = "default-on",1 U0 B$ T$ z$ {7 h" b
        },
+ P& b. |0 {9 }* P; t, R. e        {: M9 }( ^$ c+ ]3 K( b
                .active_low = 0,' b( A5 p9 k# [% W: X1 f2 D1 ^+ x
                .gpio = DA850_USER_LED2,. p, M  ~$ b8 w! _& i: b2 t
                .name = "user_led2",, ?' i$ y' t3 ^6 @
                .default_trigger = "default-on",, x' X1 k6 L: u2 o! ^- a
        },( a9 K3 O5 c0 b  E  J5 W
        {& n0 @1 G2 Y- `
                .active_low = 0,
7 ]% I. T. H0 Q  w                .gpio = DA850_USER_LED3,
1 n3 d( Q& y! Y4 O8 a  M% Z                .name = "user_led3",
& j1 J4 V& U+ K. u5 l- W  H                .default_trigger = "default-on",2 P  H+ R4 w5 r! [2 t" c  @9 }' }
        },
$ W+ ^% D2 b, O) t3 K, C};  \7 T* S+ r4 y/ ?3 Z5 [; r

+ c6 ~7 L0 ^# d4 ]static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {2 l6 \9 M4 V- _% f
        .leds = da850_evm_tl_leds,; _  W% t+ D+ N
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),' K  Q- s( c. w  O8 F" {. j
};
# x5 v  W& l% v, n3 L7 o6 V5 k5 H5 z' c: {# P+ ~- p, f
static void led_dev_release(struct device *dev)
& V( U; b; C8 B2 @{+ i9 k. K# a! o0 Q/ y) k+ @
};# R, }: Z1 p0 X. {

/ x2 ^6 W  K# x" kstatic struct platform_device da850_evm_tl_leds_device = {
  B0 _5 P: @1 z- B& U0 ~        .name                = "leds-gpio",
8 v0 s& b3 {) d4 ]8 E6 l5 P5 P        .id                = 1,5 m# _! F( V" y; G- k
        .dev = {
4 m4 {! f# I. H% m1 V" O# w) ^7 z                .platform_data = &da850_evm_tl_leds_pdata,
9 ^8 ]6 L8 j4 @; T" T& n0 x                .release = led_dev_release,5 ?+ `% k# t8 W* ]
        }
4 c" d$ y$ k9 E; r};4 z4 d$ n& e# i
2 q+ x& ?2 h4 v9 b" v& \! Z2 F8 o0 C
static int __init led_platform_init(void)
! P. Q' @2 y# F% f7 q4 S" I{  I& |/ |2 t: T7 o+ @
        int ret;
, g$ [9 c0 W- H, c#if 0
& H! ^1 R2 T; T# {* t& |        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
0 |/ ]$ F. D+ P* f2 R        if (ret)8 h8 Z5 F9 I' G, \  y
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"/ H7 I, T# r; u% m. w7 f& ]
                                "%d\n", ret);
' k9 z! R2 @% D#endif
9 w' a0 B- y% @        ret = platform_device_register(&da850_evm_tl_leds_device);
) {; F( g# ]1 u5 y        if (ret)# `/ D2 I- t9 u4 ?2 k. u
                pr_warning("Could not register som GPIO expander LEDS");- K$ j. V# g2 L  b: D. E
        else
- d/ y6 I: L: t. e$ Q) v                printk(KERN_INFO "LED register sucessful!\n");, S, c* E! p; B
5 A9 H& w" |! m5 v- X
        return ret;
5 z/ q! b% ?8 W}* A9 t4 f) P" W4 n4 l4 k4 g
, f% `" x8 K( H# M! i* W! `
static void __exit led_platform_exit(void)
( c: s' }; D0 R{. L5 X! \7 j1 B$ j2 Z
        platform_device_unregister(&da850_evm_tl_leds_device);. S$ V6 `) j1 d  U, i
1 s- G6 Y0 f% S# ?% @* u/ {; x
        printk(KERN_INFO "LED unregister!\n");
8 S- @+ M! e' B' y% t; M}' O# C  S0 K$ z3 z' i& L2 h

. K# p6 P: t6 W  a& [% Nmodule_init(led_platform_init);5 g5 M) g( b0 {6 ^1 K
module_exit(led_platform_exit);
9 f4 J  C) e8 l+ Z2 M  `
* t. |7 N& J) Q; T& p# Z# m8 _- K. CMODULE_DESCRIPTION("Led platform driver");
' _% F/ ]8 `1 k( i" ^MODULE_AUTHOR("Tronlong");
1 }9 m" Z; m3 j) K; U& AMODULE_LICENSE("GPL");
8 ^: T9 K$ H& m) |' l. I2 g5 P6 o4 K0 e0 c% V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 01:30 , Processed in 0.040200 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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