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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
1 ^% D: \7 Q9 D+ T7 e#include <linux/init.h>( e9 f: U3 y3 V+ x/ @
#include <linux/module.h>
7 G7 u' R7 Y& u#include <linux/kernel.h>
, z; e! H' u" p' A- O# C! I2 \#include <linux/types.h>
& g+ \. ~; V2 e9 Q* U+ F5 R#include <linux/gpio.h>
5 S' S  F' F$ B#include <linux/leds.h>& r; X6 |# U2 S2 u
#include <linux/platform_device.h>
: o0 H* p, ?4 w
  P" d3 J, i4 \6 U5 H' E$ k( R& ]#include <asm/mach-types.h>
0 S4 x& l: R8 j4 a" a#include <asm/mach/arch.h>
5 ?4 j; }& \3 D& D' D#include <mach/da8xx.h>
0 r$ m6 S% J5 u0 ]/ \/ v#include <mach/mux.h>
. b7 Y' G5 h# I4 g& W0 k- }# _8 R7 }9 W8 j5 n
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
5 j& Y8 Q3 `0 q) [3 U  h#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)+ |1 n/ R0 i' H% d" X; k2 _8 J4 t
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)* B: }( c0 c' m8 x" B7 o- r
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)( ^% o( F3 V2 e2 ^& {4 q/ N

& e0 w) ]' f" _; z/* assign the tl som board LED-GPIOs*/. K- a& u' q% x& o+ i
static const short da850_evm_tl_user_led_pins[] = {
. Y9 S1 E0 H+ {( j. k4 {8 h: w        /* These pins are definition at <mach/mux.h> file */
& V) l" a. p) Q        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,$ H! n4 W  O: M; z- ^# I5 A
        -1# P; d& E% i/ R, a. F
};( d0 N1 G. Y3 Q( Q6 Q9 C; b
2 D. r' K) w/ \% h+ H( z
static struct gpio_led da850_evm_tl_leds[] = {
* ?0 ?$ @; r4 F5 u  k        {# s2 b3 K; p. d  V. M. M
                .active_low = 0,+ W5 [; D3 {  U" r6 u% R
                .gpio = DA850_USER_LED0,
  k9 J3 l& c9 _% g- x                .name = "user_led0",% l% k9 d5 b8 O) R: t
                .default_trigger = "default-on",
0 @! r) n" ]6 b9 I2 M  u8 @        },, Z$ P# B, D& F2 ~  W! |; u% U
        {8 Y4 R6 z0 u% p# M7 m
                .active_low = 0,
' q" Y+ P0 l6 F' u& Q+ _* O                .gpio = DA850_USER_LED1,
6 _6 Z" v4 V1 r5 n                .name = "user_led1",6 v7 }4 a1 E2 n6 \( Z( i
                .default_trigger = "default-on",
" v7 F  j2 g# z, Q        },5 w, b( j( y9 a! \' W7 H7 t
        {9 ^3 G! j; ^" W" P1 Z' d6 e
                .active_low = 0,9 T8 `7 m; @3 n" H$ [, N
                .gpio = DA850_USER_LED2,
  b/ h8 @& p  U  m6 N7 H# w% P% l                .name = "user_led2",9 g; s$ ~0 |+ Z) Q3 c
                .default_trigger = "default-on",+ F+ t. \( V" k( B* ^5 J& t
        },
