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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。  |$ Z/ K3 h7 b: W# ]: b# c- f
#include <linux/init.h>
; H; N+ N$ @$ ]+ ^% f0 D" c#include <linux/module.h>
$ n% a7 ?; M: y( a; X0 Y#include <linux/kernel.h>3 C; e* x8 c6 F' S
#include <linux/types.h>
* f4 Y) {" ~" R% K#include <linux/gpio.h>5 y4 n* }* j% K8 w. b! j
#include <linux/leds.h>
1 F  _0 T3 B4 }  p# C" a% f#include <linux/platform_device.h>
3 w9 G$ d/ Q2 C, A$ b. V2 n2 X7 T4 F# a
#include <asm/mach-types.h>2 X5 t$ B2 m$ e- D# I+ O
#include <asm/mach/arch.h>
! p# W: L6 H9 W#include <mach/da8xx.h>
: h" ?8 G) Z/ ]6 x#include <mach/mux.h>9 i) r! H/ I+ N6 ~5 }
1 V# v5 Z! Y; c5 r  h- y
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)8 e+ E% p9 o  d; I* z% Z
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)- B8 V7 X1 q& ]1 R$ E, D. g* K8 u; N
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)9 u# ~2 n8 O2 C
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)( B' j+ ~: l3 a) F0 R

# T) n' n" r- E! s/* assign the tl som board LED-GPIOs*/
0 h( f% T/ U& Z5 R5 jstatic const short da850_evm_tl_user_led_pins[] = {" }. v) \; b% l! s+ J% h4 J% o& K
        /* These pins are definition at <mach/mux.h> file */
" M, w3 W% x! _0 M, z  ^- Z        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,: A( c6 i+ \; Y: G5 ^
        -1
+ n3 `4 h; a$ C  a5 l};
0 E# |9 o; ~5 E: h, t  b/ K: V/ A" Y0 i8 e7 p- |/ Q
static struct gpio_led da850_evm_tl_leds[] = {
' r( a. j5 _' W* ^5 M8 I' b        {' Z4 }. [) M% B. G' N
                .active_low = 0,0 D7 |7 T9 @0 m
                .gpio = DA850_USER_LED0,
, @' C& ]8 u; ]: {7 ^; Z                .name = "user_led0",
( }2 W/ r) k  z$ O                .default_trigger = "default-on",2 s, F' E1 ^8 ?; L/ x0 f! C4 L
        },
+ Z9 P5 j: j  H$ Z, K2 C        {0 _) N- P* s: X$ |! O
                .active_low = 0,* l2 h, \  M" g/ m+ [/ B
                .gpio = DA850_USER_LED1,
* ]7 s2 {% M3 @* \7 H                .name = "user_led1",
; l  Q4 R/ h" J+ S# \7 ~' m                .default_trigger = "default-on",! a# N9 X) g9 a/ y$ e( |) q1 Q* ^4 c
        },
+ ~( U, E! @8 Z/ ^        {
0 C1 Z/ z, ~- @9 m3 N# q                .active_low = 0,
7 S: D" e( G# q3 }) ^, R                .gpio = DA850_USER_LED2,
4 |7 U# c2 s/ T; _                .name = "user_led2",
) M; z: n* b1 I" G4 M                .default_trigger = "default-on",) T" ?  i  |! R% {+ ?
        },4 C4 y; F5 y5 O3 [* T! z
        {
3 W4 d. \5 R: e8 i5 W9 D                .active_low = 0," B  k7 E0 [! S9 I
                .gpio = DA850_USER_LED3,
1 s" h5 p5 m# w$ c2 U                .name = "user_led3",
& k! [( F4 ^  ~" V% C& C                .default_trigger = "default-on",
+ H) X- \3 W2 s. m- v& A% U        },
- ~% E+ q, M7 L, M};. `9 L0 @' q/ S6 g5 ?5 N  O

& e( m- e  P9 O3 v1 f1 r" x4 |static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
' }% }- O# W# D/ K9 L: P" h        .leds = da850_evm_tl_leds,
3 d+ K$ m; g9 m1 I        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
7 \/ P/ S: R8 v9 {% ~7 J. @};+ S4 P% B" N7 \  x

' t+ ?, V8 d! J( u/ {static void led_dev_release(struct device *dev)3 O% G: X) ~, R; }4 @. p' |! y2 c
{3 O% \! _) G- _- ~1 ~# `  l
};
/ Z3 e, g& L% d4 Y+ D1 u. C2 C7 N4 H( m" j" b1 s
static struct platform_device da850_evm_tl_leds_device = {1 E/ h( q; r- k/ [- o
        .name                = "leds-gpio",
$ N- A  B# {, h  j5 x6 `        .id                = 1,
: g2 [: X0 ^, i, J; |; r! _7 R        .dev = {
2 ?8 \. \0 N- Y$ q" a                .platform_data = &da850_evm_tl_leds_pdata,
; k1 ]1 a9 u0 ]9 o' l" y4 F                .release = led_dev_release,
1 @- W8 [8 @4 d+ M        }
# \  O; }4 N/ k4 i};
  _6 t, n  h, ^9 @. o, \+ Z* r  d, {9 V7 `' Y, Y
static int __init led_platform_init(void)+ B$ J4 ~6 m8 U5 g, }
{- F. A/ D" U0 `; l1 k- {
        int ret;9 Z9 z0 U! Y8 s& y, f( @- c
#if 0) e6 k, q, ]9 {
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);- n5 r* \1 B. ~4 K
        if (ret)$ G. M5 _( S$ c  m
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :". B  c- |- }0 W! n$ y; S1 O
                                "%d\n", ret);5 u; J" s4 Z" ]0 f) e$ t- F+ S
#endif, B3 V- @& ~8 T  g$ f
        ret = platform_device_register(&da850_evm_tl_leds_device);
/ `7 W3 z7 v4 B6 r2 u        if (ret)) K, r. C, Z$ G7 M6 A. R8 x( o- q
                pr_warning("Could not register som GPIO expander LEDS");- l$ ]% ~+ n; w8 _4 O0 Z2 E3 ^
        else
- |$ `. m& `8 L) _; z0 u9 H* Z                printk(KERN_INFO "LED register sucessful!\n");
0 c  X& V4 r* |" g) p; ~7 l
( ?9 s9 ?' z  F3 a        return ret;, E9 p% o- e9 x) }1 p* @
}$ H' |5 d/ i' x" ^. j! s

& F$ Y* K8 ]8 _) o+ i% vstatic void __exit led_platform_exit(void)
1 S3 U5 ]- Q7 b{
; W0 l. G" H: \        platform_device_unregister(&da850_evm_tl_leds_device);
8 L( n3 @8 C+ E4 t+ j& F+ D- Y# @7 f, d
        printk(KERN_INFO "LED unregister!\n");
! i) D4 U" N; A4 w& _6 A4 o}
8 L: v% E5 J4 F% o- W) v: C) X: H4 V- {  K3 ~. X1 m
module_init(led_platform_init);4 D8 K+ P4 _: K
module_exit(led_platform_exit);
* n* x3 G! E) w# G7 K( {0 E5 f, U8 P  Y$ z3 e' |
MODULE_DESCRIPTION("Led platform driver");# r; V) ^' ?! ^' u
MODULE_AUTHOR("Tronlong");* Q0 M9 r( g( D7 @" N
MODULE_LICENSE("GPL");4 j3 J4 U* ^7 Z
% _" o3 v8 [; x, f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 11:50 , Processed in 0.039872 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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