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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   y1 u7 y& r" F( _9 ~5 _
  1. [code]EDMA sample test application
    ) ]  f, c. K, A
  2. /*
    - h+ z7 i( i5 V7 ^
  3. * edma_test.c
    ( E6 w! Z2 D1 _' e
  4. *! q9 P& Q% q7 E$ ]- G2 }! u4 w
  5. * brief  EDMA3 Test Application
    * _3 @. d0 _+ [1 G: e
  6. *9 p1 S9 N  m* ?! }8 p
  7. *   This file contains EDMA3 Test code.
    : ~! \" b! D  v! `
  8. *
    4 b4 Y: |& k6 `  N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# S; n6 ^' ~# o, C! o" D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  p- W, o# T, f9 b1 `' ~
  11. *         TO CHANGE.
    + G* f6 U) ?9 B8 h4 h
  12. *
    ' s' Y6 U3 e' p3 E+ {( D7 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 K# ^* f5 F0 ~& H( O
  14. *9 i+ j' b8 @) F$ S# _) z( E; s. o0 D
  15. * This program is free software; you can redistribute it and/or1 @) q' b/ X' Z0 n8 Z. q, F
  16. * modify it under the terms of the GNU General Public License as
    % ^# ^- y7 b' D* X9 K) i& |4 [* ]/ l
  17. * published by the Free Software Foundation version 2./ }- A2 A9 x3 t" d' h. a8 m
  18. *
    0 ^2 q0 X8 z' A1 B& h6 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : _( s9 O3 e; A7 j
  20. * kind, whether express or implied; without even the implied warranty" N% @7 Y$ R5 C+ I  T% B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 t. t! T/ Z) X! |
  22. * GNU General Public License for more details.
    4 V7 O8 \5 y1 H6 m
  23. */
    ( `( L. z, J" G/ }. n
  24. 3 n8 I, }; ~9 `% S/ ~& k
  25. #include <linux/module.h>; X' U. A5 b2 \) [
  26. #include <linux/init.h>+ O4 e+ A+ c, k! u0 }. u+ P
  27. #include <linux/errno.h>
    ' Z8 O5 C9 N. z
  28. #include <linux/types.h>
    0 k" @5 O2 X9 ?8 `1 q1 z
  29. #include <linux/interrupt.h>
    , X8 x- t; S: B1 y7 ]$ r& N
  30. #include <asm/io.h>
    * a) H) e0 v- B
  31. #include <linux/moduleparam.h>
    0 X, C5 ~. N9 A$ y
  32. #include <linux/sysctl.h>8 I3 E0 h3 z# V
  33. #include <linux/mm.h>
    / z9 A9 }8 a; [/ j* x1 j: U# h
  34. #include <linux/dma-mapping.h>- \' U* N+ r0 Z7 d$ {- r
  35. # `9 q8 k7 x5 C' g6 S7 Q) x# r
  36. #include <mach/memory.h>2 p1 z7 k% |' K( b
  37. #include <mach/hardware.h>/ V8 }, ]( z( P; Y. I
  38. #include <mach/irqs.h>- d4 Q* P% H' S
  39. #include <asm/hardware/edma.h>
    : {! l& R$ D8 H1 \# D& L

  40. 6 E" f5 `0 v/ y/ [
  41. #undef EDMA3_DEBUG9 M1 G5 n8 G! `2 w& f& F, ]
  42. /*#define EDMA3_DEBUG*/% P: K& F' d+ E8 E
  43. ; {; q- p7 l* X" x4 H% H+ k
  44. #ifdef EDMA3_DEBUG$ A2 J# ~6 K2 {; v' `7 ^" {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : w& Z/ y/ D, ]8 X+ U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 ~3 P1 O; ^* H; l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), c6 C) |. R+ T" P7 |& b
  48. #else( k9 d& h4 c3 G0 _. y9 I" R) @
  49. #define DMA_PRINTK( x... )4 n# d' w# U3 U
  50. #define DMA_FN_IN- R* k: b: @0 b" V: c9 w
  51. #define DMA_FN_OUT
    * ]$ C/ D; C4 y" Z
  52. #endif7 _9 o5 ]) y* X/ g3 g" U8 a* b
  53. ' w/ v, M; L  y' Q% P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- @! G8 k7 k, W7 _  a) x8 g+ E+ t
  55. #define STATIC_SHIFT                3
    % d" ?- ?$ L  ^! `4 j& j6 [8 v9 t
  56. #define TCINTEN_SHIFT               20# C6 a1 x+ [, I4 k; m9 K$ z8 R* q2 p4 d
  57. #define ITCINTEN_SHIFT              21; j) s9 D0 V: n* I, H
  58. #define TCCHEN_SHIFT                227 ^; j. q! O( ^- l& W( ~  U
  59. #define ITCCHEN_SHIFT               23
    # W; ]) i1 b. o

  60. 5 k  \* u$ v' `. g% r& j
  61. static volatile int irqraised1 = 0;# w$ h  I; _* Y* E' ]
  62. static volatile int irqraised2 = 0;
    * {3 J; Q+ A  ^" n

  63. : i- o0 r2 R$ T- ]9 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) p, n8 m, W9 g' B8 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " k# o; A! D+ x8 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # W5 P1 D8 r/ m0 |( V/ [

  67. 3 G! X7 B9 O+ W; d# h5 M2 |% w2 C5 J! o
  68. dma_addr_t dmaphyssrc1 = 0;
    5 g9 a1 {/ f; M  P7 _
  69. dma_addr_t dmaphyssrc2 = 0;& b" d+ a9 e, b4 x/ b" Q, V
  70. dma_addr_t dmaphysdest1 = 0;! k9 i* W$ N# K) Y" E
  71. dma_addr_t dmaphysdest2 = 0;
    . N5 s' l# X0 r. q  |2 f
  72. ( S4 [8 J2 s6 v4 W7 b) j$ W
  73. char *dmabufsrc1 = NULL;" [1 L( m; ?& ]) G
  74. char *dmabufsrc2 = NULL;; d$ d" J* D- S- @6 E9 w  K) M
  75. char *dmabufdest1 = NULL;! w9 {7 N$ e' c: ~
  76. char *dmabufdest2 = NULL;
    2 r$ B+ `" x/ @, }8 {( q

  77. ( b1 ]$ K- y- }
  78. static int acnt = 512;
      i6 D2 C& [! D+ @
  79. static int bcnt = 8;1 c( a7 t: z0 K8 p! C; }$ k
  80. static int ccnt = 8;
    . `' }  H# j5 j0 z8 X" r6 W8 t

  81. % `" }: ]/ P) J) G9 S- Z" M( S
  82. module_param(acnt, int, S_IRUGO);
    0 V$ p  P( B% B
  83. module_param(bcnt, int, S_IRUGO);4 F+ G4 F, F! ^4 D6 b5 r3 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( {$ x2 @; E8 z7 T: `, W' _2 z; i
( c# C, y& {4 M  H) @; s& `3 k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  J/ ^; ^$ v- z, X  A# _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 `" c+ s, s5 [! `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 z' z; _0 j  H( v) X
% ]! \( H- i2 m
; x  r9 P2 _  t0 d/ }7 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 00:29 , Processed in 0.047979 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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