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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
8 R6 W( K! d8 O' T#include <linux/init.h>! h; r2 A: p( D! b
#include <linux/module.h>
, C. J! ]" _: }9 z. k4 n2 n7 \#include <linux/kernel.h>
# O1 p+ B6 T1 S#include <linux/types.h>$ r. v. i% Q4 n+ c$ ?
#include <linux/gpio.h>
  X, l# l( `" f! r: G5 ~" B" O$ M#include <linux/leds.h>
" V1 L& p" Y' z1 _#include <linux/platform_device.h>) X6 o1 r6 l' b3 E" u$ e% k8 P; u
2 w- Z; _; q* r. C5 e1 T
#include <asm/mach-types.h>& v% Q$ d4 w- V8 |
#include <asm/mach/arch.h>
' {1 `' }% d  W( D  l#include <mach/da8xx.h>) k; I6 N' M( v: X2 J  p" L/ V
#include <mach/mux.h>. G9 b9 i- F" y7 ?+ x2 n# f- v
% a2 i/ Y% ~" S4 V: x  w2 U1 b1 o
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
9 Z* w, z6 y4 v/ ~5 N#define DA850_USER_LED1        GPIO_TO_PIN(0, 5); q4 ~0 i+ o- `4 |$ T& Z
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)4 N7 k# K) o1 p4 a/ @3 Y
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)" ]2 Z& t8 \" {: D# w; Q

+ R5 J- A9 n' e' U- k7 H, J/* assign the tl som board LED-GPIOs*/
( g9 i0 v% E8 Z1 _5 T( Nstatic const short da850_evm_tl_user_led_pins[] = {
- v9 A8 ]& i' Q6 p9 B        /* These pins are definition at <mach/mux.h> file */
& C6 I; S2 T/ T) c        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
2 i4 U. N6 y# |1 g+ i3 O2 L! Q        -1
3 r9 J1 E: }# i+ }};5 r9 j2 K8 E' U$ l/ C3 J  \

) b7 n8 L0 q6 H2 t+ G2 zstatic struct gpio_led da850_evm_tl_leds[] = {/ U0 }+ ^" S# w0 {2 h4 b  e
        {
3 ], V+ X" \, r6 L4 o4 P                .active_low = 0,
1 l& s; l, E! ^' W0 m                .gpio = DA850_USER_LED0,2 U- {" h- @& y! m) b
                .name = "user_led0",
  W3 t) G% {( Q* m4 U) P& n2 E                .default_trigger = "default-on",
8 S' @$ J, u6 p        },
* U: U" p3 {) X% @/ C        {
, i5 t. J# `5 a- f; f1 Q3 u+ L  v                .active_low = 0,
: v% M: Y8 W' \1 V: G                .gpio = DA850_USER_LED1,
3 B) J) l  U8 F, B  C                .name = "user_led1",
8 q9 S- D3 v4 l: `0 i                .default_trigger = "default-on",
/ g$ P+ ~, P& z% B# K) f1 O5 O        },
! B0 K3 a7 g0 h7 [        {
8 z: ~9 e# ?" m6 }" b                .active_low = 0,  x) @& N0 {& v# y1 s' X. l
                .gpio = DA850_USER_LED2,- ~. f( c3 D. `0 P3 S1 _! M
                .name = "user_led2",
