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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 b; @4 D; v; ], G4 r7 X
  1. [code]EDMA sample test application0 k! A; X" S3 U
  2. /*) G# ?4 u- R; K; k* T
  3. * edma_test.c
    0 I! ~! m1 M( j" U
  4. *  I) ^; u, O2 r5 c
  5. * brief  EDMA3 Test Application
    9 d% u9 D0 ?9 V; ~; m! v( A
  6. *
    7 c' W0 `* M2 S; I
  7. *   This file contains EDMA3 Test code.
    * z$ y  Q- a5 ], N( O/ r# Y- A% p
  8. *
    9 t" T+ ~: G9 `! F5 r, u5 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 {$ j0 X& E, X5 m6 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# J% a0 _( k3 `' y, ^- g
  11. *         TO CHANGE.
    5 e& f! |% n/ `& Q7 o
  12. *
    2 K$ x+ B" l3 ^6 V" K1 o: G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- f% J$ k0 e7 L8 ]5 p: X! T
  14. *2 a8 D6 X/ C. G; D' z
  15. * This program is free software; you can redistribute it and/or3 v- j  u* j# q( J
  16. * modify it under the terms of the GNU General Public License as" ?2 v! l0 e) g7 e# O% Q
  17. * published by the Free Software Foundation version 2.# R: z3 n! M0 T! c
  18. *
    # d7 F) r4 w/ n" r+ g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 N; z$ v+ I  m8 n; N6 m% I
  20. * kind, whether express or implied; without even the implied warranty  P0 p7 k; _' s& W3 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , ~0 a. z- |4 _2 t( e, Q: X% z
  22. * GNU General Public License for more details.
      h1 H5 d6 a+ r2 {6 o5 U
  23. */
    4 z6 d; D/ l8 m2 n
  24. & J- n2 N9 ?" r7 s
  25. #include <linux/module.h>
    4 @1 M( }  F8 X! c2 c
  26. #include <linux/init.h>% R4 ^8 L& k. X; J2 J
  27. #include <linux/errno.h>, C8 S! p5 K) y  j1 ?% h0 G" f
  28. #include <linux/types.h>
    * }/ y7 {" R. u% ^6 a
  29. #include <linux/interrupt.h>9 m& @8 a  P/ ]" e. q% k
  30. #include <asm/io.h>
    ; R7 y1 y# |' y; ]0 I
  31. #include <linux/moduleparam.h>2 z2 z4 `! I0 B) y# `
  32. #include <linux/sysctl.h>
    ( ]2 O  `/ v6 v
  33. #include <linux/mm.h>
      i. G" @; L: d5 U1 t$ D
  34. #include <linux/dma-mapping.h>
    0 l# t- Q, {" }' x9 n

  35. 7 x# C3 P1 t6 t# a
  36. #include <mach/memory.h>' z8 O, l$ c7 ?: |+ G) L
  37. #include <mach/hardware.h>1 b( v+ O3 y9 ]
  38. #include <mach/irqs.h>
    8 r8 f+ R4 c) b9 }  i. r% a
  39. #include <asm/hardware/edma.h>
    . D" Q7 n) s5 V- m& K; |/ |3 ^
  40. 6 t; T- \/ e* W7 @) l# k4 Y$ }
  41. #undef EDMA3_DEBUG3 Y, T4 v) E- }) L6 r/ B: }( w
  42. /*#define EDMA3_DEBUG*/
    - ?# u& C2 W9 J

  43. & _5 F6 A% Q& g
  44. #ifdef EDMA3_DEBUG, ]" j& e7 j* L8 O# V: L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ T$ Z, k2 f- p8 [$ A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); Q/ z" Y* K  u/ M5 ~' `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * a% a. v! \4 Y6 V2 b  C% r
  48. #else
    $ y7 u6 k3 J! m7 i0 [) V$ _5 u5 o
  49. #define DMA_PRINTK( x... )3 k' r( |7 z9 J3 i) @: M: J) t, K4 K
  50. #define DMA_FN_IN7 G3 x5 F, [6 D2 U1 c/ d5 i
  51. #define DMA_FN_OUT
    ' x! k/ ~+ f% F. w$ G) X
  52. #endif/ V8 d1 U- b6 L% e+ h
  53. ' i; l9 Y3 _5 S6 S3 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  U4 @3 |+ V3 {) [8 @
  55. #define STATIC_SHIFT                3
    # Q) s; U+ ~: T$ D
  56. #define TCINTEN_SHIFT               20
    ( C' `) o$ F& E6 k6 C7 ]# }
  57. #define ITCINTEN_SHIFT              21- H, R* U6 a* B
  58. #define TCCHEN_SHIFT                22
    ( U8 g3 c) ~8 ~+ p) S
  59. #define ITCCHEN_SHIFT               23% v/ z# o  |$ w# |0 B3 W* c# {$ q4 E

  60. " S1 P  C& E5 m, b" [
  61. static volatile int irqraised1 = 0;3 w/ n4 n8 F4 G
  62. static volatile int irqraised2 = 0;; H, ]! f" k: y' o7 ?$ ?) o. u

  63. - t# b- O1 u4 v& g9 c+ p2 j9 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Q* h% L1 q+ k  ~- ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 S7 c  p: u  J9 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) H2 Y% u" ^/ j0 b
  67. ! ^$ n0 r: U1 T, O( \
  68. dma_addr_t dmaphyssrc1 = 0;" w+ s* r( U& C8 E9 }$ T5 q1 e
  69. dma_addr_t dmaphyssrc2 = 0;
    ; ?+ R% d4 y! \6 O
  70. dma_addr_t dmaphysdest1 = 0;
    # \1 J! O- Y2 \4 ^) N2 L% a" S3 L
  71. dma_addr_t dmaphysdest2 = 0;
    ; N) I4 Y9 a: ]+ I! J" l

  72. ' N& p. G% m) N- }
  73. char *dmabufsrc1 = NULL;5 h& G- ]2 X2 O/ a- Y
  74. char *dmabufsrc2 = NULL;: a0 I/ o! [( D: y# l
  75. char *dmabufdest1 = NULL;
    ; m3 j9 o- R1 H: d/ O. R5 f/ J& I
  76. char *dmabufdest2 = NULL;! k. k: }! m% |2 H' A

  77. 0 \- _; I, S* J3 p' t
  78. static int acnt = 512;7 e) q1 p8 D6 }- g7 T4 N* F
  79. static int bcnt = 8;
    8 E# b1 q, s) I1 [
  80. static int ccnt = 8;
    * b6 p9 X" U9 E. B; W+ P

  81. 9 l) G4 v( E1 C' a
  82. module_param(acnt, int, S_IRUGO);) T2 A$ t% S: W
  83. module_param(bcnt, int, S_IRUGO);
    ! E; S+ i5 E1 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 D% H2 T# A2 V9 t6 u
4 d' ^+ i0 n  c5 y8 Y" k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: |, }, J" X8 q# b! K$ h2 ^) Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  Y( @; J! R4 U: A, n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 e0 |6 }5 i9 C! |6 R, K5 o( |
9 Q, U$ T! d& w1 }5 w- u$ N

/ X% @9 s4 q+ s' o$ A: J( f- M$ [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 01:45 , Processed in 0.040107 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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