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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : s8 L3 Q- T  }$ `/ u& @/ P  G+ \3 Z
  1. [code]EDMA sample test application: Y! o2 X/ c% p9 d: ?
  2. /*/ ]9 [# l. s7 a% U
  3. * edma_test.c
    , z- i, d: O/ k- W  l
  4. *# n) S8 |4 y6 s1 n! O! R2 ^
  5. * brief  EDMA3 Test Application
    8 S& }; I: N' B. J
  6. *! d/ m- Q. d& r) i
  7. *   This file contains EDMA3 Test code.: k; m1 V2 l# H( X5 V  w' ?
  8. *
      |4 |* d: o7 y6 F7 |& O3 J: t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 p2 S! _# t$ V6 ?% C" N% M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      [3 ]. @$ ~6 V' E
  11. *         TO CHANGE.
    + e" d) A. {; _2 l: u! ?/ L2 _
  12. *' W7 c, V. ]. O8 l4 a2 O+ L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 H. Y( d- v( K2 K3 _( }
  14. */ U8 {. e7 ~4 L- [' c! o
  15. * This program is free software; you can redistribute it and/or
    " P" Y0 ?. @: S% W6 a6 u6 Z
  16. * modify it under the terms of the GNU General Public License as
    ! o6 p; ?4 T. T! A; H; i
  17. * published by the Free Software Foundation version 2.
    : G* Z  K0 x4 O& u* J% ]( r
  18. *
    0 U& U& g: m9 d* B+ ~* B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# |5 ]6 G, x& g8 u
  20. * kind, whether express or implied; without even the implied warranty) Z( s' s7 N) f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% D. n5 ^% p2 `
  22. * GNU General Public License for more details.
    # D: v- e! R. |  A1 D6 s
  23. */
    - Y; J6 E. e+ x" e& [
  24. ! y. A8 h$ \. k/ F; X: \$ d
  25. #include <linux/module.h>
    ; l. |! i2 i0 J4 V" o! B1 V: y
  26. #include <linux/init.h>) ?% z5 _$ j+ D7 o5 Y
  27. #include <linux/errno.h>
    , \' Z4 h3 W# z: C3 a, t, d
  28. #include <linux/types.h>
    2 _: G$ u! N; E, d
  29. #include <linux/interrupt.h>
    - |3 j8 V- \6 C  n4 N# y+ F# ?
  30. #include <asm/io.h>
    5 _% ]( R) c" E- b- R
  31. #include <linux/moduleparam.h>
    9 Q) w3 g1 o8 N. S% ]
  32. #include <linux/sysctl.h>
    " z+ V+ T1 M4 H4 k
  33. #include <linux/mm.h>
    & u3 H5 a  M: ]/ k- c
  34. #include <linux/dma-mapping.h>" ?1 G/ ?& G" u7 X2 M

  35. 9 w7 d* E: u" v0 L
  36. #include <mach/memory.h>
    4 k& G: r0 c& o/ E( O, m
  37. #include <mach/hardware.h>
    4 Y6 I: U. f8 H, r2 h$ g6 p
  38. #include <mach/irqs.h>/ Z/ f6 n4 l6 [- G4 c2 z
  39. #include <asm/hardware/edma.h>3 s1 b: x) o) f* w7 t
  40. ; [! v! L# ^' m+ D  t! X! H3 L
  41. #undef EDMA3_DEBUG* ]+ N: @6 F9 P* O
  42. /*#define EDMA3_DEBUG*/
    & ?9 l6 s# J) \; l, D

  43. / ?  b, `. n0 R
  44. #ifdef EDMA3_DEBUG
    5 m, ?: ^) n* L0 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 F- t/ _9 \5 j; P' d5 ~0 X& y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . O$ B1 n, p! n. p  D. _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . W# a8 m! E. H3 l4 B* _
  48. #else
    6 p5 `" D, |+ ?9 Y+ L! e3 j! }7 `
  49. #define DMA_PRINTK( x... )* R3 B# g9 b  Y" _8 j9 ^
  50. #define DMA_FN_IN8 I) _4 B7 u( j% Q9 [; J
  51. #define DMA_FN_OUT
    ; g1 h3 P% ^1 o# _6 F# t! O. E7 ~
  52. #endif: W  h  d. d8 r( ~% l8 U
  53. " ?/ I# g0 {- i+ _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 \0 l5 A! `2 f; `% w( l2 d6 I
  55. #define STATIC_SHIFT                3+ D( U" j5 A; ^2 w
  56. #define TCINTEN_SHIFT               20
    7 P5 ?2 i* t7 C8 D/ F, ?
  57. #define ITCINTEN_SHIFT              21% b1 o. B/ J5 [9 g$ W2 [
  58. #define TCCHEN_SHIFT                22! E1 T( Z- n# O# R
  59. #define ITCCHEN_SHIFT               23, {" y' A0 t7 o* J- N4 [& W  u

  60. 8 w) o2 C- v: }. y  t% n
  61. static volatile int irqraised1 = 0;
    ; s  s- ~0 D, ]5 z3 w( Q
  62. static volatile int irqraised2 = 0;+ s2 E: @, o& Y$ u; n
  63. # k/ X9 P; v4 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: P5 S+ u$ V: B4 G8 X: @& z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ b1 r4 r& z) c* w# F! U- x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& U! Y) O1 U1 v" k9 |5 L$ |
  67. $ W" f" [* a# u/ \7 Z$ b; p
  68. dma_addr_t dmaphyssrc1 = 0;
    6 |$ ^; L* O( ?7 k/ F( s
  69. dma_addr_t dmaphyssrc2 = 0;
    5 \( u+ D' ^4 E8 ~
  70. dma_addr_t dmaphysdest1 = 0;1 F, y, N) R8 z: y
  71. dma_addr_t dmaphysdest2 = 0;
    + G4 q4 U" h/ `/ ^, \
  72. 6 j' j8 g3 s5 {! i! k. H5 b
  73. char *dmabufsrc1 = NULL;, ]" t7 z/ J6 b6 z
  74. char *dmabufsrc2 = NULL;
    " ^6 d) ]. A* V* H1 E# y* B
  75. char *dmabufdest1 = NULL;
    - S. J8 y3 e. R  p6 a) l
  76. char *dmabufdest2 = NULL;
    ( p! ~6 V" v* l  \/ S
  77. 9 ?' v% ]. N0 Q5 Z( m8 }) m3 v, N
  78. static int acnt = 512;: f3 C/ Z* s' o2 o
  79. static int bcnt = 8;! W3 S4 g1 r$ f
  80. static int ccnt = 8;+ d* u- a8 x# Z4 p

  81. 3 Q( p7 j( W8 w% W
  82. module_param(acnt, int, S_IRUGO);( M* A7 V% a. ?6 R# _3 C/ B
  83. module_param(bcnt, int, S_IRUGO);: s4 m7 R+ D% `, p6 l3 d8 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 D- D6 ^) b. l3 d$ a
2 x  [" S/ w8 L5 B+ K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( J1 y7 h+ V4 y* M; {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' [( F$ F" N7 R1 ?* v  }0 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ g  J, ]* q7 q+ c& C" a( O/ f  ~( `: V& w

. o/ a; i* o( z$ q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 00:12 , Processed in 0.039453 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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