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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & P: y8 O" n5 Z5 W
  1. [code]EDMA sample test application
    % |  }; n$ p' E$ a7 T
  2. /*
    + B- o" Z, J! S' f. C3 s- O+ P
  3. * edma_test.c8 [5 J5 m; [% o- b
  4. *8 |: [( z: G. {
  5. * brief  EDMA3 Test Application+ X4 L! U# C4 N9 ?8 T+ {
  6. *
    " P* F2 f/ ~/ @
  7. *   This file contains EDMA3 Test code.
      t7 h2 U# c; ^$ j
  8. *
    " A: N- p$ O1 F0 F- o( L( _# A$ D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 g# B; m$ b# s* @3 D3 H8 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% F( p. s$ m3 I& h9 M
  11. *         TO CHANGE.  {& d7 P8 ^* y6 ^
  12. *
    * W  I' W" u3 G7 h1 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 y5 a0 @/ J0 f0 v; Y
  14. *, u% u$ q* l& B5 n
  15. * This program is free software; you can redistribute it and/or4 h/ B8 l2 R+ A; t8 b
  16. * modify it under the terms of the GNU General Public License as
    : k, A4 V; o$ _4 K8 Q9 x3 l
  17. * published by the Free Software Foundation version 2.
    : \2 m. _. q. b- R- i
  18. *
    , v5 V# V4 u2 i. D" `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' _% }3 W3 K, ^* v" v; W
  20. * kind, whether express or implied; without even the implied warranty) O+ ^6 w- e/ }$ m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ M6 r6 \* J8 S
  22. * GNU General Public License for more details.- ~2 r; b7 Y0 D: G7 N' F" ?* W# O
  23. */
    : H! X* I7 s8 a5 S
  24. 3 `7 ]0 S! \9 i; ?3 ^0 r$ F
  25. #include <linux/module.h>2 x' V& ^0 w& T  ]( i
  26. #include <linux/init.h>
    2 ?- \. x7 g) p, Q9 G, {; O( o: B
  27. #include <linux/errno.h>8 L6 ^* c+ X, O
  28. #include <linux/types.h>
    8 }; i1 b+ q( {1 e  g
  29. #include <linux/interrupt.h>+ m# V0 {9 B( Y
  30. #include <asm/io.h>
      L* [" v  c) f6 F
  31. #include <linux/moduleparam.h>1 e' c: _  J# x" F' x1 W
  32. #include <linux/sysctl.h>* X* k* m8 m5 b) x. F5 x
  33. #include <linux/mm.h>, G. \4 C2 }" M4 N4 W4 }
  34. #include <linux/dma-mapping.h>( a& J3 t( b/ ]: x* V

  35. ' O5 O0 C  |* r* O& [
  36. #include <mach/memory.h>! u6 D" N7 o. j5 V# z
  37. #include <mach/hardware.h>
    , H8 W" x5 m% @
  38. #include <mach/irqs.h>
    0 n( E+ t' S9 r0 q/ J
  39. #include <asm/hardware/edma.h>
    0 z5 t$ O% v( @" ~
  40. - i  c5 `7 F2 X% n# e8 y- O
  41. #undef EDMA3_DEBUG$ ?2 _1 e( g2 {' Z, `
  42. /*#define EDMA3_DEBUG*/
    $ L: o" }; k, y5 h; d# }

  43. 6 i) R4 F1 W' k4 h
  44. #ifdef EDMA3_DEBUG+ \* M/ Z1 u0 h! d! B# X+ J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; U; Y. g$ A5 e) y- Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 G% m0 C& F/ v; N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  B) L; n- M* x& W' `- z
  48. #else; {7 ]2 B% d# o
  49. #define DMA_PRINTK( x... )
    / l6 L! T2 `, d: ?  o7 i
  50. #define DMA_FN_IN
    - i' ~" N6 [8 y
  51. #define DMA_FN_OUT: N2 c, K) H4 Y7 ]0 S
  52. #endif
    # `' T. t5 {- i) e

  53.   D/ v; e& i$ l# b3 k: o/ V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( C  h3 g6 J. c- @7 H! e
  55. #define STATIC_SHIFT                3
    + i3 A! e) B9 C4 m- B6 S7 j
  56. #define TCINTEN_SHIFT               20* l) K8 V! a8 k( H
  57. #define ITCINTEN_SHIFT              21
    4 B/ I3 `- {' K; s0 p- y
  58. #define TCCHEN_SHIFT                22+ T5 `5 x7 R* ]
  59. #define ITCCHEN_SHIFT               23
    , m8 I' U7 Y( r" [3 b  s
  60. 7 `, X9 Y2 B, P+ Z( I) ]
  61. static volatile int irqraised1 = 0;3 R/ a( @  b& |1 L& Y
  62. static volatile int irqraised2 = 0;
    % e; ?& ?4 y1 I3 a5 n

  63.   Y7 T9 W5 i  Z: e& B2 x) O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 L5 q. S; s! N# Z" i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / V/ h- w$ w" V" y, y- {) D+ s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! d; V8 |' K* O+ T( q6 [% y

  67. 8 a4 u+ N  E; i
  68. dma_addr_t dmaphyssrc1 = 0;7 B$ |+ F1 e' r/ M! d4 {7 y
  69. dma_addr_t dmaphyssrc2 = 0;
    ) `1 x& A* ^% d5 ]+ m- R" c
  70. dma_addr_t dmaphysdest1 = 0;
    4 k; E* @. i; y8 l- c0 P: }
  71. dma_addr_t dmaphysdest2 = 0;: }& b6 M% B- J4 O

  72. + S1 `4 }5 i# g0 Z, ]( q- R
  73. char *dmabufsrc1 = NULL;
    0 \# q0 V% y0 n0 `/ ]6 k) k
  74. char *dmabufsrc2 = NULL;
    1 v  U. C* n& X
  75. char *dmabufdest1 = NULL;
    5 h6 w( S( U( ]) D
  76. char *dmabufdest2 = NULL;" I2 x$ J$ O" r7 U; }& o9 b& W
  77. ' L; Z% m- w0 ]0 _
  78. static int acnt = 512;! q$ m. V$ w' ^5 ?' F
  79. static int bcnt = 8;) X1 D! g$ L) u. ~. u! P6 L3 U
  80. static int ccnt = 8;* B. p$ f  r! k1 z2 P2 @: T0 m
  81. # S( g- T  Y+ I5 Y! Q
  82. module_param(acnt, int, S_IRUGO);* Z2 b3 J8 C4 B3 z$ x+ U$ g4 _& E
  83. module_param(bcnt, int, S_IRUGO);
    * }- E( C+ G6 H  S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" t, H- [& F+ f% T5 @
- \( G5 F, |- C$ z/ O) Z( i& V4 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 u5 U! [2 j5 R8 j! u. Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 R. c  {8 m) ?: R$ O2 V7 l3 s9 h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' N6 k$ Q9 L4 q; R5 u2 b* T# R* a9 g4 W+ A& A: B$ I' x/ A1 @+ Z# V& s
- K- O0 D$ Y5 H; z" y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 11:16 , Processed in 0.039656 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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