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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
! |' j8 M% b# Y# P8 A- Z7 e  ^#include <linux/init.h>- p  a! u7 }- F) q$ \) R6 k
#include <linux/module.h>
# w0 |5 Y2 J7 ~5 G% ^' ~* R#include <linux/kernel.h>6 c' O4 W6 o5 C, r" U& N; n
#include <linux/types.h>
1 Z, B5 S, ?( r; k#include <linux/gpio.h>0 Y; s. T- a& b3 a% t4 D" {
#include <linux/leds.h># j( t9 O9 I0 Z# C3 y/ k; f
#include <linux/platform_device.h>
8 w% q. c" ?$ b0 z+ o- n. e
1 \3 q. E# T1 J" N) z. Z& F+ D: c#include <asm/mach-types.h>( m1 A% h0 P- y2 G" k/ [  z
#include <asm/mach/arch.h>
3 H/ D& c0 n) E' x' f1 Y#include <mach/da8xx.h>, V4 `# x) B5 P1 w' w
#include <mach/mux.h>
. n' w7 `# ^9 W' C* X+ {4 k. ^4 ^; [% e
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)& D3 U7 U6 K. j- v7 @1 S  d
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
1 p; b$ E# \: s6 T& T$ w. ~$ g* t#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
. p. }' h0 U( ^; o( X+ X% A1 Y#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)  |( m" C9 o- D- t5 N8 ~$ v9 ^
4 k3 U" K0 h- j& \1 l
/* assign the tl som board LED-GPIOs*/; V+ K# }9 M4 c$ Y' x8 v
static const short da850_evm_tl_user_led_pins[] = {3 c3 _6 t7 H* Q; r9 z3 G8 ]! Y3 Q
        /* These pins are definition at <mach/mux.h> file */. `3 Y& d2 O. O) D- p: O/ r- n/ U
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,. S% F" k. p5 ]* Y% ^: d8 D/ G
        -1
5 J5 Y) f7 p$ k0 U};/ n4 n3 e7 K3 \: F: R

) F4 P  D3 D1 `7 j9 _. h# y- Jstatic struct gpio_led da850_evm_tl_leds[] = {
' X: O' k4 K/ q$ u        {
7 V6 `. m4 `3 p- Z                .active_low = 0,
& ~! h5 w! b+ m# g/ q                .gpio = DA850_USER_LED0," v5 C4 _% u  C6 j, `- Y, m' m& I
                .name = "user_led0",
- A" e: }5 j& f' X# g$ M                .default_trigger = "default-on",6 b1 D/ |6 A4 L& e) v
        },2 q$ O% O9 r1 e8 i& V
        {
' \9 F+ s  a/ r                .active_low = 0,, G- G  V0 j/ r' d9 m" g0 a2 I
                .gpio = DA850_USER_LED1,
* i. J3 V+ ]; V                .name = "user_led1",
6 n% b3 y4 O, b) F- J4 C* k                .default_trigger = "default-on",( \, Q# T( o  d$ l& c$ p
        },6 G9 b5 [6 Y) P
        {( |# A( D4 y1 I: V9 l5 J* `
                .active_low = 0,& a' _4 C$ o" }& e0 g2 G
                .gpio = DA850_USER_LED2,
/ n; T; m# x* t- j: U                .name = "user_led2",
% i) a- U' f4 X& [                .default_trigger = "default-on",
! [! C& U9 {# m# @2 b4 [, r& b/ F; Z        },. n- h: Y, U3 @% E! M# y& d7 D
        {
$ N& R" y- o: K$ r1 W                .active_low = 0,/ y# @- Y+ }: F; Y0 ^: Q$ l
                .gpio = DA850_USER_LED3,
. V3 E- M  y5 ?( U2 P                .name = "user_led3",
9 @2 N# L1 X. {                .default_trigger = "default-on",
; v1 f* E" a9 f' `        },
" {8 P+ A7 I0 J) F( Z2 I# }};6 S5 P' R# P+ Z; {6 T7 c
7 {8 N3 ]6 q: ^
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
: J8 |1 A. ?  o# l        .leds = da850_evm_tl_leds,
8 `0 E' Z! K" P+ {/ B( n  f        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),& J7 r$ [" X8 R  Q+ h
};
7 \* {  n. f. a$ z% V
5 U  L* A( U: O1 pstatic void led_dev_release(struct device *dev)
5 C- X. p! N& r8 ]# C: @- P, W{% j0 q; D: T4 L& n4 J( [
};: e6 M) {# z/ d( ]) U* \" G. [% E

5 N- |1 f" B+ J. q! }; ?static struct platform_device da850_evm_tl_leds_device = {. O# a+ N) \0 f
        .name                = "leds-gpio",6 K+ r2 y( Z9 d# z
        .id                = 1,/ c7 G2 y3 O, t( e
        .dev = {
  N( o/ H; o$ F: j- R3 e- p                .platform_data = &da850_evm_tl_leds_pdata,
2 q' W4 Z  ^2 G, ?; X                .release = led_dev_release,5 U; l3 O# O# Y$ L6 l9 b
        }
/ Y2 t# D% D/ Y: e, o};8 L  `: P- y0 v

0 s$ y# _, h" y8 I8 q, Y# qstatic int __init led_platform_init(void)
) r7 o3 w5 o3 P6 I, S. n: D{3 {, W1 @' y4 U5 j6 U
        int ret;' t" |) q3 _% e& n$ n% |8 a
#if 0
" |" C$ T( w2 Q; d        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
8 B3 v% E: V/ i& E4 D        if (ret)
$ u  l/ S% Y4 z                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"8 x( E) `6 l+ ~$ u: k
                                "%d\n", ret);
& x3 N3 U6 x- [& b#endif' y5 H; O8 J+ @9 [0 }
        ret = platform_device_register(&da850_evm_tl_leds_device);
9 C0 I' b; S: T, ?% C* x        if (ret)
8 C2 J" F# J7 ?9 z6 w8 Q7 @) w                pr_warning("Could not register som GPIO expander LEDS");0 D7 Q! e( M) a' J$ n5 l: K& M
        else" P1 X/ h$ g( j$ P
                printk(KERN_INFO "LED register sucessful!\n");  V$ |, w5 w4 [' U% a
; M% i! u! n7 x* ~0 K" O
        return ret;
  G; ~/ s* W8 ]}/ a6 _( M; K: x( ^: m- F' I
% S' {5 k6 i6 C9 u: o2 ?1 L
static void __exit led_platform_exit(void)
4 v( |. o' Y6 D{
4 t% z) X4 h7 l' V        platform_device_unregister(&da850_evm_tl_leds_device);1 R8 v5 _) J1 X. @

2 q; }' q  I5 w6 m' F7 c! a        printk(KERN_INFO "LED unregister!\n");
1 U, t( {( i% b8 o' k}2 ]8 B* c+ n. c9 }7 o: }9 A- [

$ B" D! Y* K; ?" k& @module_init(led_platform_init);+ |, b3 g9 }/ Y5 a/ e
module_exit(led_platform_exit);
, t  Z8 g* ^9 r" h: i& G) b3 P4 @- [/ C' T
MODULE_DESCRIPTION("Led platform driver");! n: U2 b: n8 X( L3 O1 @
MODULE_AUTHOR("Tronlong");; e& J- k- ~4 g+ ]9 j' O' T. |/ j
MODULE_LICENSE("GPL");
9 W* M% M; {( }' g
9 [  {9 {" z# z6 Z- }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-27 03:00 , Processed in 0.042850 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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