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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。% S4 F! B9 P+ [  E
#include <linux/init.h>. E( u/ ^' I% }( i8 M  y
#include <linux/module.h>
+ o$ H, l. x- `7 d# f1 a#include <linux/kernel.h>- Q+ Z0 }5 L9 X5 F- [+ E
#include <linux/types.h>8 }$ D8 g1 t- R# [4 d
#include <linux/gpio.h>
$ m  B/ s6 S* z7 K! m+ _#include <linux/leds.h>
  V- e7 v' b1 q/ f* u8 b$ z#include <linux/platform_device.h>9 [, S1 C  V+ Y. F5 ^
& k. _; W5 k; w* `6 A
#include <asm/mach-types.h>; m7 i; B) S$ F4 Y" q
#include <asm/mach/arch.h>
/ f( \" \3 @; `2 c8 u+ U7 _1 S#include <mach/da8xx.h>( g+ l: ]- t' N) x
#include <mach/mux.h>2 F4 ]4 O: o( V
* L; l( N, K5 [, G( U: X
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)0 G: ~/ _( S8 l' G/ D+ a7 b
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5). J# \7 y/ Y" }5 R* o
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)7 A9 x$ [' M8 ~8 Q+ R1 F
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
8 R8 w# H, A. L9 s) `" \9 l) w$ y* v* x# J
/* assign the tl som board LED-GPIOs*/
9 c6 h' d6 p- A8 w+ t+ qstatic const short da850_evm_tl_user_led_pins[] = {8 h2 b0 z9 h# v1 B! i! t
        /* These pins are definition at <mach/mux.h> file */
# G) |. u1 G5 [, w! K        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,: x1 E% U4 u/ h9 \
        -1
% n8 U& N, K; n) \2 ]3 i! n};% D: p0 q. N8 I" @5 e* M( i

& V" G0 s$ }% Lstatic struct gpio_led da850_evm_tl_leds[] = {
  G; R4 |) v7 E9 p! J        {
9 p: w, _# m+ w& K9 X+ X: a  Q                .active_low = 0,
$ N. X5 @% G) J- x+ k4 w+ D$ ~                .gpio = DA850_USER_LED0,* A, f( r, o$ W
                .name = "user_led0",
: F$ `9 S0 C5 S& u                .default_trigger = "default-on"," V; E2 m  }( f( D3 y& [3 i, j0 W5 `
        },
0 i  B: M4 }- P4 N5 t: Z        {
) k, {2 t$ _& m- N* ~* I! k% x* {( f6 d                .active_low = 0,
* p$ y0 o0 f7 i                .gpio = DA850_USER_LED1,
3 o. U6 S$ I7 z                .name = "user_led1",
7 F& [' f( u+ I9 _" a                .default_trigger = "default-on",
% Q5 o% M+ d9 t" k0 R$ ?        },( s) ~8 A/ P& c" P, h" x
        {
0 L) U2 N$ y, i3 ^  c2 I3 S* u                .active_low = 0,
" @% U- ^$ E: r                .gpio = DA850_USER_LED2," S' v9 ^0 t& q5 x/ x, c
                .name = "user_led2",
* \3 T* @1 ^$ [* G9 y. S; M- p/ P                .default_trigger = "default-on",
- Q3 d4 d+ F! R' j        },
  F# Q8 ?# G/ Z( k' ^  T        {
4 Z$ Z9 |2 z4 J6 m- J) x+ ]                .active_low = 0,
; S. G7 o& c; p9 J  ?                .gpio = DA850_USER_LED3,2 j' A9 U0 ~. F! n8 e  ^
                .name = "user_led3",+ [1 K. D1 m$ d  A7 S
                .default_trigger = "default-on",1 X5 A$ [# a9 j; }6 P& Q/ |$ }
        },1 y( A3 ~! `, I/ q
};7 Q" a" D, U# K/ v0 c

, n* K2 M; j% O, J1 K6 j  h3 }static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {6 b. `( l, {3 K1 K8 v& m
        .leds = da850_evm_tl_leds,- }5 _  C* I6 N& x
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds)," A  O, C" d$ e) Z, c4 ]. d: r
};+ {% _  a2 Q' q$ Z7 g

* v- ?& w9 a8 B; V* W! estatic void led_dev_release(struct device *dev), h; g- Z2 K; }. ^( b4 O
{% d- d- K) o* i* b! i
};
- S$ ~# t/ w5 O5 B) L
4 {' Y, E  a" fstatic struct platform_device da850_evm_tl_leds_device = {
, y6 ]$ Z3 u8 _' B5 c8 w        .name                = "leds-gpio",! L4 Q' i' j4 S5 ?0 e
        .id                = 1,
% I* g4 X( V% d: _( S( o8 z        .dev = {6 V2 c7 B; B) J+ Z  f+ }1 m
                .platform_data = &da850_evm_tl_leds_pdata,$ m) G9 Q& x; v/ |" q4 M
                .release = led_dev_release,
/ Q9 R8 O. e' u8 _- O; k% R        }/ m% [4 A% B. v  r5 T
};# C9 R# X" b, E# A/ k9 F  W$ q
8 y* }' h9 d" }7 o; q" g$ b- q
static int __init led_platform_init(void)' I4 l7 R% P% M/ t- i
{
( n: i7 H# u& }" x# y& H& M) T        int ret;
+ c$ q# \: T0 U: a3 u#if 07 V( M0 H  S: a- K
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);/ {6 c  ~% E& Y6 O
        if (ret)
" @& G2 H9 s+ K4 o  Q                pr_warning("da850_evm_tl_leds_init : User LED mux failed :": o6 I. q8 O" L3 D5 a/ F0 `* r
                                "%d\n", ret);
' e& P1 L5 A3 v+ e4 K) G0 S#endif
  X6 f% E8 l2 m- M% x6 ?+ R        ret = platform_device_register(&da850_evm_tl_leds_device);
9 U3 e  U/ k3 C. q- N3 X        if (ret)
. P6 \9 E! S; k3 a                pr_warning("Could not register som GPIO expander LEDS");% Q6 L7 E/ N" j6 j" P- q
        else
- Y! E& |: Y7 J) r                printk(KERN_INFO "LED register sucessful!\n");
% f2 e8 x: N7 q$ `6 b! b
' v" s8 F0 a/ r8 ?7 D1 U6 u        return ret;% W; H9 y& U- a+ ~% k; `9 @
}8 F' J2 C2 C, b  {  H1 `% @. u
( O2 l) x% X( I. v" \4 _) C5 l* _! Y
static void __exit led_platform_exit(void)
* z4 o( \* l. F. q{
) S5 p& E$ ?: Z/ {0 l( P        platform_device_unregister(&da850_evm_tl_leds_device);
% B8 H, d: s4 N4 w; u/ a( N  z' |# w- b/ [
        printk(KERN_INFO "LED unregister!\n");) D+ W, P5 Y1 o* ~+ n" T, m2 X
}1 F% d* q, d7 `' {4 E

/ P) r# N) T9 |0 Z+ Ymodule_init(led_platform_init);+ d) t, _  _7 x" M! |5 ^0 K
module_exit(led_platform_exit);
/ v% k' G. o# S0 r$ Y9 }) I5 M; U& c9 y& B8 w
MODULE_DESCRIPTION("Led platform driver");
; v1 _  L3 l/ i  ?MODULE_AUTHOR("Tronlong");
. C9 g" ^5 w! e0 w* WMODULE_LICENSE("GPL");
3 ]: d8 \/ @: J- F$ h: T% b" J' e1 V3 I3 j2 H& h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 05:46 , Processed in 0.041735 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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