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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! J: d* Z9 o8 j$ K) L" [9 ^! D
  1. [code]EDMA sample test application
    6 ?/ f: n# L, x/ p6 ~
  2. /*: u" ?' i% y0 g) e$ \
  3. * edma_test.c1 T" ?* \4 ]: ~9 V4 j& h/ H9 ~
  4. *
    ; {8 ?; t: A3 ]/ w' H
  5. * brief  EDMA3 Test Application- P$ n$ p- Z1 Z3 ^! S/ P) i: E: Z
  6. *9 Q: s2 R) @& b- t9 X% Z
  7. *   This file contains EDMA3 Test code.8 V1 i# Z" o( Z4 b9 {- `' V+ D% b  d
  8. *
    / H8 I+ c0 v- I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ [% i- k: b# k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " ~2 r- o/ S( T( P3 d$ A: h
  11. *         TO CHANGE.
    $ o+ d2 W3 ^& Y4 x: k# e
  12. *
    + @7 A' @$ o2 q. P9 o- ?/ z" x  z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// m% V* B- U' X5 ?6 n
  14. *0 k, d% U7 }/ H
  15. * This program is free software; you can redistribute it and/or
    5 [  l! B+ |) Y4 b7 F
  16. * modify it under the terms of the GNU General Public License as
    3 ^  V: t# k5 E2 J
  17. * published by the Free Software Foundation version 2.$ g3 a, @- `- N
  18. *  M6 U% z! x# A5 i7 d) o; N3 e& G  {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 g. f* M' M0 Y% V6 ~* a8 h
  20. * kind, whether express or implied; without even the implied warranty4 l$ k1 V5 s0 C: t6 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; E# D& c0 @/ _. M3 `/ @6 C. K
  22. * GNU General Public License for more details.
    ( t+ q( S) ?, ~  n% O! [
  23. */
    * v7 z& Y% q2 |4 q

  24.   a! q* n! F) p% B- z3 L0 H
  25. #include <linux/module.h>
    ( P( \6 E7 j- R' p, R8 ~- e
  26. #include <linux/init.h>
    2 ?0 B( @( G, |+ @
  27. #include <linux/errno.h>+ J( V/ M* r" N& _: R+ U8 Q0 i4 G
  28. #include <linux/types.h>
    ! A7 _- Q* ?5 C, Z* `! q  I
  29. #include <linux/interrupt.h>7 C5 H0 k: M7 y  R4 A" i* A* f
  30. #include <asm/io.h>8 N3 [4 o6 q' L9 r. g: t5 D/ k
  31. #include <linux/moduleparam.h>
    ; A5 D0 T. G3 a9 \4 {' D" M
  32. #include <linux/sysctl.h>
    2 W2 H9 ?8 |* _9 o
  33. #include <linux/mm.h>
    . e, C# N, H: i. `; @9 M% }8 i0 q
  34. #include <linux/dma-mapping.h>  Q) r# z) N- C* b- Y

  35. $ g/ n  M: b. X7 k+ x- l
  36. #include <mach/memory.h>: O' d6 ]; @( ?% Q3 J* H
  37. #include <mach/hardware.h>6 f# r% K, m* \) @, E
  38. #include <mach/irqs.h>' S' h+ o0 f! ~
  39. #include <asm/hardware/edma.h>
    5 y& V0 |7 J9 H3 J% _

  40. # j7 A( t9 w. K
  41. #undef EDMA3_DEBUG) O! T* ?5 Y# h; M% P, e* k
  42. /*#define EDMA3_DEBUG*/
    5 o: J5 }) q, m( G+ o5 q

  43. # Z2 W. r# y) D, ~! G& A  Y* G
  44. #ifdef EDMA3_DEBUG' M6 m- g  ~5 V- `- l( A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 n, a: V) C( P" g( o" @7 ~9 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # j2 P3 V7 m: I: J5 I) ?4 ~7 i; ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' {- T+ w) D$ W- t8 @  G. I
  48. #else
    1 R3 @. h# ~  @
  49. #define DMA_PRINTK( x... )
    5 s7 s( P0 ?9 t' l: p; T5 p' L; P5 P
  50. #define DMA_FN_IN- y6 W1 [. z+ B2 t
  51. #define DMA_FN_OUT4 ]8 m7 ^* N& Y0 A) h% b
  52. #endif
    5 C- s; D& l% U7 p1 N( |9 [

  53. - c& J& n" X3 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 @5 G, T8 l0 P; [' [
  55. #define STATIC_SHIFT                3. Z6 y" y2 o9 j9 X) z3 t* ?
  56. #define TCINTEN_SHIFT               20! |7 g- J9 z' [; m3 N
  57. #define ITCINTEN_SHIFT              21
    ! w  X" {' @/ Z* w3 a
  58. #define TCCHEN_SHIFT                22) v4 E; |9 H! Y3 ^# G
  59. #define ITCCHEN_SHIFT               23& c- V8 L2 g8 e

  60. 9 H) T/ G/ k5 `6 [: t& O
  61. static volatile int irqraised1 = 0;6 |3 j, R' C7 D- E( @
  62. static volatile int irqraised2 = 0;
    3 O# q1 O0 a* H7 H* I6 f" l
  63. - h) {4 p2 W' K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % p( {3 f$ O6 i5 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, m0 z; C9 t' u* M6 f' \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ f# H3 u0 ^& b: q3 E

  67. 9 d! K0 l* S; t$ ~, h) x
  68. dma_addr_t dmaphyssrc1 = 0;
    % @& Z3 p0 h5 H
  69. dma_addr_t dmaphyssrc2 = 0;/ D1 B0 b/ L$ j3 R, r
  70. dma_addr_t dmaphysdest1 = 0;
    ! [( p" C" ^' Y5 ?* d7 K  h: f
  71. dma_addr_t dmaphysdest2 = 0;. q; a0 s, \& j% U/ h" {

  72. 5 l% t- v6 C/ ~; Y; x* `
  73. char *dmabufsrc1 = NULL;
    ! C1 S6 F( f; O5 y; P7 Q+ }
  74. char *dmabufsrc2 = NULL;
    2 M8 y* _7 u5 N! T. m  D
  75. char *dmabufdest1 = NULL;
    7 ?, {& D4 Z" P8 r, n+ Z1 u+ a
  76. char *dmabufdest2 = NULL;. Q: t: n/ x( b5 c' E: t  Q! A3 o

  77. + q6 }  Z. G6 B, }% s
  78. static int acnt = 512;) O6 m; D- d% z, o2 g- }' Y% o
  79. static int bcnt = 8;' x5 f) h  Q, i, F- M
  80. static int ccnt = 8;
    7 C3 M& I% S# Q$ E. Z" y- E. o* {
  81. 9 Z. j! G; {. z  w  c! I
  82. module_param(acnt, int, S_IRUGO);
    7 s8 q! d# g" C5 B& H5 l1 R% p
  83. module_param(bcnt, int, S_IRUGO);
    1 q* O' V  C! j/ a9 g8 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 O5 i, P# v# V1 y
1 C! `. C! G( L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 T% k5 h% |, tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" i  p' W. Y' I/ B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 P# r9 ~9 Z; ?/ K# g" L+ `
+ D! `; w" _; ]0 c

& Q  l' Z/ F9 ~& W) i/ ?1 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-23 05:26 , Processed in 0.040313 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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