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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ `  `( u) |2 r+ x* T$ f( |7 b: F
  1. [code]EDMA sample test application. F+ j+ p( ]8 i0 C  H+ i) P( h
  2. /*; ?8 a- G% y. c4 y5 U! @
  3. * edma_test.c/ I$ V. j4 D  D) c' n
  4. *9 t* S& @( q. W. I+ y- W' W
  5. * brief  EDMA3 Test Application
    % x$ l7 X: T6 x
  6. *, o/ u1 Q: C) R
  7. *   This file contains EDMA3 Test code.3 [# Q- G4 R! _+ F
  8. *
    9 P6 o) S6 {. o" ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) s: M9 D8 T) v2 C0 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 `5 x9 Q) y+ Q0 l& O  l! y
  11. *         TO CHANGE.; l& i  E3 \$ [( c4 l
  12. *& C2 ^4 L9 a% [" h( b" g5 r/ u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , z9 o, }- G  C# R
  14. *# M0 h9 a( a+ Y
  15. * This program is free software; you can redistribute it and/or
    % ~, N- r0 ~. G2 K2 `
  16. * modify it under the terms of the GNU General Public License as
    . Z. o% ^" ^  G3 U
  17. * published by the Free Software Foundation version 2.1 V7 {+ l; |2 z$ u/ r/ h! j7 A
  18. *
    ' H& M7 F, J0 g6 [; {1 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      n, w0 h* q, s) p) h2 P
  20. * kind, whether express or implied; without even the implied warranty7 o' A# z1 r  l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 d" w* T1 G' |0 _0 f
  22. * GNU General Public License for more details.
    , u( L* M- s! m6 c& [; T, P
  23. */
    ! I" r2 K4 r. a+ x

  24. 7 L, Q5 E$ Z) m) A& B
  25. #include <linux/module.h>
    " f4 s$ {$ B5 |. _, H
  26. #include <linux/init.h>
    # ?6 L, E! ]7 R; h3 P
  27. #include <linux/errno.h>
    % X' s4 U- C$ t3 D7 W1 I
  28. #include <linux/types.h>4 e; C. K1 O) X9 Z! i9 v+ ~
  29. #include <linux/interrupt.h>
    . }9 R: Q/ w: K2 [( q& R2 h+ D* H
  30. #include <asm/io.h>3 l* K8 d" A- E3 b& j6 K
  31. #include <linux/moduleparam.h>2 j: a: g* Z. `+ h) a0 P& a
  32. #include <linux/sysctl.h>
    ; s; L4 u" k  H# B4 E
  33. #include <linux/mm.h>
      n0 _" G7 U1 }  c- S  E! h4 x
  34. #include <linux/dma-mapping.h>+ y" y5 [  m; K6 A
  35. 9 G6 P* q* t3 H8 a  p
  36. #include <mach/memory.h>
    9 A* h2 k1 a, K, _3 l( c  r* z
  37. #include <mach/hardware.h>
    ! `5 J' _0 A' M0 f+ }
  38. #include <mach/irqs.h>
    3 ]- x( P; L4 u* b( P% S
  39. #include <asm/hardware/edma.h>
    8 r" b# Z/ l' }) x6 o( n+ k% ~  B6 v

  40. 0 f7 i8 X+ g+ w: v9 @; @2 |
  41. #undef EDMA3_DEBUG- e' W/ x& }0 h/ T8 _( Y- F
  42. /*#define EDMA3_DEBUG*/
      @1 ?; N2 p6 s/ o
  43. ) \( F1 g4 d% T
  44. #ifdef EDMA3_DEBUG
    $ A* Z/ Y4 d$ {, O2 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 e( _0 r. p1 g- ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & R+ b+ E( q/ a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 v' V. C/ P% [2 h+ P% T
  48. #else! j$ L3 K& w/ [9 B4 E; L9 n
  49. #define DMA_PRINTK( x... )
      y1 }" a$ Z: @  @0 ?
  50. #define DMA_FN_IN
    9 q& ]) x0 G" x: w/ [# Z1 @8 I4 F
  51. #define DMA_FN_OUT
    & C5 w# N8 Z( A
  52. #endif
    ; h0 c# E9 s) _8 Y9 ?( M
  53. , N) n9 R3 i- h5 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  S+ s' v! ?2 H
  55. #define STATIC_SHIFT                3
      `  q! C* q- C/ w7 Y
  56. #define TCINTEN_SHIFT               20
    3 Z4 g/ C. k4 s" v3 f' J8 O( q( S
  57. #define ITCINTEN_SHIFT              21' f: R( Q3 T1 W& p' @
  58. #define TCCHEN_SHIFT                22
    ; N9 F8 S9 u' @
  59. #define ITCCHEN_SHIFT               238 ?( M+ X% h$ L* [( S; O

  60. ! y$ j5 h9 r  i4 c
  61. static volatile int irqraised1 = 0;
    ) L3 M( M3 ^# M6 m. G+ H0 @7 D% c
  62. static volatile int irqraised2 = 0;
    8 V: {2 V( j! x  }' [
  63. & w9 I0 a2 \# h( `4 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( U7 F4 \- @. o* ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; f$ j/ D" _7 X; M# a; p4 p4 N( D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' I* G' S! I! z! q

  67. . u4 ]2 s" W& Q) _
  68. dma_addr_t dmaphyssrc1 = 0;
    4 _7 Z( I; b  A0 S+ b
  69. dma_addr_t dmaphyssrc2 = 0;
    & O' V0 q" O' g7 g. y
  70. dma_addr_t dmaphysdest1 = 0;
    ) J1 O* ~4 j# \) l: l
  71. dma_addr_t dmaphysdest2 = 0;
    * X8 }5 v& d* e9 _- W

  72.   a2 v: y3 y1 z2 O# p9 ?. }' \6 {9 l
  73. char *dmabufsrc1 = NULL;
    & _4 ?$ {4 H1 y2 s2 D
  74. char *dmabufsrc2 = NULL;
    3 T" f9 L0 A! Y  B& G
  75. char *dmabufdest1 = NULL;
    8 l% g3 Z% ~7 q' C  `* d& i! E
  76. char *dmabufdest2 = NULL;, Q/ X' N; X- m) o

  77. : E& Z1 k% k# `0 n( [& u
  78. static int acnt = 512;! ?$ A$ V# a# q2 t
  79. static int bcnt = 8;
    . o3 \( `& A! J* x) B8 L! z( d1 l
  80. static int ccnt = 8;3 n: m" m- m( Q
  81. $ M: q+ ]1 W1 r- m3 j% V
  82. module_param(acnt, int, S_IRUGO);" d2 w2 S4 ]- L' j
  83. module_param(bcnt, int, S_IRUGO);
    ) K7 V/ h* ~, A7 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( i! C; ^; U8 k
. a* D0 o: N" \, h  L/ F, z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 r# f; ^0 y( S* K: A) karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ y0 s1 G3 w4 c8 i* B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- V5 `& t  {, A( i0 n% U
  `! ~, K# O: u: l- U1 |
, n2 R8 k( S9 G3 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 15:47 , Processed in 0.038142 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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