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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
! r( w1 [- w7 D: w4 j" j4 q#include <linux/init.h>- j, S2 u% _, `. d
#include <linux/module.h>
: w$ G4 S+ V! P; Z( {& @0 Z#include <linux/kernel.h>8 E, l* f' R. U* O
#include <linux/types.h>
! K5 U( ^3 P" M6 b$ E& h0 O5 f* C#include <linux/gpio.h>+ R* o: [6 ?% X; ~9 l! j) K3 ?: ?( r
#include <linux/leds.h>! |8 @: a& ~/ Y" J1 L
#include <linux/platform_device.h>
5 d: a+ m) I6 J9 ]& B8 R  p
3 _. M5 `) R$ F" j6 v#include <asm/mach-types.h>
- G3 V4 V2 Y+ ?/ G#include <asm/mach/arch.h>1 v* q! A0 M: y4 j
#include <mach/da8xx.h>
: U  H' \8 R! \% a. A#include <mach/mux.h>
3 Q$ i; s* l9 A2 v+ p& f5 X8 ?8 X7 I
3 x. {  M8 x+ i#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)+ U( d3 d: ]# z4 X
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)- C& r2 q- J$ A+ G) U3 q1 Z& o% g
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)! j5 m7 z& W$ y3 h" x9 f
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)+ N, q9 Y8 o+ {9 X3 [# s, F
6 J% D9 p5 j6 I: ]1 Y8 Q
/* assign the tl som board LED-GPIOs*/
" E- L' J/ o  t1 Hstatic const short da850_evm_tl_user_led_pins[] = {
3 S$ z0 F2 \5 U3 F' z        /* These pins are definition at <mach/mux.h> file */5 f$ e  d8 @0 ^' Z+ ?, v
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,, D+ R$ D/ Q0 |' y
        -1& S9 A. [3 p8 U: S5 U
};
) `1 \! Y& i% |/ ^7 ^2 i* m
4 A8 ^3 o0 D- w8 N9 @: i9 vstatic struct gpio_led da850_evm_tl_leds[] = {
9 @* i1 x, ~$ n9 B- F        {
- c, t& K( ^: z* q& ^8 S+ ^                .active_low = 0,  h* X9 P+ J( C0 J  R" G1 g' q
                .gpio = DA850_USER_LED0,
/ V) p* i! A4 g0 ^' Y5 m+ ~$ o                .name = "user_led0",' m% r& x& o+ b/ E: ^
                .default_trigger = "default-on",# g, @- i$ Q( }8 v$ p
        },1 s# p# v# f! W' x" {
        {4 e1 Y" ~' P7 L& e  R
                .active_low = 0,
" g  y- ~, J( O% @+ @                .gpio = DA850_USER_LED1,' w' r( S0 n, l! i7 _) ]& S
                .name = "user_led1",
' d' `: c4 Q4 W) F* I                .default_trigger = "default-on",
. j! U1 J# ~' A/ P' l        },
6 @( ?) ?0 D8 f9 i2 x/ ]8 D" Q! K        {
( k) p8 q- V) L1 Q& Z: z- Z                .active_low = 0,
  A# A- A1 O4 L( h) ]                .gpio = DA850_USER_LED2,
5 N/ e8 f8 E, h; \  M                .name = "user_led2",* P) o, h% `7 c; U4 O5 g8 j7 J
                .default_trigger = "default-on",
1 {1 D& G$ ^6 U% K* P2 R        },
/ T+ o( z: |& b# g$ b9 F        {8 ~! h3 L, ?; s/ I
                .active_low = 0,
" V8 r# T; Q' t8 O                .gpio = DA850_USER_LED3,
6 g7 p; H' h/ m7 R) V$ ]% E                .name = "user_led3",4 X8 W, v$ }9 c6 c! \
                .default_trigger = "default-on",: [7 }3 m' n/ b% O9 C# {; J' v
        },& M& k* [: _+ L( C7 b6 u; r! W
};
/ d  J# Y) p& r) ~, f5 N3 c5 |
! O( n* l" g0 @) z8 `static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
+ P$ N0 g0 W* e: g( B& B" q        .leds = da850_evm_tl_leds,! F' s/ z5 R6 G
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),% m7 y) `1 l; S6 H
};
" J3 N5 g9 ^$ @* n* x7 u& v, O% S  w" f, Q. V. ]
static void led_dev_release(struct device *dev)
8 T8 ^% D/ R" F& H! w+ q4 U& d7 u( m{' N: i$ B9 M0 J: F  {  U
};8 C3 I4 i8 {4 g8 ]! f
; D6 ~) i9 @; ]6 p) V0 {9 @
static struct platform_device da850_evm_tl_leds_device = {
) a" C9 Q: P/ z& A% {2 W        .name                = "leds-gpio",
1 z" W; \5 W1 t) M* Z+ p; l! m" g5 _        .id                = 1,
4 ?. z6 f. d3 L" \3 h- L* ?- K" m; z        .dev = {! D' H: [1 |; m0 O& S" V$ q
                .platform_data = &da850_evm_tl_leds_pdata,1 O* x. \& Y1 U) \; b$ Y. G$ r' Q
                .release = led_dev_release,
$ M' G: D) ~/ h! P5 R) c3 l6 n        }
0 R1 Q  _6 m5 b% b};
7 q& J- J& r8 H; C5 K
7 b/ U9 M& h# H6 H2 c3 i, a3 istatic int __init led_platform_init(void)6 P, n5 d& |6 `( d6 F" m
{
9 E3 M; I& {& F, b: k. B        int ret;
2 i; F) i/ c8 s5 r#if 0
6 h* |$ y- I/ ]        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
( @' V# g. ~! A! Y$ M2 R$ R        if (ret)
# S: J( s( k+ C8 h$ f! a                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"7 |. [# n* `% c) M/ A
                                "%d\n", ret);
6 [8 ~0 Z; Y  {1 d% m#endif
4 {  J; X9 L! z        ret = platform_device_register(&da850_evm_tl_leds_device);
4 {. Y6 Z5 Q; \( E        if (ret)
1 P7 z. s% |( n! w* z* Q                pr_warning("Could not register som GPIO expander LEDS");
' k& _1 `; g# J( a- ~        else
1 c0 J! m# K7 [                printk(KERN_INFO "LED register sucessful!\n");- r, f, ?! O/ h7 v( v' Q1 V

9 l$ ]( d1 I% N8 y3 ]        return ret;% Q* g' ], J! `/ g% v- W9 V
}
5 R$ Y  _3 t! b# ]7 _
' o) m% f: [. m% g  l2 hstatic void __exit led_platform_exit(void)$ A8 l" T( f  V7 D+ E% y0 W
{  k2 y6 M5 j6 l1 g$ j4 q- E2 b3 h
        platform_device_unregister(&da850_evm_tl_leds_device);5 H& i7 ]. ?$ ~

$ [: J3 _6 E3 \4 t        printk(KERN_INFO "LED unregister!\n");
, Z" ]; w: g8 I9 S8 e  {}
1 C6 M1 E9 s9 |% S: Q
7 f% J- i4 u7 ~. m+ Dmodule_init(led_platform_init);
9 x) c, I: r- G& smodule_exit(led_platform_exit);
2 a7 a1 C& ?  {! e$ i3 o  _. I0 n9 u9 i' B  a: x
MODULE_DESCRIPTION("Led platform driver");5 s" s! G: S9 u4 J
MODULE_AUTHOR("Tronlong");2 k; c6 o: Q0 s6 s& X' ]
MODULE_LICENSE("GPL");
- M9 Z0 o0 y% V6 \
& S& m  I) c: h/ @* ^: p- Z$ }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-23 02:38 , Processed in 0.040233 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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