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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# n5 ~2 ~+ y4 V  V, X6 x+ m
  1. [code]EDMA sample test application
    ) W. n1 J5 a8 n5 L2 i( a0 |* K
  2. /*
    1 e/ O6 v# k, u, Y; P, J
  3. * edma_test.c8 w# r+ B" K7 I7 I5 ]
  4. *
    " n9 F" C5 `7 L5 _
  5. * brief  EDMA3 Test Application2 J; u' |( I% J# y
  6. *
    6 {/ q) q. o3 I, ?
  7. *   This file contains EDMA3 Test code.
    7 s/ }8 I: O9 m. b( ?" [7 `
  8. *
    ! ?+ h/ G& M' S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 ~$ L; u4 `8 p9 J4 @; A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 P9 T4 p4 @, A, _' z2 O; R! u9 r
  11. *         TO CHANGE.
    % h8 `+ ?2 H# ]' M) u8 i7 t
  12. *4 U, R( x" P5 l& V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + n) j' K& U) I" g& B
  14. *, K, X% c# g2 o7 e
  15. * This program is free software; you can redistribute it and/or" }/ I& X0 a$ H
  16. * modify it under the terms of the GNU General Public License as
    ; x/ [* z2 ^- i% e
  17. * published by the Free Software Foundation version 2.
    + O' S6 M- l* A9 q/ L
  18. *' _. a4 T8 F# @5 B% G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ {7 @% C9 c) E1 J; L$ o
  20. * kind, whether express or implied; without even the implied warranty( K4 T: S# s- d7 U7 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ x+ k! J3 I% |! Z
  22. * GNU General Public License for more details.
    # G" R) ~  J0 D# Y
  23. */
    0 K" Y, J5 \1 F2 C; ~

  24. " ?9 K* a, w' R. W
  25. #include <linux/module.h>
    & k8 e3 y9 g% P4 ]6 k5 @. k
  26. #include <linux/init.h>
    : P; X/ C" q) W! x5 A
  27. #include <linux/errno.h>: K2 t8 M+ i4 i1 ]$ Q
  28. #include <linux/types.h>0 W0 o, a" a- f4 t* M  a
  29. #include <linux/interrupt.h>2 ^  `& B! v+ }  Z& ^# `- F
  30. #include <asm/io.h>
    ' p: U6 z0 z: C; W  k; ]
  31. #include <linux/moduleparam.h>
    - C5 v; R& u# ~3 x% P2 k
  32. #include <linux/sysctl.h>. n* A4 {- m! n& ^* S6 i5 i
  33. #include <linux/mm.h>
    $ R  n6 R; V* ^, }- k
  34. #include <linux/dma-mapping.h>
    , p2 N: c: v) ~; X# u; m" V5 ^

  35. ( z0 C, v( S, _4 V, M8 E
  36. #include <mach/memory.h>
    % N/ j& \6 Z; J8 ^: @
  37. #include <mach/hardware.h>
    4 h3 s) \4 E; G3 j6 a
  38. #include <mach/irqs.h>8 T) X1 o" ]! u7 @6 M1 p
  39. #include <asm/hardware/edma.h>* [- f2 b4 [/ U, X4 I, p

  40. + }* f% ?8 C& E$ ^' g
  41. #undef EDMA3_DEBUG
    . d6 G- G) ?/ w6 O* r
  42. /*#define EDMA3_DEBUG*/) x' `5 R: d0 g/ j; }* l

  43. " W$ F1 {! h6 i( ~
  44. #ifdef EDMA3_DEBUG, h$ t9 y2 W; _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 L; x  P! N4 u( @' ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' h% t% u6 v8 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ m: o0 t0 R& x- I0 f, _9 q) ?
  48. #else
    , x% @" y+ I! G* E' X% \9 P
  49. #define DMA_PRINTK( x... )
    8 N" `6 w$ f3 S- v4 {, V
  50. #define DMA_FN_IN$ R9 L8 o. q8 Y  _1 t; x
  51. #define DMA_FN_OUT8 H% M& ^# v9 w4 s; t6 p0 ?$ |
  52. #endif+ [$ G' V4 p, k9 v4 I  R2 V

  53. 0 P) f5 g9 j  B6 r' Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) c. h" ~' G/ u6 F1 y. V: z
  55. #define STATIC_SHIFT                3+ c' U; G9 |/ R: u
  56. #define TCINTEN_SHIFT               20
    ' w0 U$ x8 N# T2 j; V
  57. #define ITCINTEN_SHIFT              214 a, U  v7 K8 g0 f9 e8 ?1 x0 ]
  58. #define TCCHEN_SHIFT                22
    # O* l' m* L% R' D
  59. #define ITCCHEN_SHIFT               237 b! E$ l$ h1 y3 e3 Y
  60. 5 x: M/ R: l: n: m' z. h
  61. static volatile int irqraised1 = 0;5 h7 K7 P0 K- V, k# O5 d+ f- L
  62. static volatile int irqraised2 = 0;
    3 w2 L3 b8 v$ ]1 h- f

  63. + ^  a7 r' y" o: t! P$ _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / m7 T1 F/ l; ?2 H6 Y- Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ]4 Z/ h& J' O& ]# o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! [+ {5 g$ N. D; K$ T  Q
  67. 5 p0 d1 a, U/ n! c, W0 h0 P4 ^$ N
  68. dma_addr_t dmaphyssrc1 = 0;
    $ [7 E7 j5 y) M5 w( M! Z3 M9 s
  69. dma_addr_t dmaphyssrc2 = 0;
    6 j8 H8 @8 m" P- F1 o7 U& ^
  70. dma_addr_t dmaphysdest1 = 0;
    . r7 L- X/ ~8 _  g9 Y8 M
  71. dma_addr_t dmaphysdest2 = 0;( Y8 @5 ?; C& u- B! C. d
  72. 1 g9 n, t$ h8 F1 |  T4 A+ }$ p
  73. char *dmabufsrc1 = NULL;* I1 c! |2 V8 V! e- M
  74. char *dmabufsrc2 = NULL;/ s- T8 Q, q- y2 F; b1 W: K
  75. char *dmabufdest1 = NULL;% v8 b  M3 m' j& Y% K6 h* D
  76. char *dmabufdest2 = NULL;8 o# @& i5 e* C+ r, \' A

  77. : N5 @" j: }9 @) I# H
  78. static int acnt = 512;
      [" G# r  O. Z: k9 t3 U
  79. static int bcnt = 8;$ F9 v5 \/ X+ w8 W
  80. static int ccnt = 8;( u2 K" ^+ {  b4 \3 z( {

  81. - Q/ I) d8 Z& |0 G6 W$ ?
  82. module_param(acnt, int, S_IRUGO);1 B- H2 j# m+ t1 c! ]( U0 V2 _( Q
  83. module_param(bcnt, int, S_IRUGO);. W% T4 ?- V. l5 ^1 r/ o# S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; U$ N' S2 U0 B. v4 D

* }( c8 c  J) _, \3 _3 M3 ?  R9 \. A- b$ R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ I: }5 V( U+ a$ c) I4 _, ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* {1 ], `( {  T! x7 }, c( |1 a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! N& F) g) t$ F' @$ L' N( d/ m) X7 \2 Y, @; Z+ ]$ [

# U% \5 f% g5 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 08:44 , Processed in 0.039921 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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