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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' V; v9 z+ O: t
  1. [code]EDMA sample test application. D4 ^6 b2 x" X- ]
  2. /*- C" u# w* f" u+ B0 ~" A& Q
  3. * edma_test.c
    , c+ ^* F  K5 }  l% ]
  4. *
    % O3 S5 Z0 f0 C1 k2 B1 P
  5. * brief  EDMA3 Test Application3 I- H6 Y; b) {6 s8 u- n  f* i7 g8 G
  6. *
    ; D3 K! L9 P7 e: V
  7. *   This file contains EDMA3 Test code.
    $ }! t# r: G$ A( L
  8. *
    / H0 W3 m) ~* s. c  E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- X  n5 U+ |7 p8 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ ?* i) c4 m+ Q  W) v
  11. *         TO CHANGE.
    : h+ v/ v- e* {
  12. *& L  h5 I. H& j" B, w& w2 u5 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 A8 n4 L" h9 }6 O5 g" R2 V1 H5 W( V, k6 C
  14. *
    3 e- [+ g8 i0 m& F, n" n( O
  15. * This program is free software; you can redistribute it and/or
    / p" g3 t4 ~8 W: Y0 b
  16. * modify it under the terms of the GNU General Public License as
    - I- S: B( w3 d2 W# J% X0 v
  17. * published by the Free Software Foundation version 2.
    ( O8 P& J: `% s$ y
  18. *
    ! |6 }  G; T3 N! s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 B2 ?2 ?4 M: ?  E
  20. * kind, whether express or implied; without even the implied warranty' ?- p8 f( M; ^, n' B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 E. R4 n" I2 n+ b* [
  22. * GNU General Public License for more details.4 u3 V3 ?9 _8 A" G# C
  23. */
    * l: G( @" k$ V& ?5 W& m& ~9 _

  24. 5 k( a6 Y0 p) J4 l; `. x
  25. #include <linux/module.h>. Z, P; b/ E* k5 y4 x
  26. #include <linux/init.h>
    4 v/ Y7 u  O- f# }
  27. #include <linux/errno.h>1 R" R; d0 o6 K3 N7 a
  28. #include <linux/types.h>
      ^( @8 \+ \% D3 B8 g! |7 X
  29. #include <linux/interrupt.h>
    1 ?1 s+ p0 L0 P" m' Q- E2 c
  30. #include <asm/io.h>, @; e/ o9 z3 W& U+ `2 ~% d2 y
  31. #include <linux/moduleparam.h>
    6 A  p6 F9 \% G+ E. y3 ?
  32. #include <linux/sysctl.h>) ]$ @# ]' @/ L' U% O) u* f% @
  33. #include <linux/mm.h>" `3 s' j6 v& [0 b
  34. #include <linux/dma-mapping.h>
    ) J) Q; [; |/ a$ |' N; L0 ~7 ?) q; f
  35. 4 W: }& ?; B9 ~& D* p: u  ?1 L# z
  36. #include <mach/memory.h>9 V  M$ `8 T4 [
  37. #include <mach/hardware.h>! N4 i, ?7 [; z" g
  38. #include <mach/irqs.h>
    : f0 @7 _! o  h1 w
  39. #include <asm/hardware/edma.h>. e' O) N8 a* I: }9 W/ q# r

  40. ' H1 X4 y% D0 u! N8 K
  41. #undef EDMA3_DEBUG
    / u& w" P8 d: ~1 |6 h" `" i; z0 }
  42. /*#define EDMA3_DEBUG*/0 s! [& j- [, W! _

  43. , V2 x$ a: _. \1 E: _6 y
  44. #ifdef EDMA3_DEBUG
      O3 b# U( D" [& x! q  X+ \2 H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : m7 Q5 k0 h; m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 c) [7 ?  S2 ]+ j4 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! v! B) u9 k1 i% |" E
  48. #else) \9 `7 a4 f, i! D
  49. #define DMA_PRINTK( x... ). \" B9 H0 A7 P; ]
  50. #define DMA_FN_IN0 `1 g  l7 L4 C& d# i) e
  51. #define DMA_FN_OUT+ U7 |$ N& A' Q+ S9 O2 I. b. X! f
  52. #endif
    / ^- g. x- X" p% t7 a
  53. 5 y4 Y0 V# o6 |2 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # U0 K, c) \4 |9 w0 T7 q5 x2 X
  55. #define STATIC_SHIFT                34 a2 K: V6 o+ U* H9 P0 V1 A' Y( b
  56. #define TCINTEN_SHIFT               20
    4 m7 o* f! [1 [3 }
  57. #define ITCINTEN_SHIFT              21# y4 m( R; D& g; x
  58. #define TCCHEN_SHIFT                22
    / N, O: r0 s- Q( J
  59. #define ITCCHEN_SHIFT               23- j& c5 k3 N/ v7 E  S

  60. 4 u( P! L. f# ?0 l+ u5 }
  61. static volatile int irqraised1 = 0;
    + N3 g7 Y5 D* @) N7 V% e
  62. static volatile int irqraised2 = 0;' `# q" H# Q' T7 H! C
  63. ) D. l, _6 [; Z! e5 C, V$ Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 e! L% A$ `. X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - J& q7 e) P% u; t. E) K% j# T6 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 A( ?  h6 i# V3 y% `- N

  67.   \- }& {$ |) ?( E
  68. dma_addr_t dmaphyssrc1 = 0;! P( e0 n" P8 ~
  69. dma_addr_t dmaphyssrc2 = 0;
    " S; J% ^/ v8 t1 g% u0 C
  70. dma_addr_t dmaphysdest1 = 0;
    # g% }1 q0 X+ L6 z
  71. dma_addr_t dmaphysdest2 = 0;7 @( }  a9 {! a2 K! m( }

  72. 5 |" Q" d- ?) H# [
  73. char *dmabufsrc1 = NULL;! U1 z3 h1 [! G2 U
  74. char *dmabufsrc2 = NULL;
    - Q+ ~  x  ]' ^0 M" i3 \
  75. char *dmabufdest1 = NULL;/ O/ `; R. t4 L$ f: N
  76. char *dmabufdest2 = NULL;) M/ m9 E& e2 l: d, J# I
  77. : |8 {3 Z6 |7 M. u/ t
  78. static int acnt = 512;
    ! @8 O/ Y/ o' ]" ]) ^# R- e/ b4 m
  79. static int bcnt = 8;
    : K7 D6 z0 T2 r
  80. static int ccnt = 8;+ @2 v- {9 B  p; Q, I# N

  81. / p' ?) H$ F* d* p4 |* {4 [' o
  82. module_param(acnt, int, S_IRUGO);- }$ w! u+ g; {, A+ |
  83. module_param(bcnt, int, S_IRUGO);
    ; v* R, q+ }4 a( [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; k" ]7 f( W0 K9 b/ R4 J7 u% A% d( }+ S- v* O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& C( o* ?* w0 [1 P3 f! g8 v7 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 R" y5 Y' p( |; L9 g. D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 s+ f/ K9 e5 K+ `1 E0 t5 B0 |' T" E& ~5 m5 }$ v

2 Y; w& m. o. @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 23:29 , Processed in 0.040454 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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