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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# W- C* e6 |: \. P0 \3 g; \& o
  1. [code]EDMA sample test application
    " K2 F) o( E/ C( ]  X
  2. /*
    ! A# e" R* a( W" K4 M3 x
  3. * edma_test.c
    4 ]3 s+ O: l7 }5 X5 J5 P7 P
  4. *
    0 @2 K3 n' D& q8 g
  5. * brief  EDMA3 Test Application) Z& R" J$ y3 c9 @( v
  6. *% ~  q& C6 C/ _+ `+ L% w
  7. *   This file contains EDMA3 Test code.
    6 T$ d, y/ A, u$ E& U/ h" {
  8. *
    ( P( c: d3 f# F5 x  O" U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 L( r6 {, _8 `0 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 U+ m. S$ w# S
  11. *         TO CHANGE.
    " O  \/ v5 H5 l) ^6 ?
  12. *
    , N& V! }8 }$ t& E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % `9 H' n0 R0 [
  14. *
    3 G6 E$ c3 l5 p
  15. * This program is free software; you can redistribute it and/or2 u2 C7 b* `. l9 D- g, z* H: q
  16. * modify it under the terms of the GNU General Public License as$ q8 [! m6 V. N; d( s) K0 q
  17. * published by the Free Software Foundation version 2.
    * t) m2 C8 i# V6 e* i) Q
  18. *" O. g$ {8 }5 f  Z  B! O, t( j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 w* O- r4 s2 h: I
  20. * kind, whether express or implied; without even the implied warranty! a0 [( w/ z+ s; @) a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( Q+ m$ x- H/ \4 ^6 H  l/ ^3 q
  22. * GNU General Public License for more details.
    / B4 v2 a! P# U( R) I
  23. */
    / O7 d0 R. i* P( z  l

  24. $ ~  G* V# V+ T6 j! Z5 m
  25. #include <linux/module.h>5 o( I' a2 j; s& u+ d; i
  26. #include <linux/init.h>
    $ l  m* k4 d8 m7 y9 G
  27. #include <linux/errno.h>& e$ P+ P2 P# q4 C6 @' g. Y" y8 i5 p* g
  28. #include <linux/types.h>, f5 l/ U+ j0 E/ ]. R
  29. #include <linux/interrupt.h>  C' }; @7 ~& M* B  Y- {* f
  30. #include <asm/io.h>7 w1 D" a8 l7 k, J! `
  31. #include <linux/moduleparam.h>
    " H0 L$ t# S- h4 C" e
  32. #include <linux/sysctl.h>
    % ~( v" `+ @  I# \% p
  33. #include <linux/mm.h>
    ( r8 E' V  o2 {0 y1 {& R
  34. #include <linux/dma-mapping.h>
    . h+ V! H% M8 K8 T; Y
  35. % Z" F7 F' B5 e5 n9 t( Z
  36. #include <mach/memory.h>
    ) C: q) h2 ^+ H3 E
  37. #include <mach/hardware.h>
    % ]6 |6 o7 ]4 j- f, ~/ k
  38. #include <mach/irqs.h>8 y. e: Z: O  v0 l2 s
  39. #include <asm/hardware/edma.h>
    ; K" ]0 k( N$ c: Q. B+ v3 ?

  40. 5 B" J  A' x( U. U
  41. #undef EDMA3_DEBUG; p; E0 T/ i' M* m
  42. /*#define EDMA3_DEBUG*/' k2 m& y/ Y! m5 `

  43. 5 @0 H8 w4 W- A1 C3 X2 w
  44. #ifdef EDMA3_DEBUG
    7 J  C6 @) ?; B( M+ p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& R- Q4 {& N1 M! n' j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 |% J, m, g9 }8 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 }; p8 v5 |+ b  \# G
  48. #else8 j$ [) @2 Q- X! h" f! P
  49. #define DMA_PRINTK( x... ), v$ I; Y3 A4 c$ W/ x* l8 X
  50. #define DMA_FN_IN7 P0 G7 M% o9 w+ b9 G2 E
  51. #define DMA_FN_OUT) m! l2 e2 r8 Y7 W$ H" w( z
  52. #endif
    " h* ]" S: x9 x5 r1 g( g
  53. % @! h$ W4 O# x5 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" e) `5 p3 j2 I9 j+ u6 d* {2 e
  55. #define STATIC_SHIFT                3
    ' P' d% F9 z* J/ Y! U9 u& V0 d
  56. #define TCINTEN_SHIFT               20# a+ _. R$ V: y0 v( ~1 a
  57. #define ITCINTEN_SHIFT              21
    : s# @) D$ s- O# {. S
  58. #define TCCHEN_SHIFT                22
    4 m# F$ B( B6 i2 n
  59. #define ITCCHEN_SHIFT               234 k5 A) a9 f5 [5 K: E
  60. $ @6 i2 }/ h4 u% g; t. c& W3 ^
  61. static volatile int irqraised1 = 0;( M( g$ Q! S% i9 q' W% h
  62. static volatile int irqraised2 = 0;* j) j7 _* _% }" u) K0 C# w

  63. 4 o- Q2 ?) V1 s. L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' n( F" H5 P" E6 n3 }  Y/ Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; @) \9 F6 b# O) m2 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & P% S$ h. O4 w

  67. 5 P8 O" `) g4 A9 v9 b" @! B
  68. dma_addr_t dmaphyssrc1 = 0;* h* F' p. i) o  Z) e; N' c
  69. dma_addr_t dmaphyssrc2 = 0;# L, G: p3 b6 O* _
  70. dma_addr_t dmaphysdest1 = 0;
    6 C! G% N4 j3 H- g
  71. dma_addr_t dmaphysdest2 = 0;
    + _4 A1 {2 B7 D% [7 i

  72. : {  ?& s  ^5 w
  73. char *dmabufsrc1 = NULL;
    , @/ d& v4 ^( B1 Y
  74. char *dmabufsrc2 = NULL;
    . V) z" p+ M3 |$ e
  75. char *dmabufdest1 = NULL;0 w3 W; Q" n$ J. G
  76. char *dmabufdest2 = NULL;! A9 }9 Z8 l  i! ?2 h* \. h. n

  77. 5 P1 {5 ^, [# ~1 B# d
  78. static int acnt = 512;* U2 u0 c! a( Z! ^- z6 U2 c5 r
  79. static int bcnt = 8;2 k, v8 u1 ], r/ J3 n0 S
  80. static int ccnt = 8;2 B7 Q9 L) c5 F0 Q3 J2 X% |
  81. ! t% Y: ?; |3 Y4 a
  82. module_param(acnt, int, S_IRUGO);& T: Z0 N/ i/ O0 J$ `
  83. module_param(bcnt, int, S_IRUGO);
    1 o% y$ N% ~0 ~, a8 I1 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 m2 Y6 \& U4 O: A2 n- p5 J
8 R$ O: w( p1 m1 ~9 S. s8 d% s" A( @8 N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 E( H, q' }0 V* v: @! A* J9 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* ~: ?7 u9 Z6 V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 O  B" ?( r7 s8 J

3 n( M. Z5 U6 M# G) ]/ U$ L/ T) ]( r. @) G3 B, S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-26 05:25 , Processed in 0.039384 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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