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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
8 {. O7 l6 _1 |6 J! l2 f#include <linux/init.h>
) n' @" n0 ~- Y# @/ x6 e4 r8 r2 y, A( r#include <linux/module.h>
  \# p# E6 [  H" B#include <linux/kernel.h>
2 l  a3 H6 S. D6 U* s#include <linux/types.h>3 v3 c, w' U8 N" G3 z3 s
#include <linux/gpio.h>
" {8 a6 w/ [1 H8 \' e; U8 B#include <linux/leds.h>
+ K# Z& b1 V: K9 E#include <linux/platform_device.h>
; H3 W4 E( F$ p* v4 [
& o# B% g( z' f#include <asm/mach-types.h>: \& Z# X7 j$ }$ `# ^: |2 k
#include <asm/mach/arch.h>
' ]  k$ H8 p! E7 @#include <mach/da8xx.h># }/ R- K9 z1 ^, j* Z
#include <mach/mux.h>* F0 M1 n0 A$ R( h9 v1 ?
) m1 h. x; v6 z2 i) \0 ~/ o
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)) @' J& }) {0 Z1 e. c  n
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
' G0 p* A- `& S" Y* S/ p#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)6 K8 Y1 W. ]0 w; `" S" L5 @
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
# j& s5 i( [3 e9 G" W; t2 C
3 {. _' i3 ?8 |9 L2 c" E, S" }/* assign the tl som board LED-GPIOs*/
! P8 Q) `) r9 q, m: zstatic const short da850_evm_tl_user_led_pins[] = {& O& k; l! j$ l5 c/ [# r
        /* These pins are definition at <mach/mux.h> file */
$ _% ]) l9 J5 N. K; a        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
6 W% [2 R7 W& ?        -13 I8 C9 G# J" F1 u. F# p
};/ m- `' ^  h7 w8 ^7 n
' j$ B$ X2 W  X7 I4 v; R
static struct gpio_led da850_evm_tl_leds[] = {
* }# K$ z/ |5 l        {$ {$ }8 ^! M, k2 G2 t1 w+ T5 _
                .active_low = 0,
5 j" d0 P: ^) g% U                .gpio = DA850_USER_LED0,
/ e$ i/ w, c( ?6 G                .name = "user_led0",
) Y, b6 Y& [9 Z0 |6 L  J                .default_trigger = "default-on",$ K1 @0 o4 K% ]3 l1 r% d# O
        },
5 ^% Z6 \/ C9 a; l" w- E; V        {1 N1 B- \- a7 {  o3 A" b/ p# V
                .active_low = 0,
