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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # \+ O  Q3 w3 _4 B
  1. [code]EDMA sample test application
    $ `* E! B0 L8 Q# H9 \
  2. /*+ C9 o  [& h; E! ]5 N, ~3 L
  3. * edma_test.c7 o5 T; k" Y3 @) Y- w& U9 s1 F
  4. *
    $ X0 G1 s- H5 M
  5. * brief  EDMA3 Test Application; o4 H: X' ^. u% o+ O# z
  6. *
    2 l/ Q) X  k* j
  7. *   This file contains EDMA3 Test code.7 z6 p; B+ ?3 }# V; B4 M
  8. *1 t% W7 ?! H: Y4 J& j) I% J3 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 `" Z3 X- q! @" r/ v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 b- F2 T0 z( i% i1 Q; `
  11. *         TO CHANGE.
    8 B' y% i& w! {5 k% ^  n* X
  12. *
    3 f. K4 |) R( S9 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( a/ I5 M0 e' H; m
  14. *6 @; I/ h. e  P( Q
  15. * This program is free software; you can redistribute it and/or5 f6 ]. Q3 R' a
  16. * modify it under the terms of the GNU General Public License as1 p  O4 Y- |. [) Z& h  n) w' D( {! u
  17. * published by the Free Software Foundation version 2.
    ' {0 v: q# v5 |- W( ?- k
  18. *
    # \: {* Y) E  u9 `  O  B' x; v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 z. `  ~, h  Z: D
  20. * kind, whether express or implied; without even the implied warranty, i  E: f" o* f- l! c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * ~8 K* ^0 m5 }% }
  22. * GNU General Public License for more details.
    . p" q1 [& Z# O6 R% S/ `8 r
  23. */
    ; S  y: n  C: ]* P3 |

  24. # G6 p6 M6 V7 e
  25. #include <linux/module.h>7 b- u! b! \) q. r* o. }9 I
  26. #include <linux/init.h>9 h/ X  u+ h% Y* x' n; }8 y
  27. #include <linux/errno.h>  r- A3 `# ~- K
  28. #include <linux/types.h>1 b: y( L3 E  P8 b# J2 H
  29. #include <linux/interrupt.h>
    7 D: c: T# O* R) ]" Z; B
  30. #include <asm/io.h>7 U. _, V; D; H: m" B
  31. #include <linux/moduleparam.h>4 A* Q% L/ {1 y, P$ d8 A5 F! y1 R
  32. #include <linux/sysctl.h>+ a9 S' q+ ~6 N
  33. #include <linux/mm.h>
    " ~9 ]4 N5 H4 N0 B% d* `" x& `
  34. #include <linux/dma-mapping.h>
      D8 z  O' o* t  N
  35. 1 f2 U: D8 T" `$ H
  36. #include <mach/memory.h>
    7 F( w3 K/ o( R- }
  37. #include <mach/hardware.h>2 W/ C1 K, J8 h' r) M
  38. #include <mach/irqs.h>& n2 e, ^& F+ ]7 H9 C  y
  39. #include <asm/hardware/edma.h>" o4 R9 O" p/ z8 ]/ a

  40. / g+ c# d3 X% m6 W  D% d3 f
  41. #undef EDMA3_DEBUG' B$ L. s7 \3 w  s
  42. /*#define EDMA3_DEBUG*/
    * g$ l9 Y0 c* [- r) I
  43. + q6 n4 C: n- x1 \. N/ I
  44. #ifdef EDMA3_DEBUG
    - {# q& [$ _1 G9 n& W6 ]9 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , y$ e2 m: \% i9 v- G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ G  ?0 w# E+ B1 L; Y4 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 Q- S* U+ q! M( c  W: H, b
  48. #else0 f. G7 z7 E' u3 m/ |4 a
  49. #define DMA_PRINTK( x... )0 c( l3 M' m3 h% K0 C5 e3 |. K
  50. #define DMA_FN_IN
    " K7 m& l2 ~1 r* R. G5 h
  51. #define DMA_FN_OUT
    & t: l( Y" I% @$ t. s  N2 a% }0 d  n
  52. #endif
    ; O. U! l! ~+ f9 O0 _) F% H6 n
  53. ( ?3 A" n1 l7 i2 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 d3 U+ T  r. B2 a+ y% ^7 m
  55. #define STATIC_SHIFT                3
    % _# S" X  c9 |5 V1 n+ D
  56. #define TCINTEN_SHIFT               20
    0 |# D2 P" K! t- c* ]; m/ h
  57. #define ITCINTEN_SHIFT              21
    ( U" V$ `; u  [+ S4 r* {- r% ]! s
  58. #define TCCHEN_SHIFT                22
    ! n; c! Q' W: q" w% @/ j, M
  59. #define ITCCHEN_SHIFT               23
    : E9 a) w' h# q$ h0 Y  J1 z

  60. 7 Y8 K% ^0 p$ P7 L
  61. static volatile int irqraised1 = 0;
    / W" T2 q& J& [  e& _
  62. static volatile int irqraised2 = 0;
    4 ?" g$ _9 U4 T

  63. * y$ ^! N0 O& E0 x7 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! b- I. o; n# ^8 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * {+ z$ w- h( d9 ~5 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H! M. |, T9 g, M. k
  67. 4 Q$ }+ x% a( X- X; Z, {! I
  68. dma_addr_t dmaphyssrc1 = 0;7 y7 R( U" h+ J: `) g6 `/ x8 Z, p: Z: w
  69. dma_addr_t dmaphyssrc2 = 0;8 j# x+ k+ \/ s5 A( \# U  i
  70. dma_addr_t dmaphysdest1 = 0;
    6 h/ N2 K" J0 f- K1 p7 @8 [% n
  71. dma_addr_t dmaphysdest2 = 0;5 E6 P- q6 D# Y& |

  72. - v+ V1 X) Q1 S+ G) Y6 z
  73. char *dmabufsrc1 = NULL;! ?( T4 e5 d- D) f
  74. char *dmabufsrc2 = NULL;
    - _2 m7 O8 p1 t- R! [6 t8 Q. |
  75. char *dmabufdest1 = NULL;% T/ i& O  `0 F. o9 E( B2 Q
  76. char *dmabufdest2 = NULL;3 R; Y# Z5 k+ B
  77. : I; a4 F' ]' {# o4 H
  78. static int acnt = 512;
    $ w9 {: g" @* h( P. ]! U( @
  79. static int bcnt = 8;
    ( @- G: {% D- H' ]& K9 B
  80. static int ccnt = 8;
    1 ]5 u) n8 w: p; S+ U" r
  81. . E$ k3 c1 K6 n/ N9 t  ~# A5 x
  82. module_param(acnt, int, S_IRUGO);. J  t4 @# \' c. K1 g" [
  83. module_param(bcnt, int, S_IRUGO);
    ! Z0 b& W, _5 ]& N5 c) C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 Q( l1 J: I7 Z/ Y9 x7 ~

& R- h$ {/ u: S6 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, D8 L: F9 p4 p, Z) oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' F8 U5 j. R, \7 L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 Z  \2 W6 v0 e5 T% h" c  F. x; j2 C

7 ]; [1 W4 `1 y2 T9 x% R. G1 j- k" R3 r0 E$ j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 22:12 , Processed in 0.036396 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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