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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 g+ a; \! N% e0 b3 S/ ?
  1. [code]EDMA sample test application
    1 \& u' Z. ~4 W7 W5 M% z) G$ N
  2. /*
    3 [4 i" ~# g! I& B( G+ T! P
  3. * edma_test.c' `/ O6 ^* H. m, Y1 r. t& d
  4. *: V  v' D/ W. H! p# Q% }& k. D. Z( `
  5. * brief  EDMA3 Test Application
    ( r' T% M: j8 r* O: h3 W7 M
  6. *
    % f: _! x( k1 E! ]
  7. *   This file contains EDMA3 Test code.1 ~$ u  s: |' a( L' V& g
  8. *: x% w" s) g# J+ j2 q* a9 f# x% R: y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " ^! h0 b$ L3 c& R" P- s! b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , e7 E9 s: u  b' S( t  l- a6 ]" [
  11. *         TO CHANGE.7 ?1 p# b4 {+ s0 R- i' V, q  J
  12. *8 N; Q- x$ i; w! \1 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 X$ v; t3 X% J) `
  14. *4 v0 f6 x" J; J5 w% F, t
  15. * This program is free software; you can redistribute it and/or
    - j3 d* P! y8 C9 o' t
  16. * modify it under the terms of the GNU General Public License as2 d* h7 i+ m; {" P
  17. * published by the Free Software Foundation version 2.3 i& Y* x, }. K) n/ }9 E2 Q! ~
  18. *0 O8 H7 q/ |0 R( ^' p: @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ n' P) a  K# ~
  20. * kind, whether express or implied; without even the implied warranty
    , J* V  ~! _! I% x9 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      V% ~9 @: W) D( a
  22. * GNU General Public License for more details.% n! h, }+ F! R% R, V
  23. */  g+ ]& u" K% n- I9 J
  24. 6 W, R& [2 E- n
  25. #include <linux/module.h>' a4 ^4 W: K' J7 `* E( p
  26. #include <linux/init.h>% U4 ~# p9 {9 e! W! X
  27. #include <linux/errno.h>
    $ K- F6 k3 J' g5 M0 }
  28. #include <linux/types.h>8 R. S2 t) T( ?0 I7 \
  29. #include <linux/interrupt.h>
    / z0 L4 n$ _7 e
  30. #include <asm/io.h>
    & Z# j# X3 e4 Q1 \- B7 y9 O
  31. #include <linux/moduleparam.h>/ F2 D- p! D; L4 ?. X# h+ f/ {
  32. #include <linux/sysctl.h>2 a& H; b- h2 H) J. ?* Q, u
  33. #include <linux/mm.h>, W* F6 C. s! j1 \* V; n
  34. #include <linux/dma-mapping.h>( F. a! P! T8 D  q/ R0 X; m8 K

  35. 9 v6 o; _) F9 P* L
  36. #include <mach/memory.h>$ Z& e( V3 i$ j( ]( L9 j+ J
  37. #include <mach/hardware.h>' v: i& L; V$ J; v& p
  38. #include <mach/irqs.h>
    9 ^* A5 e0 w; k! n0 L  k, ?+ r1 `
  39. #include <asm/hardware/edma.h>
    ( v* ~8 M0 y' g8 S+ |& ]9 E
  40. : w( \, `' O8 q: G* b, P! i% o
  41. #undef EDMA3_DEBUG, P6 v+ S" \; c0 I0 {
  42. /*#define EDMA3_DEBUG*/3 L+ o: ~, Z3 }
  43. % v1 N0 {; v3 r( N3 a
  44. #ifdef EDMA3_DEBUG1 K' G8 p, q' B. n" `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! I+ H4 a6 E) w2 \: \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : g2 p" M8 X# O% p6 m1 }# C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 }9 w+ G) r* W  e; n
  48. #else
    ) {  T! \6 B/ `! x3 K7 h
  49. #define DMA_PRINTK( x... )4 }4 l5 W; C7 f2 ~: [
  50. #define DMA_FN_IN
    2 O- G  R. L) y# ]2 ^, M
  51. #define DMA_FN_OUT
    3 `1 f% d. c- ?- L. Q
  52. #endif
    3 i/ H% X7 `8 F
  53. + i5 I. r5 t% y4 ~# D9 Q; R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& L9 o$ X: A" d3 }9 X: C
  55. #define STATIC_SHIFT                35 E" t1 r) i. a& X  `
  56. #define TCINTEN_SHIFT               20
    " V4 j# V6 o/ v. ~; v: }+ u) C
  57. #define ITCINTEN_SHIFT              21/ D# w. ~" G3 T" L
  58. #define TCCHEN_SHIFT                22- F/ q) X/ Y; ]: X: q) T
  59. #define ITCCHEN_SHIFT               23
    ! e; I' O) M3 e- q! v" ?* |2 l
  60. 3 J8 J9 m; E- n0 T1 L4 _
  61. static volatile int irqraised1 = 0;1 R' v- i/ @# F4 I
  62. static volatile int irqraised2 = 0;
    , _5 W' b  ~" F' q# Q
  63. ! I  G( T/ f& h; |1 {5 l" }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : d- o. L+ G/ A6 Y2 a( L/ e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " f6 l# ~& G# }2 G4 ~3 C+ V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 P4 z0 y, u+ v

  67. # _, T# C; F8 B* Q% U! g
  68. dma_addr_t dmaphyssrc1 = 0;
    ' k6 E& G- \$ A1 q) \
  69. dma_addr_t dmaphyssrc2 = 0;% I. y# O3 N' a
  70. dma_addr_t dmaphysdest1 = 0;0 {$ Y" D7 L! S  e: w  c) f4 U9 ^" h
  71. dma_addr_t dmaphysdest2 = 0;8 P% P& l, c- u( C% q4 h, t

  72. . J7 @2 I9 U% U( s1 P/ ^& ?
  73. char *dmabufsrc1 = NULL;
    # g, H, r& Z* |; c5 f
  74. char *dmabufsrc2 = NULL;
    2 S% B3 f: [8 t- J: ^- i9 V
  75. char *dmabufdest1 = NULL;& P* m9 o% N8 r
  76. char *dmabufdest2 = NULL;2 Q9 a! E3 K* P- w5 Y$ R
  77. * e  p9 [5 S( z
  78. static int acnt = 512;
      i$ l4 |& T/ W& [, S4 A9 ~
  79. static int bcnt = 8;
    9 Q. a' d) `7 W4 {/ k4 X, E' L
  80. static int ccnt = 8;3 [- p% d/ Y8 q3 i5 y8 t& e

  81. % p2 H1 K' h, s  v2 X
  82. module_param(acnt, int, S_IRUGO);1 D+ E; m+ x7 F. P" ]# T
  83. module_param(bcnt, int, S_IRUGO);* S9 q7 ~5 l9 K. P  R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. x3 A( i9 q/ y: x& k
: i" [% }" `+ W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ z+ E9 Y. k0 z. u" l0 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, H3 U& o$ B  o  Q* V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) N9 |! O2 V  z8 ?

$ J% g. T9 C2 J3 ^# C1 I* M; O. a1 ~7 U1 I& x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 02:31 , Processed in 0.040386 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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