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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。0 p/ @' b4 v- z. X6 C% V! ^: f
#include <linux/init.h>6 }- C2 L) a9 A, N
#include <linux/module.h>& O3 I2 s  _+ S
#include <linux/kernel.h># o4 W0 z, Y4 W- p
#include <linux/types.h>
. [+ ~0 H: g5 ]% `4 Q% D#include <linux/gpio.h>
' {8 H4 S( v% r9 E; ?1 ?1 r3 ~) N1 k#include <linux/leds.h>" f% N+ ?6 K4 g. R+ ?4 p
#include <linux/platform_device.h>0 m# h( t3 l$ ?9 J3 B5 t

5 b& H7 `* P3 K% X: R" x#include <asm/mach-types.h>0 ?1 i$ h" `& j8 w5 o4 z
#include <asm/mach/arch.h>
+ |# _5 T* s0 v* E! Z, B6 n#include <mach/da8xx.h>
9 V5 T) C* k- ~) h% S#include <mach/mux.h>
0 Z; g  {4 _7 Y# |+ u$ f! f
/ b# x  I$ U6 C" }; X#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)& l1 q6 l8 _  p& A+ r+ W8 Z
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)6 \( ~" X) w- ^2 H/ B) i
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)9 V0 U' }1 {! L7 A7 b3 @
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
! g  n: `. e* j% G+ E
( t$ {7 i+ E" |9 P' ~+ _* j& B/* assign the tl som board LED-GPIOs*/
& ~8 f2 h7 Q9 r  K0 Q5 u' Ostatic const short da850_evm_tl_user_led_pins[] = {
1 _1 {  p3 p- Z6 o/ ^+ }- A1 y        /* These pins are definition at <mach/mux.h> file */
9 c2 `+ H( [# h  q6 c        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,2 d0 \. h1 V8 @) q8 {$ S. s: s
        -1
1 [& j: D; f% k9 L};2 q4 w" S# e* \' B# [
  s/ V! d3 h+ t/ b2 H- C! m3 K
static struct gpio_led da850_evm_tl_leds[] = {  I7 D3 w% R; S) L5 D- v/ R3 B; I
        {4 G0 f3 m! n2 ~% T) ]; A( K( a
                .active_low = 0,
- f: S0 T% H  R# t6 y4 g+ ?$ A                .gpio = DA850_USER_LED0,# {; E8 r: ^5 {3 V6 G+ {" ]
                .name = "user_led0",
: a8 p  g6 n' W& \+ X- ~* h- j- w                .default_trigger = "default-on",6 S2 ^7 ~. E5 i/ z- N1 q. d
        }," k5 a: M4 Z  d2 H- r$ n
        {
; y1 t( Z2 H2 F* B) H( w: |' D8 K                .active_low = 0,- n+ e8 G6 h- N( H% ]- b+ P" k" k
                .gpio = DA850_USER_LED1,0 O8 Q- D( u7 a
                .name = "user_led1",; {+ F! V! i# T9 k, x
                .default_trigger = "default-on",, g0 `+ y4 f" a2 ]% J% z/ l' Y
        },
$ x. a( m% n5 L3 Q        {
1 Z$ z( c, }7 r) O2 |- B: a                .active_low = 0,
4 Z: M2 ^, B5 t% s                .gpio = DA850_USER_LED2,
7 I; O5 s0 t, I3 B                .name = "user_led2",5 X3 c, V( |) y% y0 k
                .default_trigger = "default-on",
2 ^0 u) K( }2 ~+ a        },
5 {0 u# J/ V" [( I) B0 d7 g8 I# {        {2 _" i& l' M5 S1 l
                .active_low = 0,6 d2 n" O: K5 Y* g5 }0 w! w
                .gpio = DA850_USER_LED3,
7 D$ d. k6 @+ R% C" [                .name = "user_led3",3 j6 g; x6 Y- @+ f+ X
                .default_trigger = "default-on",
% H+ z- ^. U+ n) A, b5 ~+ ?3 r        },( O# a% z9 s- r) I/ P
};
2 K1 E# I5 h/ {0 k. W; l9 |9 j
$ D( X- T, G6 W* estatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
7 N+ F* w5 I0 O# f# S9 j- v7 `        .leds = da850_evm_tl_leds,: U" K+ k5 @' I( A$ I& i9 o
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),+ c/ ^4 a- L! S# Z" |/ I
};' e' q8 h7 {: p
/ j) L2 m$ f' ^4 T# l5 l; L1 T
static void led_dev_release(struct device *dev)) J  ]8 q5 u; k$ n
{
, `1 J3 G  j6 K8 U, h! j( C};* O5 G" R* ^7 C, o" X( j* _/ Z! B( u8 I
$ Z2 U% v0 k+ J+ T' }
static struct platform_device da850_evm_tl_leds_device = {+ z6 t1 M& s* }" d' E, |( z' ^5 C
        .name                = "leds-gpio",, e6 d9 z; g1 J' |) W
        .id                = 1,4 }4 p3 V* @: [2 L: z
        .dev = {( b, D) Q7 y& K7 K
                .platform_data = &da850_evm_tl_leds_pdata,
$ n% S- b5 i, F' r/ R                .release = led_dev_release,
3 x$ L( N1 N  }" v        }7 {# @1 z, Y, Q- _1 J, x( P
};3 X" U0 a, A6 i$ K
2 A8 ^6 J$ @! m7 l. Y
static int __init led_platform_init(void)$ a" }* I' J% Q9 L* X
{
0 r- v0 k: v' Z        int ret;7 z: ?/ O1 u, y! ^- ]
#if 0# O' P* B7 @- v% z# i
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
9 x( O# o  n7 T# B        if (ret)0 O* R) d" _8 Z2 `
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
, S0 D; M" I* U. }( E# ~# J) ~5 G% ^                                "%d\n", ret);- }; K/ @; _- S1 _
#endif
, O5 \1 i+ m8 G; h7 l9 @        ret = platform_device_register(&da850_evm_tl_leds_device);) \+ h3 K( x9 j! R( S9 T
        if (ret)
2 }- F1 A4 y) I' s                pr_warning("Could not register som GPIO expander LEDS");/ p! S, n5 y3 s: [
        else$ \: x8 U3 ?7 [+ P7 R9 n# ^) N
                printk(KERN_INFO "LED register sucessful!\n");
" h4 ^3 j' @4 i" I
, w9 [$ z+ d$ ^& [1 y. m        return ret;! z4 y- u0 Q4 ?) S& y7 ?2 B2 c
}; W; I! c$ L, }/ i6 B+ o" L

% |5 P% w' _: k* A- c* _static void __exit led_platform_exit(void)  I0 Z& ?; O( Y
{- U- G& j- Q$ Y! s% |1 @
        platform_device_unregister(&da850_evm_tl_leds_device);. y: p0 E% W) x/ y) u

: S5 L$ s5 d: N( T        printk(KERN_INFO "LED unregister!\n");7 E  u$ ~2 \4 Y* A
}
3 G; s% l4 Y* s9 m6 y) p5 i. \  R3 K% c
module_init(led_platform_init);
6 z* c% c: B6 @) u# j' G# Umodule_exit(led_platform_exit);; @# ]' F+ w/ p3 F; s3 }% c

/ T6 E  `) x# }( w2 y6 PMODULE_DESCRIPTION("Led platform driver");: M1 i* f) j0 v5 t( |( l+ S
MODULE_AUTHOR("Tronlong");
) E0 }% e# d- J3 S. _" [9 NMODULE_LICENSE("GPL");
( i: |) u9 [+ I0 t
- x7 m8 ^( P/ C' t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 10:56 , Processed in 0.039593 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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