$ N' w2 E- r! C# K# F4 y                .gpio = DA850_USER_LED1," p8 U2 F: ^7 Y+ p+ R
                .name = "user_led1",# b8 f4 ], w) O2 T( F
                .default_trigger = "default-on",
  q5 U( {+ z! A& D5 |        },- k. {+ I1 Y( G6 {9 [' c
        {
& ?  p( E& j. ]$ ^4 T                .active_low = 0,
- Z' V' w4 C1 u                .gpio = DA850_USER_LED2,
1 u5 ?) O" j. \$ T, t8 Z  L# i                .name = "user_led2",
* f; n- F) w$ H3 g- _6 a2 p( a                .default_trigger = "default-on",2 P% o% J" ]) B5 A( F
        },3 I, a5 r$ ~% D: H* G. e. ]+ P
        {
0 r- V6 E+ f9 c. b6 \                .active_low = 0,
5 }" Z: h2 Q; K: U( I6 E2 \5 b: |2 H                .gpio = DA850_USER_LED3,! ^# t- u5 C$ p. J3 ~6 K
                .name = "user_led3",
, c# s2 V, |, ^3 n( F                .default_trigger = "default-on",8 _8 E) H* P4 ]4 H; y  T" N
        },% s' a4 {3 k/ k/ @3 k4 a6 z
};7 ]9 q8 n2 q5 f+ i  B4 a$ C
* D* X* X- f, H2 c, p5 i0 m7 {2 Z# c
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
# m8 L0 O) I) H        .leds = da850_evm_tl_leds,
5 c6 q$ b  g3 m# @+ P! W% L        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),$ o7 @, y7 D( h# _$ Z
};  r! D! K0 e" ~/ W
4 t- i' p. P9 d% U& p
static void led_dev_release(struct device *dev)% ^+ j! H- ^/ j$ W/ K2 M
{' Q- Z6 ~; ~" W  z5 W, {
};
2 ^5 H% G2 }0 a5 I" }, w& }4 ]- q* {  o/ U
static struct platform_device da850_evm_tl_leds_device = {! \1 g' m9 _# ]; j: p0 `
        .name                = "leds-gpio",
  w4 Z! b% B# f9 ^9 @4 _" O        .id                = 1,0 W8 \5 P; w. ^
        .dev = {3 `& |1 P' i, A
                .platform_data = &da850_evm_tl_leds_pdata,
  C- g5 g5 R! J4 D8 O                .release = led_dev_release,) ~2 G. u" O' f" S9 ?. P0 g' ?
        }
2 q) U% N) T/ d1 O8 `1 }' @$ n};4 D$ v* Z: \/ g! l' [7 i' @
8 K$ ~3 I; w3 I! o: E" F
static int __init led_platform_init(void)0 j/ L' r  n2 L  K# K( t: s
{
- P! a$ \) {7 `) S) u- [        int ret;. T' c0 i/ C; K2 u. T* N
#if 08 _. Y* D; I+ J% b
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);/ E; |  W6 p$ b# l+ J8 ?
        if (ret)
! o& o1 N2 X" W( S5 Z; d                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
$ I: B- H- E  e5 f& `8 r                                "%d\n", ret);& g0 i. s* d; z0 [& i  S
#endif
, z$ _1 Y8 n: U2 F        ret = platform_device_register(&da850_evm_tl_leds_device);7 C1 j- y; V9 L# O$ N3 g& a
        if (ret)& H6 i# J+ t7 X
                pr_warning("Could not register som GPIO expander LEDS");
& A" Y' d3 P4 a/ s1 C0 [( a/ \        else
* K' S% B8 {# \3 r. ?3 Z                printk(KERN_INFO "LED register sucessful!\n");
4 \2 v) _# p/ [) ?9 p! u) s; @% n0 i' A' |3 E, X. }
        return ret;
; J+ F/ P: m4 X1 d9 J; E' p}
6 F- @$ {9 L6 Z1 e$ x& D# X$ K. _% p' u  h4 o, o0 Q
static void __exit led_platform_exit(void)+ X* q( h" z. M4 W% n0 R
{
; d. v! {) j) v2 C: q% e2 p0 b( _        platform_device_unregister(&da850_evm_tl_leds_device);0 q5 w: [  y, n& M0 T, u. B7 j. {! F) D
+ }$ u+ A/ A) T7 o* `# ^4 s( l! w$ a
        printk(KERN_INFO "LED unregister!\n");. ?: Q; |$ Y( u- X7 X
}
! R( n! T& m7 [+ S
3 q, s& k( a" Gmodule_init(led_platform_init);
4 n4 i, g9 i+ ^# l- |* w- s* z2 q4 Imodule_exit(led_platform_exit);
; }5 Q3 `$ c+ L8 K! u8 P/ R' d
9 H% A  I  T! P3 A+ S: ^3 JMODULE_DESCRIPTION("Led platform driver");
8 w+ \% i* O- C( DMODULE_AUTHOR("Tronlong");/ ^; M& B9 D$ [& W
MODULE_LICENSE("GPL");, V1 v: J- g# P" b/ n- z5 \+ d  _

% w+ T/ o7 V0 ~; ?5 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 14:44 , Processed in 0.043477 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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