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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) s9 P; ?7 p- `: T
  1. [code]EDMA sample test application. U2 x% \# Q4 }. G0 Y+ N
  2. /*: J7 Q" @+ Q4 r7 C: l% P
  3. * edma_test.c5 \  }7 ?1 ~8 q& ^- ?/ k5 W
  4. *# h8 s" k$ L. _/ u% q$ U
  5. * brief  EDMA3 Test Application4 d0 S  F* U( |- Q6 P
  6. *' U9 c0 r! m  Y
  7. *   This file contains EDMA3 Test code.( C" U, @8 ]6 ]! n: n" n
  8. *) C" @" ]; n: R8 m- W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; O9 \: \- U1 h- b' Y$ M5 r+ t' @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 h1 o  x  R) L. l  |- X6 k9 y) J
  11. *         TO CHANGE.: j8 {# }; h5 M6 Z# u
  12. *8 A* k; S8 Y$ {$ D' \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) v" `6 g: I9 H4 v
  14. *$ ]6 M- m5 z1 g; F; I% m2 j1 j" q
  15. * This program is free software; you can redistribute it and/or- `0 p, Q5 Y. Q0 s
  16. * modify it under the terms of the GNU General Public License as
    9 O* S; `* @5 E! l4 W: v; S  j
  17. * published by the Free Software Foundation version 2.! |7 Y5 X! U6 u& R8 \7 U, j
  18. *3 l, ]+ V% {0 |: F7 ?1 I' L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % A  W! P6 V4 K/ Q
  20. * kind, whether express or implied; without even the implied warranty
    - g; ]0 G# o: k( D% w1 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) P  @6 S2 g% O' j) X
  22. * GNU General Public License for more details.
    6 N8 m% L. [; J9 `: B% \: m" F2 I
  23. */8 p2 b- j. j% V' x) y

  24. 2 ~) b" Z) j  @  F0 A5 ?( p1 U' G
  25. #include <linux/module.h>
    % k- ?! x) I- P4 d" ]/ ~* T
  26. #include <linux/init.h>
    ( j6 f0 p6 H0 ^' ~
  27. #include <linux/errno.h>
    3 l! a" A5 d6 f1 D
  28. #include <linux/types.h>8 [5 z$ |9 \  v; a4 Z
  29. #include <linux/interrupt.h>9 X* ]% H0 U1 ?- R( Q
  30. #include <asm/io.h>2 x% }# [' p6 z6 i  s; y3 u' `
  31. #include <linux/moduleparam.h>: L% M. L) W) X
  32. #include <linux/sysctl.h>: D: m- t" B! P, Z/ i
  33. #include <linux/mm.h>
    ) I  D( e% z7 u8 G
  34. #include <linux/dma-mapping.h>7 H% a' ~& x" ?0 J+ E: c: C

  35. , U& o3 f! T8 v
  36. #include <mach/memory.h>- ~5 J. |0 i4 e: a; N* X1 d4 \- X7 N
  37. #include <mach/hardware.h>; a4 l4 ~7 O  g/ A* |
  38. #include <mach/irqs.h>
    1 [  p! _7 P( U
  39. #include <asm/hardware/edma.h>
    , E$ u& U# ^3 g: b. O

  40. 5 w. d/ @1 M6 y. H% Y4 c( K
  41. #undef EDMA3_DEBUG
    * Z8 x" ^# u7 p, R0 u- `
  42. /*#define EDMA3_DEBUG*/
    * P  A: z- b/ R) k! ?( [
  43. + m, l! @' E$ \# ]+ M# p5 @1 i
  44. #ifdef EDMA3_DEBUG
    4 m- q& a$ B; G' L' q- d; s* d$ y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). b" y8 P$ O2 ^9 i2 D9 t( `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Z9 W8 A9 {, i+ K( I/ e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * m( i. Z* [' o3 i
  48. #else' p4 c/ ~, H! c1 Q$ D
  49. #define DMA_PRINTK( x... )
    ' ]) Z. `3 e5 ]) U, n& l! V
  50. #define DMA_FN_IN
    : G. D  ^9 l9 |# }9 F. r
  51. #define DMA_FN_OUT# h! C) u* {5 \, }5 \
  52. #endif
    , r& N* e# I5 s  y9 H3 @8 M
  53. : H9 O& ~, |0 C( _, c( B' l5 {" M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : z  r0 X, U" u6 @1 {
  55. #define STATIC_SHIFT                3
    / y- Z8 T# w: w: t7 d5 p
  56. #define TCINTEN_SHIFT               20
    ( F) H( r! m+ x
  57. #define ITCINTEN_SHIFT              21( I5 e! C6 y8 u
  58. #define TCCHEN_SHIFT                22
    ' O% A+ Y$ j7 |6 K
  59. #define ITCCHEN_SHIFT               23: Q- M4 v) E+ U+ V) w. W0 K

  60. ! q0 \8 _5 b* d: e/ ]6 E, m
  61. static volatile int irqraised1 = 0;9 \2 Q2 I5 o: R- O( p% W
  62. static volatile int irqraised2 = 0;
    : d7 T8 t( X# B6 w6 G5 v( H: p0 C

  63. # J0 u# ^9 ^3 @' s# R* P+ L+ v1 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! K: t: g( ]! A8 u, L2 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" c1 t3 V6 S# t! a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% G+ o* L8 H! C3 E% r
  67. ) Q9 Q: P6 ]. E
  68. dma_addr_t dmaphyssrc1 = 0;% S3 _" R  H& F$ x- r6 b
  69. dma_addr_t dmaphyssrc2 = 0;$ c7 b6 \! g; X- |" W
  70. dma_addr_t dmaphysdest1 = 0;9 e) d1 e+ o* f# z, U
  71. dma_addr_t dmaphysdest2 = 0;
    6 u& Z$ K: k; i# ]5 i$ b: F% F

  72. * e# K2 C! m/ D% K0 r
  73. char *dmabufsrc1 = NULL;
    ! ?/ c  [% E: h7 a+ f/ H5 W
  74. char *dmabufsrc2 = NULL;4 e* o! s8 u1 o4 t$ B
  75. char *dmabufdest1 = NULL;6 Z/ Q9 L* Q# }$ q' B
  76. char *dmabufdest2 = NULL;! x$ s) r* o8 O1 x

  77. 8 H, ], m1 w3 o! b- i! K5 r6 P
  78. static int acnt = 512;! v' }) J/ {" c2 \. N: o
  79. static int bcnt = 8;+ S: ]( l6 Q( }/ V( O' z
  80. static int ccnt = 8;
    9 Q" R4 F- {1 o

  81. - I( x- o! B/ e
  82. module_param(acnt, int, S_IRUGO);6 E3 T' D3 a3 f
  83. module_param(bcnt, int, S_IRUGO);7 m' T9 M9 W" H) ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# |4 b' e, U* D4 H" \

5 w+ L+ j/ a: A( ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# i- U" S6 j; G: z) i: L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; H0 H) K& M6 ]- P' h$ x- g% K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 n. j8 A  c& J8 v/ c; ^. G0 t* W! K! G4 L) _6 i5 f5 h* x

8 h& m8 m$ S; E( j9 `4 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-17 22:39 , Processed in 0.039060 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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