程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
1 R, t4 t) Z" d9 w( U- ?#include <linux/init.h>
: T& ~4 a- C7 q: P9 ^# B#include <linux/module.h>
* q& Y+ X4 S7 Z  `#include <linux/kernel.h>
0 h8 O( [/ z$ N#include <linux/types.h>; F7 l/ f# d$ I
#include <linux/gpio.h>9 L5 l6 i' L) Q/ j' d3 |) s# g
#include <linux/leds.h># R4 d3 ~- _' H: l3 p# z
#include <linux/platform_device.h>" f% r5 E. Y& H' W
8 T% }, \8 g: Z' {% N4 j
#include <asm/mach-types.h>. H1 ?+ K  F9 B* X! N# `! F1 `  `
#include <asm/mach/arch.h>
" |: _# E' K$ s8 q! w. {#include <mach/da8xx.h>& w0 h+ c7 Q- a. U  Y
#include <mach/mux.h>
6 T8 {) m/ J" n. a' D6 c; X/ J6 W6 e5 z5 i
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
9 n+ M' b+ g* z( u' D* \#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
. S* t5 l% y9 V5 y( S( _5 Q1 r/ o#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)5 f6 u9 d+ G% R) `: P' _
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
( w- v7 K2 {" g! _! Y) W. i; M7 C* g7 H3 H- o
/* assign the tl som board LED-GPIOs*/: |: G" e: Q! M
static const short da850_evm_tl_user_led_pins[] = {7 z& l' k, A  @
        /* These pins are definition at <mach/mux.h> file */" P1 |# c& y5 ^0 P0 g
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
' b) \( }3 l/ A5 c/ \4 h        -1
: A5 W3 E1 O. N% }$ Q};8 A) h; M5 S/ {

  w# E( z1 Z& u5 ~8 m$ tstatic struct gpio_led da850_evm_tl_leds[] = {
4 Z) x5 D& ^2 d+ J5 Q( b        {
1 T2 v( ?5 X& g: K, K- h- f! S                .active_low = 0,
  {$ _3 l9 U( K: x+ @0 @3 {                .gpio = DA850_USER_LED0,
: x6 u! n" U  Y8 k% o; u                .name = "user_led0",
5 e# x) T" r4 [" y5 B, z                .default_trigger = "default-on",
9 m3 E$ E8 V+ A0 @        },
' _  h4 @2 ^  c$ S& f) @7 y        {
% w/ C. j* B' x$ N2 P                .active_low = 0,
/ O- S9 ~! Q5 ]& a6 v/ v                .gpio = DA850_USER_LED1,
+ T; j" E5 p: a- p( w% m4 n% H% W                .name = "user_led1",' j; V! ?/ [( d* M; H( r" t
                .default_trigger = "default-on",
$ X. m" T- z9 d& @        },1 f2 s. q5 D2 a" `5 Z9 t2 t5 W
        {$ \& b- f. t/ u* `; J
                .active_low = 0,* x  F' Z% ~* y& a. x
                .gpio = DA850_USER_LED2," |- C2 ?0 Z# u) K: W+ c7 X! c
                .name = "user_led2",% ^- d8 a7 v; l5 g) E: h  }9 m1 Z% A
                .default_trigger = "default-on",, a* A! ~4 Z6 f( ~7 ]* R1 U/ S
        },  Y, z9 P! @7 b* r$ v0 D: R7 M, Z
        {) m  ]- t) ~1 `- y8 t. x
                .active_low = 0,3 ]$ a, W6 R7 r$ ]4 e1 q
                .gpio = DA850_USER_LED3,
! I0 e, q+ W# [* v! L7 \                .name = "user_led3",3 A6 x* h0 j0 d1 Y
                .default_trigger = "default-on",
+ w& v' R3 l2 a6 k9 ^( J        },/ ?7 G# D$ U. i9 `0 w
};
% {& E) ]- D  H  X9 f4 f7 Q8 z# w. G6 {+ c- S( w
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {' W! i; q, a4 C
        .leds = da850_evm_tl_leds,
8 t5 q' D/ A3 g$ |: W  H- ?        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),- x3 q9 ~8 ^3 |, {6 D8 {
};! }2 s6 m% L8 H9 J

( W. W) w5 n* E8 C5 @& x& e. Nstatic void led_dev_release(struct device *dev)9 L4 r& C) F- C6 [- d+ A9 `5 c
{# _3 C/ Q$ V8 L+ }
};
- C% V, E; x& P% }
: ~' u1 ]6 [4 C! S: q- w% mstatic struct platform_device da850_evm_tl_leds_device = {$ ?" u1 i( e7 w) F
        .name                = "leds-gpio",) J8 L+ ~$ V- e/ r2 {' B' S9 T
        .id                = 1,( y5 P3 B& a! U! ~4 P. Q+ Z+ V* n
        .dev = {. N# |) C; ]* o
                .platform_data = &da850_evm_tl_leds_pdata,, U5 a" P$ G% i
                .release = led_dev_release,0 q1 m3 i! `' d
        }; h8 U1 m7 E+ }8 M* b1 }: T
};
9 M8 W/ v- r! v4 J- _- j2 m  n! L% Q
static int __init led_platform_init(void), ]7 J& W7 A0 N' b0 j4 h
{
* B, }" t2 s. H4 c        int ret;
( c4 X* O: w! E6 y6 d#if 0+ Y) G8 W7 Y* Q: \, t% E
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
4 ?/ E. X6 R! o$ s# Z3 o& \8 v# `        if (ret)) P2 W4 @9 ?; `) C) j+ c1 T
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
% X* s0 m' Y0 s7 h+ s+ b9 D- z                                "%d\n", ret);
+ {5 o% |( v$ F9 G3 A' ^#endif
3 q7 r. \# V+ d        ret = platform_device_register(&da850_evm_tl_leds_device);3 {4 E6 d% w! ~
        if (ret)# ]5 u/ k4 s! l" z
                pr_warning("Could not register som GPIO expander LEDS");( o( a$ ^0 H4 C. ^7 j8 n$ x
        else
. `5 `8 H9 P2 n' p. r                printk(KERN_INFO "LED register sucessful!\n");
- \3 i: |& }. i+ ?: A. c. n; [
; G6 D% X- g: b" d        return ret;; I  m3 u, A! l8 F0 ~# C$ X
}
; }' G2 M6 P! Q' ]. s8 w. {- R( r) O* k6 X) a
static void __exit led_platform_exit(void); j. \# T8 ?! l7 Q, q. W
{
& U7 s% g& V1 `* o: ~! o" M% V        platform_device_unregister(&da850_evm_tl_leds_device);
# h, D3 c' c# D7 W/ W1 R9 U' Q5 _% a7 y7 S' c2 _7 [, F7 ^3 ^0 a
        printk(KERN_INFO "LED unregister!\n");' M. r- D, {) c* h' w
}
* W- }+ t* E% v$ e* Z6 M9 L! ~& t( j- g# i# l5 A" l- t( J
module_init(led_platform_init);) d+ V% {; \. |$ d( ?) @! g$ e7 c
module_exit(led_platform_exit);
1 M" j# ]2 X! t/ p
6 m- H1 o% [+ U& iMODULE_DESCRIPTION("Led platform driver");: [( y$ W4 B- H7 v0 \
MODULE_AUTHOR("Tronlong");' ~  _6 o! ~+ [$ @" G. p2 y- U
MODULE_LICENSE("GPL");
0 s1 h, }' i8 E/ R7 s" Y- \4 L; V0 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-2 14:03 , Processed in 0.036525 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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