OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) [2 M- @8 o# J3 c! |
  1. [code]EDMA sample test application" e: G* E, T& v: f
  2. /*6 D, V" e* k4 o# F% q* U
  3. * edma_test.c
    + C/ c% f) X9 _  f) U: o
  4. *
    - f, W5 H7 O" t" h! _7 T- G# B
  5. * brief  EDMA3 Test Application
    + i. g7 Y, Y$ c1 g
  6. *: y( |- p2 T$ U; C% i' O% h' D
  7. *   This file contains EDMA3 Test code.4 ^6 p2 ^  p& N# U
  8. *% M5 C. F) }( v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 S! D& z  t1 R" a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 C4 V9 \" X2 O  r, b
  11. *         TO CHANGE.: s. y0 W# k) e) ^% S. |( x
  12. *2 z' p, K. L% t+ U% ]$ ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      t/ @6 ?! h' e5 h4 T( t% Z. _& a
  14. *9 [" U: w: K) B) x" J) X) a3 y
  15. * This program is free software; you can redistribute it and/or2 C& `! _- Q, b, v5 D
  16. * modify it under the terms of the GNU General Public License as, T* a: |8 E& v2 F* Z5 T
  17. * published by the Free Software Foundation version 2.8 r2 d) \- X) C+ }7 l* j
  18. */ b6 |% x: h/ R/ R" I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% y+ Y8 S/ P% M; w
  20. * kind, whether express or implied; without even the implied warranty
    % q/ o! p* `1 h4 T8 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) d0 c4 N7 W- L& X0 l
  22. * GNU General Public License for more details.
    % P1 t: O' {0 r; Y+ q  o+ u2 F
  23. */
    1 I4 w5 w4 m5 Q' S( q  V3 R3 g2 @2 C
  24. ! `' E3 B3 h& J0 P- n! p
  25. #include <linux/module.h>8 D7 |" P6 j6 N) q* m7 I* F' C+ J3 n
  26. #include <linux/init.h>
    1 g, C. Y3 W; y0 `; {3 h* }
  27. #include <linux/errno.h>3 U7 ]4 Y! g* ^$ b; j: B7 I
  28. #include <linux/types.h>
    , U6 I5 w' o0 O# _1 ]) \
  29. #include <linux/interrupt.h>
    8 M( S  B  D) s. G9 [7 X
  30. #include <asm/io.h>
    4 @; J% n( ]7 ?0 |3 G9 S/ r9 a: p
  31. #include <linux/moduleparam.h>* z' j5 l! s$ u) q# D; V% R. U: v2 I& H
  32. #include <linux/sysctl.h>8 W+ x4 e9 e! T3 o- o$ \3 h: C
  33. #include <linux/mm.h>
    ' J4 k# {  f: f2 I; i
  34. #include <linux/dma-mapping.h>6 O: R3 s) k/ n

  35. - B. H' |2 D, y9 y- M
  36. #include <mach/memory.h># ^& L8 ^( I8 C& e0 Y2 x
  37. #include <mach/hardware.h>
    : p0 s  {2 D, J* u: x2 u1 m# Y
  38. #include <mach/irqs.h>
    7 F4 w; j! ~  @( @
  39. #include <asm/hardware/edma.h>
    - c4 n+ H" l  o) `0 J4 M, T+ r( c% N

  40. & m: g/ a  ?- ~( q1 e
  41. #undef EDMA3_DEBUG6 U/ F$ t  z9 @. T  Z
  42. /*#define EDMA3_DEBUG*/
    . d  I) ]5 Z3 b0 O. o& B

  43. / s, |+ y9 v! e4 X9 ?- E3 y" z
  44. #ifdef EDMA3_DEBUG
    " W1 U. j$ Z- W. G8 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 o' u2 U, T3 S# N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , q7 Z: g7 y8 a; P9 p! R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 Y1 E, z! \3 f' R& Q
  48. #else
    ' }: |8 @) d) h5 O7 z
  49. #define DMA_PRINTK( x... )
    8 l0 |- q3 P6 T' y) N
  50. #define DMA_FN_IN9 x: }) v( F+ t0 I/ y) }* f
  51. #define DMA_FN_OUT
    # h) _. M4 N' X8 \5 h' Z
  52. #endif
    . ^$ R! E" t7 R- d' a
  53. * F! ]. t6 ^# r$ O4 C( u& _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % W) m+ F0 Q: S' u5 r
  55. #define STATIC_SHIFT                3
    $ [, s4 m; F3 ]# w0 L0 ]
  56. #define TCINTEN_SHIFT               20# P$ ?9 p$ E6 S: s+ c
  57. #define ITCINTEN_SHIFT              211 d! y$ W# s2 R
  58. #define TCCHEN_SHIFT                22
    6 `* L/ F3 a& q
  59. #define ITCCHEN_SHIFT               23! d. _9 P% ~1 o  w2 E, S
  60. ( m9 T8 X! }6 K8 k1 J
  61. static volatile int irqraised1 = 0;. C5 k; r3 S+ X8 T
  62. static volatile int irqraised2 = 0;. ~( v# z( k# c& y8 [! C" |

  63.   Y, G3 w- q! p2 c5 }% @) H. a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) \" x1 m  N" P; l( g# s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# A5 u( f1 i* @* `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' G2 h- J6 c6 N2 ?5 m# w0 y( W
  67. " A7 k) s  @2 D8 D/ R/ U
  68. dma_addr_t dmaphyssrc1 = 0;
    1 t5 Z% X1 l- y5 K8 z! \
  69. dma_addr_t dmaphyssrc2 = 0;
    8 {( ?- `7 M1 b* r+ R7 i6 f
  70. dma_addr_t dmaphysdest1 = 0;, A$ }% J/ j# N6 i
  71. dma_addr_t dmaphysdest2 = 0;
    ' `" B& c. }% F

  72. ) C- f5 e5 L8 i1 |) a4 x% K
  73. char *dmabufsrc1 = NULL;8 f) q$ ^2 h$ s( I* k
  74. char *dmabufsrc2 = NULL;: B1 z' R& _, k$ M9 O! x
  75. char *dmabufdest1 = NULL;
    " R) ~# d0 ?3 P6 \
  76. char *dmabufdest2 = NULL;  ~$ ?( M* g$ [1 X

  77. : @% \$ K! L" B6 w; T' z
  78. static int acnt = 512;+ e3 ^9 Y3 B) Z, H3 U; U
  79. static int bcnt = 8;6 u" h$ N( N/ T
  80. static int ccnt = 8;
    7 Y3 r0 F: K6 ?7 j" i6 j

  81. ' b& H! C  s5 D" {+ j
  82. module_param(acnt, int, S_IRUGO);( I* ?$ `4 e* v6 x# U8 n( y
  83. module_param(bcnt, int, S_IRUGO);' b  n7 k4 t- l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 U" i. u2 `# m4 [* z% q5 z. }, L

/ u  K( [1 U" n) V, H" O+ r; m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 K7 O/ W: _# p. a8 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) c6 I3 S9 ]. W3 K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 k8 w4 K: i* `/ C/ u+ w
  t7 `: M! j5 q7 s0 j
) c* I+ {, H* a' G# t8 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 19:07 , Processed in 0.037774 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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