OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, |* X$ f" o4 @- P
  1. [code]EDMA sample test application
    5 ]; S; o. P* U+ t4 b
  2. /*
    5 V" m- _+ l1 @
  3. * edma_test.c
    4 N( C8 _! D1 }$ j: z( u
  4. *
    ' [; C/ A& U5 |* f+ ^- @
  5. * brief  EDMA3 Test Application
    3 Z- A& [( r) @  k" i# K
  6. *
    5 z0 E+ G8 A" M3 I/ I
  7. *   This file contains EDMA3 Test code.
    ) x$ y# I- B6 F3 n
  8. *' L" O: @; W: C6 h9 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 I- _- w5 o! i1 J7 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 ]6 t" E7 d; Q& k# Q
  11. *         TO CHANGE.
    6 R; \, z0 K, {7 q: Z
  12. *6 A5 N  d8 C, w6 |6 g* A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : n" h! t" F4 ]% v
  14. *2 q! w! m$ X+ N* f; R
  15. * This program is free software; you can redistribute it and/or
    / a! e6 I3 d* l6 r
  16. * modify it under the terms of the GNU General Public License as
    5 V9 R, W1 s' d; a( D) p
  17. * published by the Free Software Foundation version 2.
    0 @0 {% m  E( Y3 n) |
  18. *
    7 {6 _7 Q1 c4 X+ T! {9 s2 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      g4 L0 [7 t, o1 E9 _! w; [1 @
  20. * kind, whether express or implied; without even the implied warranty
    6 m  d" {" K' y9 @" m3 t  j' n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 @8 V5 t9 L9 o4 }! _, ~# x$ [
  22. * GNU General Public License for more details.7 K1 s' J$ ?0 h5 k# Q) h6 z
  23. */' j$ m, X# }! C/ d5 F
  24. & E" d& ?7 a) v
  25. #include <linux/module.h>
    * r, a! {) X) e: v+ X' L$ r" d
  26. #include <linux/init.h>8 R; I/ z/ }! [3 t% R
  27. #include <linux/errno.h>: U: \' E: H4 r
  28. #include <linux/types.h>  p& ?! y+ t! r: w
  29. #include <linux/interrupt.h>
    $ w7 w/ R" {6 u6 f
  30. #include <asm/io.h>: y/ R+ G$ D$ c0 Y! I
  31. #include <linux/moduleparam.h>
    " k/ |# L' j4 ^, X& ]
  32. #include <linux/sysctl.h>0 _7 L5 w6 @. F5 N7 L) B2 @
  33. #include <linux/mm.h>6 h+ V. r, N/ c, s' E2 J
  34. #include <linux/dma-mapping.h># T  U' j+ ]6 |# _. ^7 t. C2 `

  35. ( Z" B8 [$ ]/ {: Y8 X5 V7 e3 M
  36. #include <mach/memory.h>
    + ]2 K5 t' p* y3 @
  37. #include <mach/hardware.h>/ |5 \; j' I1 q  B' Q
  38. #include <mach/irqs.h># Z: a- |7 y5 h* W  i% r
  39. #include <asm/hardware/edma.h>, s. G* P9 K, S* Q: N: H8 F
  40. 8 d. D$ s  ~( N7 Q+ ^$ I8 X
  41. #undef EDMA3_DEBUG
    . H) k$ y" `; E1 @0 {" c8 D
  42. /*#define EDMA3_DEBUG*/
    $ g1 H9 T% U+ Y. X* O- }% }- J
  43.   s1 }: `- c+ w
  44. #ifdef EDMA3_DEBUG4 `+ ]3 i6 Z7 Q. p* w9 ~! H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / w3 I8 F$ L; x9 K* f* V( w" s8 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 {: w' }- U/ \& H1 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 z8 T8 V; }+ n( Y" P
  48. #else( A. `' u0 s' l; L/ h' a+ }
  49. #define DMA_PRINTK( x... )" N$ Y& L( [" B3 @" m' [0 @5 r
  50. #define DMA_FN_IN
    ) ?' Q1 X- v& V
  51. #define DMA_FN_OUT0 v  C* G; H' ~/ v4 M5 P5 i
  52. #endif
    + B, k6 G. z' Q5 s8 c( i
  53. 4 p  _; h7 V  @4 J9 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ W+ `* C" d3 j5 U8 K
  55. #define STATIC_SHIFT                3" e, d- k/ E: A$ X% E" E, |, y% C
  56. #define TCINTEN_SHIFT               20
    9 w4 e. `( ]. f
  57. #define ITCINTEN_SHIFT              213 Z; f& O9 l% j
  58. #define TCCHEN_SHIFT                22( ?0 W/ u+ ]/ L; u4 N5 Q/ W
  59. #define ITCCHEN_SHIFT               23
    " w% }& F# S% e+ v6 E0 @' K

  60. / r1 w. R! U+ n, z! e/ i/ N$ E
  61. static volatile int irqraised1 = 0;# H! t8 W# f( {6 Y# l/ Z( Z" Z
  62. static volatile int irqraised2 = 0;
    ; e; k) ?( h6 z4 t7 f2 g2 P6 B
  63. 1 a: r0 m. S( [' y8 [- n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 _4 j6 z2 J/ B& [: H7 H  Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& t( M) X+ t& T* t2 G0 i' F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) s0 ^/ X9 e" _- E' F! \3 x

  67. 7 t" g9 O5 f( M
  68. dma_addr_t dmaphyssrc1 = 0;7 n! u% a$ c$ k" f$ U% a9 E" w
  69. dma_addr_t dmaphyssrc2 = 0;* W6 S1 d9 s" A, V
  70. dma_addr_t dmaphysdest1 = 0;# r0 u9 s1 j# q2 K7 b
  71. dma_addr_t dmaphysdest2 = 0;
    % V/ K8 U9 D6 ?. d; t
  72. - j. @0 u& Y6 l6 d8 B  f  r
  73. char *dmabufsrc1 = NULL;
    " d  w- d7 Q* ~
  74. char *dmabufsrc2 = NULL;* o4 p6 k' [, M1 {  q* v
  75. char *dmabufdest1 = NULL;3 V  N7 ]0 T+ l2 a* ]) K
  76. char *dmabufdest2 = NULL;
    ' S: D2 |/ h! i* H1 ~' S- k2 l4 y0 p7 s
  77. 6 ]4 U  [. o; }' S% ^& K3 L( L6 [
  78. static int acnt = 512;# }+ t$ ]; o* T# o$ N
  79. static int bcnt = 8;( C) y" M# [/ W
  80. static int ccnt = 8;) N& B- W7 t+ E, n- L2 r$ I
  81. ! Q% `$ U6 T0 v
  82. module_param(acnt, int, S_IRUGO);& M' c; t4 W  o1 ~" ]
  83. module_param(bcnt, int, S_IRUGO);
    - U% G! p6 K8 J/ U/ |# W+ W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 T, e7 X6 C! n, r* q9 t& K
3 Y& ~: _' w4 J1 r! L/ G. }6 B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& N& L' ^  x0 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 {0 |7 p) [8 j6 K1 M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 k( i" _& h& D0 ~9 f" B- v% h4 Z
, @4 w# e& }8 b: T2 ]1 O
& `) l  m5 m, T- d6 H0 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 05:08 , Processed in 0.040357 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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