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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。$ |$ V$ U; g% x9 `) R! N
#include <linux/init.h>8 M! f' M3 R; @9 R" g& `; b# k7 |
#include <linux/module.h>
4 ]. a# Q4 U6 |; e. ]% g3 c: ~#include <linux/kernel.h>
, F, _0 ]2 C5 M9 h#include <linux/types.h>
9 o, H/ G, i4 [+ E, x#include <linux/gpio.h>
, t4 j* i( ~7 n5 [#include <linux/leds.h>
/ d% h  Q$ Y2 m5 g#include <linux/platform_device.h>( T* {+ N! T$ M, S# |2 B+ p
5 n3 s; S9 V6 @: U
#include <asm/mach-types.h>8 _3 H6 E4 N6 \/ I. u! R
#include <asm/mach/arch.h>. U0 X) a. O, l* j  z* a
#include <mach/da8xx.h>
) [* ^7 g8 L* g5 u#include <mach/mux.h>$ C5 e( z7 \6 C- C
: K1 y! X6 D; _- ]
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)3 A7 k9 j% {7 c
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)& J4 ^  }4 K4 R3 k; U7 q* _; s
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)2 x1 j% d0 g5 ]  e7 t- P
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)& w) v- W2 U& W! R) A

3 I6 Q& V; o% _/* assign the tl som board LED-GPIOs*/, }2 g; @: [; I* k, E
static const short da850_evm_tl_user_led_pins[] = {
6 p: v8 b6 M7 k3 _* i1 x- p        /* These pins are definition at <mach/mux.h> file */
+ G; C, e( n# @6 n2 z# O        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,; P1 Q! i% d0 [) l' u3 Z" H
        -1
5 [' Z; J$ z" n: k) f+ `};, v$ E) t# t- a3 _' y+ g& a: w' D
( ?8 \3 q9 }+ n3 n" D4 X% E4 M
static struct gpio_led da850_evm_tl_leds[] = {
+ F- i' L' f  S, A        {
5 s( l/ u& m' {5 J8 g                .active_low = 0,3 x# H8 p5 k6 Z9 ]2 }
                .gpio = DA850_USER_LED0,
5 Q5 q  v$ z. [$ Q8 [+ g: V7 n                .name = "user_led0",
1 V! U* J5 _. [# [! @6 R                .default_trigger = "default-on",
* ^+ f% U! E) g' b  S& b        },8 H( ?& b) L; |. c
        {) X; ?) o, K% B  g, I1 l
                .active_low = 0,
0 V4 _7 g, v! ?7 K& Z3 T, V, B  \                .gpio = DA850_USER_LED1,
3 x; b  e# n- Q" L0 C                .name = "user_led1",
& \9 R' }3 }+ }& a1 O8 I                .default_trigger = "default-on",
5 S3 X8 q( U9 B; q        },
4 R: F( Q& S8 I8 ]) d        {4 f( n$ x6 v; T+ x; L
                .active_low = 0,
; P" H3 ]) l+ Q$ X2 O( g: J3 y- }                .gpio = DA850_USER_LED2," c# p6 T5 P1 ]5 X. J+ T; q$ n
                .name = "user_led2",) g: H0 T8 ~- G7 y9 {  o
                .default_trigger = "default-on",
& y, K- c+ f9 F, g) {% {        },' |5 j" @6 A3 T8 T4 O+ C! P) F8 a/ c
        {+ |, V& ^0 S, K) O: H/ k( M0 _
                .active_low = 0,+ n, G# f0 \. w9 D/ D
                .gpio = DA850_USER_LED3,5 i! C0 K/ ~2 l4 o" I, `- L( V( G6 M! p
                .name = "user_led3",( \! W! j8 I1 {0 a* b) G
                .default_trigger = "default-on",. [/ g3 r+ m6 M* ~; t+ t1 u8 V
        },( d& S- H* u- X
};4 Q3 A2 ~- O" i9 e* A! {, K
* \. I! m/ v/ j0 B
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {% p! \' a# R; s: |, E; t' t' V
        .leds = da850_evm_tl_leds,4 t1 H$ L, ^) D8 s' D; a  R- o( Z; T
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
* f$ p) B$ S' X5 Q; r& `, t3 C};
6 r3 `7 b: f' m" l
3 X8 y( u* l* T) }& w1 Z4 @static void led_dev_release(struct device *dev)4 C  |% w' J7 j
{
# l5 c! x- o4 l; R4 [' ?" c$ ^};
6 J3 ~5 T3 Y0 J' p7 J& r3 \6 L
8 `4 U2 \" c) A* \8 ^' E; n) `0 {$ y! Lstatic struct platform_device da850_evm_tl_leds_device = {- ^" @, @: x5 |. e
        .name                = "leds-gpio",
& T6 `6 p  x1 x" i* b        .id                = 1,/ W$ d5 W2 z8 m) \' k" b
        .dev = {
7 |$ N9 L" ~7 v; W( c) Z: b2 _1 ?" ~" j+ n                .platform_data = &da850_evm_tl_leds_pdata,
4 u7 B( g% O% q/ S0 B* ?) N                .release = led_dev_release,' a" ?# w5 C# _: Q, a  S7 Q1 \4 o# B
        }. i. [) Y/ V. Y5 U. z* n" y
};
" g" ~7 L: `* \4 t# b% B1 g' [
static int __init led_platform_init(void): J+ Q9 z/ T1 _+ {( i2 m1 Y( F
{
' N- s0 k3 `8 N2 J; E6 p# f6 m        int ret;
& ^! \. B2 T0 X! _; L#if 09 R* U' w, n; N
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
  V/ k  Y* y0 b3 c1 s; N( Q% p        if (ret)
# X& ^$ o0 k" w/ {& [: B% F  ]                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
" }1 W- H( o4 r( |: M4 \  \                                "%d\n", ret);/ J& y3 |( u7 r$ L8 S; B% V/ w9 I
#endif7 l5 U! ^. S3 z6 ~- j' u
        ret = platform_device_register(&da850_evm_tl_leds_device);
. M& e3 E4 \; W; p* x( d; C' z        if (ret)7 s! B. s, D' d% W/ `4 r
                pr_warning("Could not register som GPIO expander LEDS");
/ b7 s8 k7 y$ \: y        else
0 W! [0 d" j* r( p  y: c                printk(KERN_INFO "LED register sucessful!\n");5 V( Q9 C0 [! Z+ _/ r
6 B) `% e# C' }
        return ret;* T* ]% u7 z8 m3 y! O- E# m
}* Z2 h  |# v- o* R9 T

/ |9 X- o% u0 k0 J8 Q: ostatic void __exit led_platform_exit(void)
7 X' ^- H) M$ J{) ]2 u$ x  K( m% y2 K4 J
        platform_device_unregister(&da850_evm_tl_leds_device);
9 S. d5 i" W% C( p) {- @: u, {- u% F) z9 M
        printk(KERN_INFO "LED unregister!\n");* e9 Z4 k: s+ x6 q% u
}
" r7 A! x6 Q7 N$ U* R* I
0 S8 ?, B0 W. _/ fmodule_init(led_platform_init);1 u4 p" H7 Z) m+ V6 P& |
module_exit(led_platform_exit);
3 _/ z  r' g. |5 }9 D. k. T! U6 p: t, i2 m0 N- x! K
MODULE_DESCRIPTION("Led platform driver");+ e, B4 T, v# u4 h. _
MODULE_AUTHOR("Tronlong");4 N  A! s: g4 F3 e: l6 `
MODULE_LICENSE("GPL");
! d; I. O; ]' s& o/ p9 l8 u' I) o3 V# O" g2 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 19:06 , Processed in 0.037245 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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