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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 |( }1 j. v4 X) G2 R6 Y
  1. [code]EDMA sample test application6 M1 Y# u: @1 q& B
  2. /*
    9 }* z' ~4 A9 b) P; s5 k
  3. * edma_test.c+ N& X7 L5 p: W* a2 }
  4. *; s" l& X7 f; s4 }( }) z$ w
  5. * brief  EDMA3 Test Application
    , G& Z' i; e6 D  n9 \$ w' T9 l
  6. *  I7 \3 H0 p" w( G/ k/ T
  7. *   This file contains EDMA3 Test code.2 e; i! B, I! [6 z
  8. *- g9 z7 m1 W5 l; A' s& v* D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 {! i6 B: F: X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * p) Q. _) ~  J; T; N
  11. *         TO CHANGE.
    3 Z/ e( k! I5 t+ c3 J4 Q' F
  12. *
    ! D, c( N$ ~7 u6 T+ R9 \4 H# v; X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 M( W& h( T, a, O
  14. *# k0 Z' b! D8 l. [9 j
  15. * This program is free software; you can redistribute it and/or" F6 v) `" i# n/ O0 J8 H8 G4 \+ h
  16. * modify it under the terms of the GNU General Public License as
    # D% g4 g: N: x* k
  17. * published by the Free Software Foundation version 2./ E  C. x9 ~- f4 k4 c
  18. *+ f3 }5 f! Q" u5 S) f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 d# u, F! }+ f! x
  20. * kind, whether express or implied; without even the implied warranty
    0 F* U/ ]3 N# r1 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . w. R& g' h6 y
  22. * GNU General Public License for more details.
    / A$ R& c+ b3 t# s0 y
  23. */
    0 P- e+ T) F4 m# }; i) [
  24. 5 }8 ^, ]/ u/ S6 [
  25. #include <linux/module.h>
    ! |: M) T& d" @
  26. #include <linux/init.h>
    1 _* D0 D7 V4 R4 W& ?0 s# S  Z
  27. #include <linux/errno.h>
    ! i, u2 C; z6 ?9 v) ~8 m
  28. #include <linux/types.h>
    , |) t- Q, V9 |+ B6 H0 M9 w. ~" j
  29. #include <linux/interrupt.h>
    : Z7 n, }# ^: b/ Z) G
  30. #include <asm/io.h>3 R" a. V- @3 H% g: c
  31. #include <linux/moduleparam.h>0 L% e" q, m$ q* _6 S4 ~
  32. #include <linux/sysctl.h>
    + W. B/ ^; ^* H' H5 S0 I% y2 K
  33. #include <linux/mm.h>; K0 v2 L( m1 k* C7 \4 ^
  34. #include <linux/dma-mapping.h>
    ) }% E2 L& N' a; s! j

  35. + h& P! h5 x. G
  36. #include <mach/memory.h>
    + S/ |$ y. P' D( J6 I2 y
  37. #include <mach/hardware.h>8 Y: D7 J8 u- c% @/ P
  38. #include <mach/irqs.h>" v/ F) u$ ^8 C& c
  39. #include <asm/hardware/edma.h>! }7 ]5 x& F, f! x% t
  40. 0 w/ |7 }' C7 p, l
  41. #undef EDMA3_DEBUG
    7 H% J1 P  v1 i' y& U
  42. /*#define EDMA3_DEBUG*/' M9 u  r. P+ S' Q* ^

  43. 5 m4 Y1 g9 f: a; o( f
  44. #ifdef EDMA3_DEBUG0 I* f) d9 s  `, y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) G4 i- A5 a9 i0 d6 Y: V- ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      Y* {, j1 h# }% E9 {. v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ I: H5 N% v( Y6 i
  48. #else
    ' {2 M9 ]8 z3 z' p
  49. #define DMA_PRINTK( x... ), f: C, G8 [$ f: p& o$ ~
  50. #define DMA_FN_IN
    6 v( v( w. M5 r  P# P, }
  51. #define DMA_FN_OUT* t$ h" W- B4 a* ]( D- _
  52. #endif
    ) |* z# q8 ~8 \  }
  53. 7 ?2 k) y- |2 W# g8 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ o9 i0 D! J8 [7 J: ]
  55. #define STATIC_SHIFT                3
    & o% J& i  T. O# x  C3 y
  56. #define TCINTEN_SHIFT               201 W& E! z. t9 Y  P" y8 S
  57. #define ITCINTEN_SHIFT              216 G3 p- M2 W! Z2 H  q% y
  58. #define TCCHEN_SHIFT                22
    : k6 R& l  S7 _6 e* f' ?
  59. #define ITCCHEN_SHIFT               23
    0 U7 s2 z& E1 c

  60. * B1 f$ H, J& X$ r8 k7 [
  61. static volatile int irqraised1 = 0;
    0 J. Q; B8 L, {3 Z. t1 L
  62. static volatile int irqraised2 = 0;
    ( L- V' Q* S) |, s* u3 I
  63. ( B8 j2 s1 ~! h" e( b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  i( M; V6 F# t' G7 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! {; H9 w7 M8 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / D4 C) g4 \# n5 e1 }& }

  67. ( n8 T) X; V" {; d: o
  68. dma_addr_t dmaphyssrc1 = 0;3 T; _" i! t9 c8 |
  69. dma_addr_t dmaphyssrc2 = 0;# d) l( H% P* a2 a
  70. dma_addr_t dmaphysdest1 = 0;. B- k& ?  |! h3 A) I7 m
  71. dma_addr_t dmaphysdest2 = 0;7 L7 D) x1 `8 h* d; O0 F4 n
  72. $ n! z! {0 S& L* E! P+ L
  73. char *dmabufsrc1 = NULL;
    ' J/ t8 \4 }0 B& L* X" w5 ]! {1 t
  74. char *dmabufsrc2 = NULL;
    * }8 Y9 l3 _+ V
  75. char *dmabufdest1 = NULL;) g: l" [  _4 i, w; I
  76. char *dmabufdest2 = NULL;+ L8 s- ]0 |2 W7 g% R

  77. 4 q. w5 V$ J* ^+ o% x
  78. static int acnt = 512;0 a2 H" p/ O" S6 n- E" B& ^# V7 v
  79. static int bcnt = 8;
    7 d% R8 J; c5 i5 P1 G* B0 a' ~
  80. static int ccnt = 8;
    3 ~+ _  J' Q/ W, I+ @

  81. 9 [2 [9 Q! R9 R% D6 G, S
  82. module_param(acnt, int, S_IRUGO);2 x- A+ y2 f$ T5 O5 r/ t
  83. module_param(bcnt, int, S_IRUGO);
    % r# \/ [$ _1 l. I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* D" [" W  }" ~3 x- K1 h* d
% \5 f9 A* Y" Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 m0 z# u6 p9 F' G' a5 \5 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" q( X6 a* M0 }1 r3 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" P/ j+ t' k2 S# f0 B
! _- @& v7 A& j8 X
6 i' j0 C3 j6 \4 y# t" r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 09:39 , Processed in 0.040735 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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