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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # ?1 h1 c7 ^5 p8 M6 b# P
  1. [code]EDMA sample test application
    0 v$ I3 J# @  R4 P3 C
  2. /*. X  N$ [  n1 b' D4 `1 _9 n
  3. * edma_test.c
    * x. u& W& ?* x+ {7 p
  4. *
    0 \( D( P. T, d) W. I. m0 V8 g
  5. * brief  EDMA3 Test Application7 q+ u; v, }) I% `
  6. *1 e/ E7 c, c' R/ e
  7. *   This file contains EDMA3 Test code.
    % e. D/ H5 z2 S8 @
  8. *. z5 g2 ?6 I" F  b! J: t2 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) e' [- f( h5 L6 s* W. e; [3 t0 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , O( ~) B( G- R; m9 Y' @$ D2 Z
  11. *         TO CHANGE.
    2 S& ]1 L0 e4 Y
  12. *
    4 V  e' t6 u3 T$ Z5 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& M  K" L/ }. ?6 D; E# N" _
  14. *
    ' w; q+ m. w; E6 v) b- M
  15. * This program is free software; you can redistribute it and/or
    1 o3 n' t8 L$ U& ^% }; E
  16. * modify it under the terms of the GNU General Public License as
    / f7 i7 F$ q: E; @0 G# B1 q, }
  17. * published by the Free Software Foundation version 2.
    6 P. p% M" {4 s0 b
  18. *' `* R; A3 v0 h  x2 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 k6 t' V* f9 o8 d! S8 n
  20. * kind, whether express or implied; without even the implied warranty/ w, I$ Y" }, I7 h3 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 y: i: l9 l- x& n% @) {3 b2 m4 j
  22. * GNU General Public License for more details.
    3 M. `0 D- k: g" Q0 y
  23. */
    * T. R: N* K0 L9 ^! d0 ^
  24. # p! d- B+ i, H$ k$ A+ `, D$ q
  25. #include <linux/module.h>6 W) t( g) N+ X' z7 Q  E8 P/ [
  26. #include <linux/init.h>
    , b. W+ _( o, C  ^
  27. #include <linux/errno.h>
    3 _2 e& z2 O( d( x8 B# g( d
  28. #include <linux/types.h>) V: |% p) }1 V7 x
  29. #include <linux/interrupt.h>
      i$ P0 n- p1 `, J. P2 j$ H4 U# ^
  30. #include <asm/io.h>
    * @$ \0 F7 l: T+ H+ H
  31. #include <linux/moduleparam.h>
    ) w4 r4 r& E& A9 O
  32. #include <linux/sysctl.h>. m; M* Y6 ?7 m. f% f3 e
  33. #include <linux/mm.h>! G4 q2 T  k" j. j: L) q
  34. #include <linux/dma-mapping.h>/ ~( S$ t4 Y1 Q- Z

  35. 5 `% j2 e3 m1 d
  36. #include <mach/memory.h>
    ) [2 W9 B- Z: e
  37. #include <mach/hardware.h>
    * B8 g5 |( L  s6 p
  38. #include <mach/irqs.h>
    ) B4 K3 o- M* Y1 u
  39. #include <asm/hardware/edma.h>& f  M2 _) h# v0 P, U

  40. ' ?$ ~9 b. k- _7 m
  41. #undef EDMA3_DEBUG0 \, h) V; L# S  h7 o
  42. /*#define EDMA3_DEBUG*/
    : W# e( I; t1 Q3 E* o9 ~% ~% ^
  43. , O9 L9 V4 w6 f; C9 n
  44. #ifdef EDMA3_DEBUG
    : x& v1 c6 k: K, g" I$ n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 K' u; _- Z2 o" I& E" }3 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). K5 S* N+ p( D: I/ s) E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( ^: c2 v/ I# Y, Z; m, R0 O
  48. #else
    4 I% U" Q+ _9 o" ^. g
  49. #define DMA_PRINTK( x... )
    4 l- L9 `6 x1 [0 I
  50. #define DMA_FN_IN( w+ [4 X1 y3 Q  G1 S) d+ v
  51. #define DMA_FN_OUT2 }* I( X/ m8 v! v8 m1 S: ^
  52. #endif
    ' ]2 o% E% b" [6 o+ g- T3 X- L
  53. & J+ x% r: C, a; z* b7 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- K! z& ^6 L  U
  55. #define STATIC_SHIFT                3
    * e0 D( y. U) u6 Z! l4 l2 {1 O; r
  56. #define TCINTEN_SHIFT               201 H# v$ z0 R. W- ?  O. E4 q
  57. #define ITCINTEN_SHIFT              211 a& G1 |( b! a
  58. #define TCCHEN_SHIFT                22
    * h5 |: B5 g. O" V. y
  59. #define ITCCHEN_SHIFT               23& }9 P8 ^% j& @
  60. % N% z# ]5 a* p
  61. static volatile int irqraised1 = 0;
    ) A# N6 k5 k5 @
  62. static volatile int irqraised2 = 0;( R& k% \5 O; d

  63. ! q1 U  L: P5 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! f5 Z6 m, F7 ~- W* V  L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / N" k" b2 p  }8 [( S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 K2 h- L4 \( N( v5 U6 d

  67. + [5 B; w8 _' x9 t. ]; }1 X
  68. dma_addr_t dmaphyssrc1 = 0;
    " n7 F5 i. t* ~: |8 ^4 k1 M! u9 u
  69. dma_addr_t dmaphyssrc2 = 0;* u4 Y4 T  E- L+ [. @$ g+ G
  70. dma_addr_t dmaphysdest1 = 0;. i, q0 ?. b: y5 e5 z: Z
  71. dma_addr_t dmaphysdest2 = 0;
    1 i0 Q$ d  n. F, R: l! W! N" r

  72. . x! B$ V0 g1 Z' z
  73. char *dmabufsrc1 = NULL;; U6 g" m  E3 R% n/ ^* W2 j5 Q
  74. char *dmabufsrc2 = NULL;9 `; z: ~+ I4 H/ \: ]
  75. char *dmabufdest1 = NULL;
    1 k# S+ M, O! }+ G
  76. char *dmabufdest2 = NULL;. h+ q" m( W8 Q4 x# t. S) G5 V

  77. / U3 \) X4 x5 V, A8 N6 Q& o
  78. static int acnt = 512;1 n0 q3 M4 [7 y2 i
  79. static int bcnt = 8;
    ( m  q6 `) i* B% ^
  80. static int ccnt = 8;' U2 B- r) Y8 R7 J& A- z8 s! M
  81.   s8 Q; c3 A% g- _# {; I& J! {$ Z
  82. module_param(acnt, int, S_IRUGO);
    ' J* q1 j( X1 A) P
  83. module_param(bcnt, int, S_IRUGO);& e  n9 F" N4 w& r! ~; @1 {4 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; L! H2 Q9 K) F6 B1 c7 y, O( \$ x  C

9 i# v  s3 {* A1 [7 g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- G$ r8 f: k  }6 I: ~6 b  _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; \* i; L, G: e9 `9 a2 c5 ^; y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, g" s3 K. B: [- X

4 G- [* F  b& ~: a* W# s. K2 [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-14 17:56 , Processed in 0.040700 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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