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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 K, f+ L* N( W
  1. [code]EDMA sample test application
    & z& h* ?4 [% I+ ]
  2. /*
    & z2 B* \0 u# @$ m
  3. * edma_test.c
    2 C! j" X& ]- p/ r& K# n
  4. *
    ( ?& S  _2 z1 w; k1 A3 F
  5. * brief  EDMA3 Test Application
    0 ^( @. D7 d. g  U) f+ ~! s5 m
  6. *
    / T; a1 X8 t/ k8 B) p$ M  O) _
  7. *   This file contains EDMA3 Test code.
      ~; H' d& e7 c, V1 Y
  8. *
    6 b' M  W" U0 D( ~! ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' u* p0 }$ `8 ~2 v1 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; N% u. |5 B& m2 _0 R6 w& o# V# l! g' j
  11. *         TO CHANGE.
    . `) P' d2 L! ?$ J1 i5 _0 ]8 l
  12. *& N+ @3 o- b! e3 g+ {% j0 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 a4 ~! y0 ^. U& p7 P- o$ P
  14. *: m9 O" P1 n/ I+ R/ @9 f/ c
  15. * This program is free software; you can redistribute it and/or4 R1 R" o- s& e; V$ l
  16. * modify it under the terms of the GNU General Public License as
    - F* j* i$ H" ?( X  p
  17. * published by the Free Software Foundation version 2.
    1 `" g' O% Y/ L8 S9 j$ }3 E: O
  18. *; f/ v8 v. U$ U1 R0 k/ \/ s0 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& K! w  a' z5 Z) b5 y
  20. * kind, whether express or implied; without even the implied warranty% D( G  O9 d. ~7 ?+ h/ l6 c( ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 \; X4 d" Z: m+ \( V
  22. * GNU General Public License for more details.
    6 S% |$ X+ d8 S, Y; @
  23. */
    ) w( a% n8 V* @& {9 G( W
  24. 2 A( D+ u1 l& v4 ^) r/ A% b
  25. #include <linux/module.h>2 V. o; A  {, c9 T, t7 J
  26. #include <linux/init.h>
    8 V- D8 ?) D8 v7 K: b
  27. #include <linux/errno.h>9 N$ i  P/ k+ I. o' Z0 h* C
  28. #include <linux/types.h>
      _6 g5 U0 P$ `' i
  29. #include <linux/interrupt.h>
    " U; p3 g$ Y+ J' \% ?
  30. #include <asm/io.h>! [8 a+ @  h2 u3 J& x8 M: ]' y
  31. #include <linux/moduleparam.h>9 Q! _8 g4 {6 s! q+ c! a
  32. #include <linux/sysctl.h>
    " W  A8 G3 Q7 S& Z* s  q. t
  33. #include <linux/mm.h>8 q. \3 f7 h& o* i4 j
  34. #include <linux/dma-mapping.h>" p+ y$ e4 m  g2 D

  35. & r5 s! L3 y+ [6 k9 p) |& I
  36. #include <mach/memory.h>, b* w+ {% ^% v: ^8 u0 s
  37. #include <mach/hardware.h>; o& ]  d( L1 p+ {& z3 k% n6 `
  38. #include <mach/irqs.h>
    0 k# z8 E2 \, ~9 Y
  39. #include <asm/hardware/edma.h>
    " `% y# O& m5 h6 B5 Q9 a

  40. 5 f) r1 |- E: a" E
  41. #undef EDMA3_DEBUG
    9 W; h) K. J. W$ l
  42. /*#define EDMA3_DEBUG*/
    ( Z6 w8 }/ a5 O% R9 T" Z) `
  43. 4 ^3 B/ Y" v+ @" S/ K
  44. #ifdef EDMA3_DEBUG
    " m1 u: F) i- ]9 a5 _5 \6 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ n; T, |, R( K3 c& N! v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( l. R4 y( ]) v9 U" @/ J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; T( _4 @# @1 s2 j
  48. #else
    ) M& K$ g9 y: M1 o. v) F$ q
  49. #define DMA_PRINTK( x... )
    : G, I3 {4 [9 }) \
  50. #define DMA_FN_IN& b% @4 z/ U  B/ v1 `' Y
  51. #define DMA_FN_OUT
    6 k  o, [  s9 m* @; Z
  52. #endif
    ' z0 ^1 z) A, c0 n2 ~- L
  53. , A8 r8 D4 J# F$ K7 f4 \5 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , X; D+ V5 o+ Y4 B$ t& N( e  p% {
  55. #define STATIC_SHIFT                34 m) K/ u: k5 Q( O, F; V
  56. #define TCINTEN_SHIFT               20' o- f7 K2 m" U0 ^3 |/ b
  57. #define ITCINTEN_SHIFT              21* }' k7 M4 N% C6 ^' E
  58. #define TCCHEN_SHIFT                22
    ' U# Z: N/ F: g0 x$ T% H
  59. #define ITCCHEN_SHIFT               23
    ) w' d! T$ ^' r  V6 J0 L$ {  S: P
  60. 7 K8 j* ~8 _* B4 j
  61. static volatile int irqraised1 = 0;) a- Q% K/ Y4 ^8 S; b
  62. static volatile int irqraised2 = 0;
    ! M+ o/ g8 U( E4 g3 s) e
  63. ; ]$ E6 h$ `7 _; p& Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ?( c: z! h' D8 z$ Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : b# [8 _3 E% v( _: R8 g: J- D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& D9 K$ w, {9 X1 K
  67. . e& G0 P& @6 ^: }# U, H, Q
  68. dma_addr_t dmaphyssrc1 = 0;/ o2 |) m  |2 Q, d$ j
  69. dma_addr_t dmaphyssrc2 = 0;
    5 E7 K# q. M2 V7 Z# `/ S; T
  70. dma_addr_t dmaphysdest1 = 0;
    3 r3 I/ J0 k2 M& R2 A
  71. dma_addr_t dmaphysdest2 = 0;
    / p" J0 X: \0 s) n! C2 p- C

  72. ! p9 t3 H' I5 A
  73. char *dmabufsrc1 = NULL;
    6 X' Y8 C+ S. U
  74. char *dmabufsrc2 = NULL;1 j0 D. T1 I$ G) p
  75. char *dmabufdest1 = NULL;
    & u* B2 B: }' C
  76. char *dmabufdest2 = NULL;
    ) u* B$ V/ g3 A$ v" E
  77. 9 t; L5 e  d$ T: d! j
  78. static int acnt = 512;1 L' S, T7 D* K2 C- d: x
  79. static int bcnt = 8;
    : ]- \  L/ B+ V
  80. static int ccnt = 8;
    $ V9 ?4 u8 z) s& |3 u. M" Y  @

  81. & s3 Q& |- L  i( h4 v0 t+ s/ Z6 m
  82. module_param(acnt, int, S_IRUGO);
    " q9 o8 L% B4 A. G( V, P
  83. module_param(bcnt, int, S_IRUGO);
    2 ?/ e3 p- d8 g' f( M7 Q# z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% f4 p9 ~8 w, Q- {- v2 E! a
9 U, W1 d0 q1 a9 Y5 r5 _9 g+ q) e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ s5 A# _) E% i5 [# B: U5 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; C, y, t% T1 ]2 D7 N; z- N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ [9 x  p  f1 i4 q2 {

5 X$ K1 k( ], o
) W7 j7 q1 K8 a1 D7 Y' v+ n' W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 14:59 , Processed in 0.040671 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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