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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
( q# S% S" L2 M" J! Q1 H" Y#include <linux/init.h># K1 I5 ]; U9 h4 [& l% R+ x
#include <linux/module.h>1 D2 F; s, S4 t* i
#include <linux/kernel.h>
' p& b  d8 o* P! N/ g4 z#include <linux/types.h># T7 P' [& ]- a& P, ^
#include <linux/gpio.h>& \& t6 L" C3 F
#include <linux/leds.h>6 o7 t3 Y  D* }" F. S' d
#include <linux/platform_device.h>
/ V1 x* g  D" U$ t7 ]$ [, C" l4 L" g/ B- U
#include <asm/mach-types.h>
; @5 \6 c& Q8 N) V#include <asm/mach/arch.h>1 Z, L9 q, e# `4 M
#include <mach/da8xx.h>- a4 t- l$ t( g% n1 y2 |
#include <mach/mux.h>9 w+ `8 J' k( B; B# f* [
" f8 q4 `2 x% p3 j8 d2 ?
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)& J7 ~5 D/ g0 S" c& F/ h0 y% W
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
) Q% f6 q# n+ \' C#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)  m0 z2 |0 P) m3 J4 f4 |! f- W
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)4 \1 g. U% r7 q* o7 _

7 n4 ~* E2 s4 b* j/* assign the tl som board LED-GPIOs*/" t6 J/ K; F# p. p, y$ ^7 z' _8 A
static const short da850_evm_tl_user_led_pins[] = {
* V" \7 S* ^4 U% A        /* These pins are definition at <mach/mux.h> file */2 e$ @$ G/ B/ t0 ~
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
0 n4 `6 I& C3 T        -1
7 ]: O/ \/ }5 I) x};. v4 j4 f& H. v0 Y4 b: ^/ z

! y1 D1 [! L6 l6 Ustatic struct gpio_led da850_evm_tl_leds[] = {
8 S6 G3 Y, h! M4 D& e" f  y        {) c% g+ F5 K0 a" O  M/ k4 a% |
                .active_low = 0,( x3 Y9 E' ~4 \0 s4 k+ ]
                .gpio = DA850_USER_LED0,
( g# C+ K+ b- U+ ^0 x& l                .name = "user_led0",
: s4 d' w$ J, O# }                .default_trigger = "default-on",
/ r: M, l( C" j  _# X8 L        },) t7 ^& j/ V+ v4 |5 v
        {* a+ m, H) y) L9 h" k; c
                .active_low = 0,) L* P6 X7 Q7 z- V. P: A1 A
                .gpio = DA850_USER_LED1,
( W7 e* E! i% t. @3 ~                .name = "user_led1",1 U! M1 Q' Q5 L$ b
                .default_trigger = "default-on",
, F, [) o6 T  J1 v0 F! F        },
4 L7 c* J! g( p9 N, N        {9 u. \2 g% t+ g  c! L0 o$ Z
                .active_low = 0,# B" X; |0 v8 O! N
                .gpio = DA850_USER_LED2,) f9 d1 }8 T4 E
                .name = "user_led2",* x7 G$ o! d; G, N" d
                .default_trigger = "default-on",( n! h, c. R1 t, w. q
        },
+ D! S! M. m- O* G2 n7 W        {& d; X+ a  y4 N! j1 Y! m
                .active_low = 0,. N1 K; g  t0 K# {) \+ ^
                .gpio = DA850_USER_LED3,2 g2 Z1 |4 |! y* a% s8 J  U4 J, u
                .name = "user_led3",
2 a8 W) Z" d' b& U                .default_trigger = "default-on",
( X7 ^$ R1 v8 q/ N# _; ]9 E        },; p3 s7 V! k+ Q
};
  U. g5 i* c# w' |
" P% z1 y' y4 R6 estatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
9 A- I- D) K9 L2 E        .leds = da850_evm_tl_leds,
; Y7 ]9 |- N9 ^( d: x) d        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
! q" v2 |8 n0 x4 y1 m+ t};
' ?% O  W5 u3 W2 B" N$ D2 y0 u7 j3 ^+ i! r$ r
static void led_dev_release(struct device *dev); t5 m# `/ {' [% U4 q) @' C
{
3 K5 E$ |1 @" z/ ^/ Q' C2 _};* m, D% K1 {8 F. d) M8 @$ M

2 t9 Z) N$ i$ X2 w3 F& {static struct platform_device da850_evm_tl_leds_device = {/ {) j, Q* `. r. K
        .name                = "leds-gpio",9 m" N* s& ~+ _* m
        .id                = 1,
2 S+ ~! D1 y4 s9 K) Y0 y        .dev = {
" D( I+ P. ~8 s1 d( b                .platform_data = &da850_evm_tl_leds_pdata,
0 k, R& i, F* L8 N- U1 A0 `/ {                .release = led_dev_release,3 Z3 `' m# c/ H5 B: S9 o% @
        }
" h* A* b" [( w};. `* v' V1 c( P
; Y1 W1 {/ {1 ~* P( Z
static int __init led_platform_init(void)
$ \, C, U, r* q$ S1 ?2 S0 T0 d{
) G# J! Q# {, t" K: U        int ret;
' C' W9 Z" a( |$ V2 f; B: R# ~& j#if 0
5 |* s- X+ C! ]. l) H        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);& D# G0 R' P; x* h3 ?1 f
        if (ret)' K  r) E0 D* s! f! h' t# y% o/ c
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
# j1 Y# v% M5 h- h& k                                "%d\n", ret);
2 b6 \4 v; y6 Z  c' f#endif" b! Q" o+ D' M0 N! {
        ret = platform_device_register(&da850_evm_tl_leds_device);& O' M2 f) y6 I' I
        if (ret)- {  u/ V7 [- ]6 f( P8 s
                pr_warning("Could not register som GPIO expander LEDS");
, w$ Y9 }$ L$ l* b% m        else9 l2 p4 e. b/ H: p
                printk(KERN_INFO "LED register sucessful!\n");* u( e8 E- E$ G- V. H# r% |7 O
1 _  P, Q0 B* A
        return ret;
4 L2 W. {' {$ h- A/ k}* h0 B4 F* R! M2 M# Z, Z. \" R3 e# l
2 D% M  h, I* \* v; o
static void __exit led_platform_exit(void)
: z9 V$ i( w4 i* R" Y+ e{8 }) w3 J# z8 b0 X
        platform_device_unregister(&da850_evm_tl_leds_device);1 U0 p4 T  w3 x  k4 _' I4 `5 I

' m1 R0 r6 a/ C& m5 q2 ^: _& m# C        printk(KERN_INFO "LED unregister!\n");  Z( h* I5 Y' j, |
}9 L. i" J# f2 l& m9 e& c

. s# b4 P# g! m# pmodule_init(led_platform_init);
1 g. z: O5 _3 ^0 V' ^, q4 mmodule_exit(led_platform_exit);9 R, m( \; k) ?* l1 F# _7 ^1 o9 ]

* t& K% ]# P: d% v8 E7 P/ ]; Q2 p3 D$ {. \MODULE_DESCRIPTION("Led platform driver");+ z1 `4 H0 K2 ~# t! X% w) o
MODULE_AUTHOR("Tronlong");
6 @4 }2 r$ U) ]9 p6 ^/ i' a/ R( sMODULE_LICENSE("GPL");
8 H8 F) m/ Z( J5 [
  Z; P0 |5 n/ @4 L+ ~3 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 00:15 , Processed in 0.040379 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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