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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  a& h: V" b' h, d- k
  1. [code]EDMA sample test application7 ^7 R6 m- I8 T+ b4 ]- i/ d% |. j+ Z
  2. /*5 ^/ j# M! X/ j2 _6 {  X
  3. * edma_test.c! E& [3 F; f/ H' P
  4. *
    3 K  |* O( }3 c
  5. * brief  EDMA3 Test Application
    6 v* Z" {) i! p
  6. *7 ?5 \# S4 ^+ A% }" K/ o; x* {
  7. *   This file contains EDMA3 Test code.
    9 ]3 s4 v0 x( i: M, y9 ]
  8. *$ Z3 X; d( s! h( a0 ~1 l5 s' j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 B  k; e6 n, ~) `. n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* E" M$ D2 o7 l7 S; A
  11. *         TO CHANGE.
    4 ^- o' a7 Y& J9 R# Y6 w
  12. *
    5 Q  ~2 I4 I& J/ [4 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " b3 q* E: L, i  i# a' D6 L# K
  14. *
    8 g4 K9 D1 H3 d5 _" S9 O
  15. * This program is free software; you can redistribute it and/or( ?0 k+ ]8 f7 m8 I
  16. * modify it under the terms of the GNU General Public License as( u" a* ~3 [: |
  17. * published by the Free Software Foundation version 2." s4 {5 Z7 Z3 X! d" n' Z
  18. */ J4 U- B' V& l' }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 e; s; D. a; k3 L
  20. * kind, whether express or implied; without even the implied warranty8 k7 o* r1 Y( {! P  D) N0 I- G7 ~$ E  L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' w' X. k/ {4 b7 [4 n! [
  22. * GNU General Public License for more details.
    6 H" b. @$ I- }7 e& B) v2 g
  23. */
    . C4 g0 s7 U" v! K0 l: v

  24. . e' n, W2 A7 W+ {
  25. #include <linux/module.h>
    ! F/ I  _" p- u1 ^
  26. #include <linux/init.h>- K% h+ d. L1 |5 U
  27. #include <linux/errno.h>
    & j+ G/ O0 U- _% \: y
  28. #include <linux/types.h>
    ; B- h- ~* m2 m5 e
  29. #include <linux/interrupt.h>
    9 n5 Z9 F! \2 d3 I$ ^9 W
  30. #include <asm/io.h>
    " c& P2 V" s! k, s* ^
  31. #include <linux/moduleparam.h>% F% ~" P0 O4 w5 s
  32. #include <linux/sysctl.h>
    0 }6 b  K8 h- v4 L  t2 P7 {4 \4 l4 i
  33. #include <linux/mm.h>
    . ~6 v. \# N; x" e1 t
  34. #include <linux/dma-mapping.h>4 l6 M3 _0 C7 e1 l
  35. " n, ~2 `5 n. `4 z" B2 I' X
  36. #include <mach/memory.h>
    - O/ Z# T0 l  o  Q0 O
  37. #include <mach/hardware.h>
    4 O" ^* d$ x- }7 N  [1 A
  38. #include <mach/irqs.h>
    $ y8 n# x+ |1 _1 W
  39. #include <asm/hardware/edma.h>$ H' _7 e* u8 r2 N5 U; S9 C8 Q" m

  40. 0 T: `& `( A8 u5 T7 h* n
  41. #undef EDMA3_DEBUG
    6 _9 p# s4 E" c! ]: e
  42. /*#define EDMA3_DEBUG*/7 O" f. E6 u8 g! y. K( _
  43. $ N$ t4 a; h' G+ B  i
  44. #ifdef EDMA3_DEBUG- ?2 o7 x" l( Q4 I4 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* Y/ i$ [3 B& o3 ]8 \$ j; N1 x6 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). k7 K. e/ ~' _5 U* P: X' G" v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 s% V3 _- h; \2 J* A
  48. #else
    5 V3 L/ @6 t" i( w
  49. #define DMA_PRINTK( x... ): Y' f: A: v4 H3 L  s
  50. #define DMA_FN_IN0 _& S# @# X+ Q2 F
  51. #define DMA_FN_OUT  o  n5 @  H+ q0 s' I+ I
  52. #endif5 Q& M1 E/ F  d1 H/ _/ h
  53.   W* \  `7 X: |$ _( Z# O& S$ e4 H; K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  X5 e' b$ y$ w+ ?: f5 L( [
  55. #define STATIC_SHIFT                3: a- i3 i3 M! r8 j" B+ |! s
  56. #define TCINTEN_SHIFT               20
    7 S" |# |! ]' N7 x
  57. #define ITCINTEN_SHIFT              21
      r, y! g# O7 s  d, M
  58. #define TCCHEN_SHIFT                22- I& P" k( |' M4 }
  59. #define ITCCHEN_SHIFT               238 o, w: V" R/ B) @8 X$ R( b

  60. * A( I  G) F9 }5 ?) U
  61. static volatile int irqraised1 = 0;
    ; N  o& y4 h$ _$ m8 r" l/ ^) {
  62. static volatile int irqraised2 = 0;. j) o# ^2 z1 M( Y. H/ z
  63. ) M1 {4 |( m9 A! f4 n( K- p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 [9 P3 s# g7 M: P/ k, E" L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Y5 k6 ]$ U  i0 L# C7 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) l. S+ ]; z* X2 r8 d

  67. $ ]1 w  b. s; b, h" h! j* F
  68. dma_addr_t dmaphyssrc1 = 0;4 y7 V; D& d$ X9 e3 X% c
  69. dma_addr_t dmaphyssrc2 = 0;
      C; q( s; j9 J) i
  70. dma_addr_t dmaphysdest1 = 0;( @" U+ R' b  I( I. R* C
  71. dma_addr_t dmaphysdest2 = 0;
    9 h, X- P0 P5 V9 K  b: b" L2 h

  72. # H/ I1 H/ [+ n# l3 g
  73. char *dmabufsrc1 = NULL;1 M( w9 B- O3 X( J
  74. char *dmabufsrc2 = NULL;( \5 V( \4 _% p+ ?: R7 k
  75. char *dmabufdest1 = NULL;9 F& l' a. O1 m; U9 a
  76. char *dmabufdest2 = NULL;; h6 P7 j9 u, b# c+ f4 C  z8 O+ I+ j
  77. ( y, Z8 ~- b$ O/ P3 i  y' m. X
  78. static int acnt = 512;
    9 j7 l. Z+ l( a7 M9 C
  79. static int bcnt = 8;
    + c; n; ?! `4 j1 b2 u( C" |  _! G
  80. static int ccnt = 8;2 S$ r: }1 P* U1 l. Y1 x' `
  81. # j% b' E; ]" p$ R) K% b
  82. module_param(acnt, int, S_IRUGO);5 \2 h3 c' v/ u
  83. module_param(bcnt, int, S_IRUGO);
    / F' U9 u, i9 @7 T8 B3 b' i1 H% S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ B% S  h/ ~9 Q+ \# U
+ R- T0 E: M* [6 K) j' i: O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 L8 e9 C5 I' g$ L0 ~, o& o$ q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 R' f# a, b" w- J+ {' t( L8 u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ W. U0 T) J, Y
3 D$ [8 B) J' H& s! U# V7 V7 p/ w: A
2 o1 s6 z: Y* h  G2 c8 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-19 07:18 , Processed in 0.036247 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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