OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  a6 I- R9 g  f+ A# K
  1. [code]EDMA sample test application2 W1 Y/ a* P7 e. l7 ~, `3 }) a" n
  2. /** V2 a6 n. k* Y' X0 c; ~$ ?& x
  3. * edma_test.c8 ^1 j; @/ x1 O+ ^) Q2 h
  4. *
      K. g4 ?; Z. c9 H/ |
  5. * brief  EDMA3 Test Application
    ' M8 P% c9 z9 T3 y
  6. *) W8 `. r8 Q$ M, e6 S% A: F
  7. *   This file contains EDMA3 Test code.9 }; M) X) E- J/ {
  8. *
    ! \+ [4 @1 C: G/ T9 c4 D: H9 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 V* G& Y, {1 w8 Z) P" [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! ^$ u1 H5 g+ Q' e
  11. *         TO CHANGE.( R, q) p2 Z( f  @6 _/ R$ |( t$ `
  12. *
    # x$ z( \2 K) }7 Q8 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& n6 |8 N, K3 b$ i, f
  14. *% Y) {6 @6 y- M
  15. * This program is free software; you can redistribute it and/or: D$ ~8 r3 v' {4 e0 t9 V
  16. * modify it under the terms of the GNU General Public License as
    # e3 L4 G7 j% ^0 R
  17. * published by the Free Software Foundation version 2.
      p: ~$ R( z& x3 C
  18. *
    " E4 H, C+ k% ?* r9 m8 d8 x9 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / [( _6 f$ ]3 Q" l& U9 T
  20. * kind, whether express or implied; without even the implied warranty
    * k6 ^$ u2 M( S  _9 N5 u7 D( W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % ]/ Q0 m" t0 ?! V  q
  22. * GNU General Public License for more details.7 l4 K6 n, R" t4 G- v1 T2 Z
  23. */
    2 [. @! f. T4 \% U) k. H$ m0 Q
  24. 7 ]6 m: r# P% ~* C9 i' T4 s/ D5 U
  25. #include <linux/module.h># _8 w7 S2 B2 i1 L2 W
  26. #include <linux/init.h>+ \% @  [+ N5 ^+ g6 A
  27. #include <linux/errno.h>* {* @& t" a( d' {6 y
  28. #include <linux/types.h>- q& ]  L6 C6 x
  29. #include <linux/interrupt.h>
    6 |1 Y3 u  b  e$ P% {& P
  30. #include <asm/io.h>
    ! s" N9 R' R; R  c! a& @* u
  31. #include <linux/moduleparam.h>
    : d+ u& ?7 M' e9 v2 q
  32. #include <linux/sysctl.h>
    * ^4 D# L* y- n! h+ E6 W
  33. #include <linux/mm.h>
    ) k/ G# T9 I1 ?/ {3 I; r) ^
  34. #include <linux/dma-mapping.h>$ j3 G2 k' z2 x$ c2 ]
  35. / C* V" S$ b$ Z  v7 `; `
  36. #include <mach/memory.h>
    : D# K  ]3 \* L) `* ~
  37. #include <mach/hardware.h>7 R) `: A& J% {* a
  38. #include <mach/irqs.h>
      }$ F+ F; J' Q: x! @/ a
  39. #include <asm/hardware/edma.h>
      W) M: V% T# a( f
  40.   B% Q0 Y; t' Q- D. N! f7 U+ e9 k  K
  41. #undef EDMA3_DEBUG
    ( n: ^, b- n$ \' i% L* x2 ^
  42. /*#define EDMA3_DEBUG*/
    5 Q, s- m- ]( C- ~$ [; z

  43. / A% f- Q( z9 ^3 \
  44. #ifdef EDMA3_DEBUG3 H: D& ~& [9 C- W8 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) f% d! v6 F0 d$ X1 `9 ?% X- Q5 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 Y8 T5 z+ I% v' e3 p- r' t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % a  E6 I: B9 E+ w
  48. #else1 Q# b+ g# v  }% n
  49. #define DMA_PRINTK( x... )
    8 _" `2 M% z' Z8 g. M" Z
  50. #define DMA_FN_IN
    % Y+ }. A% L* T* A
  51. #define DMA_FN_OUT) A( v$ }6 \( h7 E
  52. #endif' U; h5 }. e: f+ @8 s2 @& ]

  53. - p! C3 T& b+ Y4 h8 z4 g7 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! V# z0 U, u9 K+ z; r
  55. #define STATIC_SHIFT                3: g' r6 W: W0 R; N4 ^! @# i
  56. #define TCINTEN_SHIFT               20
    ' T2 N1 P5 T" O8 b1 x+ T2 H0 Q
  57. #define ITCINTEN_SHIFT              219 `, X1 o& e3 N  h6 `0 j
  58. #define TCCHEN_SHIFT                22& x; M8 }  l) r
  59. #define ITCCHEN_SHIFT               23+ O5 G6 i! I5 k; E9 r% M

  60. 0 W5 s8 X. o+ X0 F4 a
  61. static volatile int irqraised1 = 0;; X. t, ~( Q1 F1 `6 g' a
  62. static volatile int irqraised2 = 0;
    4 |& a' P1 X" a8 Q

  63. " @2 ]. x3 u' y' i+ O( A+ B, o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( `+ S7 Q* s# ?. t9 B0 P/ _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + g+ g- B8 G5 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & P1 j2 b  p7 J! C3 b$ T2 ^

  67. ( K: `3 M" I4 r% `2 O
  68. dma_addr_t dmaphyssrc1 = 0;
    6 B( v: U& w9 _0 K$ f' }
  69. dma_addr_t dmaphyssrc2 = 0;
    ! z( X+ n( q8 U' t
  70. dma_addr_t dmaphysdest1 = 0;2 v( R: T2 j9 j
  71. dma_addr_t dmaphysdest2 = 0;) z0 }5 z- e$ A( \* Z

  72. - m* E# l- T& j5 L( s8 p
  73. char *dmabufsrc1 = NULL;
    * N) T$ J* a( \, K! z" F' g" `
  74. char *dmabufsrc2 = NULL;
    0 {0 J* F+ d( D& ?6 Z
  75. char *dmabufdest1 = NULL;
    1 Q  [: r1 b3 P7 d
  76. char *dmabufdest2 = NULL;
    8 `- c, ]/ L1 L/ ^6 _1 R
  77. : T" B/ r8 z/ n
  78. static int acnt = 512;
    : l$ J$ @8 K) i/ ^" _! r8 M
  79. static int bcnt = 8;& G/ k/ v' K3 j8 M8 F/ I! Z
  80. static int ccnt = 8;3 p4 D$ n' u+ I" [9 w% m  @/ \
  81. / W; @* {- v. w! E7 {
  82. module_param(acnt, int, S_IRUGO);
    + Z- c. f7 G' X6 p
  83. module_param(bcnt, int, S_IRUGO);  U+ i7 p6 g& h9 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 ^, L1 z0 [' U2 V1 ?* Q& [4 M9 q" |" ^8 H) N- _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' J, X  R+ ]& Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ e: l. p; c: \. s/ C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 Y7 U5 V) H. {$ |- d
, P+ \$ {6 L* n: P$ Z" K
2 M3 w/ }7 i* L, L; I9 p9 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 20:45 , Processed in 0.038464 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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