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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。" {7 o( \; H* q9 x9 O
#include <linux/init.h>
7 P# k" o% c) R1 [#include <linux/module.h>( a; t& q: p. Z( Y( T' E
#include <linux/kernel.h>( O  E: d7 Q% {2 s3 h
#include <linux/types.h>; Z, E! Q# ?- E  D. G5 N
#include <linux/gpio.h>, P" R# h+ C1 Z
#include <linux/leds.h>7 k3 Q3 ]9 I2 H, J/ c; m% }
#include <linux/platform_device.h>
1 }+ p( j; C2 Y+ S3 j7 d" }* V$ Q# }: `7 }
#include <asm/mach-types.h># ^  j0 G# @( m6 v; N% o) p% m
#include <asm/mach/arch.h>( _- o6 [8 g- {- P
#include <mach/da8xx.h>; c4 A1 N4 [  u0 d& v8 g$ Y* @  ?5 H7 h
#include <mach/mux.h>" a+ k9 @9 Y9 e$ @1 W

" y! R( q0 x6 [, f; n0 b; ?#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
- ^" ^4 d! A3 G- C* l6 ^: V#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
# A% i9 T) |) \9 u#define DA850_USER_LED2        GPIO_TO_PIN(0, 1), {- U3 [, v. z9 e' U9 ?. `5 j: j3 T
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)( J2 A' ]+ ]/ x0 s) F: O6 z/ f( ?5 S
" x4 ?$ s/ t* D& C1 o3 n) L: }
/* assign the tl som board LED-GPIOs*/
4 Y/ F1 J, Z8 f# n/ ^static const short da850_evm_tl_user_led_pins[] = {( ]& Y+ g5 d" e- B
        /* These pins are definition at <mach/mux.h> file */
0 e. L2 _4 @  |) X4 L, P9 W        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
; @( |% A8 R, u        -1
6 w: z9 p; Q) m% }8 X: O/ M5 T" _* h};& f- u/ l$ n, E* o: K% l
5 t, ?1 }' E& I* \7 b- x
static struct gpio_led da850_evm_tl_leds[] = {
6 x/ y# Z/ @- d  w3 h        {7 X: Z& y2 r7 V. i0 ?
                .active_low = 0,; i' t& v6 c1 v: D3 h5 s. {; ^
                .gpio = DA850_USER_LED0,7 g% C7 d9 v, M7 W$ p5 j2 a
                .name = "user_led0",& g; l; r2 u. D4 {
                .default_trigger = "default-on",
7 [4 |. }2 _: G        },
# v. `' k2 z( W- j2 j+ e0 q        {
4 d/ E! [: b2 p. {. S. S" w                .active_low = 0,+ o" b" y: A6 n, _  m" O
                .gpio = DA850_USER_LED1," C6 [  x  t  V
                .name = "user_led1",) m+ Q. q0 u- o' x% Z' l
                .default_trigger = "default-on",
: X+ @, S8 s3 H4 M/ w        },
/ l5 @# X: c! f/ h, E        {
0 Q0 y1 G# z  }, J$ W- T$ L. p                .active_low = 0,
/ q& A! _, j. ^                .gpio = DA850_USER_LED2,
* H. J9 r0 q* ]( h0 |- j5 ?& P- M                .name = "user_led2",$ U  g. s; U; L% c$ W% Y" ~
                .default_trigger = "default-on",
% B- R( @# h' I, E9 z        },) [- C0 p8 W$ x4 J  m
        {# B/ m! N2 o1 r1 Y$ ^% J0 M. M
                .active_low = 0,* `6 i( [; @; R3 X6 a7 H
                .gpio = DA850_USER_LED3,* L# B: F; _7 W  F
                .name = "user_led3",
7 A4 H0 p" ?0 d  U* B, i                .default_trigger = "default-on",
8 ?3 K0 ^9 b4 T* S        },7 [$ }5 ~6 c5 o. U
};
& e9 _6 z7 d' G6 Z1 B- O5 R: E3 M7 W4 N  `6 h
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
+ N5 n: ?$ `* J        .leds = da850_evm_tl_leds,
+ u/ g: `& J) d6 S7 g: E, A        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),! C: `' m, \: i+ l, U9 ~- e
};
/ ?$ w7 V3 d  A+ [0 b) ^4 T3 _% L, g
static void led_dev_release(struct device *dev)
- D* J) f' _: X8 W4 c/ c( h{! M) A) Y) }6 t) }) @3 I& @3 C$ j
};7 Y1 s# v% v4 T, X- U7 k

" e: o6 l3 z  _1 T6 l: Istatic struct platform_device da850_evm_tl_leds_device = {$ i/ R- E- b# }! @- |
        .name                = "leds-gpio",$ L; [2 z" G; j% l( j2 d0 E4 Q
        .id                = 1,
0 E; `8 o1 R, O9 e9 S7 ?, |        .dev = {1 F' f: D# T( o  G
                .platform_data = &da850_evm_tl_leds_pdata,
; }. T+ t; T" j" i  X* k! D$ @6 b                .release = led_dev_release,# \# q" p( w, D3 b! h2 J9 u; d: z
        }. B3 L+ \: `* b+ @2 c2 M
};: k5 k  H( O! {! T0 \. H" w
' |: M. P' V$ w/ m
static int __init led_platform_init(void). i* w7 D) d& S5 A
{6 I1 D" v/ H5 P# M6 {  k
        int ret;) y2 `6 S3 @0 ~2 l: K8 f1 Z' C
