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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 W) o3 J) u" b# r
  1. [code]EDMA sample test application
    / K/ h$ T  R4 |1 G, Y5 \3 k' ?: C3 M: V
  2. /*5 R' S( {- m( K
  3. * edma_test.c. c4 G+ A* N% J% V
  4. *
    2 `' j5 r7 J0 \8 p9 _. \
  5. * brief  EDMA3 Test Application
    : _* P+ k/ r6 ?4 n0 U: \8 ~
  6. *' m3 H- o9 @; o: @
  7. *   This file contains EDMA3 Test code.4 q' F# I9 [" y0 c1 o/ _. {
  8. *! R* R% {  Y5 ~9 E7 N# o6 ]9 c+ W& K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * m# G6 i" C! Q  U  S2 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ q' e; r4 t. R5 ^* p* d
  11. *         TO CHANGE.% a. E# G; M- p+ b
  12. *
    " D5 L( f* b! E0 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& c- g9 I# O' T% I
  14. *
    ; `$ b& M9 O, E$ c1 ?+ Y" M
  15. * This program is free software; you can redistribute it and/or
    8 K3 U+ [6 b0 T
  16. * modify it under the terms of the GNU General Public License as/ y9 K4 \/ D# d0 H- ^& |% u, l
  17. * published by the Free Software Foundation version 2.+ A  ?( r! P2 v, D# r! h) p- @& T. V
  18. *
    ( W4 _' W. o( X6 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( r8 D0 [& p+ w* s
  20. * kind, whether express or implied; without even the implied warranty0 E& Y2 p, [# ^8 u! K( ~: t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 a' D) [( o# ^0 ~
  22. * GNU General Public License for more details.+ l, @5 e$ W1 z/ O2 e9 ]* a6 L9 e
  23. */
    - m+ Z9 k& \+ V# z+ H

  24. $ A" K! q* k8 g  T
  25. #include <linux/module.h>9 T  `7 l! J+ a+ M7 @, s5 f
  26. #include <linux/init.h>( k) x' ?' P9 m' j
  27. #include <linux/errno.h>4 M  j% R$ E4 H; I  K1 {* W
  28. #include <linux/types.h>
    / s" R3 i' U8 h% J" c. J3 \7 ~. H: E
  29. #include <linux/interrupt.h>- i2 i8 _/ C% R$ F6 i% O8 R9 g) B
  30. #include <asm/io.h>" P; ~8 V0 t; d7 n' N! f$ U( ~
  31. #include <linux/moduleparam.h>& ]) o+ Z" i+ w7 N$ ?
  32. #include <linux/sysctl.h>0 y5 L7 h1 e2 W4 r( A7 I/ r3 c  [
  33. #include <linux/mm.h>1 t  k# Y0 w& d4 x
  34. #include <linux/dma-mapping.h>
    , D8 N  X5 `6 t/ i6 r* t/ W

  35. $ t4 O* w& F: a3 v# e
  36. #include <mach/memory.h>
    ( m- b! k4 M  \5 S
  37. #include <mach/hardware.h>% q, r* ?8 v: d- e& e
  38. #include <mach/irqs.h>
    ( S8 |, H& E6 v: v
  39. #include <asm/hardware/edma.h>, N# F- @9 ~6 d4 Q' v# |+ l# q
  40. : r; H: e, x0 j. A0 w
  41. #undef EDMA3_DEBUG  w2 z4 Y8 }% q3 x+ m# {- y/ Q
  42. /*#define EDMA3_DEBUG*/. I3 U; {3 \( Y; C

  43. 5 s  U# o/ n7 x6 s9 }2 F1 |
  44. #ifdef EDMA3_DEBUG0 o* w; c" Y; {# n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' x: d% q$ U; o- d- @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      H* J+ D$ \; L* Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 Y3 i2 V1 v' L0 }
  48. #else1 [) |6 J6 n/ M4 a
  49. #define DMA_PRINTK( x... )7 d6 r! [* U* {1 R
  50. #define DMA_FN_IN& a+ s5 p* R# S7 W: l, u
  51. #define DMA_FN_OUT9 }% x6 `* W3 ]# x
  52. #endif
    ; {5 m, k4 e; r* P- F
  53. # m5 e6 E- `# l$ S$ v' N- b5 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' L' y2 n4 O* L
  55. #define STATIC_SHIFT                31 \+ w8 H3 z$ D$ f3 C! H
  56. #define TCINTEN_SHIFT               20
    5 u) u6 d, m7 u; p& A  G: X
  57. #define ITCINTEN_SHIFT              21
    - C) J9 z, D# e3 }9 M7 D
  58. #define TCCHEN_SHIFT                220 ^& ?8 K0 R' P$ ~7 e$ c
  59. #define ITCCHEN_SHIFT               231 t  m2 V8 D& h

  60. 1 T- g2 ?) Z7 Q
  61. static volatile int irqraised1 = 0;
    ! z- f0 T4 @" R4 A$ o: X* a4 X
  62. static volatile int irqraised2 = 0;$ g1 r# ~! `6 E& |- |/ M# [+ c
  63. 2 t" I" R& w. Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 P( B+ r( o8 Q% K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 w" y( c, f) {+ L9 S1 T+ A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , S( M* [7 I/ x/ _* A) P; c
  67. ; C+ I: x6 l* g# u) e: {
  68. dma_addr_t dmaphyssrc1 = 0;) e. p; U' y& A1 C1 l
  69. dma_addr_t dmaphyssrc2 = 0;
    3 X7 h3 L5 `  F2 k9 t" P3 e
  70. dma_addr_t dmaphysdest1 = 0;
    8 T+ v' O" r6 s' [0 W
  71. dma_addr_t dmaphysdest2 = 0;
    5 P: Y, q, p$ l) T
  72. $ O! W6 g7 R3 b- D
  73. char *dmabufsrc1 = NULL;* Y! A/ e6 }7 l; ?: Z' a+ P3 I4 M
  74. char *dmabufsrc2 = NULL;
    1 g' L# H1 k/ T" A8 F
  75. char *dmabufdest1 = NULL;: a# I9 N1 w# X, o: _9 v
  76. char *dmabufdest2 = NULL;& [2 t0 g4 h/ f/ m0 `

  77. 1 t* t* }& z* ~" v2 Z5 l
  78. static int acnt = 512;6 N0 m9 h( x' Z# F) [; P$ i0 ]
  79. static int bcnt = 8;
    4 k) x! q9 w* E8 o; Q) y, @
  80. static int ccnt = 8;
    2 F8 G* `$ u, ^# e
  81. 4 F4 C* D* X: D9 N; Z
  82. module_param(acnt, int, S_IRUGO);; h3 \3 p6 ~2 m( o  M
  83. module_param(bcnt, int, S_IRUGO);0 w; M. t1 |; v$ T% }5 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; k3 ^9 }* t! x9 V# w" c" r; ]+ v- I* K- ]% l9 ^: e8 e% x2 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. Z& I6 i+ _+ O' M( V+ sarm-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 O/ c. z; T! `; L) D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& S; k- l' n* c' i5 X. I* o' p
1 z8 p! R9 D; G9 t3 y

) V) t5 H' C+ k+ e, Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 11:37 , Processed in 0.041714 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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