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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 ]2 b1 Q% \( S+ |
  1. [code]EDMA sample test application
    * ?* K* t# n5 g  L9 b9 ]
  2. /*& `( c" j- G. U9 V# Y0 e
  3. * edma_test.c# m# H, R% r! `+ ^8 Q- _$ [- V
  4. *
    % `+ }% q  a- A, a. @; R# q% [
  5. * brief  EDMA3 Test Application
    % O! ]0 U) P6 D' {
  6. *
    / y& f2 G) \% r8 }$ E) x4 u7 G7 r
  7. *   This file contains EDMA3 Test code.
    0 G" s9 b/ k3 S% d* I7 p4 G
  8. *
    + m: J0 v. L- y, K- P6 P& [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 t8 t5 s  Q* t$ T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 t/ }, p  M  W% j2 H# v
  11. *         TO CHANGE.7 ~, f2 _8 f/ }: G
  12. *: I8 O: w/ ~- s4 P) T: v) g) w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ t, i" x8 _6 q6 ^4 d# {
  14. *9 B  Y( ^  S3 e$ e& j: w: K
  15. * This program is free software; you can redistribute it and/or$ [! L- U" `! \4 ^2 W  D8 l9 H
  16. * modify it under the terms of the GNU General Public License as
    / Q" Y1 W# l5 n& z5 K
  17. * published by the Free Software Foundation version 2.# ^5 v/ t, w, P0 H, \* Q
  18. *( E( g) R6 u6 o2 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ X: X* }% g* [# o7 w! N
  20. * kind, whether express or implied; without even the implied warranty) Y( k0 F$ \& S9 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  q$ @1 |* L. a( I- T. J6 i/ |
  22. * GNU General Public License for more details.
    - S4 x/ L- T( }$ X; H9 j
  23. */- u. T4 D- p7 d0 r% B8 T/ b" D
  24. ( g& t8 g% X2 u' j- n! s
  25. #include <linux/module.h>; m5 [& ]5 ], s" P2 d9 z" s
  26. #include <linux/init.h>4 X5 u+ W+ i  x2 R
  27. #include <linux/errno.h>
    / a" h+ A# `1 W1 G' w1 Z) v) p
  28. #include <linux/types.h>' o2 A' U  Q$ F' G
  29. #include <linux/interrupt.h>! F6 K6 d7 |$ ^6 ?7 j
  30. #include <asm/io.h>
    # Y3 o: I" ?  ]/ n/ _+ o; a
  31. #include <linux/moduleparam.h>% y: b* j' V8 }  e% @; _) V
  32. #include <linux/sysctl.h>
    0 @! k  q$ J8 c4 Z: p
  33. #include <linux/mm.h>
    / W' f0 O& u: u4 S( O& [
  34. #include <linux/dma-mapping.h>
    2 k( w- p! o- C/ }. |

  35. 7 F' d9 x, g7 s4 d5 V: ?
  36. #include <mach/memory.h>
    % E) p4 I, p# n6 _
  37. #include <mach/hardware.h>" g# U6 |; W; B( z2 x
  38. #include <mach/irqs.h>
    ' U2 ]: s! U% R7 M3 H% ~
  39. #include <asm/hardware/edma.h>) }4 Z# B9 a) L; v) V1 W& m. C- q

  40. : Y, X0 K/ A. I, e4 y; f$ @
  41. #undef EDMA3_DEBUG
    1 @/ h. B$ n( @- z
  42. /*#define EDMA3_DEBUG*/. p, E9 m) j2 O5 k
  43. ; K: @1 U' C) @
  44. #ifdef EDMA3_DEBUG
    ! [3 O$ Z# M1 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), K& f+ D$ W; {8 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : E+ c( }4 \3 W4 m6 Y2 B  K, n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" v  l/ B# [9 m) t
  48. #else
    + R; v6 Z* q2 l) ^- a/ A
  49. #define DMA_PRINTK( x... )' T0 m' Y4 f8 `! b8 ]
  50. #define DMA_FN_IN$ I/ b1 j, \3 i. u# p- E
  51. #define DMA_FN_OUT: O: }. |% V9 r/ D
  52. #endif! I4 N4 V* G/ g  [2 E! t* v
  53. & t" R. Q# O4 E  f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 E( f  i+ @9 p+ o. L& {
  55. #define STATIC_SHIFT                35 K+ Y! Y. n  @$ d+ }5 |+ p+ V8 Y
  56. #define TCINTEN_SHIFT               20
    ! W- J; z: J' T! r
  57. #define ITCINTEN_SHIFT              21" W% b( v# h' C5 |
  58. #define TCCHEN_SHIFT                22
    * `1 N; h( K0 W% u3 @
  59. #define ITCCHEN_SHIFT               23
    0 y, c% v1 y) v$ [7 h) K
  60. / ]  r7 ~: ?/ [8 V& w
  61. static volatile int irqraised1 = 0;% u. h1 C" x! f& {
  62. static volatile int irqraised2 = 0;  N4 P- d/ n$ Z$ z+ a' L9 W
  63. / u4 {" t, H1 ], o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # d( ?. S0 F& c( a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 M- ?4 F# p! I* `. N+ ~4 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! V- s* s6 A/ W1 j, U8 N( c' R& T
  67. 8 J2 t4 |  r, @4 S: J  t) V
  68. dma_addr_t dmaphyssrc1 = 0;
    - g  v" q% _7 c! a, T* Q
  69. dma_addr_t dmaphyssrc2 = 0;
    * [& H& p0 x1 U& g9 d
  70. dma_addr_t dmaphysdest1 = 0;6 D2 \: e7 p+ P9 i! S+ ?
  71. dma_addr_t dmaphysdest2 = 0;
    0 t7 h* I& @: e) T

  72. # H  e  ?9 x* n3 O
  73. char *dmabufsrc1 = NULL;
    * T) Y0 G) e: M
  74. char *dmabufsrc2 = NULL;6 b5 d" J; x+ |8 H4 y+ \+ M! e, R
  75. char *dmabufdest1 = NULL;
      C! h0 U& Z: N; e  v
  76. char *dmabufdest2 = NULL;
    ) p; V4 q7 ]( ^3 l5 j) H& f
  77. ' v7 f, V8 f" ]- g3 w
  78. static int acnt = 512;/ O( d1 C1 n4 ]1 J# f% Y: O
  79. static int bcnt = 8;2 F, b( A1 _2 o- C, P
  80. static int ccnt = 8;! S- k4 W- w4 n/ M- v

  81. 6 t2 K% w( k! w1 j8 Z( h% r, W
  82. module_param(acnt, int, S_IRUGO);
    + e/ a' x# k/ D! Z2 T+ J% U
  83. module_param(bcnt, int, S_IRUGO);4 \: G. q: M5 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! R. `3 O. t( F

) f$ P0 h# f* U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* y. m/ v8 l1 j/ [2 J& l8 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 g8 D! `8 u8 |7 U2 U  w- Z. d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  `: R. T7 u% v% z8 O: w( ^
" o) m, s  P/ }" R% u% N! Y4 T! p- n( D- w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-23 22:29 , Processed in 0.041971 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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