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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * I; N! V' S# g- w6 ^6 W
  1. [code]EDMA sample test application/ q/ G. t/ a( `0 \# c2 a4 J% }
  2. /*) _) \4 [9 }5 {2 [5 F
  3. * edma_test.c
    0 a% Q/ r; `! G
  4. *
    & G4 T+ P1 d8 ~' g, R9 b/ d( _
  5. * brief  EDMA3 Test Application# a  O" d- z$ x+ w) @3 W& _
  6. *0 X4 b9 `. t- a, A& ]+ V9 |/ k) ?
  7. *   This file contains EDMA3 Test code.
    2 i, L8 `: a+ n0 D* L& l
  8. *5 P2 Z1 R) L. \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * A8 T  r, }! S. ?% W) P& _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% U! c% |% a. Y( v1 K5 E0 E
  11. *         TO CHANGE.
    / Z+ t. l$ K3 q0 t0 |5 ]. W
  12. *
    : q( d1 `+ F  y: `7 t9 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 S6 S/ B9 p9 O4 h6 C& U) i2 A! q1 g7 k
  14. *
      i9 R! h+ d) _7 y9 b4 q+ I% \
  15. * This program is free software; you can redistribute it and/or
    1 W  Q% @* {" F- r
  16. * modify it under the terms of the GNU General Public License as
    ! H/ Z" `# z( |$ t
  17. * published by the Free Software Foundation version 2.
    2 Q! q& B1 g$ A3 I/ u1 A
  18. *
    0 _0 R% L9 g4 V6 \6 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- ?5 |4 e+ K2 a4 K8 I1 b! I
  20. * kind, whether express or implied; without even the implied warranty9 m. c5 s0 K; R6 g  }$ C! t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& D4 v1 S8 L& x& S* Z
  22. * GNU General Public License for more details., c  `: P' ~5 `1 ~
  23. */
      R- O3 D1 D9 s* g$ Q7 y8 p
  24. : N4 {8 l/ z0 P7 }- j$ _
  25. #include <linux/module.h>
      W. r$ y: ~+ R
  26. #include <linux/init.h>3 I3 t, e0 s9 C/ Q  W( d
  27. #include <linux/errno.h>
    % R3 y$ A' t1 |. a$ Q$ u$ u
  28. #include <linux/types.h>6 X7 O/ h# p5 P$ s' n/ q# S
  29. #include <linux/interrupt.h>
    . {  i8 U! k& {2 M
  30. #include <asm/io.h>
    , p1 y+ r' F- p3 y# _0 o8 f* m
  31. #include <linux/moduleparam.h>% g  P( `! ]5 h* K* p6 m0 f6 X
  32. #include <linux/sysctl.h>: \  l; S8 Z7 c* X
  33. #include <linux/mm.h>/ d% X, M/ S0 H+ H# t' T
  34. #include <linux/dma-mapping.h>
    + T. L* y. n3 k6 J& d9 T! X0 y( c
  35. " [* i/ i& G/ H- n5 n
  36. #include <mach/memory.h>
    4 c" s( u2 _* N5 E* _7 f  H: u
  37. #include <mach/hardware.h># S' d) s2 p/ s1 D8 A/ q
  38. #include <mach/irqs.h>
    , l' q, m1 P7 _4 k: E, J
  39. #include <asm/hardware/edma.h>; A* _/ L5 w9 L* F! k! o4 z$ Y

  40.   v. q4 E4 a$ g1 J
  41. #undef EDMA3_DEBUG# S9 A4 s* O2 K( a0 b$ O, i( }
  42. /*#define EDMA3_DEBUG*/0 g' \2 l1 M/ k
  43. ( g5 ^. w5 Q$ {: E. Z. y7 U
  44. #ifdef EDMA3_DEBUG
    0 n) n9 w$ W4 P! f$ h* z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ I% T4 I% N' ~- g+ {2 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % y0 ]/ C8 t+ V  t9 `7 k1 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 [  p4 ], ^" r. b5 H# I
  48. #else
    0 j9 B$ i& Y  J8 [% h9 z
  49. #define DMA_PRINTK( x... )7 r  v5 W0 Z0 \5 `' Z9 q! }
  50. #define DMA_FN_IN
    6 A6 n9 o5 l; [
  51. #define DMA_FN_OUT
    " x& {, Y' l  E. T9 b  T1 W$ b
  52. #endif
    9 i) i& I2 ]1 ?7 l' f! [) ?

  53. : n8 a. P; f+ @! ?/ ~( Q- N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 S6 g3 ]! g# _& M
  55. #define STATIC_SHIFT                3
    5 g6 N1 ~; E" b) G2 w7 f
  56. #define TCINTEN_SHIFT               20
    , w( {7 y# s" p; B0 d* p; Z
  57. #define ITCINTEN_SHIFT              21  r' f8 f4 |+ v4 p. x0 {
  58. #define TCCHEN_SHIFT                22& n) R) ?: I* K6 o0 K8 h; `+ h$ |
  59. #define ITCCHEN_SHIFT               23
    8 ~; e' F, h, h8 C/ Q
  60. + K! I6 V3 i! a, e# h) Y
  61. static volatile int irqraised1 = 0;
    ( D9 i$ y: H6 x9 o) L: t! ^
  62. static volatile int irqraised2 = 0;5 M" o2 t/ x; T( U2 D. {! E
  63.   R$ _0 l2 s4 u4 O' j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 v% ^8 d4 v0 Z' G& P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Y& m, i6 O# p, M: ^( }" G/ J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ |' w' P  r% f# a( ?

  67. 4 c4 R' O) I8 `% X
  68. dma_addr_t dmaphyssrc1 = 0;
    ; U1 K! C; B1 l8 s$ n/ o
  69. dma_addr_t dmaphyssrc2 = 0;
    , J& E9 k0 ^8 h4 D1 {& z' R- o
  70. dma_addr_t dmaphysdest1 = 0;
    & |. t0 C# R, U9 i0 i
  71. dma_addr_t dmaphysdest2 = 0;$ p* t- Q1 B5 S# j+ c

  72. % D; P5 f! P! x" a+ v( S) a
  73. char *dmabufsrc1 = NULL;, @+ n7 a8 w: E
  74. char *dmabufsrc2 = NULL;
    8 b6 [' P+ J& u, ^5 i2 t
  75. char *dmabufdest1 = NULL;
    4 T! |1 N4 K% K% Z+ ]5 z& M
  76. char *dmabufdest2 = NULL;  A8 k  h0 f  k. ?# r; N
  77. 0 j3 k; M0 {" u
  78. static int acnt = 512;
    $ Q9 `/ V5 f2 m8 d- F* `
  79. static int bcnt = 8;
    * R& n- o1 K* X
  80. static int ccnt = 8;3 U1 t- w6 C* ^  H/ H
  81. 8 ^6 g# |; `( M
  82. module_param(acnt, int, S_IRUGO);  N  G9 h$ v+ R8 K% V6 ~
  83. module_param(bcnt, int, S_IRUGO);) @! [2 h! r: k% S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 M' [0 j/ S; ^( [- q: x' B5 ?
6 ^' `9 W9 H+ S$ D9 I  A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, x& ~3 z  t( S! R+ d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 M( l$ }& \' v2 D& D: x  }, @/ {+ `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 ]0 L, x5 \  i* D( p5 j* E  m

$ g: V7 `- }1 a" H; y5 \: v
( k; e& c* \! H1 f* j$ S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 11:23 , Processed in 0.045091 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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