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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& Q) r* M7 h& w5 f0 R/ q2 T" I
  1. [code]EDMA sample test application* f2 H: |" u6 b
  2. /*
    & y2 A- u$ @. L: R1 |+ R
  3. * edma_test.c" b4 k$ i' E' H$ n( a* q6 ~+ V
  4. ** W0 l: p% h3 ]- `. C
  5. * brief  EDMA3 Test Application
    - w3 b# a0 R( e
  6. *, C7 i! L/ g8 Z9 o
  7. *   This file contains EDMA3 Test code.
    % a) E1 b6 s7 H1 c4 l$ m' X0 z- O/ Q
  8. *, Y: |! B# i' {, M: _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# d7 w; e: ~! y$ E9 ?, X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 e% D, q1 T4 F! F, ]8 g
  11. *         TO CHANGE.- \3 p: ?( }% _7 O; q; X' }4 t
  12. *7 U% Y" h5 N, a3 {) T2 `' g- W3 m3 e6 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " [9 h0 H1 K& V3 i
  14. *! u; _! Y/ J7 l/ R7 F: C
  15. * This program is free software; you can redistribute it and/or
    & i8 c, f8 j) M" P
  16. * modify it under the terms of the GNU General Public License as8 o' Y  L& V& y" _' |' ]  F
  17. * published by the Free Software Foundation version 2.
    # F/ s$ D$ i% `# P3 B, v* D
  18. */ h# r- _% r4 l! R* D# p! M6 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + M7 G) V  ~* s/ O: v  A
  20. * kind, whether express or implied; without even the implied warranty
    ; h* r9 `4 U5 S$ o  k; V7 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) [5 A) V" M" ]3 W# G5 W
  22. * GNU General Public License for more details./ Z7 X  O$ `# ?: P- P
  23. */
    8 ^' V( k) d. K2 E
  24. 8 E  ?, o& f! T  g
  25. #include <linux/module.h>
    * I3 t1 ^. ?; H5 W& _
  26. #include <linux/init.h>
    # D5 v) d& H5 r: B+ Q4 x
  27. #include <linux/errno.h>5 ]4 h# C8 L0 v
  28. #include <linux/types.h>
    1 q( Z$ n/ [& ~0 n8 `
  29. #include <linux/interrupt.h>: _  K7 e7 `0 u! C+ O
  30. #include <asm/io.h>
    & ?* e: {' ~8 s' c* q
  31. #include <linux/moduleparam.h>& {8 w, I" N% S! H5 `1 o# z# @
  32. #include <linux/sysctl.h>' V" @8 o. U  k, S
  33. #include <linux/mm.h>& n  f% G8 m+ i" I6 q: H
  34. #include <linux/dma-mapping.h># q  n7 U& l; E4 L7 K$ @7 I
  35. 0 A0 ~$ E& e0 L; V$ `3 F
  36. #include <mach/memory.h>& k. w% Y: ]; q. S, f; r
  37. #include <mach/hardware.h>
    . u6 w2 Y, R, e5 x7 d9 b
  38. #include <mach/irqs.h>
    : q+ P/ D/ V, I5 N! m/ Y2 `
  39. #include <asm/hardware/edma.h>, }/ `9 s3 O2 F# J

  40. 4 y5 \1 f1 V+ k; F
  41. #undef EDMA3_DEBUG
    : F* ~& q+ y- V/ h0 f
  42. /*#define EDMA3_DEBUG*/1 ^5 d: O( i$ q) A* h6 g- h5 o

  43. ( Z, }4 V& q, L9 P
  44. #ifdef EDMA3_DEBUG
    8 J, B% N1 ^* X0 T' p0 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * }1 b2 i& K5 x; k" S. `- U# m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * H: G: D8 I: {/ [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 R7 v- d1 J: h% L$ q
  48. #else) _3 N' ]# A, D+ j4 Z/ g
  49. #define DMA_PRINTK( x... )
    / ]6 b( _% @/ E$ D, @7 W! K1 J
  50. #define DMA_FN_IN* B  e' P* Z& b1 R
  51. #define DMA_FN_OUT6 H7 t: i/ N  M1 n
  52. #endif) A* c/ L  x* I0 z* |2 M  o

  53. 8 {) ~* [5 a& D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" `* T0 ]1 z( {1 `9 c& {
  55. #define STATIC_SHIFT                3- v* u2 E. o$ S
  56. #define TCINTEN_SHIFT               20+ t/ Z! f+ b0 K' X6 U
  57. #define ITCINTEN_SHIFT              21/ \6 W; k9 Z9 S; ^1 Y
  58. #define TCCHEN_SHIFT                220 R0 o# U9 b# R7 V: O
  59. #define ITCCHEN_SHIFT               23
    / c) Y8 G1 ~+ r7 @" s7 Q5 G

  60. # m3 P! Q& Q- ?- Z3 a
  61. static volatile int irqraised1 = 0;
    ) C' Q( N  L5 W# ?" [
  62. static volatile int irqraised2 = 0;  s6 ]8 O" N3 `" V5 v
  63. 5 F2 @& x/ p8 y" h! W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 E; T% e- @9 ?1 m- X9 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 j9 k% |+ D- z0 A8 m0 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" X# |& r; n9 ^/ V: c

  67.   I. M) a& X8 d8 @+ {
  68. dma_addr_t dmaphyssrc1 = 0;, c# p4 m( Q$ C6 q& k+ O
  69. dma_addr_t dmaphyssrc2 = 0;
    8 ~* v& V, o! H$ d/ a8 z! E
  70. dma_addr_t dmaphysdest1 = 0;
    . k' `; d- b$ T/ }0 I" W
  71. dma_addr_t dmaphysdest2 = 0;
    2 x3 M8 |/ z* \# i6 L

  72. * ?1 H0 E$ \  F; a
  73. char *dmabufsrc1 = NULL;  ^' V! _2 c" o& A
  74. char *dmabufsrc2 = NULL;
    $ f+ }  j4 G& n3 c
  75. char *dmabufdest1 = NULL;
    4 y% }5 u1 o# D" `
  76. char *dmabufdest2 = NULL;- [, `0 h( K+ z1 ]

  77. $ Q0 Y- @5 e4 E$ H( A
  78. static int acnt = 512;
    2 z  n5 G% i6 [5 P- B
  79. static int bcnt = 8;" U+ a" ~* }+ Z& B' @
  80. static int ccnt = 8;
    $ u6 M0 M) w0 w4 i, t
  81. 2 v! c( R. k' f3 n; n2 e
  82. module_param(acnt, int, S_IRUGO);
    ( V0 B! G; l( Y% y
  83. module_param(bcnt, int, S_IRUGO);
    , `( @* }0 z$ T% D+ k: _. @7 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* I) N- C' V2 U! U# ]3 I, T
  ], e$ R7 M8 X' [& g' C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 F# R) @7 x( D/ h2 }2 \& u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- L, y2 |3 @# F. U# t9 _: _* D  A& C# W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! L. ^5 D8 ?/ p( M

* w' V5 ~) R, ?8 m
; n) `; G2 X4 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-7 03:52 , Processed in 0.045663 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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