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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & t3 }0 t& a5 I) z4 U: s: b4 e
  1. [code]EDMA sample test application& Q/ A  x3 o0 ^, z% Y1 H  v" A
  2. /*$ }; D- a4 y8 f  Y3 r# Y' e/ {! @/ e
  3. * edma_test.c
    8 G6 U0 z- j1 {
  4. *& B2 ~# q: `9 t/ W8 `7 M4 y
  5. * brief  EDMA3 Test Application) }! Y* B) m& u9 T5 \4 \
  6. *
    . m/ s/ W6 F1 }9 M% L* `
  7. *   This file contains EDMA3 Test code.9 i) H" d" i0 g/ i) e/ Z# K
  8. *1 W5 i8 O" H5 j: I6 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 d5 j9 r- d+ B2 `4 M- C$ p) n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! F1 b5 w! n7 m% q( G" c
  11. *         TO CHANGE.
    1 k  r  }$ Z6 n' U1 p2 s3 r
  12. *
    2 j5 |( f8 C; a7 }$ `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ {* j. P- c+ J3 G
  14. *
    & v& Y4 p. k9 D; d2 F7 j
  15. * This program is free software; you can redistribute it and/or
    + s) D3 b3 [1 P
  16. * modify it under the terms of the GNU General Public License as% Y. c3 {4 y8 Q# `% J
  17. * published by the Free Software Foundation version 2.
    1 a* ^/ q& X) U2 V5 J
  18. *
    * |4 G0 o) b' V7 C; `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # ^' E# k2 k& Y1 t% ?+ Z5 z
  20. * kind, whether express or implied; without even the implied warranty! f$ E0 A9 `' U% ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 k! H7 Y$ C7 a, d" K
  22. * GNU General Public License for more details.
    4 A  Z# |* N: ]8 |: i# C
  23. */
    8 W0 P2 j1 R, r! f6 M: L- V, G% G9 X
  24. & q" [, r' P7 t
  25. #include <linux/module.h>- V3 R: u0 k: b# ^% V. b
  26. #include <linux/init.h>( y  F, M3 H8 g8 r$ a
  27. #include <linux/errno.h>0 k( S8 U/ C0 v2 `; q0 |% ~
  28. #include <linux/types.h>
    " ~! X5 [7 Y# S6 }) Y
  29. #include <linux/interrupt.h>, s+ B, X) k7 j- \+ |- T
  30. #include <asm/io.h>  |% ^. P* _( V+ b
  31. #include <linux/moduleparam.h>
    7 m* c% ~- ]5 w' F. b
  32. #include <linux/sysctl.h>
    ' y, X1 \9 C! K8 X
  33. #include <linux/mm.h>2 L/ X! w( q0 W) Y
  34. #include <linux/dma-mapping.h>4 h% l3 d: v; n- y& m8 o

  35. 3 g8 Y( |4 N) O
  36. #include <mach/memory.h>
      h5 c, Z: ]6 F6 H/ ]. _
  37. #include <mach/hardware.h>
    1 a/ ^4 {8 c% p- ]8 P1 J
  38. #include <mach/irqs.h>5 n- r8 W  Q( X0 w
  39. #include <asm/hardware/edma.h>
    * y+ _0 C0 B, S  R9 b  X5 h9 \

  40. % q( w  H+ [3 K) z
  41. #undef EDMA3_DEBUG' f! g! y+ r4 b3 J7 x/ C
  42. /*#define EDMA3_DEBUG*/
    0 Y/ V2 b1 l7 |; A( b- P* _) V
  43. / j2 I7 M& j5 \5 i  h
  44. #ifdef EDMA3_DEBUG- d$ a' o: L2 r  q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" O8 v, u2 S5 U3 b/ `% U" L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 V5 @2 e" n, L  i" z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f6 A8 L* I$ {2 j% ~. u
  48. #else
    - u/ s/ {  d* \! M/ ^
  49. #define DMA_PRINTK( x... )
    2 m9 W* q" B& d+ }7 P
  50. #define DMA_FN_IN
    / x' C# T( X% ]3 d( k& r
  51. #define DMA_FN_OUT& k: s) H7 \$ ~! v2 j
  52. #endif
    & p2 g8 \) q% L7 o8 f, b4 u. A; N

  53. 5 n  H1 b/ k& ?4 f% w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 [. O% `/ p2 e% {, Q3 X
  55. #define STATIC_SHIFT                3( B( p& {( F1 }! R8 R9 u( K7 h
  56. #define TCINTEN_SHIFT               20+ Q8 Z( P4 N" Z
  57. #define ITCINTEN_SHIFT              21
    ! s$ M, O0 {% l- ~; X- j
  58. #define TCCHEN_SHIFT                22+ v0 Z- `0 p& R5 {  x9 H! t
  59. #define ITCCHEN_SHIFT               23) X7 u+ x+ y) }  i% @8 P  r: A
  60. 3 w+ b5 {# t9 U7 \# u4 G  D
  61. static volatile int irqraised1 = 0;3 N3 H; ?# D9 h; O1 e3 F
  62. static volatile int irqraised2 = 0;+ w2 s* m6 U9 |, k- J& a  M- q
  63. : y' l) u4 S& u6 R% a  t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& i% B6 d. v" E4 Y. u9 T. s, P8 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 d) A7 M6 x' ?! d0 A: n" u' V4 s. f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' Z  e, v( q! R; C  I$ l8 a

  67. . o" n, N6 S1 |# a& P# n! t. u
  68. dma_addr_t dmaphyssrc1 = 0;9 H) e+ D3 G  s1 \4 e  N
  69. dma_addr_t dmaphyssrc2 = 0;- ]' h" o  J: B2 p# S& F; |
  70. dma_addr_t dmaphysdest1 = 0;
    $ l9 y" S0 N2 P% o; ^! B. ^6 N
  71. dma_addr_t dmaphysdest2 = 0;
    1 `  s2 b4 Q; D% R+ i: R
  72. 9 }7 ~! ?' ?) ?3 [1 p, O
  73. char *dmabufsrc1 = NULL;" M8 i6 t3 m; a
  74. char *dmabufsrc2 = NULL;& P% _2 u2 G, ^4 s
  75. char *dmabufdest1 = NULL;9 q) s" o* G$ ^
  76. char *dmabufdest2 = NULL;
    . Z4 y$ E1 J/ G& _$ f

  77. ) B4 ?7 w5 M* l2 w* a
  78. static int acnt = 512;
    ! S  H& k7 E6 d
  79. static int bcnt = 8;
    & t! ~2 w; w6 i! [
  80. static int ccnt = 8;
      O5 F$ w, {8 E8 J0 I

  81. / b$ k+ N; K3 I; H, S, _
  82. module_param(acnt, int, S_IRUGO);
    4 ~& e+ I/ g# ^' V/ }0 d
  83. module_param(bcnt, int, S_IRUGO);
    , _4 G9 C) c- D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) a( c6 G% b% n- d5 x/ i
5 K3 @0 ^. l1 q* S8 ]" n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ N: _1 p6 o; ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' u1 {8 r: T  }3 ~) j& C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* a( w( y% [7 ~8 Q% Q

, B( L3 n1 ~+ i5 A* c& j' K1 p* H9 W6 e: L" ?4 ~9 v: r: }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 09:38 , Processed in 0.038428 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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