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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
; R" G+ A; j9 X4 x. A#include <linux/init.h>
" q3 `  P% t+ u0 P& q9 V#include <linux/module.h>
7 x) ]. G# U: x& E: t/ o: e#include <linux/kernel.h>
4 g) a% K" d& d- p#include <linux/types.h>8 Z( ?" j) \+ l9 m, U" l
#include <linux/gpio.h>
, a( ~4 I$ |) K! x3 a. h#include <linux/leds.h>& S" r3 ?$ ]1 q: ]0 f- d# P
#include <linux/platform_device.h>
* i% ^6 Q& ?4 E" G: x0 [: I
5 r4 E. R* ?2 x! b& h& G0 @#include <asm/mach-types.h>0 L& W4 J) N  O1 L
#include <asm/mach/arch.h>/ x0 Q5 K' z# F* ~" S" i
#include <mach/da8xx.h>
1 l: O1 \* [# T* ]#include <mach/mux.h>2 @( H% Z; d5 N7 ?

# \: T* x" l  `1 Q( K#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
0 C9 A# j* D3 ^, Q( T; \#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
$ U  J3 |; u4 f% m#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)2 l, ]. i( @+ |  T: u& w
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)9 c6 W/ W4 @8 D, L' i; P; r& O

' c3 g8 D4 l' l. D, K, C' Q1 N/* assign the tl som board LED-GPIOs*/
$ A6 K6 X3 f, `. D  P6 c7 i( Mstatic const short da850_evm_tl_user_led_pins[] = {( w# B& P3 V. T1 N
        /* These pins are definition at <mach/mux.h> file */$ F9 H( Z9 Y& w$ w5 v% L  `
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,# O/ M& J; E9 \  r5 D1 ?! r
        -1
2 d3 O% L* s5 E3 G( b};" C  C) k4 K3 X* D

$ ]0 n6 S) L' w+ N9 Zstatic struct gpio_led da850_evm_tl_leds[] = {+ M, g6 [# n4 D, s) b
        {. `4 v5 O: j% [! S) ?8 ]9 g
                .active_low = 0,
2 U. ?/ j/ o; I' r. a0 b3 r8 H: C                .gpio = DA850_USER_LED0,3 M" E% t; X8 g" o
                .name = "user_led0",' a3 ^! R5 v$ t) ^& ?" ^+ u
                .default_trigger = "default-on",1 |/ i# _$ k# a
        },
) t1 L2 P( N* K9 r0 T8 L+ m7 u        {+ v2 H6 [1 {% F6 P* k
                .active_low = 0,
( N# N3 c; T# s( E& S9 [0 z& @                .gpio = DA850_USER_LED1,% Y! h, J0 a+ A, e- u
                .name = "user_led1",3 _9 O& M8 W) [4 Z7 k
                .default_trigger = "default-on",
% X1 E8 s* h. J1 f4 m7 S0 F        },2 V# [" y' b, b1 a* z
        {
" T; d# X, M8 x* N                .active_low = 0,
8 L' Z- f( T& ~" z4 `                .gpio = DA850_USER_LED2,
% U! y7 l# u' Y$ t' z$ T2 ]                .name = "user_led2",: o7 g* j# A  {
                .default_trigger = "default-on",; P, t+ M) |1 B6 S5 a  e* b9 i
        },9 _/ F5 `& N# B; i
        {" u* m3 c7 c- z& _( `* H
                .active_low = 0,0 q$ X" S1 l. H
                .gpio = DA850_USER_LED3,
& X9 Q1 \/ ~, i( l% `                .name = "user_led3",
$ U9 g* r. J9 u                .default_trigger = "default-on",- E0 K$ e  }4 h4 n( k, d9 i
        },
2 V* B! ~, h& T" _' {};3 o1 f# y/ d$ c

+ L/ u1 D* W8 |" ], S, f; R2 Qstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {& n+ L& b6 ?( C# ]
        .leds = da850_evm_tl_leds,
. Z8 m: z9 @* e1 l# e4 {! L        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
3 n6 u. L9 _" k* G  N};
+ a) g. M3 A0 z- t, \8 v
8 L6 [/ ^2 f, j! x9 s# z  fstatic void led_dev_release(struct device *dev)
5 R9 `' f1 Y1 _3 g' h2 @7 b1 t* x& [* w{
3 F% A3 {# n! U$ a3 V4 v};+ j" b. j/ F6 F7 ?, d

5 X8 k% l3 t. \7 ~/ Q7 ystatic struct platform_device da850_evm_tl_leds_device = {
- e6 `1 ^( q# ~- i8 l1 [        .name                = "leds-gpio",
: F  c! {: A9 F2 L0 e        .id                = 1,
9 m1 m, I' t4 z7 e& \/ ^        .dev = {0 b) m* L3 a" f! _) B% \
                .platform_data = &da850_evm_tl_leds_pdata,
' b3 x: g8 z* K, k  d& o7 @2 Q; H) B                .release = led_dev_release,
3 j$ f. s" G- P  `! ^        }
& Q& w0 w# l3 {1 N# R9 `  V};( H" t- V; {" u
9 [4 F- Q1 J# `$ W- t
static int __init led_platform_init(void)& f' C7 L. a$ A% o. a
{& F9 _) c* o. {& c; O4 V. E' ~4 k
        int ret;7 I5 U  {2 I, X
#if 06 p/ _$ c7 |* a" P( f% d
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);. P9 E; ?6 a" V: W9 H$ W
        if (ret)
' i9 R6 p9 h1 v! ]0 P2 H7 Z, i/ S4 j+ N                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
0 m0 l( y3 J! R' G1 H                                "%d\n", ret);
2 `7 |/ S: e, P, H- m#endif
/ R3 t! Z) R8 ^4 c, B7 A- Z1 {        ret = platform_device_register(&da850_evm_tl_leds_device);
  W, n4 p& J) Y  k  r" D+ X        if (ret)
/ W- _- Q; C9 G; d                pr_warning("Could not register som GPIO expander LEDS");. S& R7 f1 }, s/ `* a; e1 K$ O: e
        else
; V$ p, ?3 F% @5 R4 V                printk(KERN_INFO "LED register sucessful!\n");
1 R4 S+ t9 c* X1 z! P! q6 k
  F* O( R" G5 V  V8 g7 y        return ret;
7 o' R" N) X: Z8 K' w}
* [1 I) @' a- [. G7 W5 Q% D9 E3 x: T# d
static void __exit led_platform_exit(void)1 G( o& ]7 V% t. d3 c' d
{
4 a5 t1 N% c7 G4 L% f        platform_device_unregister(&da850_evm_tl_leds_device);2 ?# H5 y# d* m5 \$ q. _; y

  [) K: x& ~' w. o' {$ Y& M. _        printk(KERN_INFO "LED unregister!\n");
1 f2 R7 |8 ^7 z( }1 x}
0 T7 ^( v% r( Q
; R' ]! z9 o1 f  K5 u, D& hmodule_init(led_platform_init);
1 e4 R" D+ z1 G0 W" @! Y, kmodule_exit(led_platform_exit);
" ?" S% B4 l2 ?- H; C; c2 ?$ u7 b. C0 g& |2 A2 v
MODULE_DESCRIPTION("Led platform driver");. _  }$ |" B7 ]' S* }
MODULE_AUTHOR("Tronlong");/ \; _, J% h% I3 z
MODULE_LICENSE("GPL");. `9 W$ v; c; g6 y7 ?; A

" c$ U& A1 z+ q, V2 X; H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 08:03 , Processed in 0.041004 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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