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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " m5 a$ U2 w( B* I# X
  1. [code]EDMA sample test application
    1 }1 u" p  M  ^
  2. /*
    2 t$ k  p# h, L) N( Q
  3. * edma_test.c
    9 O) d) r" {: K3 D# |
  4. *
    - E3 P) A9 Q: {! f5 V
  5. * brief  EDMA3 Test Application* G1 C* a9 v% X
  6. *
    - r3 R7 ^( L4 J
  7. *   This file contains EDMA3 Test code.
    ) D7 R# i# S* a+ s
  8. *
    7 S( T3 V2 r7 r2 L" @# f9 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- t8 g( q* w9 x3 r( Y" e/ @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. w5 U# C/ i3 p
  11. *         TO CHANGE.2 A) d6 ]% u; p( S) _' D
  12. *
    5 @, s- W1 L: _7 C/ n6 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P& @1 y, e% N( S1 p, \  o0 O7 h
  14. *
    - u, k5 V* r* W& `, ]! N5 O
  15. * This program is free software; you can redistribute it and/or
    * W  r8 p# ~! V6 }! X1 z
  16. * modify it under the terms of the GNU General Public License as
    1 Z, c' @% a5 Q7 R% n& H  q$ Y
  17. * published by the Free Software Foundation version 2.8 w% v4 C$ C+ t1 Y; y: I
  18. *9 E8 `' M; ~0 u0 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, j* ~1 [/ Y4 V6 Q
  20. * kind, whether express or implied; without even the implied warranty
    ( E% n" C) N  s; Z8 ^1 N5 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 K4 a8 q/ d  E
  22. * GNU General Public License for more details.
    9 \  b1 W% J' j- N
  23. */
    " T$ j$ y! k& I9 K5 B, ]5 x# Y

  24. + y3 p: B! N5 a5 t7 s& l
  25. #include <linux/module.h>7 B7 _1 S8 ]1 k% ~8 K( j/ {* I
  26. #include <linux/init.h>
    8 h1 l" _+ d# ?+ H  n4 d
  27. #include <linux/errno.h>
    7 y. f: R, l2 {& |) i9 h0 a
  28. #include <linux/types.h>; q# V5 b8 k! l0 ^( ?
  29. #include <linux/interrupt.h>4 }: y  I) `: b0 a& K% Y
  30. #include <asm/io.h>0 H  F, k6 j' |8 q! Z
  31. #include <linux/moduleparam.h>
    % a! ?* N8 m$ r2 n' V) h$ t: O  I
  32. #include <linux/sysctl.h>5 L; g- y) c* o9 F5 K* i0 R
  33. #include <linux/mm.h>
    / ~0 T% b' h) ?5 B/ i/ L# h
  34. #include <linux/dma-mapping.h>% t3 Z- r6 h; N* H6 i/ W# q" f' G7 E
  35. % U  r2 \3 |7 w' O  w
  36. #include <mach/memory.h>
    ; L% |1 I  C3 x) U; k8 ~9 Q
  37. #include <mach/hardware.h>: j  O/ V; V6 o, w8 H; t" D% U2 \
  38. #include <mach/irqs.h>+ }0 G! Z& b% |
  39. #include <asm/hardware/edma.h>8 s, M6 `" k" @9 x0 E) O4 T

  40. 2 D) r9 [* o- X, Z  \% h
  41. #undef EDMA3_DEBUG
    - R% h  \6 C' n$ P3 Q
  42. /*#define EDMA3_DEBUG*/, r9 j- N8 {( N! x
  43. % m4 x" M% B6 N* y! z! U+ h. H
  44. #ifdef EDMA3_DEBUG6 R# X7 |# D8 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), c. d# |$ t% Z' O4 I4 l3 `$ [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 P5 l  u) n8 }7 n, _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; k* @# N" z% y- f3 a! \
  48. #else
    5 m! U% x% x1 E3 O: i
  49. #define DMA_PRINTK( x... )
    0 s+ X! F# g/ A; J4 e# o3 v
  50. #define DMA_FN_IN
    ) r$ K% L% ?4 r: m9 X6 {
  51. #define DMA_FN_OUT
    % a; a  H% q2 J! P  ~
  52. #endif
    , L. b6 y/ T. r$ Z( Z& h
  53. - P2 o+ z) {8 w3 i9 T* u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ w: e" t: t+ r/ n6 y; S( Z+ B" M+ B
  55. #define STATIC_SHIFT                3
    $ U$ r4 n) S) P  t- W
  56. #define TCINTEN_SHIFT               20" D5 F2 |6 @6 N- ]; ~' C
  57. #define ITCINTEN_SHIFT              21
    8 {& V; {6 o, U7 Z9 J  c
  58. #define TCCHEN_SHIFT                221 ^' C! G; h( H9 |9 _/ {3 q
  59. #define ITCCHEN_SHIFT               23
    7 z6 P4 U/ P2 |; F/ Y
  60. ! l# B) D1 n5 ^( i4 h: i3 N
  61. static volatile int irqraised1 = 0;
      F; u4 ]( ?: `! X9 l, G
  62. static volatile int irqraised2 = 0;
    ! m; s2 k7 l7 x6 V* w

  63. & a" f: j0 r% J. w5 z/ u& U5 g" j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - |- {5 {$ k( ^/ ]* D( [; }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # T2 @$ f- W! |' }1 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, J2 K, x) Q- _2 X

  67. 9 f" M+ {8 k, T( W2 H
  68. dma_addr_t dmaphyssrc1 = 0;
    / E9 S* `1 T; j( G
  69. dma_addr_t dmaphyssrc2 = 0;7 t; k4 U* f6 P" |6 M3 H
  70. dma_addr_t dmaphysdest1 = 0;( T# q: N: H+ {; N, }, N
  71. dma_addr_t dmaphysdest2 = 0;' t( u! |( v- r6 l: d- x2 x

  72. & K4 N$ m$ k5 |  _8 I; V9 e
  73. char *dmabufsrc1 = NULL;4 Z: K) Q0 u  u3 n$ B
  74. char *dmabufsrc2 = NULL;% F7 N' }0 o6 N$ f6 a/ F
  75. char *dmabufdest1 = NULL;5 ~: V& ^# v6 t( X
  76. char *dmabufdest2 = NULL;$ R7 L/ ^+ V8 u9 W& ]: A7 b4 H: f

  77. 2 ~- t- B/ U( i) N) O
  78. static int acnt = 512;
    % ?8 ~1 q7 ^7 H- |7 ]5 `5 [" D
  79. static int bcnt = 8;- H# Y2 d) A2 w) S& G
  80. static int ccnt = 8;5 X+ K9 D% v7 _; K/ v8 @& N# q
  81. 5 p6 k) U- j! @0 A+ r. @. y" y
  82. module_param(acnt, int, S_IRUGO);
    $ f' P3 R2 C. t. m$ {$ B8 s
  83. module_param(bcnt, int, S_IRUGO);
    9 {0 k) g, c# y+ C  J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 O5 p  |. ^% H" g7 h2 T  C
* g1 A" a3 t0 H) C0 b3 }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 ?+ k4 s4 J1 t2 d/ Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' s4 q4 {& \. b7 I& ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) F# Z# m6 u6 q6 D+ b0 O
: H% h! O% B7 d, l% K
2 q: x4 Y: {. M" Y! U5 N$ q7 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-8 05:11 , Processed in 0.035827 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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