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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - \0 P  F0 D( u2 s
  1. [code]EDMA sample test application
    % J9 W! s$ ?  F# \5 f
  2. /*, i- k4 n$ s# q& a4 X& \3 h
  3. * edma_test.c0 B2 q9 e9 Z7 E0 U
  4. *1 S1 _) n7 j9 ]- X" ?
  5. * brief  EDMA3 Test Application
    4 `1 P+ e0 u# x5 v% d' X1 L  b
  6. *, \5 y- _7 L8 o4 U+ K4 B
  7. *   This file contains EDMA3 Test code.* x; N3 y0 y$ M1 `8 G, x4 t7 \7 Z
  8. *
    % N- Q0 A" m4 z4 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 L  o1 o7 v* Q- w$ u0 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 d8 N* t& b1 C8 S& H/ z
  11. *         TO CHANGE.
    2 B: ]" v" Y+ ?6 \3 W
  12. *9 `' F& B8 I/ y8 U' J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & ^: V: p8 Y; K
  14. */ Y0 C+ Y' h2 r/ {7 J  ~: G, w
  15. * This program is free software; you can redistribute it and/or
    7 i9 D5 m0 ~  i$ G' F
  16. * modify it under the terms of the GNU General Public License as
    0 `2 H2 o! n. D3 x& H+ Y. Y
  17. * published by the Free Software Foundation version 2.
    - B8 l6 \0 Y" y$ a& {* q
  18. *
    / X9 j$ E7 F- C# L( T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! r+ q5 ?' {1 b7 w6 H
  20. * kind, whether express or implied; without even the implied warranty5 `7 ?& t2 V' d2 k3 H8 B+ z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # [  t; Y' ?; K% ?' k
  22. * GNU General Public License for more details.6 V- w- h+ J  ?  _* g# S
  23. */
    9 s6 ?0 ], y: k7 O" n

  24. ! z( r- w# |2 f# X( ]
  25. #include <linux/module.h>1 ]. [* C* Y; @6 `1 }( x
  26. #include <linux/init.h>
    4 h0 r( }' V! \) M' |/ {& l
  27. #include <linux/errno.h>
    + s( n% C: p1 |+ D: a# u' B, S
  28. #include <linux/types.h>: o  |% `. A3 L7 o
  29. #include <linux/interrupt.h>+ r* _  s  w/ K8 W
  30. #include <asm/io.h>
    3 {+ H1 b: K+ y* |" c1 U' c
  31. #include <linux/moduleparam.h>& G0 o* o5 q# N* T7 e
  32. #include <linux/sysctl.h>6 ^6 V" u. t2 x) w% x
  33. #include <linux/mm.h>
    5 p" j( G3 D) B8 h& _
  34. #include <linux/dma-mapping.h>2 B: v4 p; i) d) p4 ?  @, l3 X
  35. + k9 v7 g5 D+ K" J' [
  36. #include <mach/memory.h>
    ' h+ Y# e* {# z) K
  37. #include <mach/hardware.h>
    1 |2 T! p' z( E# X3 n
  38. #include <mach/irqs.h>' [7 y! }- ?# ]" o5 B; ?
  39. #include <asm/hardware/edma.h>6 a  i3 u  }# k# f, a+ S
  40. * e! c; L$ h# F( j! b
  41. #undef EDMA3_DEBUG( T# t) G! \9 ~3 ^& j
  42. /*#define EDMA3_DEBUG*/5 N( G. O. F4 ?7 Z  r  j

  43. 9 N( k) h1 d; @0 s6 @% G- P4 [$ l
  44. #ifdef EDMA3_DEBUG# C3 q% b" g& z0 U; E- f1 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + Z6 s/ z3 d+ m  w) ~( a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). s1 I- h  P# F  y" ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , n* T2 Q% t8 r6 X$ H1 h
  48. #else$ l0 [6 Y! z7 K! ^+ J
  49. #define DMA_PRINTK( x... )
    ; G  j% k' V2 u6 L3 L+ k
  50. #define DMA_FN_IN5 W0 U) X# U/ \5 ~! @  y: \8 z
  51. #define DMA_FN_OUT
    * |- s6 ?( [  ]" m
  52. #endif
    " b: U- u% y9 J1 [6 \7 D
  53. ( f$ P& a9 B& d; X9 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 B) N0 b" o! \; q0 X* I
  55. #define STATIC_SHIFT                3. B6 B5 I2 |% Q/ p% Q
  56. #define TCINTEN_SHIFT               20& O# x8 T8 `- V6 {
  57. #define ITCINTEN_SHIFT              21$ g, W4 L7 Y( A+ F2 c# h2 P5 Y' o
  58. #define TCCHEN_SHIFT                22& s1 C6 O* l! c5 Z6 K
  59. #define ITCCHEN_SHIFT               23
    # U' ~9 ^, q! [! U3 ]! v
  60. 8 r  k  \# d7 b4 q
  61. static volatile int irqraised1 = 0;1 w6 L, p! q, a/ S
  62. static volatile int irqraised2 = 0;* m! E8 v& u- T1 ^( T& n
  63. 5 e2 G/ O7 d4 ?7 K/ v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " a. X% U; D% S% k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 \# F, y! R, y) \9 x, W; A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' w2 L% s  x( N) A) q4 |
  67. $ j7 U$ v3 Y9 n
  68. dma_addr_t dmaphyssrc1 = 0;
    " p: }1 |  D2 O8 |& ^% {
  69. dma_addr_t dmaphyssrc2 = 0;
    ' I& k& ]% `3 |' A9 Z3 Q
  70. dma_addr_t dmaphysdest1 = 0;
    6 f* a6 s7 s. E& j# Q
  71. dma_addr_t dmaphysdest2 = 0;) p" X4 P8 }& B% }. y: h- e3 a4 \
  72. ! T4 `; T& q% @: z3 B$ o! M4 Y* R
  73. char *dmabufsrc1 = NULL;& s3 N! a* p+ d" y
  74. char *dmabufsrc2 = NULL;# b- g$ T& l# @  s4 |* J* C
  75. char *dmabufdest1 = NULL;
    " P* D! ]& G  b( u4 A5 i
  76. char *dmabufdest2 = NULL;- D: C) _* E7 [& O* w

  77. 2 C2 P4 G/ L% D/ J
  78. static int acnt = 512;( L5 R: V) \  ~' o
  79. static int bcnt = 8;, f. J4 H% y# r+ x" Y  n
  80. static int ccnt = 8;8 [6 {( T/ q: l+ r5 G2 E' ?; B
  81. ( g; e$ a) J9 m' Q( _' A( B
  82. module_param(acnt, int, S_IRUGO);
    ! o$ J7 ?! o9 v9 Z. H. ^9 j
  83. module_param(bcnt, int, S_IRUGO);
    5 C9 p7 t4 V. G  ~, O5 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* R. _7 }9 a' V, T/ i  M  v/ J8 f" Q6 L; @. M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ d2 F7 t0 o$ P' y& M- j2 _& marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 P3 q! o. h" X: E* d1 ?7 W) ~. B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 Q/ n  \- N$ i7 J
& E8 K' M: U+ F8 l/ M  X
# o& |* W0 w1 X. W; c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 07:47 , Processed in 0.040326 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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