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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% D5 ~" k, d9 o% ~
  1. [code]EDMA sample test application6 b) H0 ]3 Z% e' g9 x; c+ y1 {
  2. /*7 e% p4 t9 d. M- X$ {! `" p
  3. * edma_test.c$ p( K1 L9 u7 }" c* S# o& K
  4. *
    $ G% j8 ~2 P& C) h
  5. * brief  EDMA3 Test Application
    ; @2 V* H0 u) i, b& R7 X
  6. *- m$ p. d, b3 x
  7. *   This file contains EDMA3 Test code.! Z* {' j& n( i
  8. *3 R. }3 \$ o& o7 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* d4 W& p' F- ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 R" p4 h5 V. X( P! z, H: v$ f  v9 D
  11. *         TO CHANGE.
    : N4 Q9 k5 t# O4 E: X! Z) G
  12. *
    3 P6 X& K/ f9 @3 N8 N1 Z8 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 {, H( t8 X) v: `) x9 d
  14. *
    3 U5 D3 }& j! [9 D  j5 u2 L
  15. * This program is free software; you can redistribute it and/or
    ; v& O5 Q) k$ _! m( x$ ~' j
  16. * modify it under the terms of the GNU General Public License as
    + F, m, ?' n9 T4 B% j
  17. * published by the Free Software Foundation version 2.
    6 d" y. c2 }3 E- R
  18. *
    * f9 N& G% l9 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ {; q3 }- L/ b$ s- C2 {  \
  20. * kind, whether express or implied; without even the implied warranty
    ( O& v7 n7 ?' |2 z: n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) Q. x3 C- v& a5 |
  22. * GNU General Public License for more details.3 y! \0 _/ H7 e" F0 A8 Z7 W" ~
  23. */
    : |6 {3 \' J# l" q6 \! J3 L( \& Z3 ?

  24. , l! p* m' l7 C# [# u
  25. #include <linux/module.h>5 l0 ^  _: l( v
  26. #include <linux/init.h>' a1 J+ ]6 L* _& n$ h2 J) P$ V
  27. #include <linux/errno.h>5 g* O* V5 I/ M! l  @- `+ N( u+ H
  28. #include <linux/types.h>
    : e2 d8 z0 W* t6 L. ?8 a6 @2 N- v' x9 C
  29. #include <linux/interrupt.h>
    / d$ ^6 q* g9 \- f/ Z. G7 {
  30. #include <asm/io.h>1 P# ~* T: j9 m4 t: M; N- q5 W
  31. #include <linux/moduleparam.h>( D% X3 H% {, H+ \5 W0 P5 S% u) u6 v
  32. #include <linux/sysctl.h>$ Q( l0 J5 y5 S) g1 n3 ]
  33. #include <linux/mm.h>
    ! x. u1 }0 J: b
  34. #include <linux/dma-mapping.h>
    1 @: |6 G3 K5 D

  35. 1 j7 |$ n/ \5 ^2 s  V4 }
  36. #include <mach/memory.h># h; K3 t6 d2 c) N- K$ q
  37. #include <mach/hardware.h>
    ) S+ i+ m" ~% a1 P) K# F7 |" {
  38. #include <mach/irqs.h>. h' h$ B0 o* I( l, X3 F
  39. #include <asm/hardware/edma.h>
    7 ?% P% Y4 ~2 [# U
  40. 2 c2 z- ?4 C% H+ A
  41. #undef EDMA3_DEBUG
    , A; i1 [- q! h
  42. /*#define EDMA3_DEBUG*/7 Q; p/ A; y# T9 w& D1 K0 b, k

  43. ) t* A5 `1 P7 D/ B. [! V
  44. #ifdef EDMA3_DEBUG* d0 k8 D% ]1 A" y* g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& U" O. H6 V) q. {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) p5 t' `' c' Z. `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ d4 U) j0 d- a$ J) @
  48. #else' g  v, O- z( ?7 Z- ^$ T5 |' J
  49. #define DMA_PRINTK( x... )
    + j4 H# c; c5 i
  50. #define DMA_FN_IN
    ' A" b8 V3 f0 k) P$ Y8 Z0 G+ a# K( L. u
  51. #define DMA_FN_OUT
    % u* c3 U/ C) v4 n' F% \' k* E- h
  52. #endif
    : d& x% J  F" v9 m

  53. 6 Z, o/ i( @: }0 _( I+ ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  k8 y% j7 Z& B
  55. #define STATIC_SHIFT                3: c1 V6 V3 U3 y4 h6 k
  56. #define TCINTEN_SHIFT               20
    1 t" h1 s" y+ T" Z. ?, w
  57. #define ITCINTEN_SHIFT              21
    / M% }, ]& @" u' s7 v  n
  58. #define TCCHEN_SHIFT                22
    9 T8 k* {% r; e' a8 C/ H
  59. #define ITCCHEN_SHIFT               23
    & a) j- h; i8 I) S+ \& @" I4 L

  60. 9 K( j, l- ^3 P; X
  61. static volatile int irqraised1 = 0;
    & s! L; t! M5 o" Y  [8 O
  62. static volatile int irqraised2 = 0;
    1 g9 W. V6 \& ?* ?" i+ O+ a! l

  63. ! ~7 ~" J1 }* _! T7 j: W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " A- h2 \; D3 D! o" j8 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 [8 r) V9 i$ x8 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . b7 |. I- J6 {; ^

  67. . A" I. Y) f9 H9 P! I5 A
  68. dma_addr_t dmaphyssrc1 = 0;. G! G5 K  P8 k- Y1 u; F
  69. dma_addr_t dmaphyssrc2 = 0;1 P. S" d; w6 r
  70. dma_addr_t dmaphysdest1 = 0;
    3 v' N5 q- D4 D/ b' A" E
  71. dma_addr_t dmaphysdest2 = 0;  i5 b% o& J4 l% V- F0 y! Q
  72.   d' y+ |* v/ G4 P2 K8 b6 ^
  73. char *dmabufsrc1 = NULL;
    ' @7 x0 @9 y$ F4 s+ k' o
  74. char *dmabufsrc2 = NULL;
    " Y1 F' _# B8 x) q3 k3 d
  75. char *dmabufdest1 = NULL;
    8 H' o) I1 M( R: r1 T) v& H
  76. char *dmabufdest2 = NULL;( j" a( c! R* r* g
  77. 6 @; k: j3 E/ t8 J1 y8 Y6 Z
  78. static int acnt = 512;' E' W8 q5 c) \
  79. static int bcnt = 8;
    4 }  \" y: A; V" v& b% v- F- a/ o4 A
  80. static int ccnt = 8;
    + L7 P; j8 Q3 `! i

  81. 9 j1 c- ]) \' h" e& }  u
  82. module_param(acnt, int, S_IRUGO);* ^% }5 w" T2 e* ]- _" P( P
  83. module_param(bcnt, int, S_IRUGO);4 g0 w! v; g+ Z$ U7 O% p" T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- [' M" ]- Q7 H6 {; ]2 v# S
! R+ A8 s/ k+ ?5 ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# B3 O; Z* G  Q7 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( Y  u2 }+ G. [. B8 v( V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) c7 c1 @5 K9 c( _
8 p* G+ R2 a0 g0 P
* N( O+ X+ ?- i2 ]/ T% K6 {' R; w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 19:38 , Processed in 0.038928 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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