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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
2 A# T4 W& Q: a- F% N#include <linux/init.h>
6 _3 m& n8 m+ p7 \7 ~#include <linux/module.h>+ c. I0 w2 r1 M1 ~
#include <linux/kernel.h>
, ^+ S8 [; }9 v. l#include <linux/types.h>
) `4 D, V; e" q: S3 [#include <linux/gpio.h>
' K3 B. t7 t. }, {5 @5 h; F  q#include <linux/leds.h>7 L1 X) Y8 X+ E
#include <linux/platform_device.h>
4 s1 j% x9 B+ G/ ]1 t! {* z* w% T8 N5 \$ r5 t- o
#include <asm/mach-types.h>5 p, e; H7 A/ B
#include <asm/mach/arch.h># w! u! O8 a8 }2 J" z) k
#include <mach/da8xx.h>
' ?- ?: q7 B9 r  T#include <mach/mux.h>
$ C3 \5 i8 |4 P! @  b, m1 A
( L. t+ o, y( G& h- i4 Y8 z#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
. a6 F! z7 q6 F, I3 g  `2 V; \. y#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)' X2 `. ~4 `: e0 ?# |; _' L1 Y* B: U' I
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)0 i% \$ {4 T3 H: o* {$ q
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
* M2 w- @. z% G: a4 j! P2 N- N
5 N& v! x9 m; d6 m& ~/* assign the tl som board LED-GPIOs*/
/ n; |4 z: ?$ D% y1 o$ |3 lstatic const short da850_evm_tl_user_led_pins[] = {
1 o, C3 j! Y2 r8 v9 V$ G; J; L        /* These pins are definition at <mach/mux.h> file */. y# W# ~; t1 l# F) ~; _& U3 w
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,& N# S; X8 ?4 i
        -1
3 |0 V8 S; D2 m7 K) A, z" {5 o};
& G: I% l$ F2 X2 f) K3 a$ C! Q. i' W5 {/ X7 K
static struct gpio_led da850_evm_tl_leds[] = {, K, q/ g; U( D) k3 e1 V$ }
        {
- M3 k5 K/ P& ^/ P: s7 _                .active_low = 0,
) W& k% U$ [  A) }' y: J( v                .gpio = DA850_USER_LED0,
) x- y  u, h' _4 v( P+ g) h                .name = "user_led0",
1 c5 `# k) D1 Q; v+ r                .default_trigger = "default-on",
1 b) k0 D) d! d3 \! p' v3 m3 s  j        },/ b4 F$ o3 X. F# L- T0 E2 l
        {
7 r0 }1 T9 M' j: D- o                .active_low = 0,
$ q. t& P& R* \- Z# Z- c                .gpio = DA850_USER_LED1,0 l9 H' D! J+ \3 ^# {+ S! r
                .name = "user_led1",7 S& ~# v# F  k) X$ y, p
                .default_trigger = "default-on",
9 |( w& ^- X# @        },! `& L2 A! T( a1 u. ]
        {, e# I5 G# j& S' `1 t) Z& O+ g
                .active_low = 0,
" p- e; X0 ~! k( }1 x                .gpio = DA850_USER_LED2,0 l3 R( s8 B" C/ n- r
                .name = "user_led2",
- e8 g$ ^8 t1 f; ~                .default_trigger = "default-on",
' `' [4 `$ C& L        },3 S- ]6 G; K7 f9 M' {6 J9 ~( R# @
        {
8 ?' |+ ?/ @! R$ U% {2 @' c                .active_low = 0,
. Z* A. c% K. T: J1 k! a                .gpio = DA850_USER_LED3,
7 M% T* c% ~' V$ a& D/ U8 Y                .name = "user_led3",) |, L% O9 X1 t
                .default_trigger = "default-on",6 Q2 U: `' \" I, m7 [
        },7 ]3 z0 i2 j9 e2 P) n
};
' E6 A) H( ?4 s6 y6 Z  ~& j+ d0 |& b' X7 `  W3 }
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
5 a- n1 P* G# p: X  s) A2 i        .leds = da850_evm_tl_leds,9 n+ N7 J) L) J. `" j
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),& g1 C+ L3 _& `, T
};
! v  j8 m6 {0 \# |' O! [2 t; Z+ _9 a  G4 W6 J. V7 p5 R. ^  _
static void led_dev_release(struct device *dev)
- G& L+ t+ |/ Y; R( k. J{6 D* J7 W+ d4 x7 f5 }1 R/ `8 ]
};0 M& k* |! M3 Z. C9 n
# u0 ?9 \* H6 g* F
static struct platform_device da850_evm_tl_leds_device = {4 i: ?% C: r% |+ \# [
        .name                = "leds-gpio",
3 s9 P2 L0 u1 k* q8 z5 }5 ~        .id                = 1,  {  f; H# b2 x6 I
        .dev = {
# ^% k* Q' F. D6 W* B                .platform_data = &da850_evm_tl_leds_pdata,
1 s2 G- s- K8 M; z  u( E  z                .release = led_dev_release,
5 l  d) P$ n4 \2 F        }
" L7 Q  @, a7 N0 ?$ Y};7 M3 W  s5 t) u4 F) C) {! \' W" I

! t/ e2 C' h, Astatic int __init led_platform_init(void), n. D  a, q* {% O
{
- z% F$ D& X8 t( \        int ret;
$ \8 {% a" T/ }$ {5 o#if 0
/ J; a; E' {- Q' _1 \        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
. D3 Y$ V, D/ ~, U2 o        if (ret)2 \6 Q2 \& O& c3 `5 Q+ q5 ?
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
2 _3 a# e3 ]! Q: S                                "%d\n", ret);2 h# Q  ^# Y5 v5 c2 o* h
#endif
8 {* W) i1 ~1 z) Z, u' D        ret = platform_device_register(&da850_evm_tl_leds_device);
5 q5 a, y4 v" L# c/ a5 D        if (ret)6 i9 T- H( T  P9 K9 q5 N& M( O
                pr_warning("Could not register som GPIO expander LEDS");) K$ C6 _; G2 L( u% B+ _
        else  t% Y: Z: j7 V1 v! _
                printk(KERN_INFO "LED register sucessful!\n");+ e! {: w9 \) b/ L! k& i

0 {3 ]" Q, a, z% j$ P# V        return ret;6 ]/ L/ G1 @) V; ?8 O4 q4 s
}
! Q1 Y/ ]) j% T) d: w7 f# P: L4 ]4 f, V# C) O- n- N; D
static void __exit led_platform_exit(void)5 m" z8 k% n! n1 T6 p1 f
{
- H! U* T3 s& y8 l3 r        platform_device_unregister(&da850_evm_tl_leds_device);6 L3 N" @/ }1 P& D

  {4 Z! p8 j1 F        printk(KERN_INFO "LED unregister!\n");
6 k$ O- ~3 j% U0 ^/ o}: Q+ ]) T0 D9 I
  A( b2 q' S6 \
module_init(led_platform_init);# m! I. D% p6 m, n5 c
module_exit(led_platform_exit);
9 ~, R1 c3 F& J- L5 M
! B: h& b! b! ]) D0 dMODULE_DESCRIPTION("Led platform driver");
" z- P% @9 n  I4 P; o* dMODULE_AUTHOR("Tronlong");
  [; {+ Z$ m  H/ v$ w; _MODULE_LICENSE("GPL");" b- I* P0 o* {1 i5 I% h- t# b* t. y

% ^2 a! T& @4 `; I" v$ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-14 18:48 , Processed in 0.045609 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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