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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
- d% N1 [/ d; L3 M( z#include <linux/init.h>/ J; l  i+ s* \# G" a  a: T
#include <linux/module.h>3 d9 C/ r6 S7 k# `3 q, g) a. c
#include <linux/kernel.h>1 Y2 l9 L8 |9 Y' C% Z
#include <linux/types.h>2 p- F- X, @- L+ C. \
#include <linux/gpio.h>) x8 H, {$ r* C- L' o9 \2 y- x
#include <linux/leds.h>
  ^; n" Y+ x% R* Z& E#include <linux/platform_device.h>
) [! x0 X( x- F! M, T8 U. h( Q4 l5 m
#include <asm/mach-types.h>
3 F- L- c. V; D* @3 h#include <asm/mach/arch.h>
& q6 S7 s% ]9 _8 Y% K! {, P7 c#include <mach/da8xx.h>; M# P4 ^* h$ Q
#include <mach/mux.h>" ^) l! ^8 Z3 c3 G1 C8 @" ^
4 t/ P) Q, k0 f- {/ X$ ]: \
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
* ^9 a7 v& d8 ^) D#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)6 M0 Y/ t! m/ V% I1 H1 A, u( h
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1). B/ @0 s9 E5 `$ a8 A
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2); \) V3 L$ h# D) S" V, ^2 A, J

& k. z5 ]) y; R( E* }/* assign the tl som board LED-GPIOs*/
% F: u" f, I4 q& N# mstatic const short da850_evm_tl_user_led_pins[] = {
" L6 n* L" e' k3 i9 j# u        /* These pins are definition at <mach/mux.h> file */
  V9 ^, f6 m! d        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,3 l# v- O( [- g! G& _9 l
        -1
: K4 W; a% y3 l0 U" f};% n3 o2 _) r, X
8 ~! p8 |2 ^$ Y: e; e/ U5 A, E% U  O
static struct gpio_led da850_evm_tl_leds[] = {0 Z% E$ i* p" j; b5 Y" E
        {( N" q( x  [6 _) T2 l1 o) l! ]& r
                .active_low = 0,
* H+ F/ j: A4 r0 t6 F& L/ ^' m                .gpio = DA850_USER_LED0,: A! D# u  i. E8 M$ L9 U
                .name = "user_led0",
/ P; |4 U# F3 c4 j1 Z" t0 j                .default_trigger = "default-on",: u+ p6 {2 B( h: _' V
        },
8 J0 @4 i# W5 L- x        {' y7 v3 a1 r2 q4 N7 _6 `+ _
                .active_low = 0,
/ f9 q( b  q: R2 b) S                .gpio = DA850_USER_LED1,6 k4 j9 e: g2 z& g8 o
                .name = "user_led1",
: M$ S% G: k" g. G/ O7 k                .default_trigger = "default-on",
: M: W7 s4 v  j, O3 L1 j; r! [        },2 X1 e' Q3 h5 y% U* L" l$ A) e3 m
        {( c- Z( d# F0 ~9 o9 @# g6 p
                .active_low = 0,
/ F0 R8 t+ G* n6 [+ [: z8 w                .gpio = DA850_USER_LED2,
: |; l3 k( m1 [2 ]% h, W1 e) r" c2 y                .name = "user_led2",, o$ l1 e4 a* `0 }- i. g
                .default_trigger = "default-on",. N1 x- d8 c  ?8 I9 r
        },
/ J2 W1 Z4 B6 ^9 F$ |( I+ ~9 W) L        {' O1 b& f$ M8 s4 Y
                .active_low = 0,
8 A9 L3 O* @8 r. ~" ^- k                .gpio = DA850_USER_LED3,
+ r0 R' t  a! R9 X                .name = "user_led3",
! k: D' y) u. t% B/ M9 {                .default_trigger = "default-on",
  j0 |! k" y) ]* D# O2 @* n( I+ Y        },( P4 t$ t/ k8 W* @* M) v) S3 |' u
};
5 r/ B+ f1 c& v% {: _" y; n( g& F1 o% h  @  E. }9 M1 s8 y! |
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
' W! N1 ^4 N+ D        .leds = da850_evm_tl_leds,
- o6 i# l, D6 n        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
6 |& v' Y  F4 e, C4 [};
* D$ c. e$ Y) O; G6 v; d" h  ]1 v# x0 f/ r2 N
static void led_dev_release(struct device *dev)( k0 t# ~' R) q) m. r5 q1 l$ c! s
{. t1 ]8 [% W) _0 t1 @
};( ?: X7 u9 E$ ~3 K6 S

5 M; J! t+ k8 A5 lstatic struct platform_device da850_evm_tl_leds_device = {+ t5 `8 s+ G( E1 f" u
        .name                = "leds-gpio",( M8 b6 x0 j2 N
        .id                = 1,7 ]$ B+ m  x% e: g
        .dev = {; q+ [- D& _* s
                .platform_data = &da850_evm_tl_leds_pdata,& ~/ M; R- C) J: E
                .release = led_dev_release,/ J4 Z% _! n8 B/ T) P
        }
& l4 h! H7 A& n; R, l7 P( @$ s};
' t0 {" T1 [3 ~' M, m  c5 h
) G+ e- ^8 Q. R5 e. xstatic int __init led_platform_init(void)- v2 J! w0 N% R- j1 R
{5 ?/ `( z0 d6 b0 |8 `* V6 Y6 w9 ]
        int ret;
1 }! y) u7 I2 |0 P#if 0
5 r/ [! ]3 x7 s# d5 F/ Y        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
9 ^, w0 s0 \( t- T+ r2 F        if (ret)
* k; t. i( m7 ~: q+ L! {' v                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"- m4 W$ ]6 T. M/ z
                                "%d\n", ret);0 p/ ]  d+ q" a/ J3 ^
#endif
4 D' {2 Y1 g! f! w7 b        ret = platform_device_register(&da850_evm_tl_leds_device);
3 ]5 T) s& S. Q4 i* {- a, o        if (ret)
7 S+ G/ K( |* ]) N& Q$ _                pr_warning("Could not register som GPIO expander LEDS");
. F% J+ M+ G5 V: l6 Z        else
% u) ]* Y4 T3 N  W; t                printk(KERN_INFO "LED register sucessful!\n");
# w& N3 \- k9 q5 @8 A1 r5 l, b0 {  N; ~: b
        return ret;
! _! Z3 _: o4 ?7 [  U}
: R- V4 D. p3 H/ F
6 R2 C, Y7 O# G- Wstatic void __exit led_platform_exit(void)
  E) f, T# ~  p9 e# j{
( w5 @# j, U, H( R8 m        platform_device_unregister(&da850_evm_tl_leds_device);( @$ n9 {. o/ \8 k( \5 `1 T& t
. m0 G9 t+ j' x+ G6 C
        printk(KERN_INFO "LED unregister!\n");6 D) M: @/ \5 r/ m, I2 ^
}, }8 \& M( ~: Z

4 ]$ ^! ~! Y8 v# a1 ?module_init(led_platform_init);! y# m) i4 Z# {1 d" P' J; T+ `/ i, I4 e# h
module_exit(led_platform_exit);
1 V( K6 r" y. b$ P
' }4 y9 O* M# @' r% gMODULE_DESCRIPTION("Led platform driver");7 K, {& x) z+ ?% \
MODULE_AUTHOR("Tronlong");1 j% _% \- y- V# D% t
MODULE_LICENSE("GPL");- c- Y3 |) F& @8 Q
! q: {) Q0 d. O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-3 00:15 , Processed in 0.045529 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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