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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" z3 B5 e2 k& c0 D
  1. [code]EDMA sample test application
    0 U4 _3 _% ^+ W" @) }
  2. /*; s/ y4 W9 }4 l& N& ]! {8 Y
  3. * edma_test.c
    ' D$ N0 T1 b) l/ Y8 p; B
  4. *: v6 P5 P0 a$ E: Q' j
  5. * brief  EDMA3 Test Application
    $ w6 q& v) O" z+ ~! o+ y
  6. *
    2 W4 x- D  a- }1 v. y
  7. *   This file contains EDMA3 Test code.  Y* [8 W5 e5 e. D
  8. *! c! M. s+ v: C8 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / o) t1 c2 E2 V2 Q9 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 \2 C, G" j1 ^5 I4 r
  11. *         TO CHANGE.
    ! n. V- U# A: ^6 C. q" D
  12. *
    % Y' h# x- w' ~: }, w6 a) x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) }5 u9 p1 `; K& B4 r- o4 O
  14. *% f; V2 j( k) D( C
  15. * This program is free software; you can redistribute it and/or/ }, a6 ]+ L) f7 p% D7 ~
  16. * modify it under the terms of the GNU General Public License as7 d# [4 {% ?1 R3 D  s: _* T
  17. * published by the Free Software Foundation version 2.7 p8 V7 w) z' @5 f2 L
  18. *
    , |# J! @: ~( p" e  L8 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 E- {$ w% e) o& g% G
  20. * kind, whether express or implied; without even the implied warranty( q9 B4 }/ [% B$ C# u( B8 D% D, ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- o7 i7 C) T4 j
  22. * GNU General Public License for more details.& F' {% H7 @- M8 H# O0 P8 }! q
  23. */: c6 f8 r, o# A( u  X
  24. # d! A$ Q2 ?8 f) W2 t' F: c
  25. #include <linux/module.h>
    3 K. `0 I7 S5 p; d3 T' ?
  26. #include <linux/init.h>- L0 v& ]: R* Z/ ^/ B
  27. #include <linux/errno.h>
    1 I7 Z6 l% j0 d  P+ x; P' J5 B& A
  28. #include <linux/types.h>
    / O! j$ L# T+ m( j* n0 H
  29. #include <linux/interrupt.h>* w8 B! G+ L9 e
  30. #include <asm/io.h>6 ~7 y5 k9 f( d9 V- ?% d
  31. #include <linux/moduleparam.h>
    * m/ q- R: g8 K8 y+ Z0 ~7 J" l6 u
  32. #include <linux/sysctl.h>6 _/ k1 y. Y9 s4 j& D- Y& J4 k9 h
  33. #include <linux/mm.h>. ]7 l8 f" y2 \( \& x* ^
  34. #include <linux/dma-mapping.h>+ x" R* W( I% T/ B* t4 T9 Z3 V. H
  35. * m# M( R  v2 i$ \1 \4 k
  36. #include <mach/memory.h>/ m  N5 |  h" h3 g1 \
  37. #include <mach/hardware.h>! }' T) S) \+ q: |# O
  38. #include <mach/irqs.h>0 f/ c- @& a& z  u  k% b2 I
  39. #include <asm/hardware/edma.h>
    . L* V5 S+ {: J

  40. * {9 |. k# B3 a" m
  41. #undef EDMA3_DEBUG
    # J1 x" s* f/ H, w" J7 z' r5 @
  42. /*#define EDMA3_DEBUG*/
    3 o( Y. D' _/ D  ?/ d

  43. , _! [; r2 k" R% c
  44. #ifdef EDMA3_DEBUG* q0 t* o: M( u9 ^5 e$ s0 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - e/ o# \: F+ Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 C+ H8 S2 N% j5 t, Z' q9 Z" t3 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& b/ A0 o1 ?5 B5 K; B! v) m
  48. #else
    - J/ ?  _* o# t' G) K$ v
  49. #define DMA_PRINTK( x... )' A. @4 Y* O2 O- [9 z& A: ~
  50. #define DMA_FN_IN" I$ r/ a( R! u5 m) Q0 M. W
  51. #define DMA_FN_OUT: C4 A5 Y6 Y/ ~, P  I' @
  52. #endif
    8 @* F* W; x8 ?4 V- a+ d  q
  53. % X+ Q! H, g( c% \+ p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 @# z7 S' s+ X! C' o9 ]9 ]
  55. #define STATIC_SHIFT                3
    3 i! I/ c. r# u. g1 m* X
  56. #define TCINTEN_SHIFT               20% \# ]2 a! I0 D6 b" c
  57. #define ITCINTEN_SHIFT              21
    3 [; M5 n1 {1 n' {" g; p
  58. #define TCCHEN_SHIFT                228 h- i# o, h" u; D; {3 k& L. u; g
  59. #define ITCCHEN_SHIFT               23! g3 }$ J# E) x* f# k6 o( D

  60. - f( N) r8 z8 C; f9 X$ c$ b7 L
  61. static volatile int irqraised1 = 0;
    2 ~) e% S) i/ x: k/ w- }
  62. static volatile int irqraised2 = 0;: j0 X3 o1 c4 k$ ?' B( @" _. D: r
  63. ( q0 {" ]8 ~1 n) x/ c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  J# o! q! W1 l# B9 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 w, x. b: D4 o- ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ]3 Y, v% m) ]. P( b( H
  67. 8 ~# ], z- l. T9 ?1 ~, n
  68. dma_addr_t dmaphyssrc1 = 0;- [$ ?( |) [5 |- e
  69. dma_addr_t dmaphyssrc2 = 0;, _0 k  G9 q7 I6 s- Z
  70. dma_addr_t dmaphysdest1 = 0;
    0 E8 [0 l0 l, m( f  }7 F
  71. dma_addr_t dmaphysdest2 = 0;
    : [" a) r  M; `4 M0 p+ T( W' r* E

  72. + O$ }0 e7 \5 P4 @
  73. char *dmabufsrc1 = NULL;
      s: O6 m- ?( C; Z! Q( g' V! X
  74. char *dmabufsrc2 = NULL;
    ' Z9 N) O$ Y+ C# B
  75. char *dmabufdest1 = NULL;% \: o  u( c) M. R0 K! ^  G7 @' f
  76. char *dmabufdest2 = NULL;# I. o4 N0 g$ `( f: {0 l

  77. 9 S' _9 R: e% m6 ?0 ]
  78. static int acnt = 512;8 q. y/ `4 r2 i
  79. static int bcnt = 8;! K* h7 I- X/ ?; u" ~
  80. static int ccnt = 8;
    / I  f& e+ ?* N+ B/ U5 x/ v: h- G& K/ V

  81. 4 b; F" k$ Z& E( d. x
  82. module_param(acnt, int, S_IRUGO);
    ' N1 q, \, p! L$ N& q
  83. module_param(bcnt, int, S_IRUGO);
    & M& z2 j+ d/ v4 g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) U2 E: b# G$ J% N) a. Y
7 b. o% o& C8 r' j, L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 y- G4 S, S$ G, i9 g5 |4 U0 [0 n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 v4 u7 V4 J; `/ q' Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  Y6 |. X" j. V" J3 ]1 p1 `" B
! T0 G' O. q3 x2 Q
9 b  ^% d' a/ V- n& n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-15 17:11 , Processed in 0.043651 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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