OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 I9 o3 O/ U: f8 H
  1. [code]EDMA sample test application: M% h" b0 Y3 m
  2. /*
    3 {, y' u- l1 T8 w' x. c( W
  3. * edma_test.c$ F, q" `/ O# h  O
  4. *( @$ G' m' t' t6 s  g* _
  5. * brief  EDMA3 Test Application2 _% q0 i5 t2 L
  6. *& {3 d- x9 U* R+ f- o
  7. *   This file contains EDMA3 Test code.
    ( Z" S; w) @0 G) ?; K: G: k
  8. *
    ; \/ H5 c4 _: f! U$ s1 o9 K% X8 _: [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ x% P, q9 }5 v3 _' x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) V1 L& b7 h$ u0 K1 W; h' r7 U. E
  11. *         TO CHANGE.
    $ O( m' M0 P/ R
  12. *6 e$ _& g  I* A/ k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 E; i, n4 u: E/ Z( ~3 I* q# p
  14. *# u9 v+ v+ _8 ~5 U3 \# Y7 r
  15. * This program is free software; you can redistribute it and/or
    9 ~7 ~4 e1 t1 r4 Z/ ^
  16. * modify it under the terms of the GNU General Public License as6 M, b6 R& z) H) f' g- x! U- c4 ]
  17. * published by the Free Software Foundation version 2.+ K6 `- U/ F! e" J) v. h$ u2 u+ h
  18. *1 O+ T* l$ {% w' \  m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 M8 `9 a# k% N! S* }0 M7 K
  20. * kind, whether express or implied; without even the implied warranty
    . s! u4 U2 }) r# n5 M% e. z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( D. L3 t% @; Y/ L% L
  22. * GNU General Public License for more details.% u* O: @3 f- \9 N4 u5 F/ d1 \
  23. */0 l& G3 X! ~5 w6 y5 P

  24. % t. t1 G+ d( ?) G
  25. #include <linux/module.h>: w" F( k! r; {5 }
  26. #include <linux/init.h>+ p8 i: F. ~* ?
  27. #include <linux/errno.h>
    ! @% n; M- W% x7 b# `( a) {8 R
  28. #include <linux/types.h>. D3 k% @+ N- ?. d2 }5 m" V9 ~
  29. #include <linux/interrupt.h>' `' Y- ^$ C* q- ?) p$ j5 |0 O
  30. #include <asm/io.h>- j( d1 a8 H3 p  _' Z
  31. #include <linux/moduleparam.h>; R" M" u3 y% ~# T
  32. #include <linux/sysctl.h>/ k2 `/ J2 ?* X  Y  X
  33. #include <linux/mm.h>
    9 ]" y0 _& b' }7 T
  34. #include <linux/dma-mapping.h>
    % K3 X0 w5 i/ S; K
  35. 2 l" K2 w' p1 \' `, s7 h
  36. #include <mach/memory.h>
    - @  H. |- G' D5 q$ l8 U% W, H8 D; Z
  37. #include <mach/hardware.h>
    $ v. F0 c6 S) W. k; F" Y! n7 H5 M, t: j
  38. #include <mach/irqs.h>& k. G7 m  x+ |1 e
  39. #include <asm/hardware/edma.h>0 A; q) x7 |, A- T5 K/ i' R

  40. + w+ E5 W1 o8 K& [& Z
  41. #undef EDMA3_DEBUG0 x. `( v9 x( Q% `( a- h
  42. /*#define EDMA3_DEBUG*/
    - K) c! o( m* S! y) P

  43. ! Y' E/ ~  c% y! x4 A4 j0 D
  44. #ifdef EDMA3_DEBUG
    ; O% J  V) ]. A0 m8 ~6 N  w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . b# ^) P5 _7 I: p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ r9 O4 F) i& B4 o1 B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 U; ?# G$ \3 W$ y7 W
  48. #else1 ]$ i: Z2 L) {: L
  49. #define DMA_PRINTK( x... )1 X+ e3 [# G( d& p: ~- J5 G
  50. #define DMA_FN_IN
    / q" Z/ ^4 B( v8 V1 X
  51. #define DMA_FN_OUT, V0 o, M+ y4 f9 |! [4 N+ Z4 r1 o& }
  52. #endif+ a4 ^* o8 N$ v- I0 J0 }

  53. 8 V. v9 j! D- E; v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' G: b! J: h, g
  55. #define STATIC_SHIFT                3
    ! g, P$ \/ N) {& v2 ~5 k8 H
  56. #define TCINTEN_SHIFT               20
    3 E1 g! Q5 \" _4 H3 X$ z, |: t
  57. #define ITCINTEN_SHIFT              21
    % a' h2 Y" Z$ y1 M! ^" X
  58. #define TCCHEN_SHIFT                22
    6 e3 k9 v: m; P
  59. #define ITCCHEN_SHIFT               23: J) a6 @2 l% [/ ^5 [8 ^
  60. 1 z) }3 |- a# X& e; u
  61. static volatile int irqraised1 = 0;% H; Q. M$ X1 Q4 g" I
  62. static volatile int irqraised2 = 0;$ {5 b4 I. D1 U& d) `- y0 G4 f0 m1 {

  63. 1 f3 D/ w% V: @6 [) H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 h' m; L) A- v# h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( d5 y6 C7 b: z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 Q3 c# ^7 L6 ~, a7 c( ~7 K- [" B
  67. % t( F4 ^/ G5 y5 ?5 c5 S
  68. dma_addr_t dmaphyssrc1 = 0;* c( |' U1 W7 J8 y  s& M6 b
  69. dma_addr_t dmaphyssrc2 = 0;' f$ H7 M6 D) L
  70. dma_addr_t dmaphysdest1 = 0;# V* z0 N! Q1 x- F; w2 d
  71. dma_addr_t dmaphysdest2 = 0;' b1 @/ H+ K8 _* T  ^
  72. 4 q& a. k& n& Z. l# I3 C  f
  73. char *dmabufsrc1 = NULL;! ?" L* E/ x8 i
  74. char *dmabufsrc2 = NULL;
    2 ]/ F3 l3 V3 T! b. |/ z6 q
  75. char *dmabufdest1 = NULL;
    1 y2 p' j- @) U6 m) W
  76. char *dmabufdest2 = NULL;) ~; ]* k1 ~9 m+ P3 C
  77. 3 l4 |/ a. r2 x) c: [' e3 K; h0 l7 [
  78. static int acnt = 512;
    + `0 n' A+ g# q
  79. static int bcnt = 8;
    8 y4 }. f* N/ z: d9 U
  80. static int ccnt = 8;
    6 J3 _( Q  z2 A

  81. 4 w) K1 H5 K+ ^9 G( U& k  c. a4 y
  82. module_param(acnt, int, S_IRUGO);$ Y: x, ^6 J, ^9 j
  83. module_param(bcnt, int, S_IRUGO);
    6 m# L. J% k) C/ y6 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 Y! _4 ]+ D9 V6 ~7 p1 m& ~. }  P; O9 `+ M! |0 C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ j9 U* }6 a, q6 s1 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% d( }1 V  L+ R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. Q2 j, r5 I1 D  L3 D# `
' E) g5 e- X- Z- F

! {$ O0 l, i4 S" E% M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 09:56 , Processed in 0.037906 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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