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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + Y5 r" I  M! N1 q& S  q
  1. [code]EDMA sample test application  |! ?0 N" N' y& g) L
  2. /*6 D4 Z0 V: Q8 M- |
  3. * edma_test.c5 ~8 ]4 z& C& d: w+ U$ x2 }/ \
  4. *
    ; e' ]; P- O& q* G5 `" d
  5. * brief  EDMA3 Test Application. g1 c8 E9 g& n6 a
  6. *
    * t# Z7 v4 V1 k9 H1 V
  7. *   This file contains EDMA3 Test code.
      f& x$ Y  m; K& K; t6 K" h
  8. *
    9 b& |2 K3 l2 ?) y! f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . x$ S3 o$ h$ e1 x$ Z1 A( a* z2 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 a) b5 c, x" x# w5 Z
  11. *         TO CHANGE.( I5 ?: }7 B6 j4 g
  12. *1 R' T# l! |$ u" f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 P$ C1 R% Q" f! h9 W& T; m
  14. *0 G8 F& [; A5 B. L! D6 ?9 J
  15. * This program is free software; you can redistribute it and/or
    / Z+ F" S( i, J' }! Y+ ^/ b  l9 w+ i
  16. * modify it under the terms of the GNU General Public License as, {1 O$ z. F  N- V1 `
  17. * published by the Free Software Foundation version 2.
    # f9 n2 O5 n% ~
  18. *; b* w8 k; D/ W0 m2 \, v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 w7 {/ @  g# {$ }
  20. * kind, whether express or implied; without even the implied warranty
      e& Z+ r# y" A7 }/ u! H$ \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' o0 M; m7 F4 B0 C0 P) n( G2 J+ E
  22. * GNU General Public License for more details.
    8 x) m* ?. C4 W( J) I( @
  23. */
    7 P4 }5 S8 @& j8 r
  24. * q% F' D; a7 D% e* q" F* O: @- Z
  25. #include <linux/module.h>( G4 }+ R0 |9 W& V5 U; P+ [" g
  26. #include <linux/init.h>4 Y, |- i3 K3 M# Q3 t
  27. #include <linux/errno.h>
    . D6 g4 Q; @3 b5 d
  28. #include <linux/types.h>6 r1 l4 D# F$ ^8 p% _* R8 V/ v
  29. #include <linux/interrupt.h>& h0 ^4 l* A; E
  30. #include <asm/io.h>
    ! H$ h. G7 [- V& A  b; t: B) C- v
  31. #include <linux/moduleparam.h>
    8 z/ F5 [, P7 m: c1 v' m
  32. #include <linux/sysctl.h>
    * o$ S1 ~+ S( X+ @& y; K  I5 y9 W& N
  33. #include <linux/mm.h>
    9 F% `/ T& d6 _2 T
  34. #include <linux/dma-mapping.h>
    0 z2 h$ n0 ~: `0 J/ l

  35. 9 _7 H6 f9 K; k) o* ?+ X
  36. #include <mach/memory.h>! q. F! b" [# Q1 j# ?
  37. #include <mach/hardware.h>
    3 f1 j& \, f! A" g6 O& \1 j
  38. #include <mach/irqs.h>' _. F  w6 a, }, r
  39. #include <asm/hardware/edma.h>
    . A! b% H# w: x* C/ T( J, g* V" [
  40. 9 g% x7 ^5 H2 L+ T
  41. #undef EDMA3_DEBUG
    4 j- c3 O* H. B6 U% W
  42. /*#define EDMA3_DEBUG*/
    $ f7 s! q% m5 X) Q. w  ?

  43. ) u' V+ u2 }9 @' ?3 M# y
  44. #ifdef EDMA3_DEBUG
    ' I1 u6 g" S7 c$ z0 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 D8 s: r0 Q- R; G: F: [9 \2 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 J5 e# p. z: w8 O( A+ c7 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 s. G* L& l+ b# \/ D
  48. #else( \0 Q/ R# k2 K: b* |6 Q
  49. #define DMA_PRINTK( x... )( Z$ L' V7 F, b+ f6 m3 B8 F
  50. #define DMA_FN_IN# N& w: J6 Z6 F6 B; L- a
  51. #define DMA_FN_OUT" s+ X* q  H  Y9 c5 H1 Y6 \/ M. H
  52. #endif9 X+ x9 C9 M- {7 G4 [

  53. / g* T/ E# @% _. ?: C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 X. N0 ~, z0 l5 U' F
  55. #define STATIC_SHIFT                3
    % Y; @, u# M. M& t  b( ?
  56. #define TCINTEN_SHIFT               20
      q1 ?5 [) q) s6 s( P
  57. #define ITCINTEN_SHIFT              21
    + {$ V7 g% @! K, |) O
  58. #define TCCHEN_SHIFT                22( r' p7 V1 \: L9 }& e) l5 J
  59. #define ITCCHEN_SHIFT               237 j, V: e$ g  ~

  60. ) ~' y/ @9 [: v1 q9 b0 Z
  61. static volatile int irqraised1 = 0;8 {7 B& x& N1 b4 F3 K
  62. static volatile int irqraised2 = 0;
    + ]- Q7 ?- c3 U0 D
  63. % c- S3 g1 @( }, E. Q% y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) r+ p, U2 j3 a% V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 }1 F7 D8 }0 `7 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      w% `; [; [0 U  ]' [- U* P

  67. . ?9 G5 Q; Q: V! Q
  68. dma_addr_t dmaphyssrc1 = 0;
    1 v5 _3 I$ h% t+ b, w, D
  69. dma_addr_t dmaphyssrc2 = 0;' N9 @: J# Q: K6 u7 n
  70. dma_addr_t dmaphysdest1 = 0;
    * Z, a# Z* Y' O0 [# z! u( I6 N& f
  71. dma_addr_t dmaphysdest2 = 0;
      {, G7 i) @1 u; N) k
  72. 0 K" p0 ~$ Z# ?3 j; [% ^
  73. char *dmabufsrc1 = NULL;6 v  d) D& U# P7 P% ]( E6 f6 m7 L
  74. char *dmabufsrc2 = NULL;
    . f9 u- K8 o5 y* W: v% _
  75. char *dmabufdest1 = NULL;
    ( i5 S9 d  \5 i/ ]6 T
  76. char *dmabufdest2 = NULL;" n) I/ y3 L! X; p. w2 O8 \9 s

  77. 7 Z! y1 f/ b7 B9 a& P( Z* P
  78. static int acnt = 512;, S8 X+ d; J& g8 a2 M
  79. static int bcnt = 8;+ a8 p9 n& ^1 ]/ \2 B
  80. static int ccnt = 8;, M! `7 X% V9 _7 }: z. \

  81. 7 E$ C) U4 J0 g2 X8 a6 l
  82. module_param(acnt, int, S_IRUGO);
    ; y, q+ t8 h- ^2 u1 m2 D
  83. module_param(bcnt, int, S_IRUGO);/ ^/ t4 b  G2 f5 t* \) ~2 a, H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* g8 \% f! G1 O
- \, d) W( G$ e9 Z- [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- H. Z/ p" N/ Y$ k8 ~9 p, O5 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& U" G7 f& g& m0 o- I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- }6 A9 L2 [. g, j$ H8 j: b5 x; A- a0 l9 F& t1 t( F4 @+ \
3 g# i( Y; Y2 ~1 l0 Z$ s" a$ N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 11:13 , Processed in 0.038629 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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