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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。2 p2 t. Q1 E9 G0 L* Z
#include <linux/init.h>5 z  ^# t+ [; Q4 a6 {) u2 K
#include <linux/module.h>
: Z& w) X% v. e6 R4 p. e#include <linux/kernel.h>
9 N9 t! S% {; z#include <linux/types.h>
' Q/ t% ^" G& l: |* g#include <linux/gpio.h>
0 t. l& j! O! u4 s0 P- `#include <linux/leds.h># |+ U0 B8 |5 \" s
#include <linux/platform_device.h>6 Q8 G7 S# U" {3 T: d& K

6 g- E# f7 Q/ b! u( S# y( w#include <asm/mach-types.h>7 H: ?( z5 ^) M! C
#include <asm/mach/arch.h>
9 ?8 y" R" D3 n6 c9 ]2 H6 ~5 C7 l#include <mach/da8xx.h>! h  \. D; E1 p
#include <mach/mux.h>
% ]% B3 }( F' t8 [4 b, ^. @" c7 H4 K; M6 J
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)4 o/ L/ t7 \* i( z4 d  u4 |
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
+ Z0 J" o5 K5 b# i9 k9 K) ]* U- T- ?; @#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
8 S1 q  F" K* |1 K( x5 N7 E+ O$ Q#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)$ B' u6 w: M% q8 I! z! o
& m# c: J' K$ w6 t0 U& |
/* assign the tl som board LED-GPIOs*/. G) _; J8 F* l4 d, v9 C
static const short da850_evm_tl_user_led_pins[] = {, p# S% j8 t" ^+ \% {1 M) q
        /* These pins are definition at <mach/mux.h> file */% x* r! ^: z# `1 Z
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,2 n  {; t$ G" \
        -1
6 ~4 J8 _1 ~, }};
# V; Q& ^0 G+ l7 E8 p* t  T5 C5 E. b) g7 S. P
static struct gpio_led da850_evm_tl_leds[] = {
/ P7 t/ \/ O7 i3 ^  S% p7 ~; U- u        {- O) b# z+ p4 z$ C& u0 L+ |2 W
                .active_low = 0,
( K1 `  B; a( {8 A+ f* V                .gpio = DA850_USER_LED0,1 b& V9 D# N8 i
                .name = "user_led0",+ P# [* y. S! _, S, ?( w% c
                .default_trigger = "default-on",5 |* e# e7 O( U
        },
9 M8 q5 i/ x& o/ K8 m0 I        {
) `  L; v) o9 c* C: `                .active_low = 0,% A8 @( u# |# E
                .gpio = DA850_USER_LED1,
$ ^8 Y4 |9 r+ K" u3 R+ {                .name = "user_led1",
; S) \. b: C8 x" a) @- h3 S& j                .default_trigger = "default-on"," ?/ z1 ^; O+ X. i! p3 y
        },1 i5 ~4 E' |, E
        {
! q! o: A6 j; c. d+ U5 n0 Q, B                .active_low = 0,
8 N$ b) g- M/ x( B! i1 z                .gpio = DA850_USER_LED2,! Z/ s& F5 T" o$ C4 j1 E
                .name = "user_led2",& Q0 s1 ^3 B+ p
                .default_trigger = "default-on",
* @6 `4 V0 [. H* U' U  {: Z, T5 o        },% g. f% M# @7 u7 Y% E% u
        {8 S; w0 J4 z  @
                .active_low = 0,
( o: D' X: P6 N                .gpio = DA850_USER_LED3,
& t7 C' t; F0 q4 P# G                .name = "user_led3",6 J2 D- E7 q' D$ w
                .default_trigger = "default-on",
3 E2 V. R+ U1 o6 q" W        },
, Z5 \! \% j$ X1 z};
+ ^! R; {, t" Q* K$ E7 W( g- t9 B0 {3 t8 v4 i
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {  }7 Z* U- B# j. ?+ h
        .leds = da850_evm_tl_leds,- k. g0 y' b+ Y: Q( D, R5 G* F, b
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
! `  M4 P: E0 }# `$ k- y2 Y};4 p9 m6 s/ W* D

! y+ n5 B  V. d* h8 X5 F! B" Estatic void led_dev_release(struct device *dev)' `4 V5 W9 ]& u1 ^4 M7 n
{
1 W! M+ M2 w% u4 u1 o};
" Q1 r# y! k( ~" J0 u: M2 [2 v
3 S$ B6 {# j, s) @static struct platform_device da850_evm_tl_leds_device = {
- y. r7 @  ^- E( a) o( n  q9 N8 c        .name                = "leds-gpio",
4 @* Q$ `$ I9 [) L9 \: _' A        .id                = 1,: d0 |, }  ]. j1 _6 R( r
        .dev = {
" O( S' B! f" F6 ~# U/ \; x                .platform_data = &da850_evm_tl_leds_pdata,
' b( ~% O8 \5 g: c                .release = led_dev_release,
+ U5 l& I: q4 ~/ @: B        }
4 Q* c7 B, G! y) b- L: J' \( I: T};
; ?' }! [, |* |
1 R. ~# @. h; b, }1 h# K/ pstatic int __init led_platform_init(void)
* {, O" k3 i) [{- ~8 e5 @4 Y& ^2 G5 L7 U
        int ret;5 K9 [* H; c3 H6 i9 b
#if 0( i! g3 z. x2 J; {1 f/ x* m
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
1 c0 \9 O) r6 \& q9 F        if (ret), I/ |8 s+ V) e- U5 @
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
/ n- f& j$ m0 R* g1 k                                "%d\n", ret);* H% C( U4 M- w8 F* u* O! ]4 c
#endif
! q2 P% m* B* j        ret = platform_device_register(&da850_evm_tl_leds_device);3 M, E% Z1 r% J- E
        if (ret)
" Z# I2 W7 V7 @                pr_warning("Could not register som GPIO expander LEDS");/ t" |2 Z$ j1 _" J5 g4 a
        else
6 H1 h' k# \8 p7 r+ y- c4 h                printk(KERN_INFO "LED register sucessful!\n");
" U2 C7 ^# r/ ^6 `$ b, o/ ^$ H3 E
2 v2 i) r  N3 e" h! G        return ret;
- x* i! o5 A. y- Z/ q}
2 `7 k3 V" y- R$ ^
2 a9 |7 f6 i3 vstatic void __exit led_platform_exit(void)7 p9 q, Y  o6 c% m( I6 c
{& l- o% a# @5 V2 d" m/ H' n4 f
        platform_device_unregister(&da850_evm_tl_leds_device);
" y; t9 A& d9 l! b  {, Q, K  x- C- H/ X
        printk(KERN_INFO "LED unregister!\n");) Y, [0 e: i" M) G8 Q5 `8 q
}& X7 h0 f2 R, J) X% [) n

2 a/ b8 z% [8 g2 [module_init(led_platform_init);! K1 r* `6 m. g( ?- H. j* u6 H8 L
module_exit(led_platform_exit);
% C! S5 {8 o. x8 U" @) Q( l. L( C+ N
MODULE_DESCRIPTION("Led platform driver");
0 p' u5 T; S/ M- ?MODULE_AUTHOR("Tronlong");
& i: `! a8 p0 y0 V8 l3 V  ^MODULE_LICENSE("GPL");
* x( _1 a2 j: H* Y. I5 ?/ S( M9 d
0 h. ~* T+ U, M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 09:34 , Processed in 0.039405 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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