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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。8 `; \4 r! y, A( D; @
#include <linux/init.h>4 J' A' `" F6 E' Z# x
#include <linux/module.h>
/ l' n8 P+ c2 T$ {. h9 n$ I#include <linux/kernel.h>8 g& I1 B% r3 L8 X7 L# j* B
#include <linux/types.h>& C+ H# Q& g1 R. f
#include <linux/gpio.h>$ W0 ^8 n5 @  V: Q6 a' y& K
#include <linux/leds.h>
. F/ G3 X- I+ f' o, d#include <linux/platform_device.h>
/ o: |' ]2 o) f4 s& ^& |* o8 g
, V2 x& w( J" f7 O/ H6 U' S* S7 @8 w#include <asm/mach-types.h>
  s# Y" O" u6 a+ h- J$ j#include <asm/mach/arch.h>8 V0 S6 S9 i- L$ L6 v" C2 `  C+ i
#include <mach/da8xx.h>
+ C/ K/ G: T" U1 u, h7 w% P3 M#include <mach/mux.h>, E4 ?' G0 b0 Z2 |# M- {; v# K
  e4 N$ H, D  X, e7 j
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
* S" s$ f- m. e8 ^! t#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
+ Q, b( G5 E" O1 m6 L1 z& N$ C#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)5 k# a! H' Q( ~$ c7 t2 e# p: {0 B
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
1 d5 w' p4 f0 k4 ^& w% i& f+ R! x2 Q4 q- _. H( i
/* assign the tl som board LED-GPIOs*/
0 D/ L0 o. G4 P! T# k# xstatic const short da850_evm_tl_user_led_pins[] = {
& [0 z& `3 D/ E( o0 U, E        /* These pins are definition at <mach/mux.h> file */
( V/ s/ {% n# }9 P3 U; x1 w5 p        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
. z( w2 \2 Q& P5 f* v1 f' y+ P        -1/ J, [, v% l$ r$ Z
};
, F/ F6 r- g4 Y; g* V2 z+ o  M1 W+ Q% O2 v- Z
static struct gpio_led da850_evm_tl_leds[] = {5 e, _1 K& }0 S; I- k+ B% X
        {* f. ^& [* g  k# ^3 O( P
                .active_low = 0,6 F: W5 ]" d; I
                .gpio = DA850_USER_LED0,
! Y/ {5 I( Z  \1 a  a8 X                .name = "user_led0",  {2 Y; U( ?8 A, p+ D; i8 n+ G4 X6 u
                .default_trigger = "default-on",& l6 S3 c# b+ s: s; a
        },: T, n# G: {! l
        {) {, Q5 S6 K9 M" k. [" V
                .active_low = 0," N* [2 N0 h3 y2 B
                .gpio = DA850_USER_LED1,
* z* D. y' k. a" d3 s5 [                .name = "user_led1",9 o- ?" N  G  A- c! q7 J
                .default_trigger = "default-on",9 b4 G' d) L! o! U8 S
        },: R0 q; t) \" q+ _) j0 j. C- ?
        {
. J1 d" f/ v" X/ X, m# ?                .active_low = 0,) L( O: Q1 a# ]* ^% j
                .gpio = DA850_USER_LED2,
/ p2 k2 @: v8 w, z3 |; A& [                .name = "user_led2",3 [0 |9 f' `% G( A# z
                .default_trigger = "default-on",, w- W" j3 w& L; J' F
        },$ o% G2 d, p# G% m1 g
        {" Z! G, i$ |) g6 Z
                .active_low = 0,4 M& z9 T3 O/ {
                .gpio = DA850_USER_LED3,
; n/ E8 x* ^$ |5 f( Y" ?0 e                .name = "user_led3",/ D% d' ?, x1 \0 b
                .default_trigger = "default-on",$ |% n, V& D, P8 ]& ?5 {" @
        },; c. v% I9 P( z5 q6 ]/ e3 F  j
};( z& @% R0 X) [3 f

: X! R0 v2 o0 P* Zstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {! ^: O# A. U1 f( Y( Q! d
        .leds = da850_evm_tl_leds,7 j1 a8 N, x& k5 M
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
9 E2 N* `7 V$ x4 q0 ~};
6 J% L# A5 @" s# \- h: W3 j  I; Q5 T* D5 R, V
static void led_dev_release(struct device *dev)- L: w- w, G7 c3 P# B
{
" w$ L. Q0 D% `+ e. b  {3 f2 F' F};
1 O9 H( ?  W7 T) Z  D1 b7 N! q
3 b: z; h( b) ]; q4 h+ @7 Cstatic struct platform_device da850_evm_tl_leds_device = {3 }7 k. _6 A9 _4 k8 z% ~# d& F
        .name                = "leds-gpio",$ J, K7 B; h6 P
        .id                = 1,; p9 K! \: o5 [- s6 f
        .dev = {
$ X9 f) N4 _6 Q7 D                .platform_data = &da850_evm_tl_leds_pdata,# s7 k) O8 }9 W9 T4 _# e; P- ~
                .release = led_dev_release,8 |- V8 G: q+ Q6 J, f
        }( u7 H7 n; w: i( `; P7 U
};
' `# j% j( r! }8 H6 }) e4 Z/ Z: {8 q
static int __init led_platform_init(void)8 l3 e# p) d8 c
{
/ f. w* ^3 L/ S3 \' s        int ret;
0 [) ]& K8 m  O$ g4 m/ k- o#if 0' L9 S- _2 {8 a: @, ?" D  V8 [
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
! X: c9 n; p- {1 I( m+ @4 b  z0 Z& D        if (ret)
- s/ e5 j2 w! s7 v$ n) [, [                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
$ i3 r0 D6 t0 }1 G) t" Z. K                                "%d\n", ret);* Q% g' Z2 o! [1 d
#endif
, d% z( I; a% R, h2 X5 `8 ?1 c5 x+ N        ret = platform_device_register(&da850_evm_tl_leds_device);
: S( t) m# @. e3 }  d        if (ret)
& C8 @6 x% @$ w$ Z+ g                pr_warning("Could not register som GPIO expander LEDS");
2 W  N+ Q* \) Y        else
( ]2 l+ a" Z: ]1 L                printk(KERN_INFO "LED register sucessful!\n");
* b' a5 `# W0 a" c) I# d5 j1 Q1 `+ _# f5 V
        return ret;
) e) N* {! s4 [2 s}
* x# F& g, O- _6 a: v1 |. O
& z, e8 L) x" p$ K- jstatic void __exit led_platform_exit(void)# a1 @" a; O7 h$ j% E
{
" i* S5 O$ |) d$ o- L        platform_device_unregister(&da850_evm_tl_leds_device);/ Q1 X4 _* R4 K5 n7 T# {
; z) L! b' Z- p  y9 ^0 g1 ^
        printk(KERN_INFO "LED unregister!\n");' u/ d9 z* w/ H
}
5 T4 ]4 f% b) ~/ p' N# b& s3 B0 y. U' s. i* k6 y' |# N
module_init(led_platform_init);, D1 B5 y, C- \
module_exit(led_platform_exit);
5 {5 W: z4 A) H" Q/ Z
: ]' z" A( |4 w1 ?8 c; l2 j. AMODULE_DESCRIPTION("Led platform driver");% u, f! c# J+ W+ v
MODULE_AUTHOR("Tronlong");8 v2 N; C! ]9 x2 X
MODULE_LICENSE("GPL");
% f) W' I3 I3 C# `/ P2 `/ e6 y' c2 f& z+ K/ K8 D2 f0 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 16:10 , Processed in 0.039320 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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