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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ P' c8 [, T" h' ]& I* D# I3 c
  1. [code]EDMA sample test application$ t( \% f* F& r
  2. /*
    7 {9 S& _' V+ g" D3 d+ v& `
  3. * edma_test.c
    & D( t7 g1 V: B$ P$ e7 u
  4. *" V. S$ z0 ~+ I
  5. * brief  EDMA3 Test Application
    1 j0 h/ y5 E: @* W3 m+ C4 _* f
  6. *
    5 T& x. Y+ d0 {6 J; {! Q/ x* d
  7. *   This file contains EDMA3 Test code.( L, C* g- \7 |, y" B6 O! p5 ]  D% d
  8. *& @# q' g7 f. j$ T- i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      g" ~* c7 f: y- O. X5 i+ e) _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: u) a  w2 g" q; q1 k& Z7 h' q7 g
  11. *         TO CHANGE.
    1 Y9 f$ O( B3 I8 L( G2 j2 }( y
  12. *
    ( t3 L5 V$ _( [1 P; g% d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, c* V! f- b# ~! b! z; H% x
  14. *) W) b( y* F0 Y2 Q* X* F
  15. * This program is free software; you can redistribute it and/or
    % G" b- G' Y: P% ^( v" `( A
  16. * modify it under the terms of the GNU General Public License as
    * b. `% E. |) E. ]
  17. * published by the Free Software Foundation version 2.3 d+ D+ s. }0 q7 @+ B2 c
  18. *, R) f+ j" ^1 g$ _) x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 e, c) c% A8 g. N" C
  20. * kind, whether express or implied; without even the implied warranty
    * f- E: l2 h7 y6 u. Q7 S! }7 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 b9 I4 S$ Q% ]/ i0 n' E9 I7 E/ H
  22. * GNU General Public License for more details.5 d- G) [2 r& E/ ~& [
  23. */
    $ d+ O! C8 B9 m, Z- y( e( A

  24. ' A- _# W: S: S7 I6 s" G9 v
  25. #include <linux/module.h># Z" u" y. X( W2 j
  26. #include <linux/init.h>0 C1 {, V6 s" N& V
  27. #include <linux/errno.h>
    2 c8 Z' D0 q( x$ @  a
  28. #include <linux/types.h>
    ; Q; Z$ ]4 T2 t: @! t
  29. #include <linux/interrupt.h>. p6 Z2 ~1 f% S% h: A
  30. #include <asm/io.h>; V% A2 i- f; n
  31. #include <linux/moduleparam.h># c) {/ g/ `( c6 j6 O
  32. #include <linux/sysctl.h>
    ( z* n' a& X6 C' F" O) D/ X! S
  33. #include <linux/mm.h>
    4 J1 f4 }* {. J/ Z
  34. #include <linux/dma-mapping.h>: W% i2 T% @' O

  35. : H( [4 N, L3 c' f
  36. #include <mach/memory.h>
      ]! T7 Z3 K9 z% l* V  L5 Z
  37. #include <mach/hardware.h>
    5 ?; o$ h. T( T1 z' D
  38. #include <mach/irqs.h>
    : _2 H3 e! j5 ^/ ~; Y
  39. #include <asm/hardware/edma.h>
    1 p. k" c3 u5 A2 f/ r
  40. , r4 z; b0 }' H$ I
  41. #undef EDMA3_DEBUG* U5 {+ S) K  w7 l0 |
  42. /*#define EDMA3_DEBUG*/
    6 Q" Y7 j- P  Z' f# A

  43. . A" R- t5 g7 K! t
  44. #ifdef EDMA3_DEBUG
    2 S0 D& i2 _: d: Q! Q/ q+ G2 V$ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 P$ @( m9 R( y% x! s. H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& }0 o5 U; d3 {9 ^1 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 N! a! m: Q# }/ n' H
  48. #else1 |* }; D" y/ a0 ^, J
  49. #define DMA_PRINTK( x... )- j0 @% v( N" V& b, H8 T3 x
  50. #define DMA_FN_IN3 J' Y: Y  |) ~4 V8 E$ X: s! y
  51. #define DMA_FN_OUT
    - g) W  O6 t3 U
  52. #endif6 \4 d- z% m; R2 k& u1 J

  53. 3 `# F; S$ z  b; g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! P7 C+ f. }( v
  55. #define STATIC_SHIFT                35 W/ w3 {) [7 m( w! B; t
  56. #define TCINTEN_SHIFT               207 q8 \5 l2 e; L8 E. D
  57. #define ITCINTEN_SHIFT              21
    . E; C; p/ U* @* s  v* h
  58. #define TCCHEN_SHIFT                22
    7 P$ i2 B$ S! Z8 I9 Q' @! ]( H6 Q  q1 E
  59. #define ITCCHEN_SHIFT               23
    7 ]. m/ k& s2 @  [
  60. 0 R2 |$ T8 R6 J) D
  61. static volatile int irqraised1 = 0;
    - ^* f( j4 R( j
  62. static volatile int irqraised2 = 0;, y  F. v# ]! o& M4 K& X' a
  63.   ~8 h) L  M- f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, t  _2 H& d' _, o3 b$ `0 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * P4 s3 d; `9 T& \/ c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, E+ G6 P0 ?& X& ^0 X

  67. ! ~! O2 {- l3 s1 S9 }$ l: Q# I
  68. dma_addr_t dmaphyssrc1 = 0;% }  j5 ^+ B4 @6 N5 g- J
  69. dma_addr_t dmaphyssrc2 = 0;! X; S: O# T% E# S# b
  70. dma_addr_t dmaphysdest1 = 0;
    / @8 m/ x2 k: k! {0 T+ z6 h; y
  71. dma_addr_t dmaphysdest2 = 0;- s4 H) y( B$ z7 l  Z4 {( ]
  72. 4 N4 Y3 ^4 D7 r
  73. char *dmabufsrc1 = NULL;) e+ x1 ]% u0 c  {; l; q
  74. char *dmabufsrc2 = NULL;  h; \) G7 \" o6 k3 k( C
  75. char *dmabufdest1 = NULL;
    & |, m$ P! c# s/ i8 s( w- U( x
  76. char *dmabufdest2 = NULL;; h" w0 K& V* |7 v
  77. 8 X' x6 q5 [. ]3 y" `
  78. static int acnt = 512;
    6 W7 E+ F' X+ T( o: S8 h
  79. static int bcnt = 8;
    . t$ j2 [2 W9 z& V% a+ M
  80. static int ccnt = 8;
    4 R: P2 q' p9 ^

  81. " B3 d8 ^7 H6 J$ T' o( `0 [+ d5 x* g5 B
  82. module_param(acnt, int, S_IRUGO);3 s* \# O% A* T
  83. module_param(bcnt, int, S_IRUGO);
    7 ~. J& X5 P! H! W& x0 i, T" R/ `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% w, o0 B0 R7 `; A& q( F0 j' R, C6 y5 S5 D% [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: ]' c2 Y1 q% G" Z; Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( `8 Y. e% ^3 e- I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ]9 Q* z; z: ]# P
8 \- }6 \7 Q) R/ L" A
0 d: i2 }$ j, t; W( }" t4 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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