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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; C3 z  q# o) h% O# f% i
  1. [code]EDMA sample test application
    3 P  G7 r& A7 K# ^, B/ G% M
  2. /*
    + L$ e3 P" q! Z9 m2 Z# U7 Q
  3. * edma_test.c6 ]4 h4 O, o; t0 \! Q- B
  4. *4 y$ w. K+ M7 G" Z/ m+ U) ~5 }
  5. * brief  EDMA3 Test Application4 \/ x1 K/ P. ?4 e" b% a. H
  6. *: U: p: u3 b+ o1 a2 J) J' ^
  7. *   This file contains EDMA3 Test code.
    ' f* s) p" W0 b- Z! K- [
  8. *
    5 J1 L- S; N1 @' O' X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ k0 `8 q; K& d; N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 h! z5 l' v! ~5 p" k& K& E
  11. *         TO CHANGE.
    " K9 ^! e( U, ]. e- A
  12. *! j+ \8 g# r1 k, L# u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 U1 O" d; Z. C2 }" A. T
  14. *7 z8 d& y; u% v! T
  15. * This program is free software; you can redistribute it and/or( L# W1 t1 b/ L5 c0 x- P  \* a
  16. * modify it under the terms of the GNU General Public License as
    / j# g4 s! _7 s9 Z
  17. * published by the Free Software Foundation version 2.4 ?/ d( k+ z3 L
  18. *2 _; Z; I2 @. q, z/ U) h( c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * x; J* q( Z; `1 [5 ~1 D
  20. * kind, whether express or implied; without even the implied warranty8 z3 L' t1 E& b+ J7 j3 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; A$ Q) i2 A0 C* g$ v9 G2 T
  22. * GNU General Public License for more details.) U! p4 H" A- t$ b3 z, U4 \2 y
  23. */
      z9 v/ Z& W- u, W: B
  24. $ W6 B, B  @" t7 H1 {
  25. #include <linux/module.h>
    ; c* o. S# k! s
  26. #include <linux/init.h>
    6 s; h+ U# m6 ]* O
  27. #include <linux/errno.h>
    ( ?# F! v7 e7 e
  28. #include <linux/types.h>- E! H' G# ~6 _9 Z; F/ p
  29. #include <linux/interrupt.h>, `/ \# c* W: w$ `9 j# d
  30. #include <asm/io.h>/ i! J" B" F0 |% A, c, N3 \2 F5 x. F
  31. #include <linux/moduleparam.h>
    - z" }  g* w+ X9 z
  32. #include <linux/sysctl.h>
    , i6 N* E5 C7 G2 h2 l
  33. #include <linux/mm.h>
    $ [3 M9 |, k# w5 Z
  34. #include <linux/dma-mapping.h>
    : S, j& E% W  ~8 R7 }# U

  35. 7 ]  M* r  Y( G6 g
  36. #include <mach/memory.h>
    7 q0 d. q9 z! I' ]1 M
  37. #include <mach/hardware.h>' ?9 q2 V( y0 s1 q" e
  38. #include <mach/irqs.h>% `3 {* ^0 P" B5 i0 t. }7 j
  39. #include <asm/hardware/edma.h>. p2 {) w( [3 }/ ~2 D, [% g  x
  40. 6 V) w" O1 l; r+ w; ]
  41. #undef EDMA3_DEBUG
    ' _: b0 c9 S$ T& L( ]
  42. /*#define EDMA3_DEBUG*/
    ! y. |! F, _' y! j6 G# o9 l6 m

  43. ' |8 ~. z& y2 j3 Z6 S0 N
  44. #ifdef EDMA3_DEBUG
    8 i% b1 V6 D+ w5 G0 f, n, B2 t6 ^; l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' F  I( Q9 E4 Y8 n7 H3 J/ i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 ^( p$ \* [7 T2 P3 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( A- K$ }& x' x" m5 l
  48. #else4 H% a8 ~, M4 Z# i, a8 d7 A* k/ }
  49. #define DMA_PRINTK( x... )+ E/ P9 x* [6 T) @& Q0 N
  50. #define DMA_FN_IN: ~$ e4 ?0 W' p1 h. J5 j
  51. #define DMA_FN_OUT- K5 M* M5 P0 ?5 Q. m3 k
  52. #endif
    ' C: Z1 d8 S' c/ g9 S- D0 D1 D" y

  53. % R0 _, [5 o" W+ T5 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 ?$ Y/ v! s. `' ?/ E6 E
  55. #define STATIC_SHIFT                38 n$ v9 p  x( s. E
  56. #define TCINTEN_SHIFT               20
      t% h1 _, V) X: T7 B' Y
  57. #define ITCINTEN_SHIFT              21
    # ~  `: l/ b3 P; N
  58. #define TCCHEN_SHIFT                22
    8 l9 r2 h6 m$ n* ^+ |8 v) M
  59. #define ITCCHEN_SHIFT               23; @- e( E, I: I

  60. - x2 v0 A, `/ v2 g8 P& N  J# w% _
  61. static volatile int irqraised1 = 0;
    + J3 ~( F$ ^. c  L7 q. D2 h2 U6 j
  62. static volatile int irqraised2 = 0;
    6 y: I5 x, v/ e$ o+ {
  63. 7 ?. \( X  r3 g( P1 d$ @! X& J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " b- Y1 X& z/ Y3 g4 `3 V. J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - f7 L* Q3 Y6 T3 S0 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / u% f; _3 V; y

  67. + n6 u  u9 a6 F# X% h4 X4 D
  68. dma_addr_t dmaphyssrc1 = 0;
    , {+ _1 A7 e. @+ A
  69. dma_addr_t dmaphyssrc2 = 0;1 N2 k3 ^* b  H8 ]
  70. dma_addr_t dmaphysdest1 = 0;
    0 [% k0 J& r. S8 N) \9 V
  71. dma_addr_t dmaphysdest2 = 0;' p2 H( I  n& g& ]

  72. 9 k% L- z9 e; Q/ S
  73. char *dmabufsrc1 = NULL;) j! `$ w$ y0 b% e7 w( P6 \
  74. char *dmabufsrc2 = NULL;% }  ]6 c3 r4 l5 L" W
  75. char *dmabufdest1 = NULL;
    . y$ m- x, G& M0 _8 R2 P) ]
  76. char *dmabufdest2 = NULL;, y0 H( g* i' O" d2 x# R
  77. . T# s6 x0 R' w
  78. static int acnt = 512;
    , `1 S+ p( j( ~- u9 R) T
  79. static int bcnt = 8;5 L( l  l2 u) q& N0 Z
  80. static int ccnt = 8;; @5 u& l' t& W* u* N# j

  81. . e' {% J9 v6 I1 m8 u- v5 Z
  82. module_param(acnt, int, S_IRUGO);
    : k  i" R9 X% ^! z6 Q
  83. module_param(bcnt, int, S_IRUGO);
    6 E5 a) e$ N6 s+ \) l/ ~6 D9 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( m9 N1 |! G( C" ^0 O0 F+ [; c$ J: j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: J1 u" o5 p5 }' |, U" Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 X9 r  X9 J2 q& f6 i: T& p, t8 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( M: b1 m3 |( k9 F) y9 Q

4 _1 r. _5 W0 x( d
# Q" y$ Q9 u$ e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 21:07 , Processed in 0.037680 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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