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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* o3 B) s* T& L  P8 k
  1. [code]EDMA sample test application
    & @6 S5 \" r+ s7 Y
  2. /*2 j+ D. |8 L0 |0 \1 o4 X3 R- ^
  3. * edma_test.c
    + y: F9 g" y9 }$ ?- p4 O- ?
  4. *
    3 D' B8 d  Q3 c$ s  ~0 E
  5. * brief  EDMA3 Test Application
    ( f+ w$ |  x; E: f2 w
  6. *
    ' ?; }: p/ r1 r. B" J
  7. *   This file contains EDMA3 Test code.6 a2 C% A3 q: g. a( ^
  8. *% T! R, Q" Z% ^2 [+ D: j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 U. _6 u  `* w5 g1 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ o$ E! d6 t! j9 {! m/ Q
  11. *         TO CHANGE.3 r  g. \$ A: V1 G" F
  12. *
    , J/ x; M; P6 T& E/ \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; \4 B& {4 ?) x) V
  14. *; b  B$ z* F1 u9 P% K
  15. * This program is free software; you can redistribute it and/or
    ! V/ O# d% c* u/ b  N9 n
  16. * modify it under the terms of the GNU General Public License as2 r* d3 i& P* t  p" W8 L& t
  17. * published by the Free Software Foundation version 2.1 A0 R9 X9 `. ?1 h- G$ o2 {8 N1 }
  18. *" u( p+ V% q; ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - {# `  o* I5 E2 Q
  20. * kind, whether express or implied; without even the implied warranty
    $ ]( X" C+ {/ Y! v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: e/ W3 H, Z- z+ q9 w9 X2 y7 Y
  22. * GNU General Public License for more details.
    6 a+ ~; I1 V/ `7 [& H
  23. */; P/ S* j( U* U% _# U0 r. e: H6 W5 o

  24. $ C  K1 K, t9 b- G! I1 O
  25. #include <linux/module.h>
    # t2 A6 J* M: c% E; {3 f8 \
  26. #include <linux/init.h>
    0 _. ^3 Y- ?- y2 k1 {* Y
  27. #include <linux/errno.h>4 }$ I0 v& X) x3 e
  28. #include <linux/types.h>
    - Q7 W: H, V" j7 U3 G1 ?2 i8 D
  29. #include <linux/interrupt.h>
    + ~( B  G3 z' O. C! w. d
  30. #include <asm/io.h>- P+ L0 B$ F5 Y3 K0 u
  31. #include <linux/moduleparam.h>1 o6 u; w. c, R) B. }: ?1 x+ j
  32. #include <linux/sysctl.h>. r9 R; n# i7 \
  33. #include <linux/mm.h>' w. j4 g$ y8 A
  34. #include <linux/dma-mapping.h>$ l! z; Y( F! t/ `

  35. ( {; t3 f' w8 z" B  _8 ~2 g, }
  36. #include <mach/memory.h>2 E8 K+ s+ w/ y0 i3 {: ?# [4 ^
  37. #include <mach/hardware.h>5 ^1 F. \! t  j3 x& }! j( o
  38. #include <mach/irqs.h>) e% c8 Q1 B. p4 N7 {! Y
  39. #include <asm/hardware/edma.h>
    . ~+ A! y  N2 p8 k( J
  40. 7 G: ~7 e  b8 {# X  W3 F  `5 a& n, ^
  41. #undef EDMA3_DEBUG! c2 z; |  M/ L
  42. /*#define EDMA3_DEBUG*/
    ! A- \- v8 ~, R% e/ g

  43. 4 D0 y& ]/ U& a+ h
  44. #ifdef EDMA3_DEBUG5 x+ W/ @8 k5 x" |6 i8 \$ I0 I2 r7 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 @7 V& n/ R4 \4 C! h4 h/ ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; Q4 w3 `8 U  m2 ]1 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 m8 s8 e+ s+ N4 i
  48. #else) X1 g8 u% U/ O4 ], i3 a5 r; a
  49. #define DMA_PRINTK( x... ): x5 h/ }6 ?3 _
  50. #define DMA_FN_IN
    ! p# X* o% _, i
  51. #define DMA_FN_OUT' b8 F/ q$ R- n- i7 w
  52. #endif
      g" ~9 f. [- q" p% F; \

  53. ' K$ A, g) P( K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 M, }* P& Q5 J- C6 y
  55. #define STATIC_SHIFT                3
    * i! Z: X" A# [7 A, f
  56. #define TCINTEN_SHIFT               207 K- v% R5 z1 p) h6 A
  57. #define ITCINTEN_SHIFT              21
    $ f& e( H# A0 g3 N$ y' u; T
  58. #define TCCHEN_SHIFT                22/ o3 l# i: m) _/ V/ k
  59. #define ITCCHEN_SHIFT               23
    6 y: o/ ?. I/ M: G: Q9 F9 |

  60. 9 }  L  f; L$ {
  61. static volatile int irqraised1 = 0;# j, a, g" T! V
  62. static volatile int irqraised2 = 0;) k; L" Z7 \3 S6 g! S, n
  63. * s4 [9 G1 Z' X* M1 y8 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 t* c# R  p- w6 R3 K& p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 {% q* ?# @9 b! K7 G- a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / Q! e& y& ^6 S" x

  67. 9 q, t* J7 r) d3 ^9 Y' E/ x6 B
  68. dma_addr_t dmaphyssrc1 = 0;! V- U# U( L) X! R' C
  69. dma_addr_t dmaphyssrc2 = 0;* L5 \" o6 N, z
  70. dma_addr_t dmaphysdest1 = 0;, K' _5 X* a( ?+ u% b3 c3 q
  71. dma_addr_t dmaphysdest2 = 0;' a/ }  E# m. [9 ^0 w0 I
  72. $ |9 d# P& m5 f) S+ O  ~( A
  73. char *dmabufsrc1 = NULL;- K) p9 y  |5 W4 Y# i
  74. char *dmabufsrc2 = NULL;
    0 J+ e) W) ~- E8 H; t" n4 c- e
  75. char *dmabufdest1 = NULL;
    ; R  ~" ]1 e' S8 y) X/ q4 ?' K
  76. char *dmabufdest2 = NULL;
    ; i. z3 L  J0 r+ O4 G. i
  77. ) L- B# h8 @( S$ _$ D
  78. static int acnt = 512;3 r; d5 o) Y* _/ b" T7 F
  79. static int bcnt = 8;& G5 h0 I* P2 t% R4 a
  80. static int ccnt = 8;  n; h; r* ^2 k

  81. ; `% f- w9 |; a6 I+ e9 g; f
  82. module_param(acnt, int, S_IRUGO);: i$ M% C; [2 D3 s, q: S
  83. module_param(bcnt, int, S_IRUGO);
    6 o1 g- T! I0 j( r; H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) T2 l  }  `% v2 w5 l

3 j% ~3 @; U$ i5 T. V- P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 `' V1 V8 ]/ ^; \8 n+ b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) Q/ R0 u, l( i! S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( U9 ~- G( k" R* I, K" K1 D5 F
+ ~" E- P2 c5 Q7 {3 n
+ I( }" p! X1 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 19:46 , Processed in 0.037669 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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