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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 O5 K1 H( N$ q! F# ^! E
  1. [code]EDMA sample test application
    ' c/ ]3 P  t8 {/ C) l& G: Q
  2. /*
    ) U' ~" V2 l, A) @2 M5 H
  3. * edma_test.c# C1 f) G9 ?) F8 v( ~3 |
  4. *
    , x# s: r0 V( r
  5. * brief  EDMA3 Test Application# p! j. ]! z' }9 T. p0 n5 r
  6. *) l3 [: j6 f* X0 R0 U% A; `
  7. *   This file contains EDMA3 Test code., D$ C: i1 C- Z' l
  8. *
    $ ^' B( L' v8 d7 |$ t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * h9 D& y3 E$ T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ f+ o" P6 N) o6 U2 _9 C
  11. *         TO CHANGE.6 ?4 c& l1 i+ T5 `  h' w
  12. *
    " ?1 }* ^4 m* I  |, g; y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 a: g7 l7 p5 \0 E/ \
  14. *2 }8 s7 R) A$ }5 t4 h8 t% X0 O7 ?
  15. * This program is free software; you can redistribute it and/or
    ; M$ K$ n7 Y+ A! O/ ]+ Q, ~6 L
  16. * modify it under the terms of the GNU General Public License as; h' c/ {! c7 N
  17. * published by the Free Software Foundation version 2.) Q# k5 z+ o, ]3 a
  18. *
    " _8 P% V4 T* |9 I% B; k- f9 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % N$ c; o) q6 y* |1 B
  20. * kind, whether express or implied; without even the implied warranty
    ' }6 v  c& {; P* u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- P% S7 \" u, ]( V! e" w9 A1 u
  22. * GNU General Public License for more details." {3 o/ s' O! _! s/ a& a' ]
  23. */  U) T, w1 m6 [% O6 @2 R8 G+ M

  24. " a5 v, ~" z; N
  25. #include <linux/module.h>
    0 p  E2 r( c4 s  [# r% {$ v
  26. #include <linux/init.h>
      J( H( t3 ^+ y* n! H/ F2 T# a) v
  27. #include <linux/errno.h>9 i2 ?% @* f3 Y& k, _% P! k  s
  28. #include <linux/types.h>& C) n9 [7 q' C3 q$ B1 r
  29. #include <linux/interrupt.h>1 r. p! r' P) f/ m) R
  30. #include <asm/io.h>9 D, D$ {/ ?6 X/ w, V
  31. #include <linux/moduleparam.h>0 K9 g2 q; N, k7 ~, B* V7 l
  32. #include <linux/sysctl.h>" T) X7 U* T7 ?8 R
  33. #include <linux/mm.h># D1 L; G4 V4 C0 P: |* v
  34. #include <linux/dma-mapping.h>, |' @9 R& o/ @3 D2 V' c
  35. 5 e4 \& s: [+ A/ _. f
  36. #include <mach/memory.h>2 S, y: l/ P9 }9 I* N: h8 e8 q* y
  37. #include <mach/hardware.h>+ A. C/ i6 q( A8 r( _! s( O
  38. #include <mach/irqs.h>0 K2 c9 B+ U# L! b
  39. #include <asm/hardware/edma.h>
    / q3 I. `) q$ D  ?9 D' X( F

  40. ( d3 y3 e* ^1 h7 _. I
  41. #undef EDMA3_DEBUG7 W' c7 u0 I# J9 ^2 r: ^5 C# T3 l
  42. /*#define EDMA3_DEBUG*/
    " Q" T( j$ r9 z" W1 S2 u! d

  43. 4 ^- ^! o" s$ U! m( ]
  44. #ifdef EDMA3_DEBUG) E; ]8 O7 I& i* V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( j; c( C& k9 r7 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 k* E9 y( A2 y0 j) g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 M8 q6 u# f' [) X/ u) `
  48. #else
    ) i3 `- V5 m) q
  49. #define DMA_PRINTK( x... )
    4 P/ V4 \# j* s; U  u
  50. #define DMA_FN_IN7 f: S% M& ]: k+ E4 A
  51. #define DMA_FN_OUT# I9 _! [7 I* q3 P% H6 Z0 B
  52. #endif
    4 Q9 @* \: t- Z& L. B
  53. , c/ e: B" x( s* Q* g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& ?/ O; {/ G0 Q' j7 {
  55. #define STATIC_SHIFT                3
    ! I5 f& r. z6 S- v
  56. #define TCINTEN_SHIFT               20
    & K! ]$ X. b# ~& B  @6 W
  57. #define ITCINTEN_SHIFT              21
    7 V8 x9 A/ J3 ~
  58. #define TCCHEN_SHIFT                22, d, s3 Z$ H. h) V
  59. #define ITCCHEN_SHIFT               23
    / a. h6 c5 d3 _4 {

  60. / X) ^* I  \  I- n2 c; Z. h* s8 R4 f
  61. static volatile int irqraised1 = 0;
    1 I/ R, Z7 E- Z, T* G' T
  62. static volatile int irqraised2 = 0;! d  L" q0 ]% M9 U
  63. 4 z* }/ D: i& N3 d- W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' m' R0 @8 i$ q7 }) }0 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 v9 Q2 B7 F9 @; q2 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Z# ~) o3 d( O, M2 ~" M, O" Q

  67. 3 p+ ]( @  h/ E
  68. dma_addr_t dmaphyssrc1 = 0;
    1 ^8 D3 ?" G3 b0 _# I( y8 S
  69. dma_addr_t dmaphyssrc2 = 0;# X4 |* t1 J7 K; i# B: I
  70. dma_addr_t dmaphysdest1 = 0;
    # |% b. H7 |2 T' @
  71. dma_addr_t dmaphysdest2 = 0;+ w/ O8 j" ?& _  H2 F4 w  I/ {

  72. 1 O) }2 G+ ^5 i. _1 r
  73. char *dmabufsrc1 = NULL;
    # r. v* G7 D; h. T2 @7 _
  74. char *dmabufsrc2 = NULL;
    : V; J% g; ~  f5 r) _% d+ h
  75. char *dmabufdest1 = NULL;, q: g( z& x* U3 Z
  76. char *dmabufdest2 = NULL;
    1 L4 K3 @8 y0 u: B4 N! P  B. b& ^

  77. + r( |6 ~6 i$ P# d! o
  78. static int acnt = 512;* x  C  {8 y) @6 w. t9 v
  79. static int bcnt = 8;# ^# I4 }" n' ~& t
  80. static int ccnt = 8;
    9 n$ i- K8 _, b, N  H" h

  81. . y, T# h6 x% O0 V+ S
  82. module_param(acnt, int, S_IRUGO);7 N& u5 b& o: m2 d  i7 u9 ~
  83. module_param(bcnt, int, S_IRUGO);
    ! r1 {9 D7 H! G: [# ?: A1 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 G3 b! u$ S+ Z. b9 _3 o, ?

) Q# z$ I% F8 b& ?9 l; A- H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ^+ E% U& b* G( R4 \( `9 @: v* X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 x4 f# N2 Y/ E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! H9 j" Z9 m3 P. T2 u/ [
4 L; D7 n+ a9 u1 }7 b4 E
$ J2 \1 Z( `2 _5 x/ L* U" O2 Y6 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 16:46 , Processed in 0.038731 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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