#if 0* G- M/ G2 L! @3 {3 c( J7 k1 u, z
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
' g. t1 V9 H7 Z; j        if (ret)
% [, c7 c4 X3 M6 E1 n9 T3 Q                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
& X1 N; i8 @+ j! P" J                                "%d\n", ret);
. m2 i, m) ?# v  V9 K#endif2 N/ F+ y5 s; O% ~: H
        ret = platform_device_register(&da850_evm_tl_leds_device);
- B! _+ b: a7 Z        if (ret)
  K' n$ Z3 A) q6 @8 a                pr_warning("Could not register som GPIO expander LEDS");, O! Q5 I5 `; R8 [4 r3 u( d+ e- n
        else
1 E$ C) d3 n0 F" v                printk(KERN_INFO "LED register sucessful!\n");9 q2 {3 N5 z1 _8 I+ V' K
4 |! E; |+ P* @/ C& l, K) ^
        return ret;
' X2 t- a" ]2 F) k3 V+ B8 ]3 y}( X% C; t1 g8 ?- Y; J' W0 X
; k! h: P0 e% }' P) E
static void __exit led_platform_exit(void)# c/ Q% N' d; v& n2 M' g
{
, ^" {6 y1 A8 Q+ V4 x) _6 O        platform_device_unregister(&da850_evm_tl_leds_device);
* y/ x3 R6 l0 d. z; L. i  u7 r
/ T: R$ t1 Z- x1 J9 }8 c- t; f0 d        printk(KERN_INFO "LED unregister!\n");& c/ B% G% L$ R( ~: K/ @
}
) b1 g) d4 I1 {4 ^& i  F* M0 U! l9 c- n. K0 @2 B( J* V! a
module_init(led_platform_init);3 c& ^8 T$ S* C; n4 j3 z
module_exit(led_platform_exit);% H. `2 m8 V* x: q) k

: c2 p% [) A9 e0 V* C" l+ D2 XMODULE_DESCRIPTION("Led platform driver");( G; z" s. ^6 t. N8 d, j
MODULE_AUTHOR("Tronlong");/ v& `( g. T6 A; }. X
MODULE_LICENSE("GPL");
" k6 b, y, w8 z; S2 Y* C$ [0 R; K( @" N6 b. z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 22:34 , Processed in 0.039809 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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