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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 B5 M" {& m. {/ ~
  1. [code]EDMA sample test application4 i* R2 c5 D. I' k& G
  2. /*! M! P3 ^+ u! |$ ?3 ]
  3. * edma_test.c
    & k1 i' W1 ~5 Q4 {7 H
  4. *
    & [: V0 Z) A* H
  5. * brief  EDMA3 Test Application) B# }" {! d3 \0 U
  6. *& G: y; a0 P, H5 F- K, S3 m: F
  7. *   This file contains EDMA3 Test code.
    # |* ^! b0 u  h+ f( z& _) X
  8. *& V2 a9 w* g  g  L: x6 c4 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 H1 o% q' x2 B- {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# E& s' ^9 n9 P
  11. *         TO CHANGE.2 N7 Z% W  }6 o/ M; [" c8 [
  12. *+ V+ D! B1 \  u3 W8 y0 k( [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & m  R8 U8 L5 p) B* p5 r, i, {4 A7 _
  14. *$ G6 B& x7 O; V* s
  15. * This program is free software; you can redistribute it and/or
    : k& i. u- y* H/ z+ h0 r, d0 q
  16. * modify it under the terms of the GNU General Public License as) V9 d: t4 {; L' u! E# x; Y" _5 d
  17. * published by the Free Software Foundation version 2.
    # p3 n6 g4 U$ u' s/ Z# R; {" e
  18. *
    9 ?/ R6 ]$ \( x; R$ s# x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 u# y3 B! V  v+ g7 c, n* t
  20. * kind, whether express or implied; without even the implied warranty- a% }1 z& q! z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* _" Z: l" ?. z5 a4 K" W; D1 I5 l
  22. * GNU General Public License for more details.# D& u" P% J4 k1 U+ a
  23. */7 }+ d4 \7 U& h. y

  24. ( {5 [$ O% b$ S) x: N  m# h, S
  25. #include <linux/module.h>
    % ~/ Q# o# f. U0 ^
  26. #include <linux/init.h>
    8 U5 X  H; `. P- N
  27. #include <linux/errno.h>8 R1 ~) X0 [3 p! B9 s  z; H: ^
  28. #include <linux/types.h>& O1 |1 \+ U* N8 l% k; G
  29. #include <linux/interrupt.h>
    3 @8 ]) |; x& z8 H( Z
  30. #include <asm/io.h>
    ) I: E6 ?2 h2 D. ^
  31. #include <linux/moduleparam.h>
    6 [4 x" a  B( f3 Y6 G: A5 ?6 ~& b
  32. #include <linux/sysctl.h>/ v) C, [5 X" e% t" c2 A
  33. #include <linux/mm.h>
    - c( Q' e5 L' D6 L
  34. #include <linux/dma-mapping.h>, D, X$ a# X5 a* b1 k  k6 ^
  35. 1 R7 l, i% l* n6 E, b; C  L
  36. #include <mach/memory.h>) S4 h/ [( i4 D7 k4 ]4 @7 R( d
  37. #include <mach/hardware.h>  ^, e6 X7 G& F8 B7 t
  38. #include <mach/irqs.h>) [& f( T* c% \2 E+ Y% \! ], b
  39. #include <asm/hardware/edma.h>) \- @& s7 y  ~! V8 j

  40. ( F0 a1 G5 X- t
  41. #undef EDMA3_DEBUG  a& {  z3 |) K$ `) h
  42. /*#define EDMA3_DEBUG*/. q* g5 l1 N" v
  43. ) i# j/ N. }2 q% ^1 L3 T; m: Q
  44. #ifdef EDMA3_DEBUG: M) p& D( c4 x: T2 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), w( a% W/ t7 L7 U9 Q- V1 x2 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' ~- e: q1 j$ y( [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* f* ]1 }& M: w, ?) m# U8 M. M& O& q
  48. #else. C6 a+ Y; u; S4 F
  49. #define DMA_PRINTK( x... )
    1 v6 S& x- O/ t5 n8 A6 F
  50. #define DMA_FN_IN
    4 r$ _3 w( k2 a8 R
  51. #define DMA_FN_OUT
    : F+ g9 C# ^' R  t7 |7 z
  52. #endif
    . \' e9 {2 A$ s# r) X
  53. 2 }5 k8 G$ L" d2 X( z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( X3 z. `! s+ @. Y+ m
  55. #define STATIC_SHIFT                3
    # }  Y) i6 q7 P) s* O
  56. #define TCINTEN_SHIFT               20* T  w* C. Q' V$ O# ~9 j
  57. #define ITCINTEN_SHIFT              21
    4 _0 B5 A) ?9 k$ z, r& |
  58. #define TCCHEN_SHIFT                22/ N) L2 h4 }' h9 ^: F
  59. #define ITCCHEN_SHIFT               23
    9 w; {9 P# z0 e
  60. 2 q$ h" O7 _* V
  61. static volatile int irqraised1 = 0;5 Z3 Y# a7 ]* T7 q& J- B6 i
  62. static volatile int irqraised2 = 0;
    6 {( E* N- e3 W6 R0 l

  63.   M4 v% W! b/ Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 E3 _9 x: V( d# P! m6 v+ }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + |: `( K/ v) _, V$ t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! m8 o( K: y& ]2 P- z$ B6 p# P

  67. & N; ^  F' G9 V$ T) V
  68. dma_addr_t dmaphyssrc1 = 0;; l) [: Q" o0 }- G7 j
  69. dma_addr_t dmaphyssrc2 = 0;
    . N  j6 Y) t, r/ ^4 p. A
  70. dma_addr_t dmaphysdest1 = 0;
    4 `( n/ J# T# y) J( e
  71. dma_addr_t dmaphysdest2 = 0;
    : Q, [4 Y  r; I. y
  72. ; l( {9 z4 _4 t, x. O, W
  73. char *dmabufsrc1 = NULL;
      Y5 F1 o7 V! @* _: q! v' x2 v- y
  74. char *dmabufsrc2 = NULL;# A+ @, b; s3 _: F4 M
  75. char *dmabufdest1 = NULL;
    ; D6 }2 H' w1 ]: [
  76. char *dmabufdest2 = NULL;
    8 z& M8 M( o3 V2 j

  77. & U! W) z& h1 `! f# Z1 m2 [6 O6 ^
  78. static int acnt = 512;
    # q" s) H% s$ I
  79. static int bcnt = 8;
    3 ^: I' J; K. J# f
  80. static int ccnt = 8;. ~" }$ R' a4 i; V6 A* B& P& Q
  81. $ l6 q2 b% j3 s0 Y+ }3 o
  82. module_param(acnt, int, S_IRUGO);" _( e9 b5 E' g4 e( A  e4 f
  83. module_param(bcnt, int, S_IRUGO);
    7 r( r8 {, s6 b9 M) ?/ |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: x: I9 }6 S0 h# |% }
( q+ V7 O9 U+ w+ i! S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" B" u; M* N6 V% x/ L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, h. l$ j2 @4 n  D) \; D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 M+ X. {  M. w  v
' w6 D' z+ ?' v

" b: N% }2 Q- K* @2 @. b6 ^8 V+ F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 14:12 , Processed in 0.037456 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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