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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
; a& n% c8 r4 G1 [/ N& `$ Y#include <linux/init.h>
8 U/ P* h0 o0 H- t- ?/ ?1 Y* h' J7 C#include <linux/module.h>
6 j+ w  C1 O; H9 Q& d, u1 t7 F#include <linux/kernel.h>. z$ @8 Y4 |& L( J
#include <linux/types.h>
' _' G% u! k: W8 A" c#include <linux/gpio.h>5 I+ c. b5 K' ?$ ]% j/ V
#include <linux/leds.h>
6 J5 W9 L1 H* ^4 i8 X#include <linux/platform_device.h>
  C6 Y2 v& N+ ]0 S& x  N! U0 R! x
! f! |+ C* a$ ^0 ?7 ^6 |) Z0 K#include <asm/mach-types.h>
0 N8 u+ m/ l! k% I; G' n4 K1 @#include <asm/mach/arch.h>6 T9 n4 o1 e& f
#include <mach/da8xx.h>- m' Z+ j8 E% ~7 s
#include <mach/mux.h>3 V- g: s' w3 ]  x: N- \/ N6 i3 a4 {
  z% I# h  n& \2 G  h0 Y1 A
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
, h3 ]# A7 d( p#define DA850_USER_LED1        GPIO_TO_PIN(0, 5), j; d8 H% R" w" X# T7 q2 h
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
3 E5 h& ]# s: r6 C+ J6 q( ~#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
% d: {6 W! V- y# i* Z  r) r$ g* H9 r7 z4 R9 X
/* assign the tl som board LED-GPIOs*/
- x3 r% ~% A/ ]" z4 {static const short da850_evm_tl_user_led_pins[] = {6 J" X& I% @$ q$ ~) I1 B) I
        /* These pins are definition at <mach/mux.h> file */
4 X" f$ s) ]6 F6 ]+ q        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,3 J/ E% R, Y) |  o# B2 f0 ~, i0 B6 n
        -1
5 Z; t+ Q+ [" o" V( ]! L4 _) t" ?};9 b( C# m. _4 V3 X. y0 a' z
5 D* K. m! b9 l
static struct gpio_led da850_evm_tl_leds[] = {
. N$ d" }9 I% _        {- b* m3 z! T( a1 d/ P
                .active_low = 0,7 {$ U2 f: ]5 _2 a. q* P$ Y$ H
                .gpio = DA850_USER_LED0,
4 }# h) o7 L! p0 w! `( `! j                .name = "user_led0"," z5 u' r# @  R  v7 g0 V# Z4 ]6 g& M, e
                .default_trigger = "default-on",3 }! A9 N' j" _5 m( l8 _
        },/ e' m7 n" u' J$ [
        {
/ |# s8 \+ D9 r9 t                .active_low = 0,1 F; |$ Z$ Q2 t
                .gpio = DA850_USER_LED1,
5 j" m* ]* x0 ]' a                .name = "user_led1",6 \; Z% T/ E9 {5 F! U
                .default_trigger = "default-on",
" S. M5 U! x; O& p        },/ F1 u. y7 A2 T
        {
+ v8 v3 @' t5 q4 Q                .active_low = 0,
( s$ \8 B+ i! R% ^% T                .gpio = DA850_USER_LED2,) q7 g+ a8 ^/ x8 a- @
                .name = "user_led2",: L6 p$ U( J7 E. q% e
                .default_trigger = "default-on",
! _* v& A  W8 F4 w& x$ k        },
( F% ~$ a% _: m7 g2 Y8 v' @        {0 l3 M' u4 X+ S
                .active_low = 0,
( k8 o: I! L- X1 m                .gpio = DA850_USER_LED3,
7 _9 Q) j. {/ f  {                .name = "user_led3",' N9 P! |/ B9 O- w0 D5 q
                .default_trigger = "default-on",/ P7 r* D9 A' X0 N2 m
        },
- R4 A( d# |9 u9 H};9 m3 [' m1 P6 L6 K1 f4 X: h8 i

: r3 y2 s, r, Z" Q. F; [static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
6 t% _. v: _( }        .leds = da850_evm_tl_leds,
, v; M. O/ V" ~# n        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),4 F, l& j; ~, }* u. f6 ]
};; x$ t, t+ D% e" \$ ?; S# o

3 D, h) a8 Y3 V7 }6 R! W. ?static void led_dev_release(struct device *dev)* U  F8 Q3 q' \. I4 H; ?
{
6 C( V  T' l; y, s5 J};
2 ~1 C% y3 }5 [) K
- Y; e/ Y$ i$ F" d/ A+ N8 Astatic struct platform_device da850_evm_tl_leds_device = {
1 v( @6 h( [0 Y; m6 \: n        .name                = "leds-gpio",
* Q0 g8 \# l7 L        .id                = 1,' `/ W0 p! |6 E( p& Z) y4 f
        .dev = {
5 A/ G) ?: @9 c7 b9 b7 s' @                .platform_data = &da850_evm_tl_leds_pdata,
9 S3 v, V1 x6 d% _                .release = led_dev_release,+ J( e$ M* x* a  |8 Y* s
        }
1 p$ }3 R1 L- ~- _2 s4 ]# t  c' I};
/ J5 g6 q- n6 s6 z) T
+ ~4 L2 ~' n) D& M+ \8 |static int __init led_platform_init(void)- d2 A/ c, y: r
{; B2 u$ s# o* z9 A
        int ret;; i4 |: u1 h& c# t
#if 0
/ m. K0 a# j" y' m( D( k        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
5 \6 w& d! b( e9 V, Z2 R0 @        if (ret)
) i9 }$ h/ F8 V  m. M3 C! F- u/ T: q' J                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"0 Y+ n1 K( ~6 R1 a
                                "%d\n", ret);
$ }' R: L2 [/ _; I# b#endif
# s$ [3 r- c) T: }: T0 [        ret = platform_device_register(&da850_evm_tl_leds_device);( j% I! b2 f1 y6 B1 v
        if (ret)( S2 |3 ?- H8 i+ C2 t
                pr_warning("Could not register som GPIO expander LEDS");  _2 i* N) i0 p
        else
2 A" b6 }2 m- \- O  K* X                printk(KERN_INFO "LED register sucessful!\n");
+ R% w4 y7 c. _; X$ e8 b3 |  I5 A. y7 h8 E$ d( H
        return ret;2 s9 \; q: D& Q  {
}/ e3 h0 s$ R5 P- k

# J$ x" x; L4 V6 q, ?" f  J, L0 bstatic void __exit led_platform_exit(void)) F& S' d; D) l2 }; D
{3 r) g& d! c, N
        platform_device_unregister(&da850_evm_tl_leds_device);
3 c: ]$ ?9 o' q9 c& }9 F
* @% ^. H+ c; O* p        printk(KERN_INFO "LED unregister!\n");( R0 m! V. D6 s
}% a0 P+ [3 G% E7 p: D9 n
2 `; |( ?# @" S# Q# f1 X: M
module_init(led_platform_init);
# _0 T* Y3 F9 _3 o' o# dmodule_exit(led_platform_exit);
" a4 R  b" {! K5 Z$ e# d: z& e9 \
; g2 T8 \+ @% ]' aMODULE_DESCRIPTION("Led platform driver");
- v8 {. u' E6 |MODULE_AUTHOR("Tronlong");) a( k! s4 D3 ]2 Q9 G" u( X
MODULE_LICENSE("GPL");/ p# P' H: K/ \* F# g" `

6 J6 @) N- t# [0 K$ }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 13:22 , Processed in 0.040158 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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