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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " R. l( s5 j  u# g7 v& O  p
  1. [code]EDMA sample test application9 |: {0 o) y6 ]' b/ K
  2. /*) ]! Y, V+ Z& U, s8 C2 a( U" [
  3. * edma_test.c$ I0 f; z/ y% Q# z9 n0 J
  4. *
    7 p4 U; s9 k( \( x. t6 ]- G6 [* J; s
  5. * brief  EDMA3 Test Application7 f% u, j% o+ j$ ]- h8 u
  6. *) }3 Z# ^7 j: o/ v- m/ u2 A
  7. *   This file contains EDMA3 Test code.
    7 u: j0 J5 j$ J% S
  8. *
    8 Z0 k! u3 p. @5 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ o  w5 a% l$ ?. h" Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) I5 P5 M4 f' p8 u* r
  11. *         TO CHANGE." e& O. W- W) j) c
  12. *. J" z; N$ g  ?, H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// X) B  J1 L# F) W7 M: g4 k
  14. *
    ( W1 n3 [! k, Z" T" \8 H
  15. * This program is free software; you can redistribute it and/or8 h0 y1 W6 Q/ x& I& Q& ^6 i2 Z; a
  16. * modify it under the terms of the GNU General Public License as# s% r$ U- N/ a$ |1 o+ M
  17. * published by the Free Software Foundation version 2.
    7 ^( s9 z) @$ b; R
  18. *
    6 ~9 t% ]+ r* B6 }* s' E" z  \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & ]; ~8 x1 m! j* [) Y$ D
  20. * kind, whether express or implied; without even the implied warranty3 t3 |. f$ h0 H$ t$ i% m  f* c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 M$ W  M& b$ S" N% l1 c
  22. * GNU General Public License for more details.
    # o- @. D: v- V
  23. */8 {& M9 V% A9 U5 p: J9 f- r

  24. 7 a* S; k! f8 X3 s, j
  25. #include <linux/module.h>- h+ y- C/ Q  y- M# u; ]: m
  26. #include <linux/init.h>0 S4 y8 ?0 I: p# S" F/ G
  27. #include <linux/errno.h># M! t- t# H0 L/ H; y# U2 S0 j( S
  28. #include <linux/types.h>
    1 w8 i; m; M, B" ^5 Z; E
  29. #include <linux/interrupt.h>
    * {: m( e5 b- b
  30. #include <asm/io.h>' Q0 C7 T7 @/ u7 K! n
  31. #include <linux/moduleparam.h>% d+ e/ O3 I4 e4 n! w7 X% }! e
  32. #include <linux/sysctl.h>4 g: d8 _: v/ g6 m5 Y$ _% T
  33. #include <linux/mm.h>
    ( Y- ^4 A; ?' M& [
  34. #include <linux/dma-mapping.h>
    * k/ T; Z" u! s- h% i6 W; Y1 x& H

  35. / q6 j0 b' K! D' A
  36. #include <mach/memory.h>
    ! T- {6 d! ~) _: n; a
  37. #include <mach/hardware.h>1 A! n- E0 O/ ~7 Z2 l
  38. #include <mach/irqs.h># Y& O) Q  X: o
  39. #include <asm/hardware/edma.h>6 k" y4 f" Y0 q) y0 j" h

  40. ) @9 g; k3 Q2 }3 }" c4 t% @% h
  41. #undef EDMA3_DEBUG
    ' l; \% i/ x; a6 V3 a8 l
  42. /*#define EDMA3_DEBUG*/
    3 h$ Z8 x# W/ |6 w* y1 m

  43. ) ^# _, C9 r: O3 \4 |; x
  44. #ifdef EDMA3_DEBUG3 ]1 B. ^1 Z& g; O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! z/ \7 u+ M' t: S# ^( V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 B4 S0 V9 X- b' W6 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - x* }7 h* k9 j; t$ k9 }8 z( J
  48. #else% |) d5 D& L( N# O6 Z
  49. #define DMA_PRINTK( x... )
    ; y+ f/ `% A5 i9 [
  50. #define DMA_FN_IN
    / J  r2 ]. @4 p9 H
  51. #define DMA_FN_OUT
    # r$ G% K, U( v- A8 R! R
  52. #endif
    9 W3 g+ Y& ^9 X: M. D( ~

  53. 6 z3 c6 \& j/ m9 H2 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 s% \+ E8 l( D/ `7 s- i: n0 Z0 m1 u
  55. #define STATIC_SHIFT                3+ r; |2 y% M" c+ c& s/ R
  56. #define TCINTEN_SHIFT               20
    * c! h0 w, _' i' s
  57. #define ITCINTEN_SHIFT              21
    8 W+ F( b& l* k9 G
  58. #define TCCHEN_SHIFT                22, E1 h' l" y$ s# I
  59. #define ITCCHEN_SHIFT               23
    ! a9 z! I! ?5 w8 x* ~

  60. % t" F/ _1 S7 Q4 @4 i
  61. static volatile int irqraised1 = 0;# W% d3 d' C5 e4 U. V# j+ t
  62. static volatile int irqraised2 = 0;! V5 E' o9 v5 b( i+ s

  63. 9 S6 @( j& m% H$ {+ X; s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 B) J$ }0 s3 X  Z! F; B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: m/ ?+ g4 Q" r& e; m7 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" V: Y5 `1 {% c3 I- J- h3 A# M- A

  67. . _$ M& f5 z! G$ E) j& j
  68. dma_addr_t dmaphyssrc1 = 0;
    / n5 ]* P0 ?- t7 j5 A# g
  69. dma_addr_t dmaphyssrc2 = 0;
    $ M/ d0 J% T6 e' w, V' W7 m" ~
  70. dma_addr_t dmaphysdest1 = 0;) y. J* d' Z' m1 t' n/ e. |) y5 L" b
  71. dma_addr_t dmaphysdest2 = 0;7 }" r4 a/ c* c% M$ N

  72. ( a9 Q/ d9 b! ?' `/ v: y
  73. char *dmabufsrc1 = NULL;( c; r( h8 O. t- e+ D4 S+ L& n' B
  74. char *dmabufsrc2 = NULL;
    9 P) Y( {0 W6 i, x
  75. char *dmabufdest1 = NULL;- o) A3 p0 D' c( e- b0 B/ S8 N4 r
  76. char *dmabufdest2 = NULL;& [# \( g  R  |  ]8 M; I, C
  77. : b/ c( V: v* P8 z9 y+ p
  78. static int acnt = 512;, I, \$ G( S, k# Z, a+ M# a
  79. static int bcnt = 8;2 {1 v* z+ e) U# u
  80. static int ccnt = 8;- t$ g& r7 M4 z

  81. - _/ B/ d- I+ _$ }: a5 H
  82. module_param(acnt, int, S_IRUGO);* X9 d1 i, o( x$ y
  83. module_param(bcnt, int, S_IRUGO);8 m7 U% D+ r) ~9 u! w4 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: \' C( X; W' ]
* {2 R1 B; k9 J4 w: v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! ?! x! \" c* ~! N  ^2 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, R* x4 ~/ x6 \3 T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ \2 L+ J+ F9 A- M4 |2 q
) f! c4 u( f6 {+ ~' t" N1 j

5 _+ U& z6 c. l1 ^% ~0 k0 O# D1 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-2 22:41 , Processed in 0.041060 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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