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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 [7 c% a" o7 ~
  1. [code]EDMA sample test application
    ; L( Y* U) g$ n2 t$ U) D0 e& [7 p
  2. /*
    1 Y5 Q! V% f4 e$ t) b0 q$ W
  3. * edma_test.c9 @! s7 [( b7 D! B6 e# S
  4. *
    " j% y/ \; F8 a0 F* R' Z3 b
  5. * brief  EDMA3 Test Application
    % e1 h% R/ e9 g" H) q" Z
  6. *3 `* c3 r5 {0 f3 \  |5 p
  7. *   This file contains EDMA3 Test code.
    & H; J4 k0 J6 U; s! c3 M' o0 }
  8. *
    % p. N0 r1 S# q: D( x1 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 B0 U  a  g1 ~! M! s' o3 U$ F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 }0 P% f% s  m! t; ^. b
  11. *         TO CHANGE.8 `# Z) Q4 Q5 v3 b6 R# H, e0 g
  12. *
    6 y5 F9 t/ @. o4 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 A) \, H9 U6 @0 X. u; ]
  14. *
    + `" H. K6 X: i/ d# m; Z
  15. * This program is free software; you can redistribute it and/or
    4 b6 h" ~" b0 I0 _+ G: F
  16. * modify it under the terms of the GNU General Public License as
    7 f4 R1 K" V  u# U
  17. * published by the Free Software Foundation version 2.; x) h% q4 B# V" z
  18. *
    ' B5 D6 s$ A$ e! W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 L. W# K1 F2 S) a
  20. * kind, whether express or implied; without even the implied warranty, r9 w3 q$ p" T- Z# e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " i, u$ {8 R! T5 ?. R( e
  22. * GNU General Public License for more details.# {) V" S' f" g& k7 S3 G: F/ g# A
  23. */
    1 O# S0 o5 E" Q3 e% k

  24. + l4 |5 X2 x0 q) @! A5 i
  25. #include <linux/module.h>3 e9 i. F! {1 u7 E$ s9 J! P
  26. #include <linux/init.h>4 ~" v* f6 ^$ g! \! g
  27. #include <linux/errno.h>' w3 m/ q6 p! W/ b( w
  28. #include <linux/types.h>5 B" T* x, ~4 D8 g6 {
  29. #include <linux/interrupt.h>
    $ r" Q* q% K- d. T0 Z% a
  30. #include <asm/io.h>
    / @3 I6 G5 V% l" [0 g
  31. #include <linux/moduleparam.h>$ S$ V( w/ D; R8 u7 F" [- b4 f
  32. #include <linux/sysctl.h>
    1 G. m8 t. a- C) [# i
  33. #include <linux/mm.h>2 F; s/ d1 u, C, p0 h. Y% x
  34. #include <linux/dma-mapping.h>2 {7 v" `5 h2 @+ |8 o3 J* @

  35. ' l# g* X8 E, ?7 o! P
  36. #include <mach/memory.h>/ V- s# c' q- g+ s3 d
  37. #include <mach/hardware.h>
    9 Z0 h% M* f6 _  q4 w( s( a& L& e
  38. #include <mach/irqs.h>2 b& G3 i! {0 Q% R2 b
  39. #include <asm/hardware/edma.h>9 H! B8 @0 r+ Q+ m6 W5 n3 u* Y
  40. $ G9 ]) d3 P" Q" R: y
  41. #undef EDMA3_DEBUG
    / k" P. z3 D( S: M7 d
  42. /*#define EDMA3_DEBUG*/
    2 \: c( o& S  h, s) l9 S, H
  43. , }4 ?! j4 ]' H" P) e/ r
  44. #ifdef EDMA3_DEBUG# H& r$ \8 }6 Q( _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' R+ B, x% C+ ~; A) {5 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 y% N- U5 T4 ~  ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 G1 I! k, V( h& `
  48. #else5 w/ L8 z3 D) Q' G
  49. #define DMA_PRINTK( x... )
    4 _# v7 ]/ _% O6 V
  50. #define DMA_FN_IN+ {$ G" P: j6 y" K4 a( a8 \0 r
  51. #define DMA_FN_OUT
    + ~" e$ k( R7 e
  52. #endif. D0 Z; @: ^: u! C" s( d, v9 c
  53. - y6 J8 j* g& z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 @: d! c4 i% N( |! E
  55. #define STATIC_SHIFT                3+ B0 j1 \. D- ]* k1 u
  56. #define TCINTEN_SHIFT               20
    7 y1 H. P) r6 D3 F5 a$ W
  57. #define ITCINTEN_SHIFT              21
    ) n7 I& Z: ^& I  E* x/ _
  58. #define TCCHEN_SHIFT                22
    ( K/ S6 _* R; r% K$ U0 P/ {
  59. #define ITCCHEN_SHIFT               23
    ' d/ ~8 u6 |7 Y! n* o, \. G
  60. 3 \8 U2 ?. ^" k! W) Y
  61. static volatile int irqraised1 = 0;
    + A8 w. G; V2 o4 z
  62. static volatile int irqraised2 = 0;5 J  _9 b9 i: `

  63. 4 Q8 h; z, d& U* q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) R. E$ H  N$ @6 H$ ]0 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! T# X3 F- b+ q/ U8 m' G5 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! M) a: R6 q+ R! t- b7 G* K
  67. ; H1 }0 O1 C9 n
  68. dma_addr_t dmaphyssrc1 = 0;
    7 d' e! d4 }& W% I+ J
  69. dma_addr_t dmaphyssrc2 = 0;
    * C& z$ E5 y5 ]0 V  _
  70. dma_addr_t dmaphysdest1 = 0;3 ]0 L! j+ T" p# ~; b
  71. dma_addr_t dmaphysdest2 = 0;8 m8 C; F' t: X  F3 N
  72. + y! V: }$ f/ J# |8 ?$ }
  73. char *dmabufsrc1 = NULL;
    1 C7 V& ~; I5 Y9 v9 H
  74. char *dmabufsrc2 = NULL;4 P* b: N; i3 V* ~: d% e+ O+ u, w5 J0 r
  75. char *dmabufdest1 = NULL;/ e/ n1 @, g( X0 N9 ~) `) G+ k
  76. char *dmabufdest2 = NULL;" d+ p- S0 Z& ^/ ]" O: a0 P

  77. 9 L, |% T: ?1 j4 {6 `/ q$ j0 M. d
  78. static int acnt = 512;- R" u! S1 y! z
  79. static int bcnt = 8;
    - h; I* h, v4 j* e4 S9 a' J9 T
  80. static int ccnt = 8;
    ) @& ^& U5 k- Z% q  d2 i, V

  81. . F  Y2 n# q- m4 T: I) t
  82. module_param(acnt, int, S_IRUGO);
    # t* @& B" k! e; d; E+ ]' [
  83. module_param(bcnt, int, S_IRUGO);1 @' _8 A- z% G/ s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- m. n* a7 p9 j! M. W

; X# K+ r1 ]/ u# }* d3 x3 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 @, k0 T8 x. i. o7 a% S' }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 [1 L0 W; o4 l2 S. o$ N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 s; p+ x& ^! S0 ~8 T1 Y$ v) I, u+ q, o7 T- a( h

, D1 m: s- u( j) a( u* ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 20:21 , Processed in 0.048732 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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