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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. G+ u8 S' K* p4 U* s2 W
  1. [code]EDMA sample test application$ I% u" e! I, I
  2. /*5 e/ P/ ^: S  J7 I* ^* j
  3. * edma_test.c
    : T$ x) a4 j- z! d" F8 o' k* I" K
  4. *
    2 O# F/ q9 W5 J& Z4 l# N% h$ F
  5. * brief  EDMA3 Test Application. U) e4 G) Y4 s5 t/ Z) N4 x- A
  6. *8 T4 B9 z: L+ s& h& u3 V5 T
  7. *   This file contains EDMA3 Test code.. W- _, C% J! I
  8. *' p1 _( c$ s3 G/ H! @, h) R! m2 c! a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 k, l$ B% `) o! f& [1 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 q* W7 L- D8 f( r; F6 J3 O- C
  11. *         TO CHANGE.( C* Y+ E/ b1 ]) W  k
  12. *& Q, F1 A" y  y/ ^+ n; x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; O1 I- J; z8 U) C3 l8 ]
  14. *
    + O$ S& R& ]2 g* Q3 h. ?) I
  15. * This program is free software; you can redistribute it and/or+ P8 F1 C# v) D( r, F0 c" z  z4 ?
  16. * modify it under the terms of the GNU General Public License as9 J7 T! z9 }$ _# X6 g  _" X
  17. * published by the Free Software Foundation version 2.
    ( x0 P6 m' \1 S4 T. @
  18. *
    5 ^9 Z+ H: X& s8 h7 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - }. q9 q1 R& ^/ I2 |6 H' O
  20. * kind, whether express or implied; without even the implied warranty
    1 n0 {2 g2 }8 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 J7 x' r0 J  |: s4 ~
  22. * GNU General Public License for more details.
    5 \- w3 G9 v, ]5 U
  23. */3 N: o, x; k( G
  24. + q6 ^5 D$ j! L) y4 Y- v
  25. #include <linux/module.h>
    4 Q) Z: t' g' V+ o1 C0 C
  26. #include <linux/init.h>
    : h  a  Z8 C) ]0 p+ C: x9 f) L
  27. #include <linux/errno.h>2 _5 n- z# v9 t% `: [$ h
  28. #include <linux/types.h>0 |- q( o; [# `
  29. #include <linux/interrupt.h>
    ! ^6 J2 L+ j) G( Y* |3 v* w, ^
  30. #include <asm/io.h>
    & Y4 j* j' f8 A" n, K' G! f
  31. #include <linux/moduleparam.h>$ f+ z% C" }! z# Q# o2 C) n; X6 |
  32. #include <linux/sysctl.h>. Z6 Y2 s/ ~4 v1 z; q/ Q2 X
  33. #include <linux/mm.h>7 [& d+ ~: g! S1 U9 b" G" g
  34. #include <linux/dma-mapping.h>+ v+ T5 ~# v' D0 `
  35. 8 X* \  M* P, }& ~1 j* x
  36. #include <mach/memory.h>0 q, q$ [" v) ^# l8 {. |
  37. #include <mach/hardware.h>
    & m9 M1 z, h; |$ Z
  38. #include <mach/irqs.h># m9 g6 i. l" x* A7 H# t
  39. #include <asm/hardware/edma.h>7 _, I" w, P/ [3 b& y

  40. + B" P- n! n- b; t3 |1 ?* W
  41. #undef EDMA3_DEBUG5 p3 [9 e* d0 Q7 n1 @* z- F. c
  42. /*#define EDMA3_DEBUG*/
    - U' U- v+ r/ ^& Z: }3 V6 k
  43. 9 c# h1 q8 P' U& B# c. \+ c1 S' x
  44. #ifdef EDMA3_DEBUG2 s. q9 h% N' U- R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 {8 y1 d& r. k, k6 E( f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , ?( L" @$ z5 K9 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 k9 P7 P8 [1 Y, f$ `+ e
  48. #else* a" K; q8 K+ C
  49. #define DMA_PRINTK( x... )- Z2 {* D& p- p& _2 F  W6 N  J& v& C
  50. #define DMA_FN_IN
    3 {' J! R, o# z7 o/ o* I6 S
  51. #define DMA_FN_OUT% X( Y* _2 Q* E) ]
  52. #endif
    ! ~' y" f# s' n; ~
  53. ! q  U6 `2 L9 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 K' \' k) P  L) z
  55. #define STATIC_SHIFT                3' |' r4 w2 U4 a! f$ [! t* H( p; L
  56. #define TCINTEN_SHIFT               20
    # N  w# X9 M3 r* E6 X
  57. #define ITCINTEN_SHIFT              21! [7 I3 D( {9 g+ |% {
  58. #define TCCHEN_SHIFT                22
    % b; S& p2 G: Z1 A  b$ V4 ?) D
  59. #define ITCCHEN_SHIFT               231 [, c7 c+ w2 W7 E) K( |6 P* X

  60. % n6 Z; z* ?+ h5 q# \3 F$ q
  61. static volatile int irqraised1 = 0;
    . H  @' g( F" C% x' X7 F: N
  62. static volatile int irqraised2 = 0;% ?, W0 H8 {; ~6 s" a2 @4 v

  63. 1 ]  Y0 \6 o$ Q/ H/ |+ H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" V$ b- {* Z( I4 `# @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : A2 T) L9 J: V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 x+ a# _5 Z, _! o, ]

  67. # `' C' _9 T% B9 U0 B3 A" D- O; ^
  68. dma_addr_t dmaphyssrc1 = 0;
    & `. Z- w3 n4 Y  a& N
  69. dma_addr_t dmaphyssrc2 = 0;
    8 `$ ?4 |: m, ^/ z9 l  g+ n7 D5 T; n
  70. dma_addr_t dmaphysdest1 = 0;
    ( ?9 A  n. k* m+ q: m5 F
  71. dma_addr_t dmaphysdest2 = 0;$ P3 {$ n6 ~. s: M; D* Q

  72. ' f8 \. l# g4 W: T$ c
  73. char *dmabufsrc1 = NULL;% O5 ?" a" N' X+ \3 q
  74. char *dmabufsrc2 = NULL;
    % e4 z& ]5 c1 Y+ _4 }$ s2 p+ G% l
  75. char *dmabufdest1 = NULL;
    ! `! t" h$ v! ]. M: \/ D; x
  76. char *dmabufdest2 = NULL;& V7 k/ D* {, y  q$ ~8 `$ u

  77. * W* V( X- e3 E# S+ L
  78. static int acnt = 512;: a7 G- L  X9 ?; L8 _8 f$ W
  79. static int bcnt = 8;" l" |& ~; E5 ?) l: b0 b
  80. static int ccnt = 8;
    ; A+ V4 {+ s6 {" j- \1 {9 a; c
  81.   D5 {' Q3 W/ G# u- Z8 ?
  82. module_param(acnt, int, S_IRUGO);
    : l3 D7 y4 i, {3 V* X+ r
  83. module_param(bcnt, int, S_IRUGO);
    : [9 K' O1 M% G  b% G0 s) Z. v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ I# t' b4 |  p2 [% f* K
& S0 ?, E- ~9 v& R; m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 b# i/ w7 [( W# e. O! O* N3 e  garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ T+ G8 u8 B" ]. G! `: v+ k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  ^& a8 L. t0 o* q" F! K) a6 f' I! w$ a: z% V
8 Z) v% j7 G. l4 E/ r0 u7 b5 L; X5 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 17:07 , Processed in 0.037358 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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