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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。# O8 t- r( `' o# d% E' d6 e9 W
#include <linux/init.h>
& h/ a2 _- A# x#include <linux/module.h>( x* N" T9 ]! F; ~- y" g
#include <linux/kernel.h>. d3 O- t( {: K0 L; J- ^0 i: M
#include <linux/types.h>( i1 L+ l1 d; l# Q$ z
#include <linux/gpio.h>
' _9 R/ ]$ Y, t& ^1 }#include <linux/leds.h>
$ ]! O. X9 @5 g/ K: P: z; W$ _#include <linux/platform_device.h>
9 `- O' Q" j( }( e- u" n5 I' c* ?2 o+ J% Z6 V" r
#include <asm/mach-types.h>8 |4 T* Y7 x7 f) M- M
#include <asm/mach/arch.h>, N% s! O4 u" [8 k3 v- d3 G6 E
#include <mach/da8xx.h>
6 e% @, P! ]7 j8 }8 z#include <mach/mux.h>" D4 g- S% J  a: {( m+ c( c, D

1 \$ d1 O* {+ W' n4 u#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
0 T2 s' l5 ~3 f) S, j( y( @' r4 i4 C#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
2 i0 \" M- B+ D+ U#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)3 B9 ?7 Q1 D0 Z1 b7 g
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)1 Q- H5 F7 V; B9 `" R
$ y) {) c- y8 t1 Q
/* assign the tl som board LED-GPIOs*/$ ^; W9 V2 |$ u0 h- W  K
static const short da850_evm_tl_user_led_pins[] = {" P$ D* c0 I4 o  K4 N# X
        /* These pins are definition at <mach/mux.h> file */
1 _0 c! I1 k$ D- Z        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,6 d  y& y( D5 ^) C* V1 ^/ L
        -1
. R7 f6 u% q7 J# e2 k- k9 o7 b8 P};) b8 J% M' Q( c0 b6 p" l- O
& `" x7 A7 T7 Z) q$ _, R: O2 }
static struct gpio_led da850_evm_tl_leds[] = {/ p) c! @8 m; y3 i8 u% K
        {
1 u7 S( Q+ s5 y- {9 F                .active_low = 0,
9 l1 s8 S2 V3 t1 E; F: g( Y5 B% S                .gpio = DA850_USER_LED0,
1 j# T2 ^7 q5 m: u% Q; g                .name = "user_led0",
! e1 R  d5 I- `. y% [: T' p                .default_trigger = "default-on",) o( \( Q* ~7 `) `$ x+ e+ U9 G* m' c
        },9 n$ k# W/ a) M# ~3 e. z
        {  z8 p# H4 @' s: S" A
                .active_low = 0,
1 C' o( ]  U3 w3 p                .gpio = DA850_USER_LED1,
# Q! T# _! d/ l+ U8 P+ b, Y                .name = "user_led1",5 L/ A/ l0 L; o  {6 w+ }8 |
                .default_trigger = "default-on",
3 y1 O$ V3 m: g8 T        },1 \, v$ [% i' q/ I1 {
        {
, L- U5 D* v7 J( O- v                .active_low = 0,0 b+ b  f4 g  q* S; o  r* m
                .gpio = DA850_USER_LED2,' P4 X; n) w1 \8 W0 G% n3 X
                .name = "user_led2",% f1 v% r# E( U2 }
                .default_trigger = "default-on",
, b- [) r) h& O$ e8 @$ q        },
0 w- X: r% E, y# l& P# i' O5 J        {
; w0 H+ w. y0 ^4 C; a# I                .active_low = 0,
) Q/ |% B/ t( y: S0 }( K                .gpio = DA850_USER_LED3,
1 ]* ]1 K7 Y: z) o3 S& ?1 l6 M) b                .name = "user_led3",* W/ H, ^" U' e
                .default_trigger = "default-on",
; O& p0 L* @- E/ D1 A/ i4 I        },
. t0 @- U  G, w, q0 Y};3 m" L3 r& T% t0 ?, }- P  G' G5 A
. X) M# n: |6 l/ @! v# L
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
; p; \2 I$ x: e( ]" r. N* c        .leds = da850_evm_tl_leds,
, [" S; A( g( C+ I* A$ v        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),7 k: m* i. c; J( N/ }7 F  Q
};3 i; a/ m2 \. i! j

1 M5 d" D' `% j; P9 Gstatic void led_dev_release(struct device *dev)8 I. p  k- m' ?+ n1 ^
{- Q! l& A1 q/ W$ X0 q3 B6 v
};9 O7 n1 [/ m4 V7 R+ ^( Y
  A/ I5 J  y7 W2 ]/ |
static struct platform_device da850_evm_tl_leds_device = {8 `* x; d  w& i- A+ A. f
        .name                = "leds-gpio",1 u& n1 y) o1 {
        .id                = 1,' h+ V. Q  t+ j1 Q0 D- f3 c
        .dev = {7 o4 A% x3 k! ]! n, M- N8 j: i- @* Z
                .platform_data = &da850_evm_tl_leds_pdata,
: [4 R8 T* C7 ?; @. `                .release = led_dev_release,
- W6 H/ R2 W( }        }
" Q1 S7 ]5 J+ }0 Y- U; G/ ^  c6 w: n* N! V};3 \0 [5 W) R" H+ C  P

2 S" r9 j2 Z, q* X" \! vstatic int __init led_platform_init(void)
/ ~& W4 o& v% Q# y3 |- I{: F2 N, j0 n1 E5 R
        int ret;& o' X" {6 t  r8 t% H3 i
#if 06 l' t% R8 j! k: a
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);! l3 _1 e7 L6 L% W
        if (ret)) u, ^* R' G9 D  q7 r
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
$ e- J$ W1 A+ ^. B) B                                "%d\n", ret);+ w; K2 }: _6 z8 y+ J
#endif
% R* R0 ~  a# t" G1 h( Y/ i8 N# P        ret = platform_device_register(&da850_evm_tl_leds_device);
- D, W, c( I1 `: `        if (ret)& D9 {" j. w+ j- p6 m
                pr_warning("Could not register som GPIO expander LEDS");8 E- ]) a' w( N3 j; P- o* P
        else
: J) A2 q7 x' O* N2 R& E8 h+ \  o                printk(KERN_INFO "LED register sucessful!\n");
: V! |6 a7 C; ~5 c% c- g3 B/ j7 b( K, U8 `5 E
        return ret;
' |" e: t4 j% {$ U8 }}
! a: z, s' j/ I. E
& R/ w) |( f+ ^1 m, Dstatic void __exit led_platform_exit(void)
: s: A& k; ]% G/ K$ V{' F+ `5 j! c. E5 g" o: P. o3 O
        platform_device_unregister(&da850_evm_tl_leds_device);
+ s! q' ]& H" Y3 [+ d5 v
' T. q% c1 D, |2 M. `        printk(KERN_INFO "LED unregister!\n");
) [0 J7 @: M: r8 v8 G' g}
; s$ K( R+ W# r4 r* d: n+ \% L" O5 D" ^2 L- r- J9 P
module_init(led_platform_init);+ B( A* R. R' J# f
module_exit(led_platform_exit);
6 b- z. c" g# }6 V! @4 z9 @7 C7 x7 p( p2 K7 |" H
MODULE_DESCRIPTION("Led platform driver");
  A1 W8 \2 u- LMODULE_AUTHOR("Tronlong");
" n2 P- H# i& ]' o- Z  pMODULE_LICENSE("GPL");, Z7 F$ @$ P/ B* a8 I- N! O: c

( A$ n3 ^: m! A( m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 21:36 , Processed in 0.037105 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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