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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 i# A! a; u: i6 u- ]' R( ~
  1. [code]EDMA sample test application
    $ _) _/ G! ]( O3 Q
  2. /*
    ; Q( ?' Y1 A0 M# i# s
  3. * edma_test.c
    ( ]9 V9 ~' M1 B; M/ Y& M! h& ^7 T
  4. *
    7 Z' |# t& ], ?; I; `
  5. * brief  EDMA3 Test Application
    : O6 x( A& [& n9 r; K; i% w
  6. *
    ' x1 m5 B  [/ X
  7. *   This file contains EDMA3 Test code.1 b/ n; V/ D$ e: U4 Q
  8. *
    / v% M# \0 X. m2 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % h$ S( T9 ~& P4 S* }& T7 F: Y/ A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( c$ y' g6 ]7 P: B
  11. *         TO CHANGE.
    : r2 U/ |/ @! z
  12. ** x" B1 m6 ~1 K7 z. }4 S3 R3 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ f6 X' U: y: x- N* ]; O
  14. *6 Z0 l( y6 y* ^" [
  15. * This program is free software; you can redistribute it and/or
    9 A( v$ D3 y/ r/ S, ^
  16. * modify it under the terms of the GNU General Public License as
    - ]5 s1 B" Y, k
  17. * published by the Free Software Foundation version 2.* H7 P% G$ b0 o0 @6 E
  18. *, X8 c2 O& m4 z* P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' G8 U9 h* ^7 }' u4 k6 E; M9 P: q1 f
  20. * kind, whether express or implied; without even the implied warranty
    # N5 D4 S& J: |* S9 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' _* u$ r! }5 `% P# o, {+ [
  22. * GNU General Public License for more details.
    $ D+ e+ e$ M5 N. ~' [* b& H" [" U
  23. */
    $ [0 E4 H3 ]* S# c0 P
  24. & _0 T$ W9 |- x! T. M, l
  25. #include <linux/module.h>
    $ }0 G/ }& [9 }! F
  26. #include <linux/init.h>2 P% W' ^1 {) K5 n" C5 p9 L. s
  27. #include <linux/errno.h>
    1 @4 {+ X! n; O1 [
  28. #include <linux/types.h>4 q8 T# X7 ?: G, P
  29. #include <linux/interrupt.h>
    2 x9 G' N# p  L
  30. #include <asm/io.h>6 x! A6 R) z. l/ m- K9 p
  31. #include <linux/moduleparam.h>
    9 t; C6 Y9 \+ D( h1 D7 _, D
  32. #include <linux/sysctl.h>
    ; x8 K" \  k: d- x0 @
  33. #include <linux/mm.h>/ l6 n' h. h' P
  34. #include <linux/dma-mapping.h>; q! `$ ~& h3 Q5 w; k

  35. ; t. J7 A: L: x  Y7 u- o+ s
  36. #include <mach/memory.h>
    ) v  |/ ~  R7 I
  37. #include <mach/hardware.h>4 o1 S) W. E: S0 S* {
  38. #include <mach/irqs.h>
    % ]$ U( p1 r3 ]1 w9 `+ n- j
  39. #include <asm/hardware/edma.h>
    1 w) ~( a  @& Q/ w9 a' Y0 |5 ]

  40. ) Q) r! l/ P0 N+ P
  41. #undef EDMA3_DEBUG3 k% U- c2 Q1 n  y' [; P. n0 P! J
  42. /*#define EDMA3_DEBUG*/8 _+ U4 K2 }. s* W' c
  43. ; g' m% ]0 r" g1 }
  44. #ifdef EDMA3_DEBUG2 O8 @9 @  ~* I4 q2 z4 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& t4 N# O1 D4 u6 u0 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- w( `: L& C2 N4 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # X, ]) p% i4 J0 d& H
  48. #else( c) [; w1 `' @: C( R/ c5 Z, z
  49. #define DMA_PRINTK( x... ); ~# B; d% M! ]) y' o
  50. #define DMA_FN_IN# n0 r. d. C( D/ L! ~" u7 _
  51. #define DMA_FN_OUT
    . C0 j( E' U. p" g9 ~* v1 S+ R
  52. #endif8 p1 X3 f5 b) @" L- ^
  53. 7 A& B+ t" n0 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% L9 @- l% J2 ?8 ^
  55. #define STATIC_SHIFT                3: L% X2 b: ?8 s; F+ V5 K
  56. #define TCINTEN_SHIFT               20; f3 t3 K( U+ J5 [7 y5 [
  57. #define ITCINTEN_SHIFT              21
    8 J0 {( B. |, S4 Y
  58. #define TCCHEN_SHIFT                227 z* S/ U& c+ ?
  59. #define ITCCHEN_SHIFT               23
    0 q& W! y+ |  o5 D, F
  60. 1 Z) a& D' E' v" }
  61. static volatile int irqraised1 = 0;, O, y  {: g" @4 q* g# }9 k
  62. static volatile int irqraised2 = 0;
    # v  W* u3 \9 l7 e& }# }& N3 o

  63. & V: x, T3 ?# a! S. F( n- Y9 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( B; d" i! C  x& Q9 _& i4 }" D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. V& j8 |3 l4 A2 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & p! ~. U' ]2 U. e

  67. # n* Y' W. ~' H, P5 x+ z
  68. dma_addr_t dmaphyssrc1 = 0;! `; H1 `" e* q1 ^
  69. dma_addr_t dmaphyssrc2 = 0;
    5 K; ~+ H; B% c0 m  X" O
  70. dma_addr_t dmaphysdest1 = 0;) J" y) k0 \7 Q5 }  h
  71. dma_addr_t dmaphysdest2 = 0;& P2 i% e$ c" k

  72. 4 O0 B! e$ C9 X
  73. char *dmabufsrc1 = NULL;
    6 B, a! z! N, d( F+ O" A# w5 d
  74. char *dmabufsrc2 = NULL;/ @# a- m) m( s" b7 L
  75. char *dmabufdest1 = NULL;' w2 n8 N8 t6 R
  76. char *dmabufdest2 = NULL;! ?" v4 K0 `( r0 q& c# o

  77. ! g: }# H9 g5 W* z& e
  78. static int acnt = 512;
    ( g  h/ R% w+ f
  79. static int bcnt = 8;
    ! U( p. o3 g  T( v! X
  80. static int ccnt = 8;6 |) c% B/ q  F6 [$ ^% A
  81. / Z( l" u& f5 b; V3 [  [
  82. module_param(acnt, int, S_IRUGO);
    0 B7 S( j" _* z
  83. module_param(bcnt, int, S_IRUGO);
    5 R1 {5 a: |5 p, `4 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# r( S! [# X6 O0 t  G( e

& V4 \3 H! [* r8 Z0 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 K1 G7 ]$ Z  n- marm-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 g7 ]1 T# r- h% y: Q2 d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  D* D  n% m! M- q0 Y2 t

7 z6 E9 b) m3 I/ U8 H6 X% S1 |6 b& V  B) N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 03:23 , Processed in 0.038879 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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