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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
0 z' F3 M/ @' t4 B0 c+ ^/ h8 `#include <linux/init.h>$ S! V: k7 @; N0 d
#include <linux/module.h>
  L5 F& |+ q) \- a% e' t#include <linux/kernel.h>
9 c% E6 G: ?* h4 ^( Q' w#include <linux/types.h>  N, B" G* y, F+ C3 L+ N
#include <linux/gpio.h>9 f( ]9 ~3 u3 J$ f# I$ u3 h% @
#include <linux/leds.h>3 w" Z* s8 L# F' v& e) P
#include <linux/platform_device.h>; c3 W7 X: Q( B& g- c$ S
( b2 m  N: I. |+ w2 A
#include <asm/mach-types.h>( ~% p" o/ s+ S- Z% O& t. \: D4 V
#include <asm/mach/arch.h>' q# j7 F. q: o4 ~( |
#include <mach/da8xx.h>
" X+ A1 y1 x" z& r4 P, X#include <mach/mux.h>; S9 f. P% \5 T5 H" v; q

" _& c4 U% S1 H1 {3 d7 o" L#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)+ D; ^  g, I2 C+ M
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5), K) c2 w$ o3 H; e2 I; \4 t
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1); }- ?# ]1 x' o! D4 g
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)6 i8 y3 C$ m% d$ P
' I- ]* L  _: @  O% b7 k  c
/* assign the tl som board LED-GPIOs*/
3 m5 ?4 J# |2 ~2 d/ F" dstatic const short da850_evm_tl_user_led_pins[] = {
& b! h, c  g0 G  G" F9 @$ }  l, F" U/ d        /* These pins are definition at <mach/mux.h> file */) t0 \% i3 Y+ s2 {1 T
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,& K/ B4 F- _3 v. S: e$ y$ J2 c. M
        -1
8 A! n6 d- y* D/ n; G8 B* R* P};" t% H( ?' Z2 I; E! q
$ g' _1 R9 `$ R" b6 [
static struct gpio_led da850_evm_tl_leds[] = {$ f2 D: U' |4 L. ]9 Q. D
        {
+ {/ H+ Z- c) G- V% }2 U" ]% D                .active_low = 0,0 p2 P$ G6 {0 g; D
                .gpio = DA850_USER_LED0,* k" s0 l# Y- \7 d$ t
                .name = "user_led0",' @3 d) r1 V* o* o; t' x! Y
                .default_trigger = "default-on",
# ~4 d- h' Q# U  D+ K8 v2 q- S        },
8 Q6 ]  ^" P2 i1 O. }, v        {
# C3 X" m" J8 N2 e7 t                .active_low = 0,
7 O0 d' ]/ X% P2 G2 g( o$ b" P                .gpio = DA850_USER_LED1,
  v6 O7 j& d1 U  y( `: E6 ?! j                .name = "user_led1",3 [8 t' d, h, ^$ B0 V
                .default_trigger = "default-on",
1 d( C% \, j. q        },& X# L: a  s# @  g1 d
        {3 \* X( \4 z& `+ D5 C7 ^9 L5 C& S
                .active_low = 0,' ^. U: L: y# D* z  e
                .gpio = DA850_USER_LED2,1 ]7 t6 b# z5 d2 e
                .name = "user_led2",
