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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
8 Y8 X& u. C+ v3 @1 G  m#include <linux/init.h>( n: ~" r1 n# X- h0 E
#include <linux/module.h>; V0 T7 t5 R- M" m
#include <linux/kernel.h>+ G" J+ X" [1 Q& K# A2 G
#include <linux/types.h>5 o( y' q8 T5 R1 t# `; a
#include <linux/gpio.h>
8 v1 B5 c# X; |+ D( c#include <linux/leds.h>
+ a4 h4 H# f2 p/ e#include <linux/platform_device.h>
* _4 K/ ]" o3 ^) s1 v
. r$ e" o/ g/ B* Z#include <asm/mach-types.h>
7 E; p2 e. m. r! Q" @4 N#include <asm/mach/arch.h>! s0 O, ~: |$ W( A, X( `; @0 F4 z3 |
#include <mach/da8xx.h>
* h$ j( C; A/ y! F, ]* T" |- I#include <mach/mux.h>& i5 C' e. s  f% S6 k9 S* `2 n2 m
) t7 a8 g4 H( y7 F! r& b# K+ ~
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
/ |) K3 f5 T  b+ o2 A#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)" F* |; U; W3 ]4 V# Q
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
" z2 c0 q. }/ A, e& E& c#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)! G. T' M; _! K2 K# H) M

6 R* ], A0 b& q* S& U6 u/* assign the tl som board LED-GPIOs*/; t- D1 J7 V7 ?3 K; |- v* I
static const short da850_evm_tl_user_led_pins[] = {
4 |" g" P; j0 g        /* These pins are definition at <mach/mux.h> file */- F& J# A" x  l4 Q' |$ g/ e0 l
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
7 M& {  \' a) p        -1
$ y1 J, W- f  V  s1 N0 ^};/ p7 c5 T) E" e( G, w1 u

4 S) s& S! K0 z$ {' K9 @  istatic struct gpio_led da850_evm_tl_leds[] = {  F/ U. @4 m# A; I8 g5 B
        {; h3 a$ B! t$ J; z
                .active_low = 0,, y: i: h! t+ e+ y
                .gpio = DA850_USER_LED0,2 ~( o3 f& h: u8 v/ z; Q7 `* g1 {
                .name = "user_led0",' Q  B- i7 c0 J% h% L2 h+ O
                .default_trigger = "default-on",9 p) i3 p/ r3 i
        },
% T: k, R8 P9 d# }        {& w- d* l. ]3 b, l
                .active_low = 0,
2 U+ P2 c; t  k) l2 |, b                .gpio = DA850_USER_LED1,
6 b. i* n1 U0 S: H+ ~                .name = "user_led1",
8 I+ M' `4 w8 n1 I                .default_trigger = "default-on",2 q" q6 m' [' x7 k2 r1 J
        },
; F2 _- _5 b7 L% l( h" @        {4 Q/ O" p& s' M" w
                .active_low = 0,
) z9 F* p# Y) n1 K                .gpio = DA850_USER_LED2,
7 U# c! y1 }2 C4 ~" Y                .name = "user_led2",
- V4 Y2 {& a& f: ~) v                .default_trigger = "default-on",: J& f; @: n, d  e  M
        },
3 t  f4 w6 x" Q        {
! O* I8 x0 B" p$ `& t                .active_low = 0,3 M6 n( p8 r- N  ^4 V1 F/ u0 r
                .gpio = DA850_USER_LED3,
' v/ R4 Z) }% d& D, P, E                .name = "user_led3",
! v3 L, H% G# L  ]                .default_trigger = "default-on",3 m, D0 u: g) C
        },/ P2 D# t5 d% Y$ t
};1 C( G' z* `2 u2 g4 A1 h

% d0 }' D+ y) q5 ^2 Q" @7 wstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {$ W2 {+ }; }6 H# f3 ?5 {4 I
        .leds = da850_evm_tl_leds,
# l- @2 {7 a) ~3 W& c1 [        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),  x( m( V6 l7 W/ b: q/ h% h
};
* R  {, }  O1 }5 n. \2 l3 X
4 Z# u  S; f2 W. u: Z; q# cstatic void led_dev_release(struct device *dev)
8 t% K; r4 c3 f! @2 n. d0 V2 e3 h{
5 e4 H0 Y/ |) U' g3 |9 [};
4 t( j2 K5 e3 P/ A  s/ \. y
  ~2 j% D- `' v9 estatic struct platform_device da850_evm_tl_leds_device = {2 H1 m. s" \% g$ y+ z* G: ]
        .name                = "leds-gpio",
& a; t6 n. q7 N  A- H# v        .id                = 1,* V( X9 q" W  e1 M8 V; G% ^$ P" K: m
        .dev = {
! D9 y3 h1 D  b; H4 C) q! S* B                .platform_data = &da850_evm_tl_leds_pdata,
9 ^2 L! c' A0 k$ G$ ?* G! f; j3 W# ]                .release = led_dev_release,
- ?& h4 s+ |, m$ f7 G/ }        }
" @4 B- T. w0 Z' D+ b};
) f/ V3 _0 ]+ B
( [- p8 y& b3 O. V- t1 B- sstatic int __init led_platform_init(void)! R! A( a7 ?7 w  n' a
{9 q* I0 Z4 D9 a6 Q# z2 }
        int ret;3 Q8 h( `$ N) J- b# }" H
#if 05 E  i% V. k) j( f6 M
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);' M- G7 ~. n( X2 T& D
        if (ret)
9 y& q( i: p  \9 P9 S. O% m                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"6 `) n# Y7 O( m8 }6 Q
                                "%d\n", ret);
8 H1 c7 s, R0 M  G( v% p+ P#endif7 h0 y9 U8 h+ ]+ Z
        ret = platform_device_register(&da850_evm_tl_leds_device);( G5 x( o$ {6 U( H- u
        if (ret)
0 e0 t5 O* C6 M, r+ N# m                pr_warning("Could not register som GPIO expander LEDS");! E  e+ S# }3 Y
        else1 a* Y1 w: J3 |
                printk(KERN_INFO "LED register sucessful!\n");& p9 f0 v3 C! r, ~# c

* g6 d& a& |. I        return ret;  I. u* }( \( t( w$ b
}
2 G2 l- Q! Y# T& g. x/ a; k1 Y8 [# j! s* A3 ^0 ~
static void __exit led_platform_exit(void)) v$ K( ^5 b+ J  `: t
{
( H9 T( f+ C- m6 X( R9 g+ X! N5 _        platform_device_unregister(&da850_evm_tl_leds_device);7 w1 y, p* i& W8 I0 z1 R7 @) l8 M
, Q' z/ w8 @" {9 N( A8 o, l
        printk(KERN_INFO "LED unregister!\n");
2 H' b/ f: K; t; a7 ]}
& Q1 l, z( |/ D0 q
  \  T& Z' Z8 O* X. _module_init(led_platform_init);$ o9 G- n3 R. s: b9 j4 O% d0 x; y
module_exit(led_platform_exit);
0 e5 C$ l5 T7 e  i2 c
, f1 Z* w8 ]' q) TMODULE_DESCRIPTION("Led platform driver");0 C( [. I) n+ `( M  u7 @
MODULE_AUTHOR("Tronlong");
5 `* `  Q; m, i! _- `/ NMODULE_LICENSE("GPL");
7 i' c$ B3 T3 k3 k! g6 W
2 W/ `2 l6 J+ X% C* X. w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 23:02 , Processed in 0.039986 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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