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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
' S+ c8 T' c; x! J0 j1 t1 Z#include <linux/init.h>
& y3 u- t5 Z/ ?% N5 d/ j6 ^& l#include <linux/module.h>
! ]2 y* Z5 d. R3 ~4 v( X#include <linux/kernel.h>( ]1 q6 V# s! M6 S% F  w. v! b7 ^
#include <linux/types.h>. ^! R& a0 k3 P; I  m
#include <linux/gpio.h>
  p* o3 U" L8 C/ Y4 Y#include <linux/leds.h>( P; \% w# q" g5 Y
#include <linux/platform_device.h>0 D; w# p& G* @& [

: g, O) ]: C% B7 Y) O8 T, {#include <asm/mach-types.h>
  E6 i$ f: d3 V, Z  s#include <asm/mach/arch.h>
: @! ~8 X) f- H; Y8 U4 I7 q#include <mach/da8xx.h>
" R) [0 `1 ]; M3 P9 t+ M0 L#include <mach/mux.h>
) m: @" B" v% s! t7 T4 u- O7 D  o7 j
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)+ d# |7 G! S; A4 v' K! v& |, ~
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)- D4 E1 p* Z$ e4 w5 z, |9 B' O
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)/ \) a, |$ {/ i  w5 _
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)! q. ]. h# X( E& J4 e
' L' K8 M4 K# v& A6 _
/* assign the tl som board LED-GPIOs*/+ J8 O, Z+ q3 G
static const short da850_evm_tl_user_led_pins[] = {- g7 x; S' d& g; |% D! U
        /* These pins are definition at <mach/mux.h> file *// @6 ~( {5 |9 M
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,# M9 j% t- S/ R- q( O
        -1
& Z; }/ W, [3 A1 F6 Z};2 W/ L  t: f4 B* z4 A. D

& K  m0 [4 K4 z( \& ?! L- ?0 Tstatic struct gpio_led da850_evm_tl_leds[] = {
; {! \- F0 z* a5 k        {
& z8 q. Z" g4 A  v! }                .active_low = 0,
' s) g4 r% A6 `8 E" E                .gpio = DA850_USER_LED0,
1 L! a8 }5 N- d' f/ N                .name = "user_led0",
! Z8 P: ?2 F* l- P. i                .default_trigger = "default-on",
! d8 G0 D* A# b        },
+ {8 a5 {& _' k- X  ?        {0 H4 i+ I) c* Z6 j! d1 E8 P
                .active_low = 0,
4 y% z- A0 e; U  S" X: t                .gpio = DA850_USER_LED1,
9 W8 i. n* p% d5 g                .name = "user_led1",& k. V6 `2 N) v4 T1 l* o* d6 Y
                .default_trigger = "default-on",, H7 e2 d! n5 i; k& V- {
        },' E; H0 i. D% }
        {* a7 Y! N* d5 |
                .active_low = 0,
- {# m" [  k) G% M9 o- m9 ~                .gpio = DA850_USER_LED2,: B3 V0 g. t4 u# s- u& n! j
                .name = "user_led2",' K, {" Y$ F5 |" a
                .default_trigger = "default-on",
7 I0 h* ]! D: I6 I        },9 e8 J; W6 H/ p/ \0 g$ e! M
        {
& {3 l. ~' v! F: I. O                .active_low = 0,
! K2 t5 E# V& v5 g* n1 K                .gpio = DA850_USER_LED3,: {) {4 v6 ^5 |# W+ u1 l" j8 @
                .name = "user_led3",8 `+ n% Y4 @/ f" X  [
                .default_trigger = "default-on",
* U- U% K. ^! l        },
* j; `: D1 v3 a( A$ g};) u" I0 v, _! X+ t" N, e

. g! N6 u" R: ^8 [+ Estatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {) ]( H. |7 o; h  i- q+ W! n' V' X
        .leds = da850_evm_tl_leds,, s# |5 ]: x8 n3 w0 T! ^
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),4 c2 e3 l7 O; ^6 W  w0 G# A
};# [/ P* Z/ S5 m, ?" P

$ I8 l& g9 |, b4 Q6 _4 u# ]static void led_dev_release(struct device *dev)
+ V$ A  n# n9 {& l$ p" |% [{- o: |/ T. B$ m9 q( z0 I6 K. {' l3 |
};: H% z# z+ l0 n$ ^
7 x% o  q) _) e4 V( |) E. {. e
static struct platform_device da850_evm_tl_leds_device = {) t' L& r: V) y+ ~- {7 n
        .name                = "leds-gpio",
' Q! d4 B2 V8 n( T% {# y9 f* q' S1 D        .id                = 1,7 n+ \) H4 f: @( ^
        .dev = {
; L6 \9 ~  z5 P/ e+ Q' X# W" C                .platform_data = &da850_evm_tl_leds_pdata,
( T% q( Y. W* }                .release = led_dev_release,/ i) [% L7 ?. c. o  Y5 e
        }- X% D) r9 y; {& f5 C! a4 b  O
};
0 O. T: a3 V$ n" s* m4 B" \. ~; G' H; D, `0 d# X, B- w$ H, y
static int __init led_platform_init(void)4 p: v2 N& ^: A: x) c
{
; P6 e+ D; ^  W1 f9 C        int ret;" P- g% ?- _- u: y
#if 0: E- y) p1 r! @5 f
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);! i4 \9 w/ ?7 d! ]" ?
        if (ret)
; R3 E, k3 D: ^& J7 J                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
5 }8 Q# s% ~) H- ~7 [                                "%d\n", ret);
. S) b7 S" c; x4 t#endif
8 G4 [2 F3 R! @        ret = platform_device_register(&da850_evm_tl_leds_device);
, N% o; r5 C* Z+ A8 s        if (ret)0 `7 |8 `. d  c$ b
                pr_warning("Could not register som GPIO expander LEDS");
5 n1 i$ V; j) I1 C3 ]2 F1 ^        else3 d% f  \1 t( i: X
                printk(KERN_INFO "LED register sucessful!\n");7 J4 O* k% }( M
# M) }' s+ P2 J1 H% f$ }
        return ret;
, K$ z1 G5 ]5 S' i$ M/ v# x: B0 }}; v+ {) K" v- K: x
. \: p  O. P# j. H& w6 k
static void __exit led_platform_exit(void)$ s( h9 J' f( R/ M* y6 K
{! \$ t. L' @) w) v" d  P! ~' N
        platform_device_unregister(&da850_evm_tl_leds_device);9 _( y6 ?4 @& _
9 \8 k  t+ c2 M6 L! f1 h
        printk(KERN_INFO "LED unregister!\n");
2 n5 Q; f6 N# i  x}8 L6 V# k- J( {% W' B7 ~- U% q
) m  j5 G! `6 b& ?$ @1 E  [
module_init(led_platform_init);) B6 F1 p) s2 H" ~0 Z9 U; W4 k* N
module_exit(led_platform_exit);( G- A3 f3 \% l( n$ N4 D1 S

! u5 D8 r1 u  g9 F: W: o1 y8 F& p9 nMODULE_DESCRIPTION("Led platform driver");
& X8 u5 F! g3 EMODULE_AUTHOR("Tronlong");9 S% I6 n" J0 H# `
MODULE_LICENSE("GPL");
& Y  H. Z5 J1 p" ^& ^# q
) V. `1 K! u; n! g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-16 15:25 , Processed in 0.066983 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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