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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
4 S' ^. R$ R8 U( ]#include <linux/init.h>. ~9 x0 |8 U4 s2 ?& \& p/ g
#include <linux/module.h>( n$ y; Y  O5 {% |  G* B% K
#include <linux/kernel.h>! W8 k7 p& w7 G
#include <linux/types.h>! ?: @7 R7 N7 z
#include <linux/gpio.h>5 _5 |) H7 a  F3 r( ~% B8 e
#include <linux/leds.h>
/ Q1 n0 @/ a6 e#include <linux/platform_device.h>. r( ~# ]4 @( J7 h, U

) P. T# o0 {7 D( {/ E. g#include <asm/mach-types.h>- T% n' \) y& a0 t; _
#include <asm/mach/arch.h>- p7 c3 r6 |. s. F) R8 h$ l0 {
#include <mach/da8xx.h>
# Q# s8 H9 @1 g, x#include <mach/mux.h>
+ ?2 c7 f, e# r$ \& c7 r
1 q* L5 m& s- g2 ~$ V5 Y# e( o7 ~#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
0 ^$ Y4 E1 @- Z* b) R6 L% t#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
- P% ?. Z8 m3 N7 Y#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
" p- m  K5 _, u  y( s5 @8 }9 c#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)& G3 w8 c# a) D

) U/ y% y2 Y  ^/* assign the tl som board LED-GPIOs*/5 j! g9 ~7 _6 s! z5 T. c, q
static const short da850_evm_tl_user_led_pins[] = {
, ?& [& ^& h" Y0 x& a" f" u        /* These pins are definition at <mach/mux.h> file */
3 n* B" n- E$ j% y0 ]/ K" t' Y* `        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
! n4 y# W9 E( t' D1 S6 {8 |  L        -1
. i+ o1 @6 n2 }" O! h/ N' U$ }};
. X1 H4 o% D! r
+ C; w& q- V2 {$ Gstatic struct gpio_led da850_evm_tl_leds[] = {
, Z) _0 t2 S; K% n, P$ Z$ ?7 [4 Z        {& u6 T4 P3 _* ~& [6 J  o- v# T) ?( {4 \2 z
                .active_low = 0,3 o4 `1 }* }7 M
                .gpio = DA850_USER_LED0,
. |+ f- `# i1 H1 C' u* j                .name = "user_led0",/ e6 W: V- k1 a, }: ~
                .default_trigger = "default-on",
  C1 A+ o) Z( |6 [' L0 v        },
: z. `6 c3 C* {9 Q% }3 D        {0 L* {2 P( p9 F
                .active_low = 0,
8 N% K( F- P6 ?. s* Q$ y                .gpio = DA850_USER_LED1,' m( j& [/ U8 @( [
                .name = "user_led1",, w+ [4 `( c3 u
                .default_trigger = "default-on",; q0 l) o1 _# b1 i
        },
- q5 b+ S/ e' s2 E! U) i        {
& w2 z! k* T' ]* C  V                .active_low = 0,
# ?; x; @2 X" G2 I                .gpio = DA850_USER_LED2,4 q4 Q7 A# f3 N! q% |( p
                .name = "user_led2",! a' V" c1 A6 \/ ^" l
                .default_trigger = "default-on",
- O7 r3 X8 E, {9 \; I) W        },
  R0 t8 ~8 q/ ^: ]  N        {  \: n" L1 }2 n, u% h! w
                .active_low = 0,, L/ q1 s( N5 d1 q% ^
                .gpio = DA850_USER_LED3,+ T* m9 ~' I( o1 p5 R  G: V  V8 Y; g' x6 L
                .name = "user_led3",+ U0 l( Z" G/ `
                .default_trigger = "default-on",
! |7 w  M" K# T& y        },
4 z, c  t; X8 i; r};
: f* _. k4 W7 w' i$ ~
* f6 ^9 f" m* S8 s, y9 ostatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {6 d  O5 c; Y* X' |* x2 C+ W
        .leds = da850_evm_tl_leds,
: |& K8 m8 Y" H4 J$ X% j1 [        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
3 y1 r$ s6 T6 T4 T( I' Z, _};
4 y8 B4 e5 M& f0 j) J& T( w( I1 Z7 G: l; V: f
static void led_dev_release(struct device *dev)
4 y$ `; `: E% Y{
# B5 o$ Y  U" U, c7 `9 j};
5 |/ K. J- p( j6 M/ }% X4 m/ I. ?2 o1 H
static struct platform_device da850_evm_tl_leds_device = {
! @/ G1 ~' w: v; b. A# c6 w* ?- J! s        .name                = "leds-gpio",/ B2 _- B9 w. x) \. O# \5 Y
        .id                = 1,: U2 D+ H7 l, {1 q4 f) P: ?
        .dev = {2 R# c0 L5 v/ \, L* B3 V+ U1 I! G
                .platform_data = &da850_evm_tl_leds_pdata,9 w- m  R! q  D/ C( h
                .release = led_dev_release,
4 R. N8 H& x' f9 L        }
/ {$ \8 j5 p$ }+ ~' `};5 ]- ]/ u' {" n0 r. g4 _+ a

! A$ ^/ u/ O7 |static int __init led_platform_init(void)5 N% M- Z& ]) r( l  z6 |1 o3 l. ~
{% O- l7 E0 m: U/ l8 ^+ R- h
        int ret;
8 i! s; O0 F3 l. L+ r3 `7 p' q#if 05 G3 H  K( ]" k6 k2 d( i" u/ r9 U/ j
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);) ]" O4 y* i  n$ p" U9 ~' X# e6 T
        if (ret)+ b# U: z! S  }# J. u
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"  f$ X2 }' s* s- W
                                "%d\n", ret);
) |$ F* X6 _# N' ^#endif6 C* ]7 x: G1 f
        ret = platform_device_register(&da850_evm_tl_leds_device);! p  x% d9 i( ?, H' ?
        if (ret)1 I# f- {* r6 c' ?- N
                pr_warning("Could not register som GPIO expander LEDS");
. C0 w9 b5 P6 f# M6 ^1 T        else8 U+ q3 O7 V' H: E2 W; ]+ I5 W! t
                printk(KERN_INFO "LED register sucessful!\n");2 N  N7 s9 R4 u7 ^

2 g# N# n+ y, l! U        return ret;
9 ^7 c) p4 N" e}
6 c9 F, m, V) v( M, |5 J  _" U( f2 S, ?" a. K) e0 F
static void __exit led_platform_exit(void)( p1 d/ B0 R+ ]8 }( m+ `
{
/ x$ c( Z( t" g        platform_device_unregister(&da850_evm_tl_leds_device);
: g# q4 }5 y7 n0 k7 G- ~3 N6 g/ `% ~0 l2 h" D" W& [. w" T# R
        printk(KERN_INFO "LED unregister!\n");
" ^! _) m' R! P}0 U* _3 T3 V2 d, i* T

& V7 u5 t0 Q0 S4 [module_init(led_platform_init);
' W" b0 e' U# l1 b: Y; T: Kmodule_exit(led_platform_exit);
+ j/ U5 B7 P- \4 o1 o8 {9 N2 M4 R( `/ E; {% z! I- N. J0 W9 M
MODULE_DESCRIPTION("Led platform driver");" t1 a7 g; b: j8 R1 e4 I
MODULE_AUTHOR("Tronlong");
$ @6 F5 }" D. x( L* dMODULE_LICENSE("GPL");- c, Y' a8 x2 B4 i# Q
+ l' m0 k1 s1 K0 y+ y0 k$ {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 18:13 , Processed in 0.035624 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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