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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
3 t% I) @$ g8 a+ G# z#include <linux/init.h>' @5 I3 \# _# x8 q0 U8 A
#include <linux/module.h>- j' S: d  \! {! Q
#include <linux/kernel.h>
# A0 A9 a$ Z7 E7 x, t#include <linux/types.h>
2 I5 K# k, N. s( d1 ?#include <linux/gpio.h>
% e! I. c) C! n% _+ @3 h0 E#include <linux/leds.h>6 V1 d) w, l! _3 @; Z+ P
#include <linux/platform_device.h>0 Y8 B9 Y* n5 k( A# Y4 a/ [, g

9 A$ Y) n) n# d6 c7 m. h( q#include <asm/mach-types.h>
  g3 N$ _" I( Q: q#include <asm/mach/arch.h>0 |# F, `5 R0 O* D
#include <mach/da8xx.h>$ Q+ A) [, p# X2 |4 m
#include <mach/mux.h>
% F  {9 u6 |& Z% j1 }: D8 w7 ~2 w. n# e  P0 p) A: f. Z$ v
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
8 X5 h  i9 M' H& [8 b  O0 D#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
- R* O9 B! _- e5 y% F#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)/ H8 }& k/ \* v1 @. L' i
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
/ v" M: j# J  h2 G
% s* K4 C; y0 v4 |& }, Y* j/* assign the tl som board LED-GPIOs*/1 \7 |% }0 ^; r6 j5 z4 p# [# f) o
static const short da850_evm_tl_user_led_pins[] = {
" Z+ K! m& U/ q) p' o: ?        /* These pins are definition at <mach/mux.h> file */
, `; {2 O  u, R' r9 @' ^/ h, s        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
) s( b4 x) v, m) R        -1$ j. ~8 Y) W/ c( b4 @: e# q3 g
};
& k+ k* z2 X- v* |7 t, ^
7 ~: V( W4 D" p. B: sstatic struct gpio_led da850_evm_tl_leds[] = {' J3 e& b" C( }* A7 l
        {
, J6 u" i. D9 z5 B4 q                .active_low = 0,
- ^$ f6 [  ?; c                .gpio = DA850_USER_LED0,& k$ `* ]2 C/ A& f: j5 E
                .name = "user_led0",& s1 M! T8 D- V
                .default_trigger = "default-on",4 T+ `! t' r; {% i
        },
1 k2 _0 X- W3 D; ^& t. L' c        {5 }4 N3 j/ q: H# Z
                .active_low = 0,0 v# f# R0 `) ~3 Q2 u
                .gpio = DA850_USER_LED1,
* q4 q6 r. n# E2 j1 j7 V: V. w                .name = "user_led1",- s: E$ d" j4 Y+ I& `& c5 z
                .default_trigger = "default-on",, F5 b1 j8 }) y
        },( D1 f3 |7 W4 D( Y' r7 _8 y% G& t
        {
' K- p* o' v3 s+ _0 G                .active_low = 0,  A3 p8 U8 r  S
                .gpio = DA850_USER_LED2,6 d; [6 G" U& _( M
                .name = "user_led2",7 t! U- M) L& ~  q8 H) y
                .default_trigger = "default-on",* K4 l6 {! f' o5 W% p& f
        },5 @* c' l9 `1 _8 p% i1 ^
        {7 c# O6 I- T" W2 P8 j
                .active_low = 0,. E) j! L3 E' I/ s" f
                .gpio = DA850_USER_LED3,3 V3 @; W# y, x; Q
                .name = "user_led3",
) z9 n8 w  ?6 V8 n( K. o3 B( |- [                .default_trigger = "default-on"," g6 C0 v' ?! f3 V5 E
        },
+ _. |( @1 f6 g' k9 n8 U};
5 Z' B' Z; C8 s  {7 W5 h
& f  r. v+ Y) l; Zstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {5 t4 O; l; W+ M- T
        .leds = da850_evm_tl_leds,/ F! K. A9 \9 J" ~" y
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
" m/ Z$ f1 }. h7 R! s2 X};
8 T6 J6 k. g7 k6 y5 c0 `) b+ y7 g( d/ e* F( c
static void led_dev_release(struct device *dev)
/ P: _* _$ n' `$ {{
# J/ q4 j# M- Q};* l  h) ~! L7 j) l  n" |2 g& A3 N9 d

; K% {7 t, p8 T# f3 F3 Fstatic struct platform_device da850_evm_tl_leds_device = {# L* D! i6 I* n/ U0 y# E
        .name                = "leds-gpio",
4 k* r! }, d; M# \- Q5 t- d" J3 k        .id                = 1,. m7 o, d8 o$ T& L/ ~& _0 p4 {
        .dev = {
& Z1 a$ m' E: ~. W                .platform_data = &da850_evm_tl_leds_pdata,3 o8 f' V4 ~- O) g4 U. D8 X
                .release = led_dev_release,
7 ?% X( O! ^* w0 _: q* B+ ]/ @        }
* P8 N: K- N* I' T6 K  J6 J};# {6 @. w. R1 B. q# P" }- W
/ ?; B- j% z# i7 J/ D
static int __init led_platform_init(void), [* f$ G6 R1 K
{
; c' Z; n& o* _        int ret;
9 X4 q: w+ S7 R5 O0 O& x#if 0
7 f3 W& w( l7 i" V9 o/ N) L/ k        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
8 T& `. Z+ r" H3 [1 W        if (ret)8 n) {% d' o6 C' d7 k
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"( _! Z; Z) A; j' P
                                "%d\n", ret);
% ~1 S/ I6 t: a) }#endif  Q! i1 J/ Z* |. N. g
        ret = platform_device_register(&da850_evm_tl_leds_device);
2 q  ?0 ^4 K  _5 P% I( a        if (ret)
/ f7 A; F2 x# m                pr_warning("Could not register som GPIO expander LEDS");  Q( Z8 c' E4 ]5 D" w
        else
& F/ `/ v! M4 @4 H' W) }& U8 `* c                printk(KERN_INFO "LED register sucessful!\n");
! V+ _- G; t+ |2 [
1 f4 z5 x, t$ q6 z        return ret;
* G  H! G/ h6 ]2 t% r}
. B/ S7 k! r( k$ o8 ~* g: f! y; S
5 F  g! |& \* \7 @+ U4 R( G) S* Estatic void __exit led_platform_exit(void)
. ?( f- A1 A3 C8 g( @; P3 j{
; Z* U" N. N3 a" [        platform_device_unregister(&da850_evm_tl_leds_device);
) T( C7 l) d/ n( t3 ?2 W2 Z
" J3 k; |+ x* N! E% v: \# C& \        printk(KERN_INFO "LED unregister!\n");
' }: j9 D  a; `0 X, x5 s7 k}
4 [4 [, i9 }3 v5 I" W' ?
* k2 n; y4 h$ b) P9 Z: ?module_init(led_platform_init);; \7 G7 ?4 a; ~$ V! v
module_exit(led_platform_exit);
8 D/ Q1 F. d7 g& d7 G
6 V7 w0 |9 f! B$ E  }8 _MODULE_DESCRIPTION("Led platform driver");
. r/ q4 S1 H; E# R+ C5 FMODULE_AUTHOR("Tronlong");5 I( ^8 S  f2 Q9 h
MODULE_LICENSE("GPL");
( ~0 l1 X/ ]! t  K# I% o0 z  ]6 T0 N( u) Q! g' N2 e4 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 00:49 , Processed in 0.039349 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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