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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
% n4 Z! {! n9 |+ G8 _' }#include <linux/init.h>+ P8 V1 z: Q, }8 A- r% p+ S
#include <linux/module.h>$ B- X% ~6 R' Z, w( {8 i
#include <linux/kernel.h>6 N8 b( ?7 D, b8 f
#include <linux/types.h>- t5 i/ y$ W  R2 N  |
#include <linux/gpio.h>  C+ |4 K/ ^( C" _5 {; y; N
#include <linux/leds.h>9 ?$ S: Z: O, A) g+ c7 o4 a  ^
#include <linux/platform_device.h>
$ b; n+ J/ I+ X' F8 c  V3 L; k) b# @! u2 E0 a5 f' p7 [
#include <asm/mach-types.h>3 h& K* W2 V) t. F
#include <asm/mach/arch.h>, T# C- b! u7 I* ~8 X" O! d
#include <mach/da8xx.h>- m( V/ T4 ^# G! ?
#include <mach/mux.h>
2 p( B1 {9 n  |1 h5 b
$ e0 d- ]* t7 ~" }#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)# b, c" W3 d3 n& R0 e: e
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
4 s4 s' u; M5 Z#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)$ t5 }! S& o7 F$ G: Q6 @3 K
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
* f; B# w4 J* `0 P3 o
6 I7 Q( g7 h5 |2 K( e2 j/* assign the tl som board LED-GPIOs*/7 C3 a4 S% w& `$ H
static const short da850_evm_tl_user_led_pins[] = {& F: {# M: m8 x8 y! |1 L2 m4 E* c
        /* These pins are definition at <mach/mux.h> file */
$ z: w8 |! Q- `% L/ m/ l: E        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
- p! X5 c3 h& J9 g5 c        -1$ \: f- E) f, W. \
};2 o4 |2 e4 J" F9 ]& G7 ?+ g+ B
) C' v4 x# d5 }5 q
static struct gpio_led da850_evm_tl_leds[] = {
: i: |! V4 J; B- u: t        {
- c. H2 v: Y" R5 M" C4 f5 S                .active_low = 0,# V2 i. c3 b' d; H
                .gpio = DA850_USER_LED0,
* m4 t: C. H8 G. q) v                .name = "user_led0",
# o4 P# w2 h+ K                .default_trigger = "default-on",
  `+ S% s5 a, l        },, |' f6 |5 F# p8 n: Q
        {0 E* s& `6 l6 n" {' t% C% c" s* Z
                .active_low = 0,+ c9 C( w$ r2 O. W
                .gpio = DA850_USER_LED1,1 i4 E' g  ?9 k: m
                .name = "user_led1",
: Z7 I; r4 b% ?& Z3 b                .default_trigger = "default-on",
+ @1 ^/ m, d6 @+ Y( a- {6 o" r8 l        },
  n5 U  r9 }! |: v( K2 ~        {, s" M2 ^$ b: a4 L  f- r
                .active_low = 0,
3 e! e$ t9 [) |                .gpio = DA850_USER_LED2,8 _  O& b- R' P0 q  F
                .name = "user_led2"," O) a5 c' x) a* @) B
                .default_trigger = "default-on",
6 y5 F+ [# F2 U; g8 f        },
' `$ \- b; g2 ~8 e. ^. B        {
, d- O  I% S/ }, a; Y3 \$ T                .active_low = 0,
( O/ \. ~5 c6 S5 Q/ S$ O) O                .gpio = DA850_USER_LED3,
( v, _3 q# [+ g- o7 g                .name = "user_led3",
3 k, A% H; A, X1 l7 y( j1 D% q                .default_trigger = "default-on",& S% h2 X1 j% s& ?
        },+ H' u: E- u* e; ]* @
};4 L) X8 k/ y  E5 \4 C1 V* b
; E  S0 o1 y  x$ F4 j. Y; R
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {  s' J. W; M; ?" U! j
        .leds = da850_evm_tl_leds,  R% z; p+ u9 [9 }
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
0 J1 W8 K6 r: {- Z, c6 v2 V};
8 J  ^$ i& f! w( ^) W2 x4 q/ Y$ t- o1 E* [7 h! v
static void led_dev_release(struct device *dev)
7 n% t4 J6 E( G* w) H{
  A! {+ N; f( e};
1 F4 w" n' f  \% t( [5 H
  g- X, E0 n8 N$ B" Zstatic struct platform_device da850_evm_tl_leds_device = {
3 ]2 B4 V' o5 ]5 [( e) Y$ P        .name                = "leds-gpio",
3 y; o. W+ |. z0 \1 [        .id                = 1,
5 `% t1 K  n. Y/ k7 r        .dev = {0 Y* `% a1 z# O! c
                .platform_data = &da850_evm_tl_leds_pdata," E* |1 @! v$ i8 _1 V! X
                .release = led_dev_release,
- I: Y# k1 h; A8 X3 w        }& @6 U% w$ R; w. Q
};
0 X5 Z% K$ r1 M" L/ j5 c
$ k- {/ [- u) j4 z4 ]1 U& lstatic int __init led_platform_init(void)# o/ z) B3 N" _9 a& m4 b* p" s. Y/ F
{
0 L' K; A$ e9 H& u0 i& Z  l7 J        int ret;
. J4 c6 J9 V* l9 X+ {2 {1 h#if 0
  S+ k1 D0 F# W        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);. t5 R- c' T+ j( Z; U
        if (ret)* Q, i' s- S( o
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
$ W% r9 @. R3 k7 _! F& `                                "%d\n", ret);
7 i+ k5 ]  h/ H, ?8 z#endif
. c+ g/ E5 `! h1 H3 \0 |! X1 |        ret = platform_device_register(&da850_evm_tl_leds_device);
  G# {/ h4 X; ~+ t9 j& ^        if (ret)4 T# I4 ]! u1 ?# N1 ~& H
                pr_warning("Could not register som GPIO expander LEDS");/ `) K5 x/ {/ e* A' x4 H3 X
        else
' l2 y: \+ ]' ^6 `- x& }4 x                printk(KERN_INFO "LED register sucessful!\n");% p# \# l3 t% [: T7 w* ~+ Z

% x# _6 O1 @; k5 ]! r        return ret;
2 D6 C, M+ J% K8 a% @% Q8 k: \}- O/ l2 }- k$ K: L3 X# R& Y$ R

" Q+ K, u5 S" i; y' X4 U2 sstatic void __exit led_platform_exit(void)
# Q! I5 J7 h0 @8 H{7 S3 H; J) v/ L  V
        platform_device_unregister(&da850_evm_tl_leds_device);
  X0 ]* P2 n( `$ D' {/ ~. m
0 b$ h- _/ A0 L% \9 I        printk(KERN_INFO "LED unregister!\n");
" W& L, O/ h% x1 j; S  A( f9 A}8 ?2 u# D7 R0 V5 m" ~2 b' R% H) j

6 g8 e% O2 |; v/ L: qmodule_init(led_platform_init);% L' X7 ?2 H3 w; D2 L8 ~
module_exit(led_platform_exit);
4 l2 N0 g2 c5 |* ^1 `8 H9 m0 f
" T  Z5 Z3 t( m9 V, [8 lMODULE_DESCRIPTION("Led platform driver");) L( j! B3 S$ ^8 B$ A. G
MODULE_AUTHOR("Tronlong");
' L+ V, q- p3 B6 dMODULE_LICENSE("GPL");# B3 `6 ^0 A, Q5 M& M
( O* Y( r% t4 X: {! A; N. F8 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 01:15 , Processed in 0.039042 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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