- ]1 D& \6 d& o2 d: a0 U; t% s) b        {
+ u' E+ T% Z9 e6 K                .active_low = 0,
( e) z3 o9 M' |" {' D( L                .gpio = DA850_USER_LED3,
4 M  r8 E' `; E) j) c% V: \- _                .name = "user_led3",
$ y1 Z% g. h% u3 o* @                .default_trigger = "default-on",+ U, ^3 C: x' {) a
        },
1 Y; f7 U. o7 D! x; z};( Y; Z/ t4 P  Z8 @9 [+ M

; f0 a2 ?( K' j9 y2 H( t8 c) L  ?: I3 gstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {9 @9 l  K& U* x+ T) |; O7 n6 o) R
        .leds = da850_evm_tl_leds,; D1 Z) N3 K9 Z* S
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
( Q9 h( b9 R& p};3 Y( j" Q% Q) B, ^$ w. q7 O

, p/ D$ I9 S2 K5 V9 n+ d$ Lstatic void led_dev_release(struct device *dev)
" ~% o$ W& ?3 q9 V4 b{+ _4 a- ^  r7 V5 M
};
, E0 F, ?$ A# V2 k# U
1 f1 Q5 S( }7 T) L6 ]2 M" Hstatic struct platform_device da850_evm_tl_leds_device = {0 E  X/ d& o+ Y9 a6 T
        .name                = "leds-gpio",
& i2 r. f5 I* w/ ]  b        .id                = 1,
( |2 N! f- z$ i& W        .dev = {
6 `# h$ _0 o5 _+ o" |                .platform_data = &da850_evm_tl_leds_pdata,) g5 A  }  C) t: n; _2 q3 m! a1 k
                .release = led_dev_release,. H& _2 C# `4 E9 U& V
        }( J4 {! b0 ]  F0 r! Y
};
) {2 J6 _& l! k* a6 A' ^! X5 }8 z% F5 v- N! N8 V7 k
static int __init led_platform_init(void)
% G3 P5 P2 c9 Z/ \; h" x{3 ^5 O, [6 r, U: ^& A9 X, f
        int ret;
: @' u9 g  z( E. W% H/ b#if 08 b8 |, a' F* R/ k5 g
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);7 }( X' z, ~! {# F# |
        if (ret)
! m7 L$ T. H" O, q4 b+ }1 I                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"* d$ g* j4 \9 E4 Y( U
                                "%d\n", ret);
; u: v" Q0 p; E- Q#endif) ~- |$ I6 j( X4 {' @! g
        ret = platform_device_register(&da850_evm_tl_leds_device);: D  O$ X. {5 D$ k; K6 @  _* `+ v
        if (ret)( {9 f& [  q+ H& ^% {- D$ n
                pr_warning("Could not register som GPIO expander LEDS");7 U% b- L5 x# k* V  G( r, A( D/ ~$ x
        else3 Y! R- k# f0 r1 j
                printk(KERN_INFO "LED register sucessful!\n");8 ^" |+ Z- ^0 {  P3 p- {9 U/ T
* ]/ U% U+ Y' w" I! V) B2 H
        return ret;
3 a0 X+ B3 r! L1 q; M}
- a% r8 h: w8 m6 S* I
: n: T/ Z, j/ [# m+ Ostatic void __exit led_platform_exit(void). e3 i* f& u  [& W3 u( }) u$ u, R
{
! i( z, d# ^! a7 \$ l, ~7 O3 C( L# Y        platform_device_unregister(&da850_evm_tl_leds_device);9 P* B8 u& z+ }9 V' b* `: j
  V- K- }1 ~4 L- D! K8 O
        printk(KERN_INFO "LED unregister!\n");( m2 K/ k% o+ h5 d0 }% z
}
- X) D" j. @$ F  F& L, g& t# R
& C7 o2 L0 [9 zmodule_init(led_platform_init);# U2 ?9 Q1 `  l: Z  V. I
module_exit(led_platform_exit);) [  U8 `2 y4 x$ {

: l& u/ Q4 A( ]! fMODULE_DESCRIPTION("Led platform driver");
- n" J" s- L6 D; r( d6 P5 tMODULE_AUTHOR("Tronlong");3 P: V, K% r" _+ I- k4 J. c( n
MODULE_LICENSE("GPL");$ t- S2 N6 u/ c, ^6 g& Z( U9 i( W
: |! I7 R/ v, `6 P/ k5 r; z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 08:59 , Processed in 0.037543 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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