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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - C0 ]  `. g" Z! T: T. N2 m
  1. [code]EDMA sample test application& B; z: h4 @# M
  2. /*8 U9 x3 v' y9 S2 Q
  3. * edma_test.c! M7 A1 X8 y/ u% L3 g: I6 t: c. e
  4. *
    - ]& w2 I# ]. N: S4 {. s0 ?
  5. * brief  EDMA3 Test Application
    , o6 s7 {) P* `, L
  6. *# }) T0 @: Q  K& Z" X  {
  7. *   This file contains EDMA3 Test code.
    3 Q. m1 ~/ X9 y% j$ L$ e  U
  8. *  S$ r* O, n. z' f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 s7 `% Y; s4 s% R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ C9 U, L" w( T9 o
  11. *         TO CHANGE.
    # X( T7 G7 x# F4 ~+ y1 c
  12. */ G' P. x0 j1 N8 _! T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; C, v; l  P* n3 u
  14. *$ u4 R2 O* \0 B# h+ K; ~5 D+ M
  15. * This program is free software; you can redistribute it and/or
    # B7 C- `+ V7 ]4 K, m. R
  16. * modify it under the terms of the GNU General Public License as) G: q* Z# L6 x6 P# M# H6 I  p6 k. W5 w
  17. * published by the Free Software Foundation version 2.1 H1 G3 O3 W2 {0 P' j& l
  18. *
    + f0 V! ~, N$ j! \8 P/ V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 K) I, Z; A: Q0 o+ s$ {; ?
  20. * kind, whether express or implied; without even the implied warranty! r8 _# K1 L1 v2 F9 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% P5 a2 g$ k2 k" r9 V
  22. * GNU General Public License for more details.: c( D" K  x) g1 k
  23. */5 l* T# ?5 ^& n: T/ `
  24. 3 y# }+ h4 e" @
  25. #include <linux/module.h>
    2 r% q9 k0 B3 b0 @) A! H
  26. #include <linux/init.h>! l% q/ K: e6 n' V1 W8 g
  27. #include <linux/errno.h>
    8 r0 j6 `8 Q7 H* N0 M; j
  28. #include <linux/types.h>$ f+ d5 d- S' @" D& j
  29. #include <linux/interrupt.h>
    1 m1 S1 J5 E* T  O! a
  30. #include <asm/io.h>, @* N9 E9 a3 f1 w. [/ M
  31. #include <linux/moduleparam.h>
    4 }, ~: q- V4 S2 O
  32. #include <linux/sysctl.h>
      i% O- z$ [! d2 C8 y$ h+ J
  33. #include <linux/mm.h>' T0 {& V& _4 T$ j
  34. #include <linux/dma-mapping.h>
    : M; q. M, L) Q2 A9 m
  35. 4 b7 P' ^0 T2 Y
  36. #include <mach/memory.h>
    % t% N: l" y1 z( i
  37. #include <mach/hardware.h># Q. ?* Y/ a- Q+ ?% ~
  38. #include <mach/irqs.h>
    * E& k1 F3 v0 I4 `" `
  39. #include <asm/hardware/edma.h>
    ; V& s0 U9 ^! X! Q% d1 e
  40.   P- i' U) n' I! L1 U/ b) u
  41. #undef EDMA3_DEBUG1 ~0 B* N2 o; b
  42. /*#define EDMA3_DEBUG*/
    ' w3 w9 g5 J& `$ H5 R* F
  43. ; X9 U3 q* \; d& Y- H+ G  @; e4 z
  44. #ifdef EDMA3_DEBUG
    % w$ p7 U; a' @- U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ [' l2 @3 X7 k6 t! N( D' ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 }( K; r* s! f0 C/ R( A1 t$ |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . d4 x) t! F0 d1 x: v
  48. #else- X4 R8 t# T0 @7 a8 K" c1 P4 F
  49. #define DMA_PRINTK( x... )* K0 `; m& C5 K: D0 J3 I
  50. #define DMA_FN_IN$ q7 |2 e, o) K! Q6 n
  51. #define DMA_FN_OUT" X+ K8 Y. \3 e; G! u0 T
  52. #endif
      M# a7 o" \0 T: P7 u% B

  53. % k: h: t/ S" S7 G3 `' n8 y2 f' o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). G: [* R7 U- G9 g9 W' e1 T
  55. #define STATIC_SHIFT                3
    & G* S; w( T$ k/ K" h6 c# S
  56. #define TCINTEN_SHIFT               20
    ) b* c1 d2 j5 F( N3 c" E
  57. #define ITCINTEN_SHIFT              21, b; s+ Y# s- L% C. L8 `& P0 {8 ]
  58. #define TCCHEN_SHIFT                22
    " d/ c- c; o7 b
  59. #define ITCCHEN_SHIFT               23
    " H6 t3 G' G( _
  60. - a1 P8 J7 b0 w# G0 F' E
  61. static volatile int irqraised1 = 0;
    . L* S9 b3 V) x/ L1 d& U3 J$ b( W
  62. static volatile int irqraised2 = 0;! T8 U8 J3 j$ z4 U9 g7 V$ ^/ a
  63. : S. {* U/ z3 e  {8 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, H; p- S4 j" c( }  Y& a+ z, d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 s9 G4 ^7 w8 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 h; S7 }9 j# i

  67. 9 z# `( r/ c! E
  68. dma_addr_t dmaphyssrc1 = 0;
    ; c8 y( ~2 {- l" R& Y' J
  69. dma_addr_t dmaphyssrc2 = 0;
    0 s  M& Z9 m  M. x
  70. dma_addr_t dmaphysdest1 = 0;4 j; u# @! o9 e' L7 |) P/ ]( h
  71. dma_addr_t dmaphysdest2 = 0;
    2 P' N  N* S# u$ R
  72. 7 X8 p6 ^9 \; \2 X/ W2 L
  73. char *dmabufsrc1 = NULL;: h2 Q* k7 }8 c9 {. x5 H  f: R
  74. char *dmabufsrc2 = NULL;7 n3 u" F2 @3 P- o
  75. char *dmabufdest1 = NULL;6 o8 C0 S9 v0 J& j+ E* f0 B7 w: S
  76. char *dmabufdest2 = NULL;
      p8 k4 O- x7 q* ~1 G# [
  77.   x- R) P) g& y2 j; K! m
  78. static int acnt = 512;
    1 O, s2 r' s  c) N* P0 O+ D8 F
  79. static int bcnt = 8;
    7 q/ ]0 H  [9 ?7 k/ ?* ]
  80. static int ccnt = 8;
    + G2 ?- J. m; |( X+ u+ I

  81. * z* q( I: q) |/ V; h
  82. module_param(acnt, int, S_IRUGO);
    * x8 a/ h5 f2 u- |+ g' F' y
  83. module_param(bcnt, int, S_IRUGO);
    - w$ E7 [& X) m/ K& f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; Q9 ~- H: V( F$ Z. W7 S9 P5 k! y

- }" q" v8 Q. t4 F2 l. ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( h" J/ c+ u0 t! P3 p" i- Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ m, H) G4 M9 n- P- _' S; g9 k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ C. {7 _' q: A. y
7 O0 N: }. Q& C3 E

1 h; u2 i* Z* ?, H  L( F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 06:38 , Processed in 0.038668 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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