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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 W5 {) b9 o% E; Z1 ^
  1. [code]EDMA sample test application
    " ?% c/ Z+ d6 D- g; Q( J
  2. /*8 ~( P- Y3 A3 f" r, \. Y
  3. * edma_test.c
    5 c- B1 V+ U3 i8 t; b+ d. @, E
  4. *
    0 x$ w1 M1 W0 v* z
  5. * brief  EDMA3 Test Application' @" S! h4 n! k2 P# Y% s! W& [" Q
  6. *6 P) e% j5 C6 Z" s* W" n1 E* ^
  7. *   This file contains EDMA3 Test code.# o% C5 {' F" y+ R
  8. *# b0 {/ \: r$ y+ _0 ?( n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! i- W! W" P/ @/ S7 C5 [; Y9 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% x$ `& @& u3 V
  11. *         TO CHANGE.# l" g0 u& g% K" Q5 k! b
  12. *7 {* F: r' b3 ^( c/ P$ k$ _  q4 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 q! {8 M& Z# @% V
  14. *' n, t( ^& I" V! p
  15. * This program is free software; you can redistribute it and/or/ S" f- [+ b1 b" K9 I0 J0 N
  16. * modify it under the terms of the GNU General Public License as
    " t) w7 ?0 H8 N  B5 R6 A/ H8 F4 y4 R
  17. * published by the Free Software Foundation version 2.0 J$ t1 f) y% n) l2 Y
  18. *
    8 c% X" C: }) Q; @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 c2 \8 i* \7 q8 Z, |
  20. * kind, whether express or implied; without even the implied warranty5 U/ F3 j, u; q! e. N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: u. J5 h& F$ z. E1 S; k& ~
  22. * GNU General Public License for more details.
    # S' T9 U& s. Z* U' \9 J
  23. */
    ' C4 n5 c  d, m- s( X  O

  24. . b% a. [8 Y  S- O# J
  25. #include <linux/module.h>! o1 I: M( [$ b, W% g( h
  26. #include <linux/init.h>
    " a" H9 D0 v- Y7 ~1 @5 _
  27. #include <linux/errno.h>7 }0 Z9 y) E: B1 x& ~3 r0 {
  28. #include <linux/types.h>
    1 o) e8 B- E+ o/ X; m
  29. #include <linux/interrupt.h>
    / x% t4 c' t# J
  30. #include <asm/io.h>8 B+ l9 j; ~: O: w" Q
  31. #include <linux/moduleparam.h>
    - z* I4 s: Z6 Q8 L1 y
  32. #include <linux/sysctl.h>
    : @; C) |$ l" ^. o4 {2 j$ H2 q. A
  33. #include <linux/mm.h>: Y' T2 y1 e2 Z  `9 c8 l+ i
  34. #include <linux/dma-mapping.h>
    / N# J* g( l# g

  35. , c/ r0 N- m3 P- G9 Q
  36. #include <mach/memory.h>+ ~* b$ C" m3 I; i
  37. #include <mach/hardware.h>
    * A3 G0 S' K  A( ]3 ~1 E
  38. #include <mach/irqs.h>
    % {0 c3 A+ ~: m/ x; a: }5 f3 f
  39. #include <asm/hardware/edma.h>3 s  J$ [% ^# s- U! ~5 _

  40. ! M7 |4 h; C; b, }/ f
  41. #undef EDMA3_DEBUG. ~5 ^+ j) I. r3 S0 W5 L
  42. /*#define EDMA3_DEBUG*/8 ?9 i4 H9 F% |

  43. # p& q8 z) g5 X' R& n' D
  44. #ifdef EDMA3_DEBUG
    8 [9 ]0 ]" Q7 |! r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* l3 d3 ]( S3 I/ o: Z# P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 C1 p' W& K, D) u+ s, O  i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! K6 N) }1 p( j
  48. #else
    3 |* @. o8 y( r% @$ ?$ |9 Q4 R9 u' l
  49. #define DMA_PRINTK( x... )
    : H7 O* d' L1 G2 d- u
  50. #define DMA_FN_IN6 Z% s, _; u: c
  51. #define DMA_FN_OUT
    4 [, l) Q8 ?) n7 B. ]; ^
  52. #endif
    4 R5 \' Y* F1 H( \0 ~% N

  53. 0 R6 k7 M5 x0 H) u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 w' `, R, h4 A5 G1 h6 ?4 M
  55. #define STATIC_SHIFT                3
    - X& j/ _% p! h" T8 m
  56. #define TCINTEN_SHIFT               201 h" C2 A# |* L1 K0 O
  57. #define ITCINTEN_SHIFT              21$ a4 D1 w% q6 O: U4 v, _% h' j6 Y" o
  58. #define TCCHEN_SHIFT                22
    : W/ z) h: x- Z* A
  59. #define ITCCHEN_SHIFT               235 b' N! X$ [* s/ k4 R' L& a

  60. % q) h. G& e8 L3 O
  61. static volatile int irqraised1 = 0;# a! V2 q7 \/ E; |* F$ z% A
  62. static volatile int irqraised2 = 0;3 `7 t( W  F* `3 h) L: M) M: Q$ H
  63. ; c. b* n4 u2 o) m3 Y$ E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 D# Q' e/ h* {% N5 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . Z' S: \9 H% b0 o/ m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& B# V. R) i+ ?

  67. 9 N* n6 \5 Q2 j8 W5 Y  R( J
  68. dma_addr_t dmaphyssrc1 = 0;7 B. w2 P1 C& u$ I  Y* H5 n
  69. dma_addr_t dmaphyssrc2 = 0;5 E5 [& e1 R. t4 s# x; L3 U5 p
  70. dma_addr_t dmaphysdest1 = 0;. f! ]5 b. `1 J! o) e
  71. dma_addr_t dmaphysdest2 = 0;& {/ M) C9 |) g; Z" y) D8 |

  72. / b" h* n/ E! {9 z6 ^
  73. char *dmabufsrc1 = NULL;0 ?5 x2 T$ e( J+ J) X
  74. char *dmabufsrc2 = NULL;3 Q3 L; @" T# [- z
  75. char *dmabufdest1 = NULL;1 l: x$ }/ N3 F8 k8 }
  76. char *dmabufdest2 = NULL;! y2 h! e* [. J

  77. . }5 J- H/ e9 u. F2 y
  78. static int acnt = 512;
    - ?" V3 ~- P# ]
  79. static int bcnt = 8;  I" W! ]* Q9 _" g9 h
  80. static int ccnt = 8;* c% |- f2 \( t- k
  81. " g/ c0 J+ ^  a3 N9 q
  82. module_param(acnt, int, S_IRUGO);
    % z# k# b# G% }
  83. module_param(bcnt, int, S_IRUGO);
    0 e7 Z9 u& g4 b. w9 h, ]/ S* [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 X' ~* y. |' g+ q2 @
$ c$ Z/ z4 y. j  d3 I" V( I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ |( V/ h4 K' Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# P) h4 F- R3 J3 E; g% v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 _$ U: G" l" [% x6 z+ f
  b! w( q( ~6 j5 b0 D- A+ J

7 G. M/ ~) C% X/ Q! ]9 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 12:44 , Processed in 0.038142 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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