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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 D3 n9 c" A6 m: H( F5 J: E
  1. [code]EDMA sample test application
    / O* k7 ?4 O2 F/ `! M: ~
  2. /*( u& j5 j% ?- @/ w7 y
  3. * edma_test.c
    & P4 I5 f! \( Y8 b: K
  4. *. @" ?1 C8 b. l) \# n
  5. * brief  EDMA3 Test Application
    , ]6 m9 `4 ~! C: ]7 ^
  6. *$ k+ I$ O  J  Y$ J- g" a) B
  7. *   This file contains EDMA3 Test code.
      U  ~3 p: R0 y3 L
  8. *
    + ~$ B0 \0 t& ?0 }  {9 _# a7 U. g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( l# ?, [  V  k8 o0 o. O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 J6 }$ m4 @  d' N' m( ]4 }5 V' Z
  11. *         TO CHANGE.
    % h6 e4 b4 v! k$ e/ U
  12. *# l0 _- |8 O& X6 `: ^( u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 k1 u" w- W0 V7 W8 f  v; V) `
  14. *" \' w) J3 \& T( @+ o2 P: ?5 I$ {
  15. * This program is free software; you can redistribute it and/or
    : C" {7 n7 n1 w; d8 S4 O
  16. * modify it under the terms of the GNU General Public License as" ~. p$ a+ `+ n" v7 U6 G3 }
  17. * published by the Free Software Foundation version 2.
    : u/ S0 s6 j* W! y, Z7 t  P
  18. *
    . O! f& p, L2 H3 l; Q4 t: w0 e2 S/ Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 e$ k# C: q: O9 ]: R
  20. * kind, whether express or implied; without even the implied warranty
    ; r; @, u% y9 W- J6 B$ k1 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 @' x4 S1 m% s. [2 h2 n6 E7 z) p
  22. * GNU General Public License for more details.
    & {( E  }, e5 `5 M
  23. */8 j9 T9 d. V5 Q- D6 J" c6 A$ K: m

  24. 7 t* @+ u6 L- |' k3 ]8 z
  25. #include <linux/module.h>
    0 [% w3 U8 S* \2 P3 ~1 F7 \8 j
  26. #include <linux/init.h>
    : U9 ^0 e6 _; f4 ?& D9 D1 F
  27. #include <linux/errno.h>
    5 b/ G- E6 \. K( K  N% E- x* O$ t
  28. #include <linux/types.h>% {6 v7 C, r1 h& b. R; n( r
  29. #include <linux/interrupt.h>
    6 R" j1 a; C5 S% u9 @$ ?; D
  30. #include <asm/io.h>
    0 I* P% |+ O: W1 D' i6 w
  31. #include <linux/moduleparam.h>
    * ~7 b/ G  A8 U
  32. #include <linux/sysctl.h>
    ! u2 M0 J) T# P  L9 e  D# X
  33. #include <linux/mm.h>
    6 l6 }- y0 ^! ?+ \2 x3 i- l  l
  34. #include <linux/dma-mapping.h>
    - S' g8 m* l, W3 P5 L7 H5 m1 w# p

  35. 8 b6 U; R5 N1 X8 t
  36. #include <mach/memory.h>
    ) k  f; v+ |3 Z+ w9 |0 k* ]# r, |
  37. #include <mach/hardware.h>
      e' V. t) ]. S( V- r* u
  38. #include <mach/irqs.h>: S$ L1 K) i  X& @- _8 H" R5 T
  39. #include <asm/hardware/edma.h>
    $ m: J- k& M3 a- |5 V

  40. - f* R9 s3 ]/ X% H! t5 }6 h! Q2 G* S
  41. #undef EDMA3_DEBUG
    9 r- b8 g7 O: [; l/ c
  42. /*#define EDMA3_DEBUG*/
    ! n$ ]0 l) Q- M* c8 {% K
  43. . }; a: p, b& Q* I
  44. #ifdef EDMA3_DEBUG
    1 b+ {' Z' I6 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) W; b1 P4 p7 \* u5 n) E" m. n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# O$ _0 ]6 z) W+ t& J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( w( d$ O& b+ K  g
  48. #else
    4 H  x9 r& I/ G& U4 c0 y" i( q% W3 q
  49. #define DMA_PRINTK( x... )! t9 Y+ B& D( W8 x
  50. #define DMA_FN_IN' X0 q3 B0 K, d# H1 V! Y: W
  51. #define DMA_FN_OUT
    + k3 G$ Q/ G4 f8 E, G& Y
  52. #endif' g0 x+ r) v5 v: @- ?( o4 P5 b' |- n# f) [
  53. 7 Q+ E0 f% P9 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 X8 T% [/ E) K% o/ J2 q; A
  55. #define STATIC_SHIFT                3$ a+ g, ]* [& d; }! |/ t
  56. #define TCINTEN_SHIFT               20$ ]* |6 y* Z! j. V4 M1 L- w
  57. #define ITCINTEN_SHIFT              21
    . E6 a8 h) L! E! Z
  58. #define TCCHEN_SHIFT                22
    $ z3 v5 n8 C/ ]& o7 }4 Q8 K% t# c, I7 U
  59. #define ITCCHEN_SHIFT               23& ]3 P3 [& _' N

  60. 7 N5 h0 h+ |! X% W0 Z! T8 k
  61. static volatile int irqraised1 = 0;; T4 ]2 N9 t5 R1 C* @7 }
  62. static volatile int irqraised2 = 0;
    2 d: Q, \. {# x# _2 h. V+ a) y; p# M

  63. $ d- Q, `2 j* z% s+ b: h8 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 r7 Z) Y1 v& V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: E+ C. s- F: a8 C9 f* v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 u3 @. B7 N- }! B6 k

  67. ; q/ }0 N4 `8 [3 h' M
  68. dma_addr_t dmaphyssrc1 = 0;
    % ?) x  H+ M/ q7 D2 W: [& ?
  69. dma_addr_t dmaphyssrc2 = 0;  W8 ~' L5 X; W2 k7 H
  70. dma_addr_t dmaphysdest1 = 0;
    ' I1 c5 o& J* S
  71. dma_addr_t dmaphysdest2 = 0;
    . m2 f  u, ]1 a1 w. y
  72. $ S9 x: I6 w1 f! s6 s
  73. char *dmabufsrc1 = NULL;
    : u! N8 L- [# A( d- {. u: X) s
  74. char *dmabufsrc2 = NULL;
    # @& X9 Y$ b+ M# _3 U5 |
  75. char *dmabufdest1 = NULL;  E3 O  Y, Y6 u+ D2 m; B- j
  76. char *dmabufdest2 = NULL;; s4 z! M9 k" C9 t* l+ J

  77. 2 L  e. ~4 w# w* N% w% x" {
  78. static int acnt = 512;
      y$ |3 M8 c( w# ~+ r( ^
  79. static int bcnt = 8;
    & U# G1 u+ M! E/ e! [, _6 ^
  80. static int ccnt = 8;
    % e+ \+ k" Q- `; j: a6 z

  81. 6 h6 A: [5 p7 ~( V
  82. module_param(acnt, int, S_IRUGO);
    * ~( |; K: O" ?, Z+ W6 r+ L& p- q: l9 ?
  83. module_param(bcnt, int, S_IRUGO);
    & ^' z. p* ]" m. \: ?: D$ s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 x9 S1 V8 B. t" N5 L" j! [& d$ ~% `, P6 @; m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; s7 G7 C- t$ F& @3 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ B6 E# e$ V$ Q0 V$ m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ b, n! _3 t: Y4 H# [) ^% @
0 T- j2 i# o# x: P

- V, c( `3 e5 T$ J% T( i: a0 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-31 00:33 , Processed in 0.046292 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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