OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . }  `6 ]. [* E% j$ C( `4 r2 [. o
  1. [code]EDMA sample test application
    3 Y/ `9 @& l7 B8 N
  2. /*
    4 @& H8 L5 E) M: h) V) q$ d' U
  3. * edma_test.c4 \3 U5 t5 ^5 r4 t. Y
  4. *
    8 h; [% O' j6 K1 _
  5. * brief  EDMA3 Test Application: ?0 J1 g1 L! o8 B% ~
  6. *# p7 \2 K  n4 [& i* C/ k' N
  7. *   This file contains EDMA3 Test code.  M$ C# H! |; V- v9 y
  8. *
    4 k9 F# H" a1 O- C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; a( v' f- B( ]$ R: j1 g) y* A* k! W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' I+ }$ n" w8 d$ J& m& ^
  11. *         TO CHANGE.: A2 r0 r* A9 }; O6 N" U
  12. *
    ; _5 B' s: u& A- n5 G' f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 L8 Q- E; G, i& [
  14. *+ U; p: y* ~$ G! j0 n- y1 Q  h
  15. * This program is free software; you can redistribute it and/or
    % c/ t; i  O" p% N0 @8 X: a
  16. * modify it under the terms of the GNU General Public License as( o+ N5 l+ x. w0 d  S0 B1 z
  17. * published by the Free Software Foundation version 2.
    + p4 S! C! d. H7 o. Z2 y# J
  18. *
    : \$ q2 |+ c& r* a# L/ F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . a) f" m& Q5 \4 H2 u, D& Y
  20. * kind, whether express or implied; without even the implied warranty
    5 U  |; W. q! q. v8 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 D0 p: ?' d% ~' ]2 I1 ^8 @5 B
  22. * GNU General Public License for more details.0 y9 t- y# T) z$ p: _' a
  23. */+ C7 O' I: S" C; W

  24. ; c. H- b' y& R- o1 h
  25. #include <linux/module.h>
    . ^9 e4 |- K4 v# n
  26. #include <linux/init.h>6 R: p5 y0 v& c  t
  27. #include <linux/errno.h>3 ~3 D3 n4 c0 G8 v( z. G- h
  28. #include <linux/types.h>
    1 }. z* n1 E0 N# Q* A  ]
  29. #include <linux/interrupt.h>2 b8 F7 V+ j9 i/ p1 X. {
  30. #include <asm/io.h>
    6 O2 l) U- W2 v4 ?
  31. #include <linux/moduleparam.h>
    # I2 w7 H* P5 @- B
  32. #include <linux/sysctl.h>
    - Q) w# Q; `( d- E( a
  33. #include <linux/mm.h>
    + ~* |! R% ]" @$ O; [) ?! c# E6 T9 q
  34. #include <linux/dma-mapping.h>
    - P& ?' O. ^  p

  35. 0 y. Z( z! h" N5 J" A" G
  36. #include <mach/memory.h>5 A1 q' |. A7 u: S
  37. #include <mach/hardware.h>$ u* \5 A4 N6 P$ R% H
  38. #include <mach/irqs.h>
    / m' x: d2 v& X% T- e
  39. #include <asm/hardware/edma.h>
    0 z5 \! ~- R4 O/ {0 J$ |

  40. , d' Z; y) V7 Z. b- {! c4 y
  41. #undef EDMA3_DEBUG
    $ s( a" F# i3 z/ N. O( d
  42. /*#define EDMA3_DEBUG*/: K; U7 l+ D+ P; T! I: n! S4 z# e
  43. ! H) Y# y+ Z0 d* i. }7 q; R
  44. #ifdef EDMA3_DEBUG5 \0 D; J8 Q7 i) s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      M5 ?6 a+ Z8 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; S3 I; P7 Y+ t, R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , L( @- _9 t& t5 Y% }2 _
  48. #else
    5 y$ z2 v: I( S3 z& z3 g" F
  49. #define DMA_PRINTK( x... ), {1 ^0 l) d- k, Z  o2 _( [- |7 u+ j. H# N
  50. #define DMA_FN_IN  A+ V, x" j. V2 Z0 {
  51. #define DMA_FN_OUT
    ( t. o. s5 T3 J0 H* Z
  52. #endif
    & P4 p( g  Q/ H6 `

  53. " S8 o* `# E/ u- X0 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 K# J6 K0 m% ^8 D: t& N* j7 ^$ A
  55. #define STATIC_SHIFT                3
    # t/ W- q& j' V/ V, y  K1 c2 E2 _
  56. #define TCINTEN_SHIFT               20
    ' X+ O' P! c7 V* Z6 ^% h
  57. #define ITCINTEN_SHIFT              21
    0 G; e2 u. }3 q0 ~
  58. #define TCCHEN_SHIFT                22
    4 r0 j; U) }; `# Z0 B
  59. #define ITCCHEN_SHIFT               235 j$ C8 h7 C6 ?; Q
  60. * y: @% U& @' V9 X7 G
  61. static volatile int irqraised1 = 0;1 _) {+ s4 i8 q" v
  62. static volatile int irqraised2 = 0;+ a4 ~- w; x: `, p$ d! J7 T

  63. - O) e, O% r# l8 H9 }: z; ^" p: d1 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 P/ b+ r: }. Z/ h+ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      C1 Z" f6 }2 m- p" K- O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ [" O6 e3 f' \* n9 ]7 N

  67. # r% `. p$ P% E/ n: y- l- Y
  68. dma_addr_t dmaphyssrc1 = 0;
    / r2 S. W! ~# C6 W" T, x
  69. dma_addr_t dmaphyssrc2 = 0;3 ^" e5 J3 M, _& _# j1 }* N
  70. dma_addr_t dmaphysdest1 = 0;9 k2 t  x: A5 @( x+ i1 ~
  71. dma_addr_t dmaphysdest2 = 0;( W9 H- f* ]' p- [( s3 g1 w2 ]

  72. 5 T& \" D( C9 S7 j* s9 P
  73. char *dmabufsrc1 = NULL;1 |5 ~1 y  b' D" a3 \* Q
  74. char *dmabufsrc2 = NULL;
    ! k# X" N; B) u" G0 y$ k  u3 l( e. z- F
  75. char *dmabufdest1 = NULL;
    # }5 R2 W, c% S2 L( B
  76. char *dmabufdest2 = NULL;  w' W: ~$ L: s3 r) s3 L* i5 f
  77. : r# M6 F; O! F7 v5 ^2 I
  78. static int acnt = 512;5 A/ Z6 M. j/ G, J( r
  79. static int bcnt = 8;+ t2 H3 e/ u2 Y) l
  80. static int ccnt = 8;, C, ]  Q+ w0 R7 ]

  81. ( v# [/ J* I% f
  82. module_param(acnt, int, S_IRUGO);) }. C  e' D" U( e! r+ j. |
  83. module_param(bcnt, int, S_IRUGO);
    ( C) |1 i% E, N1 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% ?7 Y) W9 L' s" K0 u5 @3 a/ W' J! z9 t6 G- p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 x5 P; T( z) b% h0 |
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( E" m! I7 y5 k' y7 G" t9 Z5 O0 I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% V4 g( t# x: E8 V# R

' ~% X3 I. t  z6 ?: i7 L* `8 X6 z3 p- y3 N, h3 q( v6 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 13:30 , Processed in 0.039410 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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