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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 K) j( g4 R- }! V! d- f
  1. [code]EDMA sample test application( R8 Z( y2 p1 {+ p* u
  2. /*8 K; K+ w5 h* J; H. |
  3. * edma_test.c
    4 g* F4 W1 g3 I6 a) Z3 D* ]. u
  4. *$ o2 E7 Y) q: @
  5. * brief  EDMA3 Test Application
    0 \2 A' x' j6 e" O: B! D, t$ @
  6. *5 b" H" ^3 i3 C/ |1 ]
  7. *   This file contains EDMA3 Test code.
    ' O* B8 i% N6 n. ]/ K
  8. *0 G5 Y8 R5 o0 a$ ]* \! [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 y% T- y. S; n1 L* S# q0 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! `6 Y  K& f9 M# m( Z! x  ?; z" K
  11. *         TO CHANGE.0 T! \9 u9 e# j0 W5 s: y
  12. *
    " f" O% ^3 l6 J$ a) S0 }/ ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) j: S1 n! l, o8 D3 c" _0 A
  14. ** n; C6 G7 c7 v- A. G, k
  15. * This program is free software; you can redistribute it and/or( J* s1 Y: n5 n& t- V
  16. * modify it under the terms of the GNU General Public License as
    ' `- d& p& t) `. U" H
  17. * published by the Free Software Foundation version 2.) Q# s( ~/ F) W& n3 A- \# T' N
  18. *
    # y- ?) f: d: s# b7 Q: a. t: z' J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # ~7 A/ C9 P, T% b: A4 C
  20. * kind, whether express or implied; without even the implied warranty7 c4 [  b. ], |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 c. p+ [" j$ [
  22. * GNU General Public License for more details./ M( T- p- j# n3 O* z: f( X7 E
  23. */8 [% p6 O1 S1 C, N, g
  24. 0 N- j- e9 T' |! |3 f0 r, N$ A
  25. #include <linux/module.h>
    ! ]5 z0 F: ]+ }! ?9 y2 e, R  f
  26. #include <linux/init.h>
    ) r. s5 p" p- U6 X" I
  27. #include <linux/errno.h>; a% n' ~- l9 S0 d) J% q8 G3 ?' z% ~6 }
  28. #include <linux/types.h>
    ! D. H; n& `5 I+ W! C9 Q# X
  29. #include <linux/interrupt.h>- q- O2 A* j9 ]" z
  30. #include <asm/io.h>& P1 L: P) Y9 m3 ]
  31. #include <linux/moduleparam.h>
    & x; U8 w8 ~9 L) }
  32. #include <linux/sysctl.h>
    . T  L. E; Y8 w9 O3 r
  33. #include <linux/mm.h>
    2 t1 e9 g+ d6 S+ y2 K" _
  34. #include <linux/dma-mapping.h>7 _& w8 y/ p3 S6 j

  35. 1 V0 u2 |9 [- X
  36. #include <mach/memory.h>
    / G; @: w9 s& Z/ t
  37. #include <mach/hardware.h>
    6 P9 I2 T! q. w
  38. #include <mach/irqs.h>
    1 X2 A) }5 o* r4 H9 k
  39. #include <asm/hardware/edma.h>6 L8 S) E3 x" t

  40. 3 k  Q0 R& F" ]' @! `: ~
  41. #undef EDMA3_DEBUG
    2 J* g- _# A, K! G% U; L: O. l
  42. /*#define EDMA3_DEBUG*/
    + c& m: k$ X4 A& T. a$ l

  43. ' E: c, T: `: G2 s' P+ o2 }$ ~
  44. #ifdef EDMA3_DEBUG
    : X4 B: ~1 ]# c) a+ Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 Y( \. I9 {4 x. x, [6 ?) k. i2 B5 p5 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( D1 @! y  m7 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 s$ x* @% a; z- U% _# u! Y" G
  48. #else
    ' N0 {4 R% z; U& ~4 [  \  k
  49. #define DMA_PRINTK( x... )% l* z' Q3 F% @1 q; L% k! O
  50. #define DMA_FN_IN
    ( s+ ~' a+ S: G6 Z
  51. #define DMA_FN_OUT
    - t5 y! P: F( Q# p+ i
  52. #endif) @. @% [( j" n% V
  53. ) c# C! ~& t- G* c5 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & L2 I1 ~5 T$ q0 Q
  55. #define STATIC_SHIFT                3
    4 f9 g3 l+ w* _4 p  W& A
  56. #define TCINTEN_SHIFT               20
    : V" Y# x5 z, @* R6 _' f
  57. #define ITCINTEN_SHIFT              21: z: q9 i* y+ k( E( E
  58. #define TCCHEN_SHIFT                22  L2 N. \( Y5 E4 M+ [# x; H
  59. #define ITCCHEN_SHIFT               234 F  D4 w  ^9 Q' W% R
  60. # Y1 Q3 d$ @! G* J$ k3 I2 Z  P
  61. static volatile int irqraised1 = 0;
    0 V8 x1 j- P$ {0 A1 C/ A
  62. static volatile int irqraised2 = 0;
    * Y% o( o  r' }) J3 o: E

  63. # L; {3 k. H, X3 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 d" r. S. k1 V: j: C0 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 m& B0 N" X3 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 {, l) a4 o* w# C5 }/ b# o1 x
  67. & E7 [& i: ]0 h6 o) |) [
  68. dma_addr_t dmaphyssrc1 = 0;6 K3 V' k' k' B$ e3 c6 C+ m1 T
  69. dma_addr_t dmaphyssrc2 = 0;
    $ [8 z1 _) L' l' k. ^. {+ `
  70. dma_addr_t dmaphysdest1 = 0;
    7 x5 {- ]% A( w& u0 S
  71. dma_addr_t dmaphysdest2 = 0;' h* \( r- V! `* Y: g' V" O6 h; \

  72. 6 V! f6 B/ X4 ?5 ]' @) n
  73. char *dmabufsrc1 = NULL;% f# S, l, {" ]9 A6 S2 ~" L
  74. char *dmabufsrc2 = NULL;' n7 E0 X7 ?6 j1 ?/ G3 @  g2 ~
  75. char *dmabufdest1 = NULL;
    1 c) B+ g3 g# q- B
  76. char *dmabufdest2 = NULL;( ~7 @8 Y% @0 Q( o+ G8 ?5 ?

  77. * [  r0 @5 T* L* L# l+ h2 B
  78. static int acnt = 512;" q6 \8 K6 B  \6 X9 Q7 I+ I, E
  79. static int bcnt = 8;
    8 B  Q6 W7 [: x) Z! m6 Z5 G& T; p! X
  80. static int ccnt = 8;
    9 O6 y' u9 ~$ V6 y- O, f# D) N% U6 u
  81. " f6 r3 a% R3 d( l3 b3 U
  82. module_param(acnt, int, S_IRUGO);! h7 j- ^7 r( e
  83. module_param(bcnt, int, S_IRUGO);0 a' l1 i3 O9 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; p9 `( U2 d  l+ W0 S6 E
8 K. a2 C$ E; s$ u" Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ E5 U% |( i8 A" b  H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ \4 j9 g4 O9 ~4 B; j+ E9 W4 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 F! O2 [2 t  Y5 H' x

" J6 B% v0 z* K8 X( m
3 C' A& @  C  e' ^. s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-31 03:25 , Processed in 0.044715 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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