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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 ]/ ?1 S: R4 b1 r" m" k
  1. [code]EDMA sample test application: }; s; f/ J% F6 u& i+ j# p
  2. /*
      Z3 d4 c8 Y( t% [
  3. * edma_test.c$ R) }( A: y3 |: m
  4. *
    * H) T( n( s/ v9 F
  5. * brief  EDMA3 Test Application$ C, R) P/ H7 J, I, M9 D  k
  6. *
    ! N( a, Z: G; o4 ?' x
  7. *   This file contains EDMA3 Test code.
    0 W! U; e$ e; y) f# ^6 N
  8. *+ ~& `+ D" A1 K# ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , l" R0 p, d% E% J! n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) c) u$ h/ A" B
  11. *         TO CHANGE.
    ' X5 S+ o, ]$ g6 a) |
  12. *9 V$ {3 \3 H1 |+ f. Z8 F7 r5 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 n: B# v! p2 \
  14. *) [: W( I' u  m4 r  y9 z; |8 d8 I
  15. * This program is free software; you can redistribute it and/or5 P: U+ G  {( Q9 ?& ]0 k
  16. * modify it under the terms of the GNU General Public License as# M' `8 D0 X6 {; }% @/ a" a
  17. * published by the Free Software Foundation version 2." y7 ]* i4 o* q1 B5 u: b
  18. *, f2 [- h( g; c7 t; v) {/ l) n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 p7 j  j# h2 x$ V5 W
  20. * kind, whether express or implied; without even the implied warranty
    + h# |  t& t# p. c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( z- W. l4 b/ l9 [# I* {7 q
  22. * GNU General Public License for more details.% b9 m8 a( n( w% ]
  23. */% D8 y( |% c$ C0 f/ N7 \
  24. % U" I7 q6 K+ [7 j/ ?0 r
  25. #include <linux/module.h>2 Y: N+ ~- e8 r' o
  26. #include <linux/init.h>0 v% B" n4 ?* e+ [2 z' g# J
  27. #include <linux/errno.h>, N! Q" T& @/ M& @4 p
  28. #include <linux/types.h>
    8 L: z1 }" s6 O* @# I( J: f
  29. #include <linux/interrupt.h>
      n1 f3 p7 ]  @- S
  30. #include <asm/io.h>
    0 @1 {% O: J: B4 Q
  31. #include <linux/moduleparam.h>! J+ u5 C3 @- L! ^$ G/ Z
  32. #include <linux/sysctl.h>! C4 V* h5 U& v5 T- l2 A  i: E& R3 _$ Q! E
  33. #include <linux/mm.h>
    0 w: k) g0 l& y  z
  34. #include <linux/dma-mapping.h>
    & Y( L4 Z3 r9 Y

  35. 2 Q- ]# U# h  j7 P) a5 ?
  36. #include <mach/memory.h>
    0 ~$ P! V* ~1 K5 s4 M. B8 {
  37. #include <mach/hardware.h>
    ! @* q  w7 k4 L" }8 N% [' E- K
  38. #include <mach/irqs.h>
    : u1 l! N# Y2 Z; w* d' A
  39. #include <asm/hardware/edma.h>
    8 y# K4 c' M0 b% f+ S

  40. 5 V- t* [+ h0 m
  41. #undef EDMA3_DEBUG( m( U" T% A, v7 h8 D) y
  42. /*#define EDMA3_DEBUG*/
    6 R) [3 N$ z. [8 O# ]" E
  43. ; Q; N1 l4 M: T/ e! i) d
  44. #ifdef EDMA3_DEBUG
    9 N: p; G9 `% O0 ^# I& U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* H' ]6 t9 _/ q" r% P5 x! o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* ^& o) B" b5 N& B3 y$ B0 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + v1 D& h+ h9 b' i
  48. #else
    $ O3 G# Q' {2 S" G
  49. #define DMA_PRINTK( x... )
    ' ~1 Z0 E" e  b* l% d; f
  50. #define DMA_FN_IN0 |0 g  S& X7 |3 E% a2 v% {
  51. #define DMA_FN_OUT2 l1 A; s& h' j6 \" w, E
  52. #endif
      _8 _+ e- {/ ]. X$ E" b: ?
  53. $ r) }2 \6 F  P! ^! Q: u1 e$ g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( Y+ b9 P6 i) j, I
  55. #define STATIC_SHIFT                3/ o# |" \! g. t1 d
  56. #define TCINTEN_SHIFT               20
    . ~8 X$ i$ \6 M  E
  57. #define ITCINTEN_SHIFT              21, m1 x8 ?; \2 W
  58. #define TCCHEN_SHIFT                22& x& D" k8 @1 {& L/ J! C- w6 M9 R
  59. #define ITCCHEN_SHIFT               231 q* L$ F4 i6 y  y% m: v( M
  60. 6 y8 J6 l+ B7 U* \
  61. static volatile int irqraised1 = 0;1 o, f& H. P% S
  62. static volatile int irqraised2 = 0;
    , V2 t/ X* b) W

  63. 6 h1 w% f: D3 `  r' f  m' }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 p. [* i0 r; N3 S8 R0 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      F" Z4 V  L+ B0 v* c( e& E, Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      ~0 U  P' o4 }9 P

  67. 1 a$ u5 o8 p0 a6 q0 n8 j
  68. dma_addr_t dmaphyssrc1 = 0;
    ( o0 |- |9 f& \# C) S
  69. dma_addr_t dmaphyssrc2 = 0;
    6 {1 p1 d+ [( e. o4 q3 C) j) d
  70. dma_addr_t dmaphysdest1 = 0;& x6 A& ]0 B$ x/ K1 {
  71. dma_addr_t dmaphysdest2 = 0;
    3 z* q# J4 n8 w7 s2 x$ ?* ?( j  `0 h

  72. $ Y. D# M9 U5 x' ?, o# e! Y
  73. char *dmabufsrc1 = NULL;
    * b4 |" [( M) b
  74. char *dmabufsrc2 = NULL;
    3 u1 Z  C! B: c5 n$ O& C" \
  75. char *dmabufdest1 = NULL;2 |( L5 S5 `. J3 C2 ^# F
  76. char *dmabufdest2 = NULL;
    % _, Z4 M" \" j: w9 Q2 B. A

  77. & Y6 X! E2 E# L
  78. static int acnt = 512;: R: }0 _: j2 X- ?- s* z' @1 L% q% G5 ]
  79. static int bcnt = 8;
    & b& G: ?5 e6 c2 x
  80. static int ccnt = 8;& M! [+ c, C2 k9 O( G: P$ P- |

  81. ) ?1 x1 h# o+ |$ f' u
  82. module_param(acnt, int, S_IRUGO);
    / F2 T: C7 ^% ]: S
  83. module_param(bcnt, int, S_IRUGO);' S4 |0 ~7 _4 S, N3 m% D/ }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' I! y0 @/ [7 B5 y: w

) b7 n; v; \' m- V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 i: u  Q" V# r) P) N. W/ R* n0 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 Y7 y6 G$ e  ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: t, L" M; G3 `" s) _
8 r; ?5 B7 B. ?8 {7 _- Z: L; b8 N  J- Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 22:36 , Processed in 0.037886 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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