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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 A1 B: j3 s" X9 |3 A
  1. [code]EDMA sample test application
    3 j, K1 I0 r: K2 O
  2. /*  v. t& p0 Q3 j6 T/ G; s; z! h1 U
  3. * edma_test.c
    % j9 ?* N/ s# J
  4. *, n2 N8 `* q9 r0 t, p3 ^
  5. * brief  EDMA3 Test Application
    ' p7 r$ g9 ^  e' L
  6. *
    0 B9 p& k, o; C
  7. *   This file contains EDMA3 Test code.
    ( x# U& M  k5 ?1 b2 B' e
  8. *9 ]* ^- ^- c/ x& v1 \% `  [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! d6 ], z1 `  e0 @- i  ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 ]1 s" i& ?. `' _, Q( r: t
  11. *         TO CHANGE.. [/ r3 m$ T" T+ d
  12. *
    % h% z! D" v, f6 X9 e. ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( x- d2 t- X! K0 i
  14. *
    ! y5 b, D- E4 W5 _
  15. * This program is free software; you can redistribute it and/or
    " X  b$ s+ [$ T) X7 ]
  16. * modify it under the terms of the GNU General Public License as
    ! m4 W3 \! m" }$ S  n8 D/ n( g
  17. * published by the Free Software Foundation version 2.
    . y1 r& j  }- r+ U$ g9 F
  18. *
    - I: [( j: f& q8 J2 l% l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. i6 R' S) J2 B7 a/ X
  20. * kind, whether express or implied; without even the implied warranty
    5 M) b3 O+ @8 h: {4 ~, q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" S+ \& ^  T. g1 g$ R
  22. * GNU General Public License for more details.6 h3 a$ t2 d( H0 P
  23. */1 d! z- e! S$ X2 f" H" A! k

  24. - s8 {! E0 O# B8 p5 E) _
  25. #include <linux/module.h>
    / H# ]! Y8 ~: e8 M/ J& H
  26. #include <linux/init.h>
    # ]  \% i5 `( Y8 a4 [6 G: S
  27. #include <linux/errno.h>
    & C+ `$ ~8 y3 u& ?
  28. #include <linux/types.h>/ l$ Q' y# J3 o# ~* k- d- a
  29. #include <linux/interrupt.h>! ?8 g8 T; d, C
  30. #include <asm/io.h>
    , t# t2 B. ?: W' H! U9 X
  31. #include <linux/moduleparam.h>
    4 p. v" K' \# F2 Y
  32. #include <linux/sysctl.h>
    , T4 i. a6 x; T: c- I
  33. #include <linux/mm.h>! _" T4 d) q/ U& O: C
  34. #include <linux/dma-mapping.h>; a0 F. ?2 _0 u: G3 }! R
  35. ; C4 `: T6 L/ _. k# ^
  36. #include <mach/memory.h>: R! \, a7 _, q" D( m* V: R+ X- H) b
  37. #include <mach/hardware.h>
    3 A" g" j, K3 _% e- x* y$ {
  38. #include <mach/irqs.h>/ K$ y$ x2 Y, R
  39. #include <asm/hardware/edma.h>* B6 n# v6 P, F+ F% h, y
  40. * L8 q! f. h4 b4 c5 s' X* X# c+ f  Q; f
  41. #undef EDMA3_DEBUG3 d; f/ N: w. ]' A- u  p/ o
  42. /*#define EDMA3_DEBUG*/# |1 G; L3 w! ?# \. F* m
  43. 6 u0 g( k1 K0 p
  44. #ifdef EDMA3_DEBUG4 ~! ?* \9 G3 w9 W* `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 q  i6 V1 y$ \" @# o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 T5 P, T/ Y$ r4 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . [  ?+ i! s) q- V6 ?) B5 M/ }
  48. #else
    2 {0 e* [9 A7 y; L3 B) p& n- Z' ?
  49. #define DMA_PRINTK( x... )
    1 L5 L0 X. D, w8 ~, V6 I2 }/ w
  50. #define DMA_FN_IN2 e& r- f5 m+ y" f* ^
  51. #define DMA_FN_OUT
    + b/ U# c3 G5 F* X; X7 Q
  52. #endif
    ( n& D# g; O' x3 D' r- w9 }
  53. 0 X* I4 d% S: k4 ?: t( |/ l1 ]3 c/ }$ z. h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( A7 k' W0 K: I3 [
  55. #define STATIC_SHIFT                36 l" Q6 i) R  Q
  56. #define TCINTEN_SHIFT               20; M1 s, O5 b8 a' Z- l
  57. #define ITCINTEN_SHIFT              21# R/ T( u$ _% m: E% i1 d
  58. #define TCCHEN_SHIFT                22
    ! b% J- j( A& o' W( O
  59. #define ITCCHEN_SHIFT               23
    . a5 p$ T. C& G0 |4 @5 a/ J
  60. ) W, u5 d9 [8 k
  61. static volatile int irqraised1 = 0;* i' _8 l* h. ~
  62. static volatile int irqraised2 = 0;, ]; B. ]  e' O& Z

  63. 9 }. |3 t% H6 N3 o& Q5 l; l% ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# O; g7 Y( T0 V2 Z' d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & J5 Z' e9 s- ?* N, C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: `: g) \, u& p7 Z: e& V

  67. & K6 {: J$ W- B5 o2 B# y/ z+ L% K
  68. dma_addr_t dmaphyssrc1 = 0;
    & }; g* [2 D1 N0 u) B1 }) |+ O: M
  69. dma_addr_t dmaphyssrc2 = 0;
    " s8 N0 j* M/ K* l* h( F
  70. dma_addr_t dmaphysdest1 = 0;# {+ d( b. \2 ]: ]5 J
  71. dma_addr_t dmaphysdest2 = 0;
    4 G, J- Y( w1 s6 v* |' i

  72. 0 Q8 q  f' S. L3 r* p( K
  73. char *dmabufsrc1 = NULL;
    7 g" F! L8 H8 A, x
  74. char *dmabufsrc2 = NULL;
    " b+ @" I) B/ L9 A
  75. char *dmabufdest1 = NULL;
    " ?, e2 p) c7 o: I& o
  76. char *dmabufdest2 = NULL;
    - D6 c+ p0 P. P& M3 U

  77. $ J) j1 b7 [& ?& P
  78. static int acnt = 512;
    3 g0 E9 [: L0 n1 g+ N
  79. static int bcnt = 8;
    # q! C" r6 [3 b$ @  N3 q
  80. static int ccnt = 8;( a& A! ?9 \. G: s' U
  81.   I. Z! _4 b- _; j8 Q
  82. module_param(acnt, int, S_IRUGO);0 f' v7 X! _: j7 y
  83. module_param(bcnt, int, S_IRUGO);; H. _" P2 C0 c1 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 a/ K2 f+ e1 [& W1 {; N# |

  Y" g/ `  f; S* l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% Y  j0 Y: j7 W& V9 v& }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. B) t" I% p7 W7 \" G1 _5 R2 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 S4 N( z& L4 R) @9 n( N8 C

* F6 m  \2 G/ O5 @2 W- q& n3 c' p" m4 L/ j5 @  i' K9 `2 K, S7 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 09:20 , Processed in 0.039018 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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