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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" E) x: @6 p7 ]; n
  1. [code]EDMA sample test application0 e& f6 ?. Z+ ^8 y! m, n5 Z
  2. /*- m+ K7 H7 @/ F# [* X
  3. * edma_test.c
    , `. Y+ T* }! T: N3 H
  4. *
    8 x- n7 F: }, E$ a
  5. * brief  EDMA3 Test Application
    " ]4 @( J: |2 A/ \# z1 b; b
  6. *) k1 e) ~) H. e
  7. *   This file contains EDMA3 Test code.5 M2 N( _; m4 @
  8. *0 l; e" \! C- D' O; @. G. T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ Q9 T: A1 T) W: x, K% |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 ]6 Q& v8 K  G4 p  d5 U
  11. *         TO CHANGE.
    7 Y8 Y5 O& g5 }  A/ A2 f
  12. *2 t: ^* P$ k6 Q, @& [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . j: |4 a* k& }/ V
  14. *
    % F' ~# V% M0 m6 Y9 ]' M
  15. * This program is free software; you can redistribute it and/or
    0 G( o3 l0 G3 X/ x% u$ W
  16. * modify it under the terms of the GNU General Public License as  o& y; ~1 U; ^4 @
  17. * published by the Free Software Foundation version 2.- ~" r: {! v- b% Z+ u5 j5 L& p5 o
  18. *
    , e' m! \8 Y+ n# h1 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ w* l' w; g& Q
  20. * kind, whether express or implied; without even the implied warranty
    " ]' z. d/ K& R: V- l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * b, k$ e5 q$ ]' g2 P) r) h
  22. * GNU General Public License for more details.5 I2 N+ s4 Y  s8 W4 H7 F0 M; t) K4 [; q
  23. */2 d$ U6 U4 g8 a- s* ]8 M1 y+ W
  24. & P' [% |% ?5 K% \, F: L$ |' z3 R
  25. #include <linux/module.h>" g, n, T* y6 P$ R4 N/ b
  26. #include <linux/init.h>9 f$ V4 y2 H& M  b, O
  27. #include <linux/errno.h>
    / }3 [! x7 A! W; p; B" ~
  28. #include <linux/types.h>' L3 O0 C4 f" Z9 K' r
  29. #include <linux/interrupt.h>
      v- R5 d5 s6 P: J5 j0 N: r2 [
  30. #include <asm/io.h>
    + z! Q. a! L; k" ?0 r; U7 O$ ^7 C/ R
  31. #include <linux/moduleparam.h>
    : I; |0 X! K' g
  32. #include <linux/sysctl.h>
    . T! A- b( D6 y
  33. #include <linux/mm.h>
    5 L" R6 S* e2 j- J% |$ Z: b3 N0 f! @
  34. #include <linux/dma-mapping.h>% ?0 Y/ _9 d& O% _
  35. 4 Z4 o4 ^0 N* N
  36. #include <mach/memory.h>$ w4 ]/ F! |: z5 [; J
  37. #include <mach/hardware.h>
    / Q7 E/ W8 P6 v0 i
  38. #include <mach/irqs.h>
    0 Y: ^+ h% w1 L
  39. #include <asm/hardware/edma.h>, r* F* R# X  Y% y) z% U
  40. " Z7 e8 p6 w# U' O) Q# a1 c6 n
  41. #undef EDMA3_DEBUG
    # X# D" M& p# L/ o9 R- C
  42. /*#define EDMA3_DEBUG*/5 n6 L  v* n  Z5 T
  43. 1 ^. }/ l% @+ Z+ R$ g( k
  44. #ifdef EDMA3_DEBUG( A2 Y7 @3 v% B$ X& y  @1 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 v; Q# r6 k% z2 e5 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# {% l) i8 T' S* U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      M4 k& J4 b" p' P1 s; B! y3 L
  48. #else
    3 n3 S/ N  C8 m7 F" d9 u
  49. #define DMA_PRINTK( x... )
    6 n/ u2 J% j$ v3 ?! w9 s, }% D* G4 a
  50. #define DMA_FN_IN7 o! D: p' j  X5 A2 @
  51. #define DMA_FN_OUT4 d" S# I' U8 R& ~- n3 h1 L4 ~" G
  52. #endif* d3 U4 W" L3 ?" ~+ P( |+ A7 n) m
  53. 5 H' P) ~; C/ j! R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % K% Q* O: d8 ^3 }
  55. #define STATIC_SHIFT                32 l8 p% |3 d( Y; X8 X3 _
  56. #define TCINTEN_SHIFT               20
    ( [" O. B% d4 @" h
  57. #define ITCINTEN_SHIFT              21
    % X0 j  _& o& u5 I& r; c7 q
  58. #define TCCHEN_SHIFT                22
    ) i+ K: W7 Z; H6 d: d1 z* s! Q9 r
  59. #define ITCCHEN_SHIFT               23
    + h- ~$ Q' P% Y  a. n/ p: J/ C

  60. , a, d% S% C( o
  61. static volatile int irqraised1 = 0;" _6 Y9 e: n& _9 z: b# J
  62. static volatile int irqraised2 = 0;
    : \9 {, g- B  @& B/ I( {: y
  63. . {" E" q' ~5 c! \. [; R$ ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  {! J8 Q8 x" p9 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' X$ J8 A* m- B9 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; x& m* ^* ], e7 m

  67. / N) `% i/ c/ I  _
  68. dma_addr_t dmaphyssrc1 = 0;
    . D2 x  w; p) G# B, q
  69. dma_addr_t dmaphyssrc2 = 0;8 F7 `' a9 P1 G
  70. dma_addr_t dmaphysdest1 = 0;
    ( n8 o- i* Q8 j% k
  71. dma_addr_t dmaphysdest2 = 0;
    ' |9 W. Y! I( N' T; n4 d  T  ^
  72. : `& l% H* f+ U
  73. char *dmabufsrc1 = NULL;0 u$ v1 N5 d* C/ W
  74. char *dmabufsrc2 = NULL;
    ' k& v8 G, L8 k! H% M# N1 R; S
  75. char *dmabufdest1 = NULL;! C7 j; Y' G6 T9 |% R' o
  76. char *dmabufdest2 = NULL;! c+ T2 S% g8 Q5 n/ `! [0 Y) x( k

  77. 8 l8 |; e7 Z2 \; v
  78. static int acnt = 512;
    % W% _; D8 Y) J* h
  79. static int bcnt = 8;
    5 R3 s3 `/ Z* R2 L
  80. static int ccnt = 8;& Q6 ~) a) D  {/ S, ]  E

  81. ) `" w+ D4 j0 c7 W3 m; L0 b
  82. module_param(acnt, int, S_IRUGO);
    ) g, `) [6 e3 w
  83. module_param(bcnt, int, S_IRUGO);
    1 h8 U. h, A. }. o8 Z) \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ K: w' r  X# [  h1 c

' V* q5 x4 J, f$ F* l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 k+ a2 F4 I3 {% c$ k; [+ ~  T6 s) iarm-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 |, j5 `$ s+ t2 x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ K/ `; b* t! C2 x3 |

6 u  j6 a, b. p. O# t7 n8 C: z
$ u; w7 i$ j2 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-22 14:28 , Processed in 0.041084 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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