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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % L6 l  t* [( m5 w0 R
  1. [code]EDMA sample test application* C' a. d/ u; T3 e# J6 N8 L
  2. /*
    $ `3 u8 i# q  z
  3. * edma_test.c
    7 g+ F0 d: l# A
  4. *
    : C/ A4 K( R) |2 y. C4 j, O: c
  5. * brief  EDMA3 Test Application6 m5 x, u5 D9 u1 l5 L* x
  6. *4 j" M5 I  U0 o! Y
  7. *   This file contains EDMA3 Test code.8 [9 O) R* \  m4 |
  8. *
    ' @. T5 I5 n- ~, X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * c' e5 D/ T0 A. o3 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, [2 e5 N+ f( i% d# G' X+ i
  11. *         TO CHANGE.
    . ~* B6 ?* K0 |2 n5 [
  12. *
    : x' b. H' y: N% D4 i9 l1 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % A* z/ T4 _' v8 U2 v
  14. *
    2 h. N/ _0 I4 _. W5 C
  15. * This program is free software; you can redistribute it and/or* z$ a' V: S( @$ `1 c# J
  16. * modify it under the terms of the GNU General Public License as
    $ H" i  E; F% \4 @
  17. * published by the Free Software Foundation version 2.8 x8 c; J/ o# U" F
  18. *5 \2 F9 V2 E! E0 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 u7 }: P' ?2 O9 J
  20. * kind, whether express or implied; without even the implied warranty5 A6 y. P9 W" E! X. Y2 m$ p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 z0 W: [- l. E) c1 p5 W- n
  22. * GNU General Public License for more details.4 k6 [7 K0 b' @
  23. */
      q, b6 q2 p" Z; [* i
  24. 7 j2 R5 M+ C& x5 r
  25. #include <linux/module.h>
    ( b& k$ z9 P, d4 v6 N
  26. #include <linux/init.h>0 P* S9 _4 b; p( E0 U( S0 B
  27. #include <linux/errno.h>' N6 p* \% ?+ c- s- ?& G, u
  28. #include <linux/types.h>
    - v# |8 Y5 p3 O. h8 i# K1 R
  29. #include <linux/interrupt.h>
    5 e! t. H: ^; L
  30. #include <asm/io.h>
    3 L# _4 E# r* V$ F
  31. #include <linux/moduleparam.h>
    . u6 m! q/ i% Z9 w2 M+ G
  32. #include <linux/sysctl.h>0 z7 S) ]: A$ _) `" E2 g
  33. #include <linux/mm.h>
    8 l* m0 O5 Q% p6 m2 ?  p$ S
  34. #include <linux/dma-mapping.h>
    4 D" _! z% P1 C
  35. 3 X* J- c; Y& d: a! f! t- y
  36. #include <mach/memory.h>
    1 P. h+ l' m+ Y0 c
  37. #include <mach/hardware.h>
    : \; n" N  r/ H. m$ W
  38. #include <mach/irqs.h>1 `$ K+ i# c) s$ Z9 T- Y% U
  39. #include <asm/hardware/edma.h>
    ; d: [0 Q& C4 g6 B* Z$ d4 l

  40. - v! |7 t9 \- X* N
  41. #undef EDMA3_DEBUG
    : i. ]7 B  y% }" e: ]8 p. T+ G, S
  42. /*#define EDMA3_DEBUG*/
    " M7 h% ~/ G) X/ j' w' p8 C

  43. " B/ {; q- O- A8 U2 ~5 o
  44. #ifdef EDMA3_DEBUG5 ^2 S/ s9 x+ B' o: a" ~! ^/ u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : k3 T- t7 y( W2 M/ i3 `1 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * t% ?; }4 ~( |. A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); {5 d  ^! G6 ?- ?( O$ o" p
  48. #else
    ) A& b) z4 I3 [) S2 D, A
  49. #define DMA_PRINTK( x... ); [/ y, _# O/ v
  50. #define DMA_FN_IN+ Q& _' L! M: g) I" g
  51. #define DMA_FN_OUT
    . }( X+ n" |- ~, m, H% L4 L% _
  52. #endif. B: Z( W. j% V
  53. 0 X4 Z0 R$ P) [6 q- D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 L5 s1 o$ ]3 ]# B
  55. #define STATIC_SHIFT                3" {3 J, u9 g5 {6 y0 T; [! M
  56. #define TCINTEN_SHIFT               20) l9 l9 X4 n3 |. N# f
  57. #define ITCINTEN_SHIFT              21
    * q5 l. D  X4 P# Y( ^
  58. #define TCCHEN_SHIFT                22; T5 ?" M! h% W
  59. #define ITCCHEN_SHIFT               23
    : I$ s& |1 r  ?# E
  60. 3 j+ j9 H2 V' R: R% r' p1 `& A
  61. static volatile int irqraised1 = 0;
    8 W$ Z1 n8 L: n8 A
  62. static volatile int irqraised2 = 0;; A8 L& [: D$ ?! I6 f0 n' V
  63. : A* \6 h) d' n& h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- u$ w/ t3 g2 J% s# k/ F8 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 i: S/ f/ N# |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 v# V, f7 x9 Y' h
  67. 2 z8 Y9 ?. T: ^
  68. dma_addr_t dmaphyssrc1 = 0;
    : ]0 Q; x" p/ ~8 p' J$ W" g6 B
  69. dma_addr_t dmaphyssrc2 = 0;" S& T+ i! g: j% n2 [/ k
  70. dma_addr_t dmaphysdest1 = 0;' N" ]  i+ }9 T5 I0 t" O
  71. dma_addr_t dmaphysdest2 = 0;
    " S1 V" E. O0 {- z0 K

  72. 1 O# o$ D9 Z' C7 I) x+ C
  73. char *dmabufsrc1 = NULL;
    ' t- S6 n. s8 W
  74. char *dmabufsrc2 = NULL;: }  M0 f, l% i# u5 m4 l- f+ ?
  75. char *dmabufdest1 = NULL;
    9 t  z  D; e2 m3 o  n
  76. char *dmabufdest2 = NULL;' I6 o$ ]. _/ F/ p
  77. 3 e/ J2 v! B9 D$ ]
  78. static int acnt = 512;9 M9 n7 g: T2 g% ^& N
  79. static int bcnt = 8;
    0 ?5 m* l8 x3 x
  80. static int ccnt = 8;
    . F- O6 u, R# a2 b) l& R6 O
  81. * f5 C3 p: {: q! P
  82. module_param(acnt, int, S_IRUGO);1 _3 f, g0 p- h- M: b
  83. module_param(bcnt, int, S_IRUGO);! r8 Z* o2 D  B8 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: \( v! y6 T& X( h' u( I. V
" p+ ?8 C4 Z3 o$ N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. g  h9 f6 w3 D# v! N7 X2 k& Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 b0 i& F: s. r# `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 M- Z; }2 E# F7 G5 W
# g2 \3 x6 T6 u3 r# e* D. w+ D( p5 t7 Y, G# L2 B9 \4 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 01:20 , Processed in 0.044921 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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