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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. Q" L$ X: ]0 C4 h1 _
  1. [code]EDMA sample test application
    0 R9 Y  y/ [5 ]6 J
  2. /*
    3 |! O% q+ {; P; k
  3. * edma_test.c* V0 x+ D" j# d+ K2 _
  4. *  J4 x$ L* l! {( ~
  5. * brief  EDMA3 Test Application4 B& ], h! g' h. f: [0 v5 b
  6. *
    ( }; Z1 n9 p  `. x6 k! O
  7. *   This file contains EDMA3 Test code.5 n) K0 C( V! F
  8. *( h/ i# b. R+ Q4 u9 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 p5 Z/ |, t( e1 m7 q. x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 V; W' i6 W- e: b. N; j' i
  11. *         TO CHANGE.& V. }2 b0 B7 m5 t0 z
  12. *1 w2 n0 n; T5 N/ g. I3 H- F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 S9 Z) E6 M8 K' r) C
  14. *
    ! |; q( m" `2 ~( _) g
  15. * This program is free software; you can redistribute it and/or
    ' `( N! y7 k! D" R0 {$ K$ i
  16. * modify it under the terms of the GNU General Public License as2 r- e2 q" t/ Z2 U
  17. * published by the Free Software Foundation version 2.7 P9 _1 c( q+ y2 s2 V6 \# h6 h! h
  18. *
    + |4 b4 L. Q$ s% Z/ w  W; B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' m; E1 x* h2 \- y
  20. * kind, whether express or implied; without even the implied warranty
    , q+ {, b! k( T" F# Z5 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% L4 [- @$ V, i1 c! ?( o
  22. * GNU General Public License for more details.' |6 C" s  _( a1 C8 @9 T  m$ h
  23. */) H6 i7 Y- Y7 ?. Z. E

  24. ( L) I8 {& ^7 d3 a; J" L
  25. #include <linux/module.h>
    7 [6 U. y2 e2 `: H+ j$ ^
  26. #include <linux/init.h>
    6 V7 a- Z$ V% Z& ^5 I
  27. #include <linux/errno.h>
    1 _- c+ `7 t4 v! H# p6 o1 E
  28. #include <linux/types.h>: F* G, E0 D, V6 b  n
  29. #include <linux/interrupt.h>8 p' B. }& \% k1 _
  30. #include <asm/io.h>
    - i* C- I' k( I) m5 R
  31. #include <linux/moduleparam.h>
    6 X0 c  I% o& l. O) q
  32. #include <linux/sysctl.h>* ?& y- q9 y& S" o7 e  W! C
  33. #include <linux/mm.h>6 @# ?# z7 l' w" @$ X+ k
  34. #include <linux/dma-mapping.h>
    / }, D2 m( T: {, n
  35. 0 X1 j1 ^& N$ Z' e& F2 y
  36. #include <mach/memory.h>: U$ A* c2 T, @: R7 _  k/ S$ B' g
  37. #include <mach/hardware.h>
    3 ]% t2 K$ w  ]9 w. M
  38. #include <mach/irqs.h>
    . i6 Y. Y- }% g
  39. #include <asm/hardware/edma.h># u; \3 E8 Q# ^: o' Q. s" A
  40. 4 M! A% {  g: {6 a/ t
  41. #undef EDMA3_DEBUG
    / ]  w5 ^& s& `& g/ A# s
  42. /*#define EDMA3_DEBUG*/
    4 G0 Z. W( _% c% b3 c& S; B

  43. ( ~3 p3 s2 z1 e5 q( J2 U- \
  44. #ifdef EDMA3_DEBUG
    ( T* W  A8 Y3 v* r3 g" o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 E( m% T; o# q) Q( F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 w3 z6 L: ~; |9 ~, I" K2 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): W6 A! z% z2 B, n! V" ~% o% ^4 j
  48. #else
    1 Z# |7 d; F, c, l7 g8 f
  49. #define DMA_PRINTK( x... )8 }, w+ z8 Z# q# l
  50. #define DMA_FN_IN: K9 n/ U  [& d  c- P1 Q$ l
  51. #define DMA_FN_OUT
      K( q& N( n' c5 Z) m$ B- u
  52. #endif
    4 h  r$ D: V! U5 p+ p4 q* O8 x/ \6 z' p+ {
  53. ! \, c- a, x5 D6 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 j4 z7 t+ g. v  I6 z, D/ j
  55. #define STATIC_SHIFT                31 V  y- u! H9 w. ]' |
  56. #define TCINTEN_SHIFT               205 u% J9 m  o- ]9 X5 M" k, N
  57. #define ITCINTEN_SHIFT              211 x+ e7 X2 d. r0 F
  58. #define TCCHEN_SHIFT                22
    5 r3 @8 M) Z; B# _6 N4 v  T
  59. #define ITCCHEN_SHIFT               23% W. ]8 ~- C7 b2 L+ Q
  60. 9 r' m4 V' r, y. v& O) C3 q( t% q
  61. static volatile int irqraised1 = 0;* \2 ]( Z* z- x; ]9 v3 L* A
  62. static volatile int irqraised2 = 0;" M4 K: j+ o8 J2 W+ S4 c
  63. $ c, i: H1 d" b5 o( D8 S, }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # I$ _% c$ a, T% y3 `( A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . L& J: V7 m9 L9 X5 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 A( U# y& P9 b0 w

  67. ( _1 z4 s: \0 c5 c" W
  68. dma_addr_t dmaphyssrc1 = 0;
    , O6 h) m' j+ C% C3 v, ^6 p, U
  69. dma_addr_t dmaphyssrc2 = 0;
    8 w! D6 p; T# ?
  70. dma_addr_t dmaphysdest1 = 0;4 g6 v! A! r9 p. e8 Q1 F& \; |- A
  71. dma_addr_t dmaphysdest2 = 0;
    9 c" S7 N( u# w! m7 V
  72. + }3 A  {- a8 ]3 x9 l( p9 `
  73. char *dmabufsrc1 = NULL;
    - l3 Y/ D1 s5 [9 z, }& s, o3 C& K
  74. char *dmabufsrc2 = NULL;
    ) r, f% G7 h, p
  75. char *dmabufdest1 = NULL;9 c/ r" t* n* ^7 t8 x9 ]
  76. char *dmabufdest2 = NULL;! H. C" S( X+ w$ R$ }3 a* B
  77.   Z! b5 Q' [4 a! W, R% q! p
  78. static int acnt = 512;& ^2 s) i% O6 `3 ^8 x- ]4 o: Q0 h
  79. static int bcnt = 8;
    & ?+ a( y8 n2 H
  80. static int ccnt = 8;
    1 _% Y' V7 T. c. P* _

  81. : Q' l. B  ]9 B& m" \3 ^
  82. module_param(acnt, int, S_IRUGO);* D# I% B: P( P+ c8 H* ]3 ?
  83. module_param(bcnt, int, S_IRUGO);1 |& g( _' V, Y0 k- f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ Q9 L1 P+ U# Y  g1 X0 _+ U- V
# ~3 w# V/ Z# O9 F' ~( X* `. H' K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ l8 |* G6 \1 y2 b3 f2 I  ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% I4 I  w( z* m" h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, b% Y/ ~5 Y- ~( p  E
1 g0 S, b$ V6 G; D3 J9 K% a
3 l2 _$ F/ Z8 R5 Q2 ~( ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-8 08:03 , Processed in 0.041937 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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