5 B7 x' P! U5 B! F                .default_trigger = "default-on",
$ `& _5 D# n  S; _* D. n. D        },( j: K& G8 K5 b8 z5 }4 V
        {2 |5 X6 I' q1 K# H  ^, ]: ?, e; X
                .active_low = 0,# M4 r" b/ g, O0 [
                .gpio = DA850_USER_LED3,, b2 ?8 [# i% p3 Y2 G4 y3 t
                .name = "user_led3",
9 n- j, b3 m) _                .default_trigger = "default-on",
' C7 V, R7 ^' O9 P' u; }        },
+ u% b2 b) |* z8 y. v0 ?/ M2 L};. m1 _' p# X! l2 n2 t& [) C+ K, l

8 f+ E/ D' ?. Rstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {, U2 s8 Q: s$ H) z% ~
        .leds = da850_evm_tl_leds,- A8 l3 v& P' d1 r3 q. ~# k
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),; d8 V& ~, P. p3 b- I  S, U
};
- F7 _& @- y( a) P2 i6 _/ }+ K- x$ I, G. f
static void led_dev_release(struct device *dev)
$ |% s  I7 k/ Y* j+ N{
9 ?. L! L3 I6 [};  C5 c) o( u, X/ c- g  b
4 F. u6 k; B: W; `0 Z8 J
static struct platform_device da850_evm_tl_leds_device = {1 e7 Y3 `1 ~1 n9 X3 e
        .name                = "leds-gpio",& e" O" a! @' Z9 s# f2 \+ @+ I1 V
        .id                = 1,
4 |. e. X# g" B3 [, s        .dev = {& |0 Q. t/ W) w
                .platform_data = &da850_evm_tl_leds_pdata,
3 t8 J8 w2 F% V4 }1 w: B0 ~                .release = led_dev_release,
6 o0 ^0 A$ O9 v8 e        }
: d1 l# V( i7 g- v! ]# N( k};) N5 ^3 ]0 L5 f) G" y: P
8 W" c7 A- b, g1 M1 _3 G6 E
static int __init led_platform_init(void)5 |' S; {- ?6 k% e
{
0 K" z! e  B% ?- V        int ret;8 X% u% W4 q9 c! O# b* K! _
#if 0
( N& a4 N% ]4 q4 V) j: z        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);. V4 F1 A6 r: X6 T6 b- _' S
        if (ret)
8 P  O* m  [+ Z3 D7 t0 ~% Y' U; R+ S7 U                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
8 b7 ]9 u" F% c0 n5 H) t, A" _& [                                "%d\n", ret);3 {7 j2 F6 D: `: L6 j2 Y) A- N! I
#endif1 i5 b$ J0 Y- n0 f# B# M% C
        ret = platform_device_register(&da850_evm_tl_leds_device);
& _- I  `/ ]0 A: _' ~' x        if (ret)0 f% X' G( X" G7 b
                pr_warning("Could not register som GPIO expander LEDS");" h$ e& Y6 ?7 i; g* z
        else3 x9 m) E# ^8 l# L" ~
                printk(KERN_INFO "LED register sucessful!\n");9 W9 t1 E4 Y* t! ?" J
  Y: B  L7 e* _5 u# h, b
        return ret;
6 v/ f- p: r3 c+ j! D/ D}0 G% ~0 ^& {# n
: Y5 d; U8 i, d0 A: X5 U) m( j3 M
static void __exit led_platform_exit(void)& s  d. s3 R+ Q) e
{
  B, _& B2 K& f! H; t3 X* g* m        platform_device_unregister(&da850_evm_tl_leds_device);
. r/ m" E3 U  V7 r0 L
3 z' T, y$ h6 Z' ?. C2 Q  F: }        printk(KERN_INFO "LED unregister!\n");
. z% \9 D/ H) [/ z; ~4 L}
& j) q4 ?: l( q9 Y* f" X# X' D% I; J, y7 f6 r; V
module_init(led_platform_init);5 R+ ?  p! M& `/ g
module_exit(led_platform_exit);' R  ?# G8 y  w/ Y. g9 m9 U
6 Z2 C% m$ Q4 I  I8 d3 A. @2 O) j7 v
MODULE_DESCRIPTION("Led platform driver");
) J; }  }8 m& v6 U# c) D$ P6 wMODULE_AUTHOR("Tronlong");
: T  ]- j# R8 V8 XMODULE_LICENSE("GPL");
# m; h. G0 Y" s: L$ r& q- U$ s' D( Q) v+ ^* Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 03:12 , Processed in 0.039514 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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