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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
  D1 P" c0 V! d#include <linux/init.h>9 _$ B4 n: L& d3 x% R
#include <linux/module.h>; D5 d# ~/ K' s* X
#include <linux/kernel.h>/ o. V6 e2 X% l2 q1 m
#include <linux/types.h>
/ k# Z! S* f. e8 [  i& V#include <linux/gpio.h>& M. q! k: B' I$ z  z& ~' ^
#include <linux/leds.h>
; ~6 P5 {7 b6 g. ?, w#include <linux/platform_device.h>
3 _: c! d! p& Q8 k; h
& E2 P' ?0 O( F% b0 s#include <asm/mach-types.h>
! U( a# V2 k+ k- |' C#include <asm/mach/arch.h>
% s( @9 E0 m, h3 K# y* `& J#include <mach/da8xx.h>) k6 S/ r5 Z; B# g/ {
#include <mach/mux.h>
( V2 c! E! C% a, s# O$ F. L# ~7 o- e- w
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
: n2 N! a: f! d$ o#define DA850_USER_LED1        GPIO_TO_PIN(0, 5). T4 M- A+ Z- B5 l1 J, W, @% l0 P
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)+ E5 ~0 |* m- v. _% G4 X8 s/ l
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)3 R; Q8 G. z, s6 u
6 O  Y, `+ x% S% ?" @
/* assign the tl som board LED-GPIOs*/7 ^1 {* W/ ?; z4 z
static const short da850_evm_tl_user_led_pins[] = {0 a/ w# E9 N0 o
        /* These pins are definition at <mach/mux.h> file */' }# K3 s( p0 }8 o
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5," D9 U0 K0 J9 g" V: P, `$ ?7 \
        -1: u$ w( l2 q/ a+ @3 q7 F8 n+ c
};2 F5 O4 ?3 h$ c
; O: Y( o- f8 r- d. @
static struct gpio_led da850_evm_tl_leds[] = {
) w& ^% D1 y) \" J% a% I$ T& z' U        {& b' `8 N& \  J, |4 e& T
                .active_low = 0,
/ E" N- V6 ]  v" y                .gpio = DA850_USER_LED0,' a/ r" u. K- Q1 E
                .name = "user_led0",
8 R, b2 J$ H, Y                .default_trigger = "default-on",6 h( n  X$ ~2 ]# h1 X1 h0 j
        },
. d4 |" q$ M% l1 ~( ~* N        {
2 X3 i. B3 M+ v- _! N                .active_low = 0,
/ R" K* p! ~) F5 [                .gpio = DA850_USER_LED1,
# ~7 \  E: P5 \0 D3 o9 g                .name = "user_led1",
  M& i( L8 P1 N                .default_trigger = "default-on",0 u0 n1 F- V* N; y4 K% b- J
        },; k0 N6 c& K: Q' }5 }" _. N
        {
: }8 {# ~# R5 V( @& e7 e" Y6 e/ P                .active_low = 0,3 x' F% l7 s9 B; r0 l5 X2 ~
                .gpio = DA850_USER_LED2,8 Q) S+ l/ q# Q' i$ D( j& K/ v5 g
                .name = "user_led2",9 e/ n/ l2 E/ N1 h1 X
                .default_trigger = "default-on",; M( `: D5 R& l3 e
        },! ^3 \4 d; w- D8 I5 s8 K3 W
        {: ^2 A5 X4 a) P6 S& u4 ?- F/ n
                .active_low = 0,# A& D7 I2 Y9 h2 U8 h3 l
                .gpio = DA850_USER_LED3,5 |0 a; F' k1 ?, _
                .name = "user_led3",. ~7 z3 I" _: m) r' ]& h
                .default_trigger = "default-on",- r1 x4 ^& g* `6 Q8 I
        },
, ]9 i+ v4 h: ^! [8 x6 J+ @};+ {; V) w  T% ~4 j

6 h: O9 n0 E" i2 H" ^static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {9 C. a  G4 g: P
        .leds = da850_evm_tl_leds,
) N" z* ?8 q0 o6 b( ^9 y" @5 M        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),8 v0 h+ ]. J* N) c
};
6 Y( s6 O+ g) P! b1 g$ u4 W: D- l' @: J5 X& W7 Y5 x0 Y  W
static void led_dev_release(struct device *dev)
9 e6 i0 V/ F0 g& X3 N; k{3 ~+ E' z9 Z+ j9 ?/ R; X
};
' P+ g7 q# s7 {
3 e/ S2 ^* K6 w/ H: ?! `8 fstatic struct platform_device da850_evm_tl_leds_device = {0 D% _3 x- B' n8 K2 s! Q5 P& A
        .name                = "leds-gpio",8 P$ F  @: O% ?, v* `
        .id                = 1,0 }2 n+ V2 O, r+ T; a) a1 g
        .dev = {  j$ }% c7 V* r9 Q7 v
                .platform_data = &da850_evm_tl_leds_pdata,
1 C+ S" n7 a) i" _0 W& J                .release = led_dev_release,
5 g/ f8 ]' G: {3 i1 u# {7 E& [        }
5 Q# r: J" @# D) D- E+ |};# J% `' F+ L. ?2 l# B
% V& u- J) {  j  y; a# S# j/ r
static int __init led_platform_init(void)" D$ u* G( ^# R7 w7 a8 z4 o
{5 l, Q  _" T; g
        int ret;
! }; Y# q$ Q" G; c! @" i#if 0! Z5 k: ?* _$ ?* k4 T* @% G
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);1 U$ ~8 V1 B2 W+ z/ C3 v- ^' `; k
        if (ret)
2 ?8 @# x/ p* W! \                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"8 g! k3 ^$ _5 g  s
                                "%d\n", ret);5 C7 x# [  m" h5 P" w+ D, u
#endif
5 @6 _' _" H  V4 L9 j        ret = platform_device_register(&da850_evm_tl_leds_device);9 n0 d7 ^: o0 m
        if (ret)' B4 K; {. s- u& D& H& h) R
                pr_warning("Could not register som GPIO expander LEDS");4 y5 s3 g9 h6 s8 d' u% I
        else0 [  z* p2 j0 ^, f( `/ H% i
                printk(KERN_INFO "LED register sucessful!\n");
4 x0 X' Q9 I/ p2 F5 ]  a5 r9 q9 j; c) h/ y' c4 Y
        return ret;( A1 }  s# ~! M7 Z  ]) i. y
}1 M2 _1 R4 t$ q( B6 H) U; G; R
* r, j- t  k! h9 z
static void __exit led_platform_exit(void)' j0 b, ?! l1 _; s
{$ G/ z. V: n# T- t& Z% F+ O
        platform_device_unregister(&da850_evm_tl_leds_device);
& [1 h6 v" a( Y$ c& q* P
0 k( E$ L% i4 f1 F, X/ y0 A        printk(KERN_INFO "LED unregister!\n");
- d8 w& ~& R6 c1 z/ X}
% @8 l. K- u0 n- U# ~8 m% D
5 G" C1 |; f9 T/ Q/ |  `module_init(led_platform_init);
$ f* q# x1 s, Umodule_exit(led_platform_exit);. D3 _' x% m8 V! s" B) P" x- x

6 a# s& w; n: s3 o- SMODULE_DESCRIPTION("Led platform driver");
1 \6 H' r  R5 x7 ~& @MODULE_AUTHOR("Tronlong");
) O3 e9 z  L+ L, e7 mMODULE_LICENSE("GPL");
" r' u4 x7 V: C8 s
5 K# ]( Y* P+ ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 04:39 , Processed in 0.041179 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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