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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % \' E4 S! I0 z2 v6 ^- P/ z
  1. [code]EDMA sample test application
    8 y: ^) }& x3 s- @$ r$ n
  2. /*
    . ~, Z% I: P) ~" P' T; g
  3. * edma_test.c
    1 P7 M" o6 D- b. k; X$ Q) ^/ o
  4. *
    , R# L# X+ U2 |" L+ Z
  5. * brief  EDMA3 Test Application
    % [) E" ^: s  [' l( s3 k) W, F$ R
  6. *4 y2 q. `0 V8 P) z
  7. *   This file contains EDMA3 Test code.
    ) K8 N/ }& [  \: k, F4 E( s: k
  8. *
    0 Z' t$ K$ k: k  G/ `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & a6 ~8 G4 ~- q, q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# H, e7 B# r0 @# ]6 @
  11. *         TO CHANGE.* c) s, e% r$ I# D. K, _# O
  12. *
    ; s* E0 T* G8 c' S4 s! i4 I& J! R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 \4 S) ~$ l: O
  14. */ a8 Q  _0 j2 I9 ]. T
  15. * This program is free software; you can redistribute it and/or
    5 i. m! c' S; l% p% v+ w. `( W
  16. * modify it under the terms of the GNU General Public License as
    * p' Y5 p: {$ i, X
  17. * published by the Free Software Foundation version 2.; P7 J) @5 }" @( y$ F3 @/ ^
  18. *
    5 K, n" B- F) ~4 |0 j9 z6 H, h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& E' s, x0 X: j$ Z! J
  20. * kind, whether express or implied; without even the implied warranty
    ) o% x  U) |* D9 O0 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) ~# A! f1 f5 o/ N
  22. * GNU General Public License for more details.
    ; K6 D2 u0 e+ ?% Z2 Q: i+ L
  23. */
    / j$ L# O, u9 \
  24. + M* i; D* h4 C& w, T
  25. #include <linux/module.h>9 P4 B* u6 m) C
  26. #include <linux/init.h>
    / d1 h7 H2 ?  w! l$ M4 I
  27. #include <linux/errno.h>
    ' L1 e; w7 Q* t8 k: a6 s
  28. #include <linux/types.h>7 C9 M& ]3 S: o- X; f' b0 N9 R
  29. #include <linux/interrupt.h>
    - ~7 G$ K% k% _! G2 ?; L# M, G) z8 H( R
  30. #include <asm/io.h>
    * P3 y$ U. O* p0 L+ ?) O0 S! d
  31. #include <linux/moduleparam.h>6 B: e" w1 t1 k  @8 B9 B* w% @
  32. #include <linux/sysctl.h>
    6 ~6 O4 ]! O/ W$ u
  33. #include <linux/mm.h># h; H  z2 N  o  m0 D1 W
  34. #include <linux/dma-mapping.h>( A' U. w8 c! J1 A3 X) L

  35. ' N4 t0 ~8 _' m
  36. #include <mach/memory.h>
    % F. L/ V# P( _1 V
  37. #include <mach/hardware.h>
    : [4 O+ q0 j! }
  38. #include <mach/irqs.h>
    : h0 @" I1 @! L' I
  39. #include <asm/hardware/edma.h>: I" i7 n$ Y9 z* a+ g7 l4 E! K
  40. - N2 J+ O- J/ _9 r7 ~( W; b) a
  41. #undef EDMA3_DEBUG
    & K& r6 y2 _, y' ]" S& c" ?
  42. /*#define EDMA3_DEBUG*/' m, M4 K, X8 [0 V
  43. ; u5 O. S4 n! V9 I/ W
  44. #ifdef EDMA3_DEBUG
    ' h6 U; }9 L" C, \; B3 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * m! M, Y: n6 I/ L0 r4 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! C3 U1 N( L+ G0 e; m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 i" a& \. Z! F" {) `
  48. #else3 b9 O1 K8 d" v+ ?
  49. #define DMA_PRINTK( x... )
    & t; X2 ^+ u" F) t
  50. #define DMA_FN_IN% L4 P! `' ^# T
  51. #define DMA_FN_OUT
    ! F/ [  u) {# A
  52. #endif8 Y( ~1 k/ ?; ~6 S( a" s: k3 O! a
  53. 4 \( q; x# o+ s* Y) ]4 d& f1 i1 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# J9 _& k- \5 ?
  55. #define STATIC_SHIFT                3
    - O7 N1 o) q! g9 X
  56. #define TCINTEN_SHIFT               20
    + T1 z0 w+ s$ Q4 v, C& M
  57. #define ITCINTEN_SHIFT              21
    4 m; K* M4 L6 h; [* e2 N
  58. #define TCCHEN_SHIFT                22
    / \7 ]7 n6 Y( ^0 i. g: F0 }
  59. #define ITCCHEN_SHIFT               23
    # `: g1 ?/ D2 u# q+ v
  60. 0 ?4 S. w: N" {, l
  61. static volatile int irqraised1 = 0;! l  m, B, X6 _5 R$ ~( L+ o
  62. static volatile int irqraised2 = 0;: @" s) V4 h  }, o* A9 b1 A

  63. 3 p: w( Q3 j, ^0 |8 B8 F! m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 T) j  q7 D7 `2 d, R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ~' l- Q4 X" B: q) k# w( n: {' X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ B3 f7 q6 `9 _: ^" t
  67. 3 p7 ?8 u1 t, l8 a% C' Z
  68. dma_addr_t dmaphyssrc1 = 0;2 Y1 M/ O4 P$ u. _2 ^2 V) B
  69. dma_addr_t dmaphyssrc2 = 0;
    # R( _7 f7 A0 y& ^3 H, e
  70. dma_addr_t dmaphysdest1 = 0;, c9 l% d+ Q5 K& a' h8 N" d
  71. dma_addr_t dmaphysdest2 = 0;  a3 V/ L& h" [/ ^; R
  72. - c& n1 [* s4 Y. L% j! c8 V9 B" o: h
  73. char *dmabufsrc1 = NULL;
    - m9 W; E" t: I% {! K- z, l
  74. char *dmabufsrc2 = NULL;
    : e; b' z- u$ ?/ A, e
  75. char *dmabufdest1 = NULL;
    : W8 J! |4 A5 a" K4 L  s
  76. char *dmabufdest2 = NULL;$ ~- ]  p1 O& q7 U1 B4 @; Z* G6 p

  77. % U: S$ x& B1 T# R5 ]5 g
  78. static int acnt = 512;" X  e+ u( r* W4 h  O: f7 b
  79. static int bcnt = 8;7 I- Y& G- |! Y; N$ k; F
  80. static int ccnt = 8;5 @' V7 K& ?* k) ~' y, V( `& U: @$ _

  81. / G# s, U  k, e
  82. module_param(acnt, int, S_IRUGO);
    5 v/ U; G) z2 n0 x- r9 u  o. I
  83. module_param(bcnt, int, S_IRUGO);
    # X  I$ p5 ]" m! p9 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& q$ K2 E- p7 I2 C* ^2 e$ J( }/ @( ?+ u* H4 o4 e7 W* H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 F1 s8 O: r& b. C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 s6 x5 j, K" C( d4 W8 I0 t& Y; h8 X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 s2 k9 d7 ~% s/ I8 ^$ x  x5 F2 m* D/ B: J
, [, n9 l* R( Y0 |8 {5 ?7 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 12:38 , Processed in 0.038849 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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