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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。* p6 ]  y& i; O( G8 y; x* y
#include <linux/init.h>
" Q/ j; z' g0 X+ p( q, q4 l#include <linux/module.h>
7 z3 f+ C; G% U#include <linux/kernel.h># b! u6 f: _( l8 L  Q2 w
#include <linux/types.h>
. F4 _: R5 m1 V! V+ M$ w#include <linux/gpio.h>
' @9 ]& ?$ y- U% E: X: ]#include <linux/leds.h>
  F& `, G' Y8 l! g7 ^: B8 D#include <linux/platform_device.h>
) [5 Y* g; Y' x' I: d
7 u/ S1 n* N$ P9 ~9 g& Y#include <asm/mach-types.h>
4 {# M; C6 q! W#include <asm/mach/arch.h>
$ D- y4 a- S% Y8 X3 L- l) G3 n#include <mach/da8xx.h>3 p+ ]6 N) m- w  m. s7 h  `7 K
#include <mach/mux.h>4 B% p7 A- ?5 Z( ~8 m+ k

6 y! Y1 b) X5 `& k) @- `#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
, m4 U6 o) t; E8 w! W#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)( K1 m' u) }: d: y. t, S6 _" a$ @
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
* Z: O% l7 r( g# p#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
: p6 Q: K( Q& y
# p$ r. f' p( a/* assign the tl som board LED-GPIOs*/4 K) Y8 ~1 k. R" m% b! ^8 B
static const short da850_evm_tl_user_led_pins[] = {
' m! ]/ k8 Z- b  I4 W3 Q        /* These pins are definition at <mach/mux.h> file */
' R) w- ~7 b, F' D, Z        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,; R  ?8 D) X+ t9 B" ~. N6 u, U
        -1* l  r0 R3 v8 r, y; Z% f
};' @5 {- k7 v5 G. N9 w- ^! C/ k
; Z; Y9 @- d7 B1 @
static struct gpio_led da850_evm_tl_leds[] = {
1 g7 m0 m1 f6 Y/ `$ X4 Z* |) ^        {
  {3 ]# C' [  H' u8 G9 S+ r                .active_low = 0,
* q2 c$ u  ^6 v% O4 R6 H, `  j1 ^                .gpio = DA850_USER_LED0,# S& i! W+ E0 M  Y  e
                .name = "user_led0",
3 l4 M! b9 j& c4 ^- F                .default_trigger = "default-on",
2 z- K" f" F" F% t        },. F$ \6 o% A1 o. t3 p% N( B
        {
! H( x+ J  F; Z; \                .active_low = 0,
; W% M. @! o. n! R& B: F" X# a- y+ K                .gpio = DA850_USER_LED1,# H1 C: O- ^4 f% R
                .name = "user_led1",
- n/ ~6 ]% \! H$ z( ^1 j                .default_trigger = "default-on",- \, ~& x( D# C$ a5 e$ o
        },4 e8 Y& q* {& w2 E: Y: P
        {4 M5 S. M+ h' s, F, G" w6 n
                .active_low = 0,, J, p* ^8 c1 q3 S' E
                .gpio = DA850_USER_LED2,
5 Y0 g7 H( v  `& x                .name = "user_led2",9 M6 Z* V9 r9 H' C0 k% {
                .default_trigger = "default-on",
5 q* x9 ]% @. W9 I        },6 ]* I0 q8 |0 o. q/ h0 p
        {, Y) ~* V' B( L
                .active_low = 0,
: c: `2 s$ F8 k/ q4 J( {6 Q  Y                .gpio = DA850_USER_LED3,
8 `5 W' X: v) [                .name = "user_led3",
, Y$ d) w( A; Y                .default_trigger = "default-on",: ], N2 y; G& O7 C+ x2 |7 X' U) F! `. v* d
        },4 Y1 M6 u% ]: C
};
+ R3 U# d% V! g: t- @
, U! l1 e* [+ O8 _# ~static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
$ I( Y" x! \# c5 o( {, \        .leds = da850_evm_tl_leds,9 N0 C6 o6 _4 f8 ?/ g
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
. i( w5 a: A: N$ ~2 [2 v6 q* O};
+ A  i1 l1 |" t1 t& x( D4 z6 G" E6 s, v- T9 ]2 t9 J
static void led_dev_release(struct device *dev)9 f8 {7 X3 N4 g
{& ?1 {1 F" b* ]
};3 i/ G4 n/ f& n  ~

7 W. o3 e$ n( s# y' ~! G  _" \static struct platform_device da850_evm_tl_leds_device = {! H3 F/ X: T) c6 w% D7 c; x8 d
        .name                = "leds-gpio",
! l7 \% C7 |3 _* q        .id                = 1,
; I5 F; \% X1 f( @# R- A        .dev = {7 L1 t2 Q3 A/ n- U
                .platform_data = &da850_evm_tl_leds_pdata,5 ?8 m- k1 @+ F- _/ Q& D5 E1 t
                .release = led_dev_release,8 X& y" u3 Z! O: X4 a3 l; a, _
        }
6 b. ~& C. F, A3 f' Z% y  q' z};) v# D* e" n3 E. Q& @: g) \' j

, \  O/ K8 n: b% X. \2 [static int __init led_platform_init(void)3 X1 w# j) O1 x# ]$ a5 M; X3 k
{
! @) w7 S: d# f+ b' F3 m' ~' z. v' E& S        int ret;
! C; c1 _  ~, |7 h- e. g! j#if 04 H9 ?9 Z$ T7 p" E( a/ l- [% _
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
4 l# F2 T) h2 W        if (ret)
& S" N% U) r$ S& Y2 d" |5 e                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"8 C9 A3 L" m7 w% e* w$ V
                                "%d\n", ret);
5 K7 y. y, z3 r) L* J; l#endif4 {( J& n; ]& A4 B4 c. K
        ret = platform_device_register(&da850_evm_tl_leds_device);
  ^$ h* v7 Q0 J) m  b        if (ret)
6 u) A9 H2 y( W                pr_warning("Could not register som GPIO expander LEDS");% N, y* X; z5 a- J$ X# ^0 R7 P6 O, U
        else
. C2 A, w! Q3 W8 p# ~4 a2 U                printk(KERN_INFO "LED register sucessful!\n");
" h8 f1 j& h8 }$ Y( R
& H0 B0 p4 z  `6 X" T4 D        return ret;1 a  c  K7 n  c/ \: u1 f0 {; D) {
}
, Z' ~( k! c& p5 O3 N' {
) G& T& [' W4 j' f! lstatic void __exit led_platform_exit(void)) z$ k' |7 X6 A* c& R* f/ n
{0 C7 x# l3 S: M: f
        platform_device_unregister(&da850_evm_tl_leds_device);
& p1 t7 g- h0 U. ^
' D6 C5 h8 c, x, C        printk(KERN_INFO "LED unregister!\n");" s4 C! X3 h( d" v' |
}* c' m6 B* X- L: Q8 i5 {6 N8 G
7 ]" h. b% B$ r9 F
module_init(led_platform_init);8 P" N* u! q" B/ ]
module_exit(led_platform_exit);
) w8 g# V- ^5 z, ]# U$ o: E5 u/ E) G7 Q
MODULE_DESCRIPTION("Led platform driver");
. c0 ?: i0 U% \4 s' |MODULE_AUTHOR("Tronlong");: S6 A: r! n  p
MODULE_LICENSE("GPL");% `8 @, k0 }7 D/ s
. r4 j1 b( _% ]7 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 23:26 , Processed in 0.079443 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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