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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
* O' X. X0 Y2 v: Q  c#include <linux/init.h>
+ i5 q" m  @$ T* d& B) D/ h#include <linux/module.h>
  ]4 z8 j/ G6 Z#include <linux/kernel.h>* Z1 }' p( x  J, f5 w. E" b. e$ t
#include <linux/types.h>
& a# e. B) ]1 }1 a( \1 W# j#include <linux/gpio.h>
7 J9 E$ u3 K* |( F% {% [' D$ A  }#include <linux/leds.h>: H  [5 P/ [+ _" x
#include <linux/platform_device.h>
8 x: h. k) m. q7 F1 T0 w* e1 R$ x
#include <asm/mach-types.h>$ X+ S/ W2 f8 y  L4 y& u
#include <asm/mach/arch.h>) \4 l" p  X8 x7 Y/ n2 i0 N7 g) r
#include <mach/da8xx.h>
; \5 y4 i& R* \/ q  N2 [* `1 C#include <mach/mux.h>
4 Y4 _, d2 X' A* w
6 d$ T2 F- R' l/ ^9 M#define DA850_USER_LED0        GPIO_TO_PIN(0, 0). R7 A4 Q# A( S
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)0 w0 E( W/ L- l0 X8 x7 h9 e
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)! s9 e) L$ R4 O
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)' W8 [& m- M' Z% U
9 l- a$ l4 Y* }- {
/* assign the tl som board LED-GPIOs*/
# c$ C0 S5 d+ G2 e) Ustatic const short da850_evm_tl_user_led_pins[] = {
/ ~8 j0 M' h% D! s# {1 i        /* These pins are definition at <mach/mux.h> file */
. u4 I# ]* J& Y4 a: X, O$ @2 l: L        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,2 I' a- ~3 I9 q$ N) l% h. r. a
        -1
6 t% Z$ A2 r, [. C};
9 {( S4 p3 ~* Q* U9 Q1 J# g/ G# a' Z
static struct gpio_led da850_evm_tl_leds[] = {
  _0 z& u; B4 i4 }        {) n/ G2 |: Z  K% D
                .active_low = 0,, s8 Z* h3 o: D
                .gpio = DA850_USER_LED0,# Z9 H) z2 B! r8 C  w0 s
                .name = "user_led0",# i0 t9 v. D' ^
                .default_trigger = "default-on",
, `2 R: U5 L# S+ `- o9 U+ C        },/ x, W2 T, ?1 s6 ]6 y
        {
2 Y1 P! E0 I9 F7 \- N) _+ h! o                .active_low = 0,6 x6 Y) \) r. U% t! k! O* H
                .gpio = DA850_USER_LED1,
1 e5 v$ R9 ]* O- |, p. [1 B                .name = "user_led1",
6 \9 X/ Q: ~( c1 h                .default_trigger = "default-on",6 n3 b7 a; D* D) O4 e
        },
  y& O& J3 C6 L" S/ @        {
) R% E$ `2 R& J, {! p8 Y2 a                .active_low = 0,2 R1 l6 z( y/ f# J/ M  j2 q
                .gpio = DA850_USER_LED2,
9 c' ?. P1 G% p1 J$ y% O( ]                .name = "user_led2",5 J* \$ e! a0 D3 S* j5 c
                .default_trigger = "default-on",
5 S  K# \$ }' V. K: m* ^        },1 N& _1 _; A7 z/ D
        {/ k  T7 y5 l$ a+ j
                .active_low = 0,, p& m' ]- O: s+ z2 E+ ^2 d
                .gpio = DA850_USER_LED3,, b# v9 j) L) p; P
                .name = "user_led3",
- s! f/ @3 T5 t+ Z                .default_trigger = "default-on",
+ ^6 [/ u6 W$ c2 a: Q! u        },4 M1 j# O" e. l8 @3 ]
};0 ]# Q4 v0 y4 l8 x4 k1 f
4 W5 U2 C+ c; \; n  g
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
  ^4 z& ^6 l/ b7 W. U: E' y- e        .leds = da850_evm_tl_leds,
9 V4 J% I: n/ E) ~        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),4 T0 d5 S" i4 \  I' c$ _
};
, z5 e9 ^4 e: ?2 J+ C/ r0 [% T  M+ |: x4 I+ \$ Z
static void led_dev_release(struct device *dev)' q8 [5 V. w* r: j
{7 Z! S, s+ g# s$ a+ k
};
0 a! D5 h0 j9 }4 U/ a9 n4 G; _( l+ [/ S
static struct platform_device da850_evm_tl_leds_device = {
) K4 }' e* e: |3 r) q        .name                = "leds-gpio",
( H/ X9 C) r/ O+ o) J( V        .id                = 1,  e. M( \0 [3 o. I8 Y
        .dev = {
7 O  ^. P- F( d! S, c                .platform_data = &da850_evm_tl_leds_pdata,$ p" p. t/ P2 g9 n5 q8 a" V6 f, V
                .release = led_dev_release,
  V( Y5 s2 g7 V2 ?1 }* p$ o3 D        }; [' [1 }2 B( j
};: h0 s  h$ y/ f7 F( a, T

, h0 p( a$ h" E/ q8 Nstatic int __init led_platform_init(void)
' B, y1 M$ r8 H, k  @{9 V2 Z# }8 c8 E) E* c3 m
        int ret;: f. S, O+ F) o% k. P
#if 0- l& ?2 L) {6 `) C/ c
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);5 J( b2 G; L: I, U
        if (ret)
, ~6 P) h  Z$ m6 m$ x: T: d                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"( z- f  b/ w" X1 u
                                "%d\n", ret);& S/ Q$ n% G& l  E- Q( b
#endif# z/ _8 h7 u) d6 J0 t; h% r% `* }
        ret = platform_device_register(&da850_evm_tl_leds_device);- F. j' |' E+ @+ @& w) G
        if (ret)
" ~7 w" D) P1 w) c$ z                pr_warning("Could not register som GPIO expander LEDS");2 _% Z# F% w7 r, z* o( R7 k+ u1 r1 Z
        else
* P1 J* x7 C! w( R! y) w! D                printk(KERN_INFO "LED register sucessful!\n");
. T% k; X! {0 f7 h: A  T' r0 @1 N3 G% D# j- E+ Y
        return ret;
5 N% s/ x) \& d5 ~) Q$ \}, R" V* e# {! @) K$ v$ F# X
: P) p: b" {0 L/ Q
static void __exit led_platform_exit(void)+ y* [2 L/ j1 G# d
{
, r( Z- H: d9 b: p4 ]        platform_device_unregister(&da850_evm_tl_leds_device);3 `9 Y* C  _2 q; T
& r/ e; j9 `, J' A$ c% Y
        printk(KERN_INFO "LED unregister!\n");. T* {. v6 {, P
}
- ~7 z1 t0 `, n
4 Z1 L% F4 d" L5 Xmodule_init(led_platform_init);& K$ n5 k- r9 Y9 ]0 N/ R4 f
module_exit(led_platform_exit);
& X+ N! D; D7 r1 ?0 f& W4 f. q" E- M8 N  a8 y) |9 B/ t# p7 N! W, Z. `& E
MODULE_DESCRIPTION("Led platform driver");
' A& e+ d; `% jMODULE_AUTHOR("Tronlong");; M3 K) R( u, F9 \' ?& {, R' ~; T$ G1 k
MODULE_LICENSE("GPL");9 M: v! D8 m# l" |1 ^
4 H$ g2 n, w/ t1 @, |7 B( e* L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 05:37 , Processed in 0.039144 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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