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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% w* o. @6 r# z- g
  1. [code]EDMA sample test application- h7 Y4 @# e) _
  2. /*
    ) D- l* Q9 v. _+ D: _$ z' w
  3. * edma_test.c2 r4 }. \8 m' N$ G( k" A3 Q2 g
  4. *; ~! m, O* p8 w9 W% H  G0 s
  5. * brief  EDMA3 Test Application
    " R4 j( U2 i* Q9 j& a* {  X/ L
  6. *
    # s- }0 Z7 V( \$ [9 Y. t
  7. *   This file contains EDMA3 Test code./ r- ]! \+ Y; c
  8. *
    + z( H2 N* v- F0 ~8 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 v! X$ e7 s4 U' Q+ t% Y, O9 C2 ?3 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # D- [3 B# }  K
  11. *         TO CHANGE.
    ! i  f& K7 o3 n7 H
  12. *
    ! A  t$ j" W, [, K0 M; {% f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 I2 O% o7 x5 `% W- Y$ K
  14. *
    & X+ J- I  j- C3 m) s) @
  15. * This program is free software; you can redistribute it and/or+ W* n6 v# v7 h2 t4 [) n; C6 T
  16. * modify it under the terms of the GNU General Public License as
    % [7 ~2 Z: E' k* _! f9 \
  17. * published by the Free Software Foundation version 2.# f) ?# {$ K1 }* V4 q) T! ^
  18. *
    1 \; M& K! p, z+ x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 v$ J  [- N( p% M# X
  20. * kind, whether express or implied; without even the implied warranty
    & `' \/ O  x! k! U! F/ P2 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - O4 l/ j6 S1 L6 G9 E/ W  R- R
  22. * GNU General Public License for more details.- S: O. |/ m& g
  23. */$ d: {: m0 Z+ I3 u. x' a! D$ j
  24. ( z6 M8 A4 W) j0 n/ L4 X* ^
  25. #include <linux/module.h>8 x0 O3 s4 \4 F0 S. @  M
  26. #include <linux/init.h>
    . H" }! k# W; G7 k7 ~
  27. #include <linux/errno.h>8 u/ W2 \6 B7 m; R5 v
  28. #include <linux/types.h>5 O+ B3 V$ z: p! U8 c" x& L( w2 N" G8 G  f
  29. #include <linux/interrupt.h>; X' p, I. r: s  L
  30. #include <asm/io.h>  K, _% z0 g# ?: ^1 W  c# P5 U) q
  31. #include <linux/moduleparam.h>0 K( ?/ d9 t5 m0 _
  32. #include <linux/sysctl.h>% U' G. S, J& q( M: o
  33. #include <linux/mm.h>* q! N# Q  u/ L3 ~. K! f0 M
  34. #include <linux/dma-mapping.h>6 ~* O7 ]- o8 W8 r. U5 V' O
  35. & l/ U7 |4 K6 A
  36. #include <mach/memory.h>' Q& w2 b( Y9 e% T# ?' Y
  37. #include <mach/hardware.h>- u1 j( m1 r4 X4 R. P- L, ^! W
  38. #include <mach/irqs.h>
    / I$ O, m' B8 ^; ]2 r( [% e8 J8 P, T
  39. #include <asm/hardware/edma.h>6 }0 h6 J: n2 o" [2 k

  40. 2 _/ G% ^1 n6 W3 a/ x
  41. #undef EDMA3_DEBUG
    6 h: d! i2 v2 e& c
  42. /*#define EDMA3_DEBUG*/
    0 T: S0 K7 z8 j2 t! W6 w. I: m( B, y

  43. 1 J% P! u0 `$ N
  44. #ifdef EDMA3_DEBUG
    ! q# s$ p! e/ O- z! \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" E8 i# U: a: J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 t( r% V4 `. j; s0 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 t: ?* }5 ^- B& r" a
  48. #else
    ( M8 l: ?$ I) X- i; _8 H/ J6 X  b8 ^
  49. #define DMA_PRINTK( x... )0 v' O$ g  c* y1 x
  50. #define DMA_FN_IN( {* e7 [' i4 e. @! v# P+ W
  51. #define DMA_FN_OUT
    1 i- z- v0 G8 v" I
  52. #endif
    ' H* _% M/ [7 x6 a" D; S% [. O: j

  53. 6 X/ A. |' m3 J) H8 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 p9 c- p# ?2 N. Q' K# j6 C' X
  55. #define STATIC_SHIFT                3
    4 ~& d1 d; D9 l) ^) \3 V6 l6 r) I: J
  56. #define TCINTEN_SHIFT               20: `) _8 W% x) C
  57. #define ITCINTEN_SHIFT              212 c' [( h6 ^# m6 s' @
  58. #define TCCHEN_SHIFT                22; q  P! w  z8 ~) ]( I4 y4 K) Y
  59. #define ITCCHEN_SHIFT               23
    + E9 @: `/ Q! `; J$ k: f! P3 P

  60. 8 q: E; ^) A* W# c; X1 U
  61. static volatile int irqraised1 = 0;
    . D3 v; @2 r0 g$ j7 ~$ P: x
  62. static volatile int irqraised2 = 0;0 V4 h9 {' b* Q0 @) F

  63. - \  W+ F6 }$ ~- ]4 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 E! F" b4 t- W- R/ E9 C& P1 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + H/ L) v, A1 A, G8 i/ j9 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Z8 t' J# V; h& e* e* J$ Z; [! q

  67. 5 m% i5 g/ M; S. x: W: l
  68. dma_addr_t dmaphyssrc1 = 0;
    ( l1 U/ f9 i* r: l2 d
  69. dma_addr_t dmaphyssrc2 = 0;
      `( l1 A& x: I& Y9 Z
  70. dma_addr_t dmaphysdest1 = 0;
    6 X- \, f' I! v  F+ |
  71. dma_addr_t dmaphysdest2 = 0;
    ; g8 D0 k% z; i- u

  72. 1 b/ W0 O; N0 N' ]& y. P4 M$ i2 N
  73. char *dmabufsrc1 = NULL;- Q" |6 T6 S( [: `" d: H: i; a
  74. char *dmabufsrc2 = NULL;
    7 q0 a% w( ^' C, i# X, n
  75. char *dmabufdest1 = NULL;8 r/ P$ n$ I% }6 J2 K( j
  76. char *dmabufdest2 = NULL;
    . }  X+ I9 V( j, c
  77. , k, g, T/ Q: w, S. T) f" W
  78. static int acnt = 512;
    7 h/ S* j( K5 B0 s8 h- ~4 x
  79. static int bcnt = 8;
    7 J4 u- }, K- d
  80. static int ccnt = 8;) h* ^& D: ?1 B0 Q
  81. ' w1 g5 x( Y* }, k; s8 y
  82. module_param(acnt, int, S_IRUGO);
    & g% Z- x; B6 ^+ P! q
  83. module_param(bcnt, int, S_IRUGO);7 e( @4 m: D# s' L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; E) N' ?9 y! ~- C  q2 z+ a- I: ]8 a
8 l4 o$ O5 d& ^3 V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ f3 o7 v4 {; Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 d7 ~+ G$ p- ~' [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# I- `/ E8 N3 F5 R' f

: S$ f  M! ^& M/ C! M) S9 q) D0 V: E  v) v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 18:01 , Processed in 0.038726 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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