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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; I4 _* }( i; R& h
  1. [code]EDMA sample test application8 h& H) }; z. D# a& L) \) p
  2. /** H2 l. D; I: I0 c9 @
  3. * edma_test.c
    6 ~; ^% }6 D' g: _3 W' K
  4. *# Z, l6 q, q5 W
  5. * brief  EDMA3 Test Application
    / C! I9 Z; d" ?- w" y7 F
  6. *
    9 t# s. n: c& [+ V
  7. *   This file contains EDMA3 Test code.. y8 t. h3 Y3 H$ S, {
  8. *2 H  K" N$ `) ^+ Y% T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ [4 @% h- N, O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' r& g7 H2 @' l8 M* H9 M# r# Q& `
  11. *         TO CHANGE.
    ( y* O  o1 ^% A  h
  12. *
    & {/ |& Q( q' \! y; l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 H& s3 I3 l1 E5 H1 I
  14. *) Q$ a! k8 h2 w; {9 {! ^
  15. * This program is free software; you can redistribute it and/or5 a3 B6 M7 H! g+ |' y
  16. * modify it under the terms of the GNU General Public License as
    + v6 m- J+ I8 j+ H
  17. * published by the Free Software Foundation version 2.6 R% R/ \+ h+ V+ W8 O
  18. *8 m# [  @, P& a) P8 _" H* M4 U" \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 c* o+ C, t# N; e6 L; N6 K! c) K
  20. * kind, whether express or implied; without even the implied warranty
    : f% M+ \4 ~5 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( _; @+ ~$ j7 S, ]5 r
  22. * GNU General Public License for more details.
    1 j: V  l  [3 e: }1 L& T3 r8 N
  23. */
      [/ E( L$ ?. [; C

  24. 4 d5 g/ i8 K0 ~' h' }3 \
  25. #include <linux/module.h>
    / f" j! s$ w$ _( M1 p
  26. #include <linux/init.h>
    : o* V9 J, `9 D( x$ \3 M
  27. #include <linux/errno.h>" ~# y2 B% N: `1 O
  28. #include <linux/types.h>
    6 X3 L9 O* R% W/ h* u0 k( V4 `6 o
  29. #include <linux/interrupt.h>* z3 A! u1 s, U# ]6 w+ n5 ?
  30. #include <asm/io.h>
    1 r/ [3 b, N  H, g
  31. #include <linux/moduleparam.h>
    $ Z+ v" N- f6 Q; _
  32. #include <linux/sysctl.h>/ H2 P9 W- x: O* X+ R
  33. #include <linux/mm.h>& m- U* `4 r' @; b; z6 p
  34. #include <linux/dma-mapping.h>
    ) L$ c$ K* o/ V

  35. " }3 j; ^4 l0 d. Q7 H
  36. #include <mach/memory.h>6 F5 g4 j- b4 ~* G, ~
  37. #include <mach/hardware.h>: ~$ L7 `1 v& q2 h  Z! y
  38. #include <mach/irqs.h>
    , c% O" L/ F; k3 a
  39. #include <asm/hardware/edma.h>$ b; q% }; G/ C/ j1 B1 A9 E- _
  40. 2 b& n9 v  U9 A5 J
  41. #undef EDMA3_DEBUG" w. Y! j1 K5 Y: g7 w
  42. /*#define EDMA3_DEBUG*/' C) H9 w& I0 L1 E

  43.   ]! P# e3 S* Z8 D; {$ j& k1 R
  44. #ifdef EDMA3_DEBUG2 H* W& m7 I4 e5 ^7 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 E2 C  o1 K* `+ Z6 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ ]% A; i: A# K! u! ]3 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , L. C  e5 C( c2 L" j" E
  48. #else
    8 J0 g# l4 q: }2 Y
  49. #define DMA_PRINTK( x... )
    9 H. A* V" j- ~
  50. #define DMA_FN_IN
    " d1 U% l0 ]2 N  _- l; L
  51. #define DMA_FN_OUT
    0 U  A7 Q9 ?1 ]% ^
  52. #endif
    6 r; M# V& @8 k. r1 ~) v

  53. ; W3 P  L& U9 }; D9 @# n( j5 n/ v8 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" F7 o- q- M& G: I- u! Q4 _
  55. #define STATIC_SHIFT                3. A. c' r8 ^% K* K4 Y
  56. #define TCINTEN_SHIFT               20
    ( E- X6 k- s& L, ]+ b; ?) Y8 P3 G+ s
  57. #define ITCINTEN_SHIFT              21
    , A$ r  n8 s8 T4 @. F8 k' g
  58. #define TCCHEN_SHIFT                22
    5 F/ J9 e, e& N+ W# ~0 X) J1 S
  59. #define ITCCHEN_SHIFT               23
    : O+ u) H0 r, l8 Y0 ?7 f6 ?

  60. 7 N5 g. I, S8 \# z
  61. static volatile int irqraised1 = 0;6 R$ [8 N' u& W0 U  {
  62. static volatile int irqraised2 = 0;
    , W/ D8 j9 g+ O
  63. ) a, y# Q8 p2 o( C9 ]+ v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . A/ u9 ]6 e9 D: z3 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! a6 S( e$ T: _6 V) W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ o- z) c! f% a* c6 R4 u- p% @' V: j

  67. ; A* E8 d" t- U# r1 A
  68. dma_addr_t dmaphyssrc1 = 0;8 \2 n# n# b/ k: o" I- m) T4 g
  69. dma_addr_t dmaphyssrc2 = 0;. S6 |$ ?# ]& j- {$ J
  70. dma_addr_t dmaphysdest1 = 0;; J. _+ ]. C. f0 o6 _
  71. dma_addr_t dmaphysdest2 = 0;
    , G* W) S" m0 G  Y) C2 Y6 _' D
  72. + }! t/ Z8 V5 h' l0 D
  73. char *dmabufsrc1 = NULL;& E- p- X7 _6 \8 \
  74. char *dmabufsrc2 = NULL;1 U: l5 |- G" }1 E, V
  75. char *dmabufdest1 = NULL;
    ' I& M7 F$ r$ x' Y( ]; \
  76. char *dmabufdest2 = NULL;
    : Z9 ?5 e. h; [! W1 R% [
  77. 5 u- z' [/ `) S4 X. R; g+ a: J
  78. static int acnt = 512;1 x! b+ o- v% ~. b
  79. static int bcnt = 8;* d/ h+ ]' {# c# X7 J# e3 C
  80. static int ccnt = 8;
    7 D  E+ N) I- U7 `7 M

  81. * S) _  m* L: h' L& M- q
  82. module_param(acnt, int, S_IRUGO);& g% Y! _( Z% K- n( Q# E& }. a
  83. module_param(bcnt, int, S_IRUGO);
    - b9 _- K3 R% j# Y( F, ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  Y$ d- w3 f! `0 H8 o

+ Z6 t& V$ I2 [7 q6 A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! \& e( ?" H- [# s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" _. J' o' ^2 q3 A. h7 v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 Y# O! O- n6 h* i; O; d  ~; ~
% v4 {# Y& J1 n
' L! u& h! r- ?+ i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 18:24 , Processed in 0.038961 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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