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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & R( ?; f: b" G+ [
  1. [code]EDMA sample test application
    ( m( p2 S: }5 u' b$ `1 U. V( u# X
  2. /*
    : e9 R; u$ R6 |
  3. * edma_test.c! L  }( j8 }0 V, F
  4. *
    ( m3 ~0 R" [" T3 l8 J
  5. * brief  EDMA3 Test Application& Y3 D9 x/ E- B$ X/ l* _7 ]1 d$ ]& b
  6. *
    7 u. Y$ C" L% p( B7 [
  7. *   This file contains EDMA3 Test code.* B' m$ _) n2 @8 C, ~0 s: _
  8. *
    3 Q& A" w! z; P) B3 N7 C# ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) [$ o6 a, Y' D7 R7 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 }4 G3 D; Q% T4 P) T& Q* ^/ C
  11. *         TO CHANGE.
    4 U$ I$ Q; E  C
  12. *
    5 B" Y* b: ?2 {' U1 ~* c5 R$ l4 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; k4 @" T& E. m" ]0 p1 @" U
  14. *& u. h/ N0 |6 v. C8 R
  15. * This program is free software; you can redistribute it and/or
    $ n8 ]! R: y1 I) a
  16. * modify it under the terms of the GNU General Public License as2 J) n& b) O# Y/ \- B
  17. * published by the Free Software Foundation version 2.
    ) b% h9 z' D! J  @( B! \+ X, @
  18. *
    ( Q7 r& X, {, i! x8 E% w) h. d- W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # h# i8 j0 |' c, E
  20. * kind, whether express or implied; without even the implied warranty. h+ D7 K" d, k) q4 ]( r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ [- z8 p% {) d: K8 h
  22. * GNU General Public License for more details.
    ' |, w7 ]2 P) z" N
  23. */  X+ }' u9 G4 z8 b( e" K) m' S

  24. 2 ?" Y. i, F% \/ r
  25. #include <linux/module.h>
    1 H8 L6 s- g" E3 s" u" N. B# t
  26. #include <linux/init.h>
    7 H" y' Y  r* W: [
  27. #include <linux/errno.h>  C, w* M# w/ `2 I/ U- z
  28. #include <linux/types.h>
    6 _3 k: f$ l# ]; D% T
  29. #include <linux/interrupt.h>
    4 S2 R7 z( A: m
  30. #include <asm/io.h>
    8 g4 G4 d- T( o: |+ _' e
  31. #include <linux/moduleparam.h>' ~) F% U. o6 C5 Q; M9 m
  32. #include <linux/sysctl.h>9 p3 j  K" Y9 d/ M7 @
  33. #include <linux/mm.h>7 e" g" M. C" G
  34. #include <linux/dma-mapping.h>
    2 t. N  i3 y/ t  `
  35. ( D, }" ?( \9 R
  36. #include <mach/memory.h>( }+ |3 t6 s' j1 W6 n  u
  37. #include <mach/hardware.h>3 ?1 E/ x% O  m9 q, g
  38. #include <mach/irqs.h>
    . p+ l( ?; G4 L- n
  39. #include <asm/hardware/edma.h>5 E/ ?  }" j, n1 d* {

  40. " j* B0 n& R9 N& u
  41. #undef EDMA3_DEBUG" \2 M  ~8 ?& G6 g5 d2 T
  42. /*#define EDMA3_DEBUG*/0 Y2 O/ w6 ]7 `4 l/ k3 O
  43. 1 B1 G: s9 O8 d9 K5 Q* w+ w* Y
  44. #ifdef EDMA3_DEBUG
    ) Y6 c" ^. e5 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- _. x4 A0 k* q1 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " X# w- Z5 X2 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): w2 n8 k: l6 Y9 Y5 e( z
  48. #else" O" q' V* R2 ]) R) [
  49. #define DMA_PRINTK( x... )5 o0 c- b* j( Y. I( u, @
  50. #define DMA_FN_IN
    0 F. ]. d; ^& C: w" s
  51. #define DMA_FN_OUT8 ?/ Z9 A5 G% N" F
  52. #endif
    2 d, `, P# d% x% |. d

  53. ' \! @& {0 v* H' Q  a: N+ s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 Y1 P* U* H9 g, j
  55. #define STATIC_SHIFT                3
    . _5 K8 P, c' J3 \5 Y
  56. #define TCINTEN_SHIFT               20
    8 ]) ]% _; D8 t7 J
  57. #define ITCINTEN_SHIFT              216 c& Q9 N6 k3 b# x, h
  58. #define TCCHEN_SHIFT                22+ M/ t! v3 `5 E. ~' h0 o
  59. #define ITCCHEN_SHIFT               23' T. ?* R; p/ }9 z

  60. 7 O: d2 \0 ~( i- |: i
  61. static volatile int irqraised1 = 0;
    4 F) z9 i& b  }' K# n6 U5 C5 T; ]
  62. static volatile int irqraised2 = 0;# A2 j  w; c) c( E

  63. ' ]$ B7 y- z! ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  G6 N  {: b3 x9 d  R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Q+ {8 u2 r  N; t1 U+ d) I- Q, H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - a/ |* ^4 v7 w3 g

  67. ( ~$ a  _9 T) x# k' ~
  68. dma_addr_t dmaphyssrc1 = 0;
    ! y0 R- W0 ~8 K
  69. dma_addr_t dmaphyssrc2 = 0;
    3 w9 |* r* X8 V
  70. dma_addr_t dmaphysdest1 = 0;' v8 A% T4 z: A
  71. dma_addr_t dmaphysdest2 = 0;  ^3 I# g* I+ c! K

  72. 2 c; X8 y) k4 t- H. e- G& e
  73. char *dmabufsrc1 = NULL;
    - E7 j& `$ ^0 k) ?: o( b2 [
  74. char *dmabufsrc2 = NULL;
      J/ r9 F" k* _( ]
  75. char *dmabufdest1 = NULL;
    ( e' O! m- _/ ^
  76. char *dmabufdest2 = NULL;
    % Z0 I* s) ~; K( C# S- H- g

  77. # X9 M4 e5 x+ y" a# K
  78. static int acnt = 512;+ T: f& k% I5 X1 [# h* ]
  79. static int bcnt = 8;
    6 l) U- B) H! ]8 j  M; |2 f( v
  80. static int ccnt = 8;! x5 O" ~7 R' I+ \4 u4 O

  81. 6 [7 I5 ]) q+ j1 A* J. r3 C
  82. module_param(acnt, int, S_IRUGO);
    : y7 a% O  d6 z) I
  83. module_param(bcnt, int, S_IRUGO);6 m- e/ h6 |3 ?: j( c7 B7 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& P4 |1 g5 R6 t
& o8 G: Q' [0 N5 `; x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* U/ U# J6 m/ a- b* t
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& h; n: u% _2 z' p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ p" J! ?; d" I3 Z' c2 B% L/ d

5 f; O4 z+ H# B/ l7 i+ _2 O% ?$ b4 `; g0 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 02:06 , Processed in 0.060331 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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