% n* \! ?: s6 R                .default_trigger = "default-on",
0 ]) u/ u2 {, S: k. G4 w8 }        },4 ~0 J8 K6 c: O# Q8 o+ x
        {
2 `" K1 F7 E" D9 `1 B  v0 N                .active_low = 0,9 r  ]3 v  l! ]5 X
                .gpio = DA850_USER_LED3,7 ~1 d( U$ O+ f1 L+ a( I3 t' q# Q
                .name = "user_led3",
$ k+ @% L# D7 U                .default_trigger = "default-on",
1 O: e1 y0 I2 n1 \  {        },# v1 A4 S& T( ?" W! I5 l8 F! \
};% J7 }& C& W5 L+ P; n! h! B
* k$ n& X& J- u
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
5 {+ I/ E, t/ P$ e2 ]+ _        .leds = da850_evm_tl_leds,
4 e7 d, n. k5 y5 V) N  R        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),. }/ a. C4 ^. ?0 y/ U
};
, g: o6 k2 h: |2 k$ T/ S8 P
" e& I# Q, L  G" M8 Q' fstatic void led_dev_release(struct device *dev)
0 c0 e& R* Q3 R, }{- W2 [7 g( T3 ]5 P* }
};
& C; o$ w2 n: Q5 C& t" w$ D! d3 s! |$ R
static struct platform_device da850_evm_tl_leds_device = {
$ d! Q) K+ r+ B  ^4 F        .name                = "leds-gpio",5 I! [9 [" P7 l/ R) k: f
        .id                = 1,
" C3 L! f3 P& ?! U$ f* ]- {8 ?# b        .dev = {
& X3 z" f. {% o: L, ?; B( x0 @  t                .platform_data = &da850_evm_tl_leds_pdata,3 a1 c. ]5 E6 x
                .release = led_dev_release,
* [; q7 L5 r! |. A: K2 F        }2 K* Q3 K  X- L' y" p+ J
};
! Y2 h$ Q* _2 o- f) f/ r: z$ w; n
static int __init led_platform_init(void)
9 T4 d% `3 Y2 X; C% H% E{6 A% [% |, E! A% h1 e; m# x
        int ret;
$ a' D  P; f6 S( ^! ~#if 0
# n' I; c' E- R! `4 }5 ^8 |/ P$ c8 j        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);. J! h$ {6 q, o% K+ K- Z
        if (ret)
2 e6 Y7 _/ e/ ]: x& D1 n. |                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
. J/ ?6 w* Q1 d- C2 f, c                                "%d\n", ret);
% b, b- R$ K& h3 m. c9 k7 o#endif
; u2 A2 Y! K8 r9 s: Z) r        ret = platform_device_register(&da850_evm_tl_leds_device);) H$ t! z. ?: }2 h
        if (ret)
4 F1 t3 }' l1 ^$ q                pr_warning("Could not register som GPIO expander LEDS");
3 u# Q9 R5 C( L3 r        else
2 J1 N8 V' i2 Z/ N) h                printk(KERN_INFO "LED register sucessful!\n");
" s% P: \% o2 a; @6 B( S: W
6 w9 S" p, U# G6 [        return ret;
& G  e- ~. ]3 Z4 Z% |' h5 g3 O}
; p! K3 |( g5 s& H3 c3 f! O1 Q, H2 g# M8 s2 H& W
static void __exit led_platform_exit(void)
2 g) z. d! O1 U. ?* d# U{
* T$ @) y! z) [        platform_device_unregister(&da850_evm_tl_leds_device);
2 Y: P1 P$ @) L& t' x
; }/ e. h9 v  T& Y" `& b6 B* i        printk(KERN_INFO "LED unregister!\n");
1 \# T+ L8 V# ~" \3 ]3 H1 U% ~' P}
- M: w$ h) w" Y' ?" W* W- z- W
. E1 {+ C0 j0 p. H% t! Z' Kmodule_init(led_platform_init);' a' u( l/ ^" i7 R5 k: q
module_exit(led_platform_exit);+ u# T5 [3 E& ]7 ?, U
# l  F" s5 f+ R+ E- s2 e
MODULE_DESCRIPTION("Led platform driver");" ]0 k: L' H, m& ^5 O$ X' e/ D
MODULE_AUTHOR("Tronlong");# ]3 f! Q$ V6 ]" m* F
MODULE_LICENSE("GPL");5 U- F# H6 q. G, _% e5 F
7 p) H5 e# X# d; h  S) A- C  p: N& Q5 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 22:28 , Processed in 0.039804 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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