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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" ]: K4 r8 C- j1 y% g0 d  y
  1. [code]EDMA sample test application+ _+ ~3 f' E* t$ `1 y7 t. {
  2. /*& n0 s$ h" X& W- w. B9 c/ F
  3. * edma_test.c
    & X( M% G) Q% D3 F7 `  {
  4. *( p0 y; j9 e) E/ P3 e
  5. * brief  EDMA3 Test Application; y# h. n0 y: u9 l
  6. *+ m+ a- [2 F, F$ J& K9 E
  7. *   This file contains EDMA3 Test code.! l+ G0 ^; G1 V8 g7 }' I
  8. *: Z9 f4 B0 C& j$ l8 X$ ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- y  B) Q& k$ k- Q- u: [) _( n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ @0 p/ N' n8 v! q; W6 y
  11. *         TO CHANGE.; l7 u) b3 Y" \9 v# O* Q5 a
  12. ** H) h1 W" N7 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" ?6 j$ A2 i5 u( [, d' }2 x0 y% g
  14. *. x& l5 R5 o+ s+ y
  15. * This program is free software; you can redistribute it and/or/ u- D: u' b4 C+ K2 r' Y+ ^% h
  16. * modify it under the terms of the GNU General Public License as
    - M" {( D6 C" Y9 B; I
  17. * published by the Free Software Foundation version 2.
    8 H5 i' M: E1 q8 ]: s" y0 e
  18. *
    ( K5 X& y/ s% y* O  f/ i+ i9 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + H* d, w2 Z/ ]8 V
  20. * kind, whether express or implied; without even the implied warranty
    ; S& o3 Z4 d0 @/ S0 F4 k4 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & E+ L2 t# {9 b. j3 U
  22. * GNU General Public License for more details./ j) i$ c9 [3 z+ G7 H6 R5 z
  23. */+ s! ^/ P: [1 e& w

  24. 8 X& d1 d1 \% q
  25. #include <linux/module.h>
    6 x: E: P  |% \  ]0 a& h+ o
  26. #include <linux/init.h>& s* c3 U& J' E) K$ a# a& P
  27. #include <linux/errno.h>, h. M* n9 T7 s# Z0 |' n
  28. #include <linux/types.h>  e( j. c; G  B7 l+ q
  29. #include <linux/interrupt.h>$ W% S7 v6 ~$ |7 y3 X
  30. #include <asm/io.h>+ e- q% w7 j! r$ T+ k
  31. #include <linux/moduleparam.h>1 S7 t7 d; L; ?4 i$ Q/ H5 S
  32. #include <linux/sysctl.h>
    . G: O- ?- ^4 X( p
  33. #include <linux/mm.h>) z4 S3 Y' F+ [2 m  Y
  34. #include <linux/dma-mapping.h>
    0 f  ]' [' O$ x
  35. 5 S) ?' r$ V; _0 z# V" e+ Q0 K" }: }
  36. #include <mach/memory.h>$ |  e7 W- K: b% c; t& l
  37. #include <mach/hardware.h>6 K4 v* ^  n( r
  38. #include <mach/irqs.h>4 b* Y0 Z) j5 ~! L6 S0 S6 C
  39. #include <asm/hardware/edma.h>7 z& P% j  D2 G- e3 R( o

  40. / w4 s" G6 Z5 N' O* d
  41. #undef EDMA3_DEBUG8 e) G0 B' k1 v& `% }9 d
  42. /*#define EDMA3_DEBUG*/# M* R$ i) r* I9 I

  43. 9 K4 n/ k! ?! Y! y6 ~) R+ d. R
  44. #ifdef EDMA3_DEBUG( P. l+ M5 b; s. ~: n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 W6 w: E; |; F8 i! ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): D, p9 R: Y/ r5 F  A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # n* Z. a7 i! E' J* \! ~
  48. #else0 E8 }+ c' H- G) r# L0 n* A
  49. #define DMA_PRINTK( x... )
    * R# a: Y! I& G2 T) y7 Y
  50. #define DMA_FN_IN0 e! @8 h1 A4 ^3 m- l6 \- e
  51. #define DMA_FN_OUT
    5 \4 W7 I1 }5 v9 G( P$ v( t
  52. #endif
    7 }5 O0 Y; \, p
  53. * W4 @3 W3 J# L. e1 O+ ^& \" m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . t2 t( a& B! \3 ?" T, r
  55. #define STATIC_SHIFT                3
    $ L" E; y  [$ o+ d
  56. #define TCINTEN_SHIFT               207 W# u1 j# i$ y# }2 N" S
  57. #define ITCINTEN_SHIFT              21
    5 a( e! m8 W) d
  58. #define TCCHEN_SHIFT                22
    * {2 `- k# Z3 F! ?) `' d/ E
  59. #define ITCCHEN_SHIFT               23
    2 L: _4 h5 y' c% |" [& [* W+ c
  60. . O& K0 V" _3 i# C, @
  61. static volatile int irqraised1 = 0;
    : R- B# n' \" t! _
  62. static volatile int irqraised2 = 0;
    2 g( H; L4 Q) u- X3 o  O6 C

  63. $ L5 R8 Y7 j4 ]3 d' X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Y3 [$ X- |' W0 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' F9 V& B# h7 h! ~$ B1 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, p) x7 r" M! J; A; y  {: [7 H
  67. 5 W4 A3 O6 b2 k0 Y3 P2 I
  68. dma_addr_t dmaphyssrc1 = 0;$ O% U" H" ]5 L$ [. I
  69. dma_addr_t dmaphyssrc2 = 0;$ ?. k9 V; z0 B; ^: J! ^* W
  70. dma_addr_t dmaphysdest1 = 0;
    6 ]& z5 k( ~0 d
  71. dma_addr_t dmaphysdest2 = 0;
    # t+ X0 |0 P5 G$ D/ a+ V4 D
  72.   w/ L7 E* S& E* e2 M+ q/ C' T
  73. char *dmabufsrc1 = NULL;& T1 i; a# `1 ]% G# ?6 Q. X, l
  74. char *dmabufsrc2 = NULL;
    , ]/ m3 O4 M% G5 d
  75. char *dmabufdest1 = NULL;5 t8 A9 `& r4 q5 s' y3 |
  76. char *dmabufdest2 = NULL;6 \) D8 M0 ^: V' K4 v% z8 [
  77. 6 ^7 r! W, g7 {5 C& t
  78. static int acnt = 512;" }# p/ h3 ^( x# s( J( p
  79. static int bcnt = 8;" t6 K. W  S" t6 Y/ }8 `7 z! x/ F
  80. static int ccnt = 8;. J5 J! P( H% J4 b5 [' ?

  81. ' @, Q* B9 ^2 _
  82. module_param(acnt, int, S_IRUGO);
    # V- B* c# t" i* w' u
  83. module_param(bcnt, int, S_IRUGO);
    ( c( X9 f9 z# a, {* w4 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. ]% l$ x* Q6 |+ U
+ ]0 ~5 e2 o- U% d& Q  A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  \; s9 [  r9 L0 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. l- n+ Y: p& L  k. n2 E" O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 L: j$ R) O7 ^' q. p% o6 m9 S! p
4 P$ n2 _8 l) E- ]- S" F& b  M$ p# J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 12:33 , Processed in 0.048942 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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