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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ }# C0 n% J4 Z& @# o8 e
  1. [code]EDMA sample test application
    2 F" N2 c- E6 P( f5 y$ c
  2. /** W- P  t6 O2 n( w
  3. * edma_test.c$ t* Z6 ^: d- ~' \6 Y3 E7 O
  4. *
    3 m' y+ M. x# K2 X* U
  5. * brief  EDMA3 Test Application$ ^7 ~) g/ T. H) K0 l
  6. *
    ( r/ a' w- Z( v5 P$ G
  7. *   This file contains EDMA3 Test code.
    9 \7 Y9 O, j: |" U
  8. *
    , e2 K2 W5 K8 F/ ~( G: Q+ ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 j, ^4 @: Y, x; P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " v, K  E; z8 _( v
  11. *         TO CHANGE.* {/ e( W( a3 a% \
  12. *
    # ?  y% w6 }3 E( @; H$ v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 }2 k( T! s0 M8 l; U
  14. *
    2 n. o8 P& a9 @7 V2 k- p$ H0 f
  15. * This program is free software; you can redistribute it and/or
    ; n$ B* S: W; j5 s6 F6 P* o+ ]
  16. * modify it under the terms of the GNU General Public License as
    % R5 F# }& H3 I, t2 b8 Q
  17. * published by the Free Software Foundation version 2.
    ' Z' W! ^8 j9 i4 a8 J) G7 x: p
  18. ** ]7 ]- h0 H7 k) _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % A' D+ Z$ o/ @, ^7 f8 L4 X
  20. * kind, whether express or implied; without even the implied warranty
    * W2 f" t$ S  e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* W' P8 R1 ~3 l' q/ M, Z
  22. * GNU General Public License for more details./ S$ W6 ]6 ?, T% k
  23. */% W( @. o( I: f5 E. T" T; u) n

  24. ' e( M# Y( c! a
  25. #include <linux/module.h>
    3 ?. \/ h: \9 e
  26. #include <linux/init.h>8 P6 Z$ Z; _2 {. |) m$ s
  27. #include <linux/errno.h>
    $ H6 M6 M( X: b/ [
  28. #include <linux/types.h>9 \/ l  E. ~8 Z0 Y+ ?8 Y
  29. #include <linux/interrupt.h>1 K4 v1 ^- t) |% h, `! [$ R2 [7 V
  30. #include <asm/io.h>
    $ k) x/ F8 [& ^. ^5 i/ a4 M- V+ W
  31. #include <linux/moduleparam.h>- e9 |, J: f9 |) N
  32. #include <linux/sysctl.h>9 U; Y! e0 A! E) l/ `2 @) X
  33. #include <linux/mm.h>
    4 @6 o5 d* c& l. U+ Q3 k4 G5 Q' |
  34. #include <linux/dma-mapping.h>
    : l" f; m$ y# ?

  35. ; E+ r1 x# r5 c9 ?0 \
  36. #include <mach/memory.h>
    1 B7 a! s6 p$ u2 J7 W4 Y
  37. #include <mach/hardware.h>
    / X8 S0 [5 t  Z5 k7 @/ I" P
  38. #include <mach/irqs.h>
    8 }/ `8 z. k* G) |: p
  39. #include <asm/hardware/edma.h>
    " w4 K2 [% a0 L, `8 t1 g( X7 U
  40. ! [$ l0 e. U2 M) m8 t
  41. #undef EDMA3_DEBUG
    " d3 q9 W, |* w- w; i
  42. /*#define EDMA3_DEBUG*// S5 ^! q4 x( U2 w7 f- E6 ]6 @, [5 z
  43.   B' R0 x/ z6 d' m
  44. #ifdef EDMA3_DEBUG
    8 Q' i9 s3 _6 o. ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): C& v. H$ O' |" N0 f, s* B: I6 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 f, u6 P8 d9 a1 C0 x7 [; b4 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 U! ^2 n% q" \9 \) y* n# N
  48. #else
    1 @- p& A( V( v2 ~) J7 Z
  49. #define DMA_PRINTK( x... )
    , B4 l& D* q- p4 M+ F8 G8 Z) T
  50. #define DMA_FN_IN! H6 ]8 w# e6 J7 `" M. I# m
  51. #define DMA_FN_OUT8 E3 X+ M4 D, Y. r" j# C& Q5 L
  52. #endif* d% h9 c% |. J( ~! ~6 S

  53. , ~# u) a- _5 ]' T3 p/ Y9 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& [  s/ S: P9 j. f$ h  }$ ~% F! ]
  55. #define STATIC_SHIFT                3
    0 _* w% y/ c% o" f
  56. #define TCINTEN_SHIFT               20, D8 g! l) ?6 U# l$ K% F
  57. #define ITCINTEN_SHIFT              21
    ( A+ e# _/ C; Z% y5 q8 c& W
  58. #define TCCHEN_SHIFT                22
    * b8 D1 ]) Y/ J
  59. #define ITCCHEN_SHIFT               239 _; b4 |: ~* V/ u. {

  60. ' b& }. y" j* m: S% S) J
  61. static volatile int irqraised1 = 0;
    # `/ j' G! R$ f2 ]) F$ n: \+ f
  62. static volatile int irqraised2 = 0;/ A: Z) W8 x: {* s0 F7 M' m

  63. , ~7 h/ D9 }% y3 F  \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 p4 i; h1 y$ D7 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 k' x! |# y2 v( k; _' p& i; G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ ?! G7 L/ l0 D; p4 n% K" k: l* ]8 Q

  67. 5 R' u) |7 o& M. O, G
  68. dma_addr_t dmaphyssrc1 = 0;! d9 P$ f& D6 A2 O* O2 w* m6 f
  69. dma_addr_t dmaphyssrc2 = 0;
    ; @) Q) v+ m: ~! M5 K
  70. dma_addr_t dmaphysdest1 = 0;
    * U2 E# t  E7 q4 L/ ?9 C
  71. dma_addr_t dmaphysdest2 = 0;4 s+ x& d  t" N

  72. 8 u* d2 Y0 S! D3 e
  73. char *dmabufsrc1 = NULL;- z8 n3 W4 g6 F8 e& X
  74. char *dmabufsrc2 = NULL;
    ) g0 \1 b" F9 S% N  o/ J( n" g3 D
  75. char *dmabufdest1 = NULL;
    5 Y2 o' }) o1 b+ T; s% w
  76. char *dmabufdest2 = NULL;
    ' D$ ^. D4 L& N8 g" |! ]- j

  77. 9 _$ ^+ w  F1 i2 x
  78. static int acnt = 512;; e0 r8 I* \6 M* G# A1 W6 C2 }
  79. static int bcnt = 8;2 `9 H& C; l+ o
  80. static int ccnt = 8;
    ) I" D2 e" D' J! D2 @

  81. - _9 v0 E7 g+ _
  82. module_param(acnt, int, S_IRUGO);* e- n$ l8 @) \+ x& x
  83. module_param(bcnt, int, S_IRUGO);
    : S. ?: x: Y, j6 m" M. U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; P; a/ |3 t; S/ Y$ ?0 x
9 ^8 b) Z. @2 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ v& P2 A. ^  V, j2 v1 D+ U0 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; z+ M. _3 [  f7 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 H9 y9 q3 e7 ~: [! e
" Y) P7 ^& I" x2 y* `) K, u. H4 g# [& X0 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 12:21 , Processed in 0.040038 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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