程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
  _7 f* r2 A1 A/ V# h9 f3 V#include <linux/init.h>
! T2 Y% ]; }4 V  _* g% k) Y9 M#include <linux/module.h>
  I" O- i# A1 A! a#include <linux/kernel.h>$ k) e* S: r, D& o1 W
#include <linux/types.h>
" [% G7 J9 n/ Q" ^/ c#include <linux/gpio.h>; N8 U0 c0 l( `/ i- U
#include <linux/leds.h>
: T: U& \, b* R- l#include <linux/platform_device.h>4 K6 t2 Y) Z1 b4 X, E7 |/ G! y

4 {  w" b: K% z/ R4 U#include <asm/mach-types.h>
6 q; x/ [+ F, M#include <asm/mach/arch.h>
+ B5 {* u* V6 g# ]( p/ V+ {#include <mach/da8xx.h>9 c* Q# E. u7 l4 w% n
#include <mach/mux.h>
/ L( G" V# @7 z6 i
3 ?0 H# v2 \1 h! l8 ^1 i; g" X#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)! ]4 j$ F* S/ y2 a4 _2 E
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)4 ~2 {4 d" \0 {) F" X4 m
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
& y3 f0 p8 X2 k5 m( F* c5 S#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
. c# `. U1 k! r8 n( f7 w9 X" K/ G. `4 o! y/ J
/* assign the tl som board LED-GPIOs*/0 u2 G" `. @  a  h% Y
static const short da850_evm_tl_user_led_pins[] = {6 E  k# t( [* i$ [& T
        /* These pins are definition at <mach/mux.h> file */7 f: z* {) Y0 X; d" t, ?
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,, T6 O0 P# J( g8 S3 b
        -13 O! T* C0 b9 ~, e, _1 q
};( K9 `$ ~: _7 P+ k. B4 ~# t2 U; A  D
8 d/ W/ b$ l' w; Z
static struct gpio_led da850_evm_tl_leds[] = {, l* X% v/ c1 t( g. M& ?4 |
        {; v/ p! t6 E; l  A1 c( \4 D
                .active_low = 0,
" q% I' t3 J1 z4 v+ ?; m1 k                .gpio = DA850_USER_LED0,
8 O( S1 m3 e# G4 H9 X/ R                .name = "user_led0",
4 v1 [- _. d# m5 a                .default_trigger = "default-on",1 ^4 _0 D- d2 i7 t, S
        },: c2 l$ r1 ^! U+ c% n
        {
" ]4 b% u. c: ~5 E8 d# D                .active_low = 0,
, _. h4 [* m; s+ S                .gpio = DA850_USER_LED1,
5 r7 F) T% H  R# W1 B) s3 {( ~                .name = "user_led1",
2 h  W# M1 r1 W, ]                .default_trigger = "default-on",; k5 k, `* L) H8 _
        },
) [% c( _2 j. N        {
  V  X7 c7 [4 e                .active_low = 0,. y# I" R+ R1 N1 N3 }6 V' \5 j
                .gpio = DA850_USER_LED2,6 g: u6 M. F& H2 s. x" w
                .name = "user_led2",
1 }. @* {# h4 {/ {6 g$ Q                .default_trigger = "default-on",
6 [3 M/ ?/ I( ^        },
1 O( h8 l) P! f9 ~3 k# t7 P        {
; K" N5 b2 y& v9 R                .active_low = 0,
6 d& H+ K  p. Y( N8 X: j                .gpio = DA850_USER_LED3,+ R9 C0 C4 ^* f* J
                .name = "user_led3",1 v( G$ g- a/ `
                .default_trigger = "default-on",
% ~- k0 U- [$ ^* ?/ K/ V# U  S* G/ P6 B        },# n: x+ v% ]9 d8 W' ?8 j5 i
};4 @2 g& ^$ E+ S8 F3 f
+ g" ~$ w1 A/ v' ?+ p/ N
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
% y$ f5 H5 {( K# A8 {) o* ]: P        .leds = da850_evm_tl_leds,
, ~& y, G+ y( U. t        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
: y- n- \) y( [' Q};# B7 G/ q# N8 a5 [8 n
+ D8 y$ w/ C$ \, U7 d0 m& g
static void led_dev_release(struct device *dev)
5 Z% t$ ^: b" S( V& F{- }8 A$ }' K+ Q/ W) h1 W4 e
};, i6 X) q# k( _  ~7 r, c

1 F8 T6 l6 Z( _5 e7 R# Z+ T% Fstatic struct platform_device da850_evm_tl_leds_device = {' I, ^2 v1 ~6 [
        .name                = "leds-gpio",
8 b! Q! `0 v, h+ `9 J$ ?0 S        .id                = 1,1 Z4 i- ]1 ?/ V+ ?; F
        .dev = {' K* R" ^, c# c. [% ?% }: j# j' X. R
                .platform_data = &da850_evm_tl_leds_pdata,
* ^( N$ }9 A# Y, Q9 K                .release = led_dev_release,
+ C, E6 `6 [/ B, G, A' T# O        }
+ x6 n3 H* i& n" z* B};
1 \- ]& n& K0 |# p& Q" b( }; s' a2 \1 K9 n! L
static int __init led_platform_init(void)
1 J/ c0 ~9 B1 i{2 d9 h$ K; P) J3 T
        int ret;+ g, X0 Z1 H- U& u8 U" h) R
#if 0# [9 r& f' S* ^% m
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);/ v2 p) V1 \1 @2 B; R- d& ^! u9 \
        if (ret)
6 b; ~% X: H. D                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"( X3 d$ Y2 J5 f
                                "%d\n", ret);
0 V% t& p0 n% E- L#endif
# S; Q: ]( }& m        ret = platform_device_register(&da850_evm_tl_leds_device);
6 _8 q5 T9 N8 I3 I        if (ret)
. p0 {" A' p0 e% t& ~9 ]                pr_warning("Could not register som GPIO expander LEDS");
% ]/ D7 o6 M% ^8 M        else: b- q3 e" U" Y% @0 o
                printk(KERN_INFO "LED register sucessful!\n");
( c% N& `; c# o  r. }5 @0 n& G4 O8 E9 M, Q$ O
        return ret;
4 J8 W! g% G4 l5 P4 p4 P( u' j}
- x& T, ]: d( k* e9 H; W; w% @9 X; K9 v4 R( T: q$ @* v
static void __exit led_platform_exit(void)
4 V" ]% {9 q: |" K{: ?4 I) ?0 ]' O" p
        platform_device_unregister(&da850_evm_tl_leds_device);9 c+ G+ S0 l& t" G1 q% D7 y
! [, l) r2 r& B, V! ^/ a( h) S
        printk(KERN_INFO "LED unregister!\n");
6 K1 [- V' s2 @) h}
! @- ~5 j% e/ {8 a* [( a4 n. k8 C
8 {; U' o- z8 ?$ ?% B5 Rmodule_init(led_platform_init);
8 g7 p4 Q* j0 E1 P% a* ~module_exit(led_platform_exit);- n7 i/ k3 |4 O- |

4 y4 O# A" B& h% g( L1 nMODULE_DESCRIPTION("Led platform driver");9 L+ L+ P* e4 }" |
MODULE_AUTHOR("Tronlong");" C$ @8 Q2 b: W
MODULE_LICENSE("GPL");9 }2 }" u5 J( s/ u- V

1 ^# Z- G: B( ]" M8 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-8 10:53 , Processed in 0.035846 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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