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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % e# Q- |' E0 v) g8 e( ~) [) \
  1. [code]EDMA sample test application/ p# K/ `* o% \* K: Z& I/ f
  2. /*
    & _6 V* |! t0 I" r
  3. * edma_test.c, ~) P( ?3 j. `) w/ W
  4. *
    4 P- X% H" @0 g7 M) u9 ~
  5. * brief  EDMA3 Test Application2 M+ v; J$ R, n) T1 g' t
  6. *, J  K, |: ]0 b! r+ t* @
  7. *   This file contains EDMA3 Test code./ E& j% a, @' W
  8. *
    , S: B' J' i9 F% q! O* A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 d+ h+ h' d% U3 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - q" w) O8 c7 z
  11. *         TO CHANGE.
    " N% |. w% X3 e( _2 \: H
  12. */ o+ c0 g4 @& w3 w, g7 l% I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 p3 m: D( X4 C8 }8 J+ Z' C/ X
  14. *
      o* ]" J' c$ `5 D! y0 _; l
  15. * This program is free software; you can redistribute it and/or
    8 E2 a' ]' K* Z: i
  16. * modify it under the terms of the GNU General Public License as% D8 D' O$ f, S, q
  17. * published by the Free Software Foundation version 2.
    6 b$ m9 B4 u4 ^: _8 [5 u3 R/ p
  18. *+ x# g3 N# k3 I2 X; w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 a0 `% n% J9 L& _7 w
  20. * kind, whether express or implied; without even the implied warranty2 w, m' u# b, O- }6 I! w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. j; ^2 b$ M" J5 l4 a0 G" Q
  22. * GNU General Public License for more details.! r7 m+ p$ C. V/ b% m1 r
  23. *// I! n9 R2 z; l8 n2 l. P* F5 d6 t
  24. 5 p, r0 @. x, B, ?  I5 y, Z
  25. #include <linux/module.h>
    , o$ n$ s' w. I/ j7 x' |( ~
  26. #include <linux/init.h>
    8 V9 q* h% S7 Q0 R+ J
  27. #include <linux/errno.h>
    2 [% f" b. k, C0 m6 h) s
  28. #include <linux/types.h>% h" w* Y1 N$ a9 B
  29. #include <linux/interrupt.h>
    / I7 N. r5 C. ~) X
  30. #include <asm/io.h>
    + A: ]; e7 E, U- o9 X, T" _/ c/ Q
  31. #include <linux/moduleparam.h>
    # y* m, T1 Z% O) X9 K6 @; E
  32. #include <linux/sysctl.h>
    + r! Q: _+ \6 K: p5 Q6 M% O
  33. #include <linux/mm.h>
    * ^9 V5 }+ I4 B& e6 Y; w
  34. #include <linux/dma-mapping.h>! L, i/ R5 F0 x$ g+ b6 n, M! p
  35. , ]7 I* V7 A- z1 r  a  }! `* H7 Z
  36. #include <mach/memory.h>
    % Q; s) T$ _5 ~7 C. C
  37. #include <mach/hardware.h>: t/ Q; I9 f- e% d+ B' ^# Z
  38. #include <mach/irqs.h>
    * o% ]# |6 {4 k8 ?$ L5 {$ ?
  39. #include <asm/hardware/edma.h># r; {. T: x! L) ]  {: V3 S

  40. 5 Z9 U" I8 _4 w/ L
  41. #undef EDMA3_DEBUG& d' Q) c$ t; @1 Y( j' X
  42. /*#define EDMA3_DEBUG*/
    0 P* \( M+ I0 {% T  s  _: N# _
  43. ( `" M+ p1 [$ ?( a1 b
  44. #ifdef EDMA3_DEBUG
    - D1 V& L) }( ?2 D& w/ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); Y! W' }9 A  c- _( G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # @& n2 h' K) K  Q2 v, y$ i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" }& P4 m7 n+ E, z
  48. #else5 n' G1 k( p/ A0 A. f! e* W
  49. #define DMA_PRINTK( x... )8 h: J& P4 s/ v
  50. #define DMA_FN_IN
    6 k) T4 M3 c' \% q3 V) P
  51. #define DMA_FN_OUT
    ; G6 u0 {8 _: _4 Q
  52. #endif9 g1 X( f# y; `. j7 h

  53. 8 q: r+ w# t" Q1 ]9 }( h" f! T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 o( U: l+ t; Q
  55. #define STATIC_SHIFT                3/ z) ~4 X0 l; l! R
  56. #define TCINTEN_SHIFT               20/ f$ k) v4 B) V+ D& E% b
  57. #define ITCINTEN_SHIFT              21
      F1 e! D5 R2 h6 e
  58. #define TCCHEN_SHIFT                22
    3 p5 O9 H: d0 @- ?% v, R; V; U# F1 X
  59. #define ITCCHEN_SHIFT               23
    : Q% i7 K8 T5 B: y
  60. 7 ^: r7 V# K$ n6 M" S$ _
  61. static volatile int irqraised1 = 0;
    ) `9 K+ A. j2 y
  62. static volatile int irqraised2 = 0;; k. y$ F* \* L
  63. ) b6 H; |1 a$ E, K, d0 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- P. |5 ~; `1 y, B( e( E3 Z, p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, n6 g4 m7 i3 T) U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , y' N  i* W) n  h% m

  67. ) H6 j5 E8 s" ?; A* _
  68. dma_addr_t dmaphyssrc1 = 0;
    3 a! [/ v7 O" p2 x7 c3 T
  69. dma_addr_t dmaphyssrc2 = 0;) W4 m! E1 ]6 u7 S4 ~* G  |7 k
  70. dma_addr_t dmaphysdest1 = 0;
    " c- T# `0 o3 V) Z" X
  71. dma_addr_t dmaphysdest2 = 0;
    9 k; e" q& g& P1 i( R7 z4 m0 j

  72. : s5 |7 n( H0 Q( l
  73. char *dmabufsrc1 = NULL;  W) S, W$ F1 ]4 \: D0 N+ @8 ~
  74. char *dmabufsrc2 = NULL;
      y2 ~6 K! }: i5 `& S
  75. char *dmabufdest1 = NULL;
    7 \+ X% C$ r, ~
  76. char *dmabufdest2 = NULL;
    , h2 `/ _- v/ K* ]+ C

  77. # D1 n) Q+ i2 y* @; h
  78. static int acnt = 512;
    * c$ ?5 u$ z5 p3 `, j
  79. static int bcnt = 8;
    " P0 s5 k; b; p* f1 D! q/ S- g. {6 \
  80. static int ccnt = 8;
    # R6 C: e! _9 m% o

  81. 2 S) j1 Y4 L7 U9 s- K
  82. module_param(acnt, int, S_IRUGO);* M" N" T0 B8 s; H) t: N
  83. module_param(bcnt, int, S_IRUGO);
    9 |8 p; s8 r* s0 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 ~: i0 `$ E7 d: C
; P+ f8 d1 A$ B6 S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  B! r; f! I7 ~% B+ L% e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, b7 T9 u/ Y. D4 [+ y( |3 [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" I7 q+ C" B0 W; S
9 \% B. N  {1 ]. z% w# t, i+ M( @( j- b$ J7 ~/ H0 U2 J9 \" l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 04:21 , Processed in 0.038819 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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