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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
! w( r5 l7 ?" Z0 s0 V$ W) H/ z/ s#include <linux/init.h>
3 K1 f1 p" Q6 v3 f: F: }# v8 m#include <linux/module.h>
' G* X3 O% ~% E#include <linux/kernel.h>
$ R6 J0 y: k6 \' I#include <linux/types.h>
3 c; |2 e6 P% h# Q4 ^" z& }( O#include <linux/gpio.h>$ p( T2 v, F$ o# X" }
#include <linux/leds.h>7 R( A' B. c3 B  q: X
#include <linux/platform_device.h>
( J. H% M+ O3 [0 t7 ~' V4 u3 D3 X5 y: \- O' |% y
#include <asm/mach-types.h>0 R; N+ F) S% P. t0 K6 _6 S6 T* f
#include <asm/mach/arch.h>& o6 y! b7 S$ k0 W. ^. F; p3 F5 o
#include <mach/da8xx.h>
1 ~) B: ^. }/ i" K* s, c/ P. L#include <mach/mux.h>) @' e0 M# l- G  J
4 F& F! J* W2 z" T/ `; Q. \
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
" Y: c8 L9 L, G- u* u& W#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)  Q* m$ L: W- O& F7 z5 s# {  A% P
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)) T  o( B8 a8 D" ~$ ~
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
4 q0 ~  J  U( E' R
+ }9 a  ~5 P1 Q/* assign the tl som board LED-GPIOs*/' r+ I* X2 |8 z
static const short da850_evm_tl_user_led_pins[] = {
( Z: ^& d9 h9 L3 v$ l8 c# C, W# L        /* These pins are definition at <mach/mux.h> file */
3 G- f! y6 G7 r! H5 j4 b        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,  G& J  c$ ~; P: v" x6 O
        -1
6 G2 ~( l6 Z2 E};7 U! |, @9 }4 d2 G3 c' H" r
$ ^! {& G6 j* ~
static struct gpio_led da850_evm_tl_leds[] = {
0 i2 @; Y4 Q4 z3 p6 i        {+ O; q: g+ S* g5 U' M7 s
                .active_low = 0,& i3 w& L6 ?6 B; Y, K; j1 R. w
                .gpio = DA850_USER_LED0,
  N8 U% I0 U* q; u- |                .name = "user_led0",
" R' z% h3 p- x5 g3 ^                .default_trigger = "default-on",1 g1 X- p: K' q4 g. C
        },
; S2 B- R4 t4 b- h5 @        {" D2 q  Q* l# ~/ q8 H* [$ c5 h! r& V) a
                .active_low = 0,
9 L! l% J' D: ^                .gpio = DA850_USER_LED1,
2 k* s1 L- Z% o5 {                .name = "user_led1",
. G5 V8 N- r2 h  N" k                .default_trigger = "default-on",% G$ X4 U9 q% F# e6 ?$ d9 z
        },
6 p) z* [6 x7 M5 @/ h& s( A        {! X* e# f  d6 W. g1 `9 `
                .active_low = 0,
0 l9 W- X! Z- I6 ?% g                .gpio = DA850_USER_LED2,( ]. A( U/ v6 o: Y
                .name = "user_led2",% U# [% B! D3 I& f( R3 H' x) i
                .default_trigger = "default-on",: k& [# A+ M" A% O2 K7 a5 @( [
        },
! }# i: k8 z' ]        {' K. }! ^& u5 D
                .active_low = 0,
. s, \  S( s' p- Y                .gpio = DA850_USER_LED3,3 [9 ~5 G8 [. o2 ^2 q1 X  s
                .name = "user_led3",
4 m& L% E8 }& X# R: w3 B) z+ g                .default_trigger = "default-on",
% l  U2 Q2 c& X2 Z9 b5 {        },
% u4 _/ Z7 s, a( K1 D- t( I};
8 _2 z. o4 A' O1 D7 H+ l7 |& n. L5 l4 R& c
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {) T, L( Y' x7 r2 F# X+ ?1 U( J
        .leds = da850_evm_tl_leds,
0 u( ~. [$ r' B/ _2 S        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),3 g" I( _& H" {" s1 o
};. p' e( \" o7 F2 R! f
; @4 a* Z2 m9 d+ v: U4 i! J: H% k' ^
static void led_dev_release(struct device *dev): T; s! K' _9 `: Y
{( P1 e  ]# k& K# p* E; x
};
! \# ^' G' [9 Q9 ?7 f0 e, g6 q- \0 @. g7 M3 f0 s
static struct platform_device da850_evm_tl_leds_device = {- ]' m2 ~8 F0 p
        .name                = "leds-gpio",
- J( p8 x0 w# a. f        .id                = 1,8 L" I( m+ C0 Z6 E$ T; G2 V4 R
        .dev = {
6 @  s+ k" L1 `                .platform_data = &da850_evm_tl_leds_pdata,
. l# i6 @+ k; }  ~                .release = led_dev_release,6 t' @' z' o% t- `7 X4 a& {  c
        }/ r& v( G- _" x% p! A& ]8 |  M: s
};
4 f8 F! h. j& l2 y$ A$ l$ N5 q; u
. W: X, g: z1 }  U) ]1 {static int __init led_platform_init(void)
8 X! g: N+ d/ u1 R2 I7 C{
$ [# N% j' J5 h% a. w        int ret;2 G8 |, {( C5 `  j
#if 0
, b# n9 H+ s5 j5 u& e9 e$ |8 R        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);' D( V5 S! R% U' d- [
        if (ret)6 s# r* O% R5 |, @
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
' u$ c& ~$ |0 ]1 R$ v                                "%d\n", ret);
* `% e# r+ o$ r$ ~) r" X: V% I#endif, F7 m, O6 h, d. l* {3 i
        ret = platform_device_register(&da850_evm_tl_leds_device);
; P# _- E6 ~* i# N        if (ret)
/ G0 L' [& `' z% K* j1 V: Q                pr_warning("Could not register som GPIO expander LEDS");8 u& n. L$ _' D% Q/ [5 V
        else
$ s1 F4 _! F. y7 I! J9 c                printk(KERN_INFO "LED register sucessful!\n");9 m2 c6 j. n1 N' J* L

: ]. b0 |' S# ^/ h' r0 d2 S6 i        return ret;+ e0 S: V: f0 }' {
}" X1 F/ z+ r0 f6 s# Q6 T
1 s" {& ]* a# \, m  S4 T
static void __exit led_platform_exit(void)* }' i/ o/ R2 e
{
! `$ N' e& X& l- {5 ~  ^        platform_device_unregister(&da850_evm_tl_leds_device);, L& @) d- v) J% I. B

: b. V& I3 [' \" a# h        printk(KERN_INFO "LED unregister!\n");
& ?- x7 T, D! |/ x$ r$ R5 y8 q}
  V; I4 f  E( K8 B
0 }& @2 q  ~2 h# _  r0 Gmodule_init(led_platform_init);
# E; Y0 H0 b1 t% N0 h. imodule_exit(led_platform_exit);) M; s5 {$ v/ W+ _: L9 G
* }6 Q  i1 L( K% V2 `
MODULE_DESCRIPTION("Led platform driver");
- @4 J4 l' Y) v4 fMODULE_AUTHOR("Tronlong");
* {! w; `$ b9 N0 q( YMODULE_LICENSE("GPL");
& M7 @4 S1 }$ w
0 q$ F' l; K$ {1 c8 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 22:48 , Processed in 0.038533 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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