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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 X) z/ W4 E$ n- i
  1. [code]EDMA sample test application; c  |7 w) c; D
  2. /*
    9 F* W; V! W6 o3 e% L# ^
  3. * edma_test.c
    : J7 I4 J/ ^9 z2 D# U
  4. *% ]' [# V# x# n+ {3 A% b- A
  5. * brief  EDMA3 Test Application
    ! a# e% V! F8 w# \4 r7 v5 v
  6. *; Z, q1 E; [% T) G9 T6 t  p7 o. ~3 N) c
  7. *   This file contains EDMA3 Test code.
    * Y! R6 n' R' Z& J/ k
  8. *
    2 ~; c% Q# \, J; W+ L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) c/ c, J0 \' b/ _- r# K4 p% e/ l8 y0 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + p7 E8 b& j; P+ N, Z% ^
  11. *         TO CHANGE.
    & @) ^! V; G1 M% Y/ U
  12. *( _5 _' l0 A* k7 l- E% w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 O3 c2 n# T5 ]- W. w: n  t
  14. *
    4 K3 [# W2 F: b9 D4 b
  15. * This program is free software; you can redistribute it and/or7 z  |; k$ u$ E/ e' t2 B5 a
  16. * modify it under the terms of the GNU General Public License as
    3 B0 Z3 f' V- p3 `' h! t
  17. * published by the Free Software Foundation version 2.
    8 a$ u3 a/ g  D
  18. *
    - b( `( I$ B( ~% A! r! X7 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* U3 _4 f' ^! m4 y
  20. * kind, whether express or implied; without even the implied warranty' X7 H" ]- s# w( ?9 }/ p  o( l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : Z9 \% l# B- z; p, m) k
  22. * GNU General Public License for more details.8 J) Z4 ?# ]& n6 z2 `, L* V$ e
  23. */; S% i' r. h$ ]( q$ a
  24.   }6 S- p  y. b+ U6 D- w
  25. #include <linux/module.h>
    : k! G* _# b/ T7 w( q* O  t8 a
  26. #include <linux/init.h>' ^4 ~% ^3 @( ]* }( \( T) \6 M% B
  27. #include <linux/errno.h>7 P( p% Y3 p/ q
  28. #include <linux/types.h>) m; R: Z4 H9 C1 [9 n; n
  29. #include <linux/interrupt.h>+ v# P5 F! P& y9 }
  30. #include <asm/io.h>$ a4 C3 P. n: ], r3 n( i
  31. #include <linux/moduleparam.h>
    % x" s5 C) i( X3 r
  32. #include <linux/sysctl.h>7 a+ A2 e" D0 Q' @! i
  33. #include <linux/mm.h>
    . S9 N) s, J. D1 R% O1 i& v( F
  34. #include <linux/dma-mapping.h>
    " p  i+ p0 T& t8 K! s, g
  35.   z: t8 d; @7 \* y
  36. #include <mach/memory.h>4 \% S: ~7 t( t' e( E, r
  37. #include <mach/hardware.h>2 J$ ~8 I! S& ~5 `
  38. #include <mach/irqs.h># V0 }- u6 Z3 x7 G, w: ]0 \, a
  39. #include <asm/hardware/edma.h>
    ' {3 L" b6 `- }7 N$ O7 Y
  40. 1 F/ U' s; [1 K: R, _3 M
  41. #undef EDMA3_DEBUG
    4 B5 ?9 g7 j2 M( n7 K
  42. /*#define EDMA3_DEBUG*/
      g* L# D3 s) \8 t" v

  43. / W5 V7 e3 W+ b" @7 y6 I# e4 m
  44. #ifdef EDMA3_DEBUG6 }. H( p* N, {, t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ D# n1 u7 C8 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 c  V* d" ~0 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% \" O9 r$ D; p' B% Y& C8 i' ~1 _
  48. #else* v& o" X- F3 f/ c+ O* p  T% y) j
  49. #define DMA_PRINTK( x... )
    4 _2 l1 z/ u. b7 Z
  50. #define DMA_FN_IN' n, T. y  N' z9 [3 t; k. v
  51. #define DMA_FN_OUT
    " Z% D2 B% m* R& I+ v  A+ Z! e; w
  52. #endif5 j+ i) A! `( Q( A& ~0 b  a
  53. - j' P7 a( S" D" Z  O+ B2 a# I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- k! \/ X6 s# j% Z: x
  55. #define STATIC_SHIFT                3
    % g% w9 S  p  S' O' V- S! P0 C3 {" S
  56. #define TCINTEN_SHIFT               20
    / E9 ?1 t! v# l2 j/ `/ L$ J1 W
  57. #define ITCINTEN_SHIFT              210 i& u/ p, r6 B; L7 C8 y$ t
  58. #define TCCHEN_SHIFT                22
    % V, O9 K" Y0 |2 k  I; T
  59. #define ITCCHEN_SHIFT               23
    + j' r+ [6 V/ v, Q
  60. ; j* Z$ ?2 H; X7 A+ N
  61. static volatile int irqraised1 = 0;
    , s+ X/ J. Z! ~3 b0 u3 S
  62. static volatile int irqraised2 = 0;
    5 j9 l9 `5 ?6 C  W) i$ t' ^/ u- d: d
  63. + M! S) l! ]8 P% k& t- G& y: E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% a0 F; o/ I( m3 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 k+ W$ b7 e/ }/ }+ D4 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 @" {5 o5 X0 U

  67.   }+ F; @( Y+ x5 u
  68. dma_addr_t dmaphyssrc1 = 0;) D% A: J0 ?# E5 M* c
  69. dma_addr_t dmaphyssrc2 = 0;
    ) x" W) M5 l3 h% m: R+ f, T
  70. dma_addr_t dmaphysdest1 = 0;
    : T$ f, M  h7 m+ `4 ~' F
  71. dma_addr_t dmaphysdest2 = 0;
    4 k5 M. a3 f, J

  72. ) I; [8 p8 ?; t/ a  S
  73. char *dmabufsrc1 = NULL;
    7 U% l' Y0 s: e* Z( t, A: Q, B
  74. char *dmabufsrc2 = NULL;
    ( W, @+ x, B4 e7 e" x! n/ x9 v
  75. char *dmabufdest1 = NULL;% f0 b8 E% P/ i. Z4 S
  76. char *dmabufdest2 = NULL;) Z7 Q0 V( O0 ~  f0 T+ s

  77. ( I1 N$ L7 @) a7 N' g6 f
  78. static int acnt = 512;
    . k& D, m/ j5 M" F, t" [
  79. static int bcnt = 8;; P2 I% u) H1 m3 _  v
  80. static int ccnt = 8;
    " T" q2 q  Q4 t6 ?, ~
  81. 3 P; ?  B1 f* T
  82. module_param(acnt, int, S_IRUGO);" P- [( w" Y- I4 q. P% C. \3 t
  83. module_param(bcnt, int, S_IRUGO);+ v3 N5 P; g: S8 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) \' Y+ @2 Y/ n/ `% c2 u" v1 Y1 j( j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ p0 w1 J- c0 S6 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 J6 l2 \, D& x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 V6 {) O& D" g% i% E

5 x& Z, ?  ?5 C, V" `* n
; W% r6 t; e, O9 k: F, x4 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 13:43 , Processed in 0.041914 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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