OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 {) X2 l, _7 O7 z% l; K: p3 ^  W) R
  1. [code]EDMA sample test application, G3 F2 E& l. M3 O( j; w; S6 `
  2. /*
    $ q- p$ X4 X3 E& s% u3 ~  j
  3. * edma_test.c
    0 W; O6 \% O) g
  4. *
    & S" S* N* h2 i: O1 ?6 u
  5. * brief  EDMA3 Test Application
      g3 [  K7 e; |% r
  6. *
    ! X) L6 ~5 C' A: p" Y  k9 @. [
  7. *   This file contains EDMA3 Test code.5 J$ D* P6 q' _: f+ B
  8. *  a6 ]# |% i9 U" m: o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 A* j4 n6 B6 D) j6 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " a" S2 H3 }' q" Y! g
  11. *         TO CHANGE.
    9 }) V' M$ _' r: V
  12. *- W+ J% R- F) E; s6 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ A( C. I7 }* x& j1 V
  14. *- g/ k, [( f0 ^+ e, [
  15. * This program is free software; you can redistribute it and/or9 s! J: `  g( G8 k
  16. * modify it under the terms of the GNU General Public License as
    * i* u4 V7 h- c2 t( N
  17. * published by the Free Software Foundation version 2.
    1 }6 E1 A- a4 Q$ S
  18. *
    . n+ C* H$ q4 j7 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 Z* E2 u- o5 R  H5 n3 _: c+ a  I
  20. * kind, whether express or implied; without even the implied warranty% ]/ P$ e+ W. D% i- N7 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; B* l/ m' {/ m9 T8 c% ]
  22. * GNU General Public License for more details.( ]) x9 I, M/ f/ m8 \" J% ]$ b
  23. */
    : J4 E/ j5 T& E, O7 v; n: P# x; v0 i7 H
  24. 1 W8 u' k6 a4 f0 F" |+ E0 ^: B
  25. #include <linux/module.h>, |, H5 T: w& L+ o" i
  26. #include <linux/init.h>
    % ~, K7 X( B3 i7 f
  27. #include <linux/errno.h>
    $ M' A, b* f5 A4 N
  28. #include <linux/types.h>
    8 e7 s8 W( R, f) [  @
  29. #include <linux/interrupt.h>$ q; F6 X' f% m( V& ~
  30. #include <asm/io.h>0 L! k, T1 g, a9 {9 a' W  N$ g
  31. #include <linux/moduleparam.h>; G6 u( X0 @' |8 |+ N' r
  32. #include <linux/sysctl.h>0 f0 q" Y! Q+ A& V6 K0 O9 g
  33. #include <linux/mm.h>8 J7 R5 B) ^5 K. }
  34. #include <linux/dma-mapping.h>1 B; y3 k- B3 N& t) a5 v& O

  35. & T7 s+ l5 t: k. M( s
  36. #include <mach/memory.h>
      [! X9 V$ S) X6 R0 {
  37. #include <mach/hardware.h>5 b' I/ Y9 a6 X: ?5 I+ D
  38. #include <mach/irqs.h>
    0 L3 `, y; s5 v9 `4 p0 J/ d
  39. #include <asm/hardware/edma.h>& e- a4 F( f& _/ o) F
  40. 8 ~4 [8 Q/ }7 o: D8 Z7 Q0 q
  41. #undef EDMA3_DEBUG
    . x8 [1 G# f; M# e3 p
  42. /*#define EDMA3_DEBUG*/; W8 M6 ^  c" `" Y( ~. r0 L

  43. : e, B3 H: @/ v# ?" v4 y9 g
  44. #ifdef EDMA3_DEBUG1 M% L$ l7 y5 V/ i6 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 u! R' q, D' ?8 J: W2 J; F: t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 `! d- b9 d; f' f. l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 T; n2 x0 K& y
  48. #else
    7 s6 c2 y( I& w4 t/ l
  49. #define DMA_PRINTK( x... )6 @: }, [, K2 W2 i  d
  50. #define DMA_FN_IN' O. I. ~- Y: K% j+ B
  51. #define DMA_FN_OUT, @7 A7 u, a; X. J- Y
  52. #endif: U- L6 K7 }+ u9 R' O% M

  53. - ~" a  H3 j1 T# U3 c' {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 S$ _5 f- A* }7 e1 y
  55. #define STATIC_SHIFT                3
    # X1 i; S* H. J; {( l
  56. #define TCINTEN_SHIFT               20
    ) q  i4 N: }- ~
  57. #define ITCINTEN_SHIFT              21
    ( h+ F( B) q5 K
  58. #define TCCHEN_SHIFT                22
    ) R! |& g3 D) }; _+ E1 ?, O
  59. #define ITCCHEN_SHIFT               23
    + Y' d9 J4 I  v$ X3 P
  60. & X; v- S; @) b- z: `1 @/ P$ K
  61. static volatile int irqraised1 = 0;
    " [3 O5 }9 P% U2 O' u7 n8 j; D/ V& s7 n6 h
  62. static volatile int irqraised2 = 0;" c1 _4 ~# E  K& A0 e1 a6 W

  63. 2 S# t2 P0 t% I9 @8 A7 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 i5 ^3 a' A/ r. D5 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 P/ }# P6 c4 W% D& M- ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 b4 b! ^/ ]. q) [% x7 C; f* n
  67. ; v1 A4 u" x2 V
  68. dma_addr_t dmaphyssrc1 = 0;$ a% W& Q& c* A' P5 V
  69. dma_addr_t dmaphyssrc2 = 0;
    . |) H1 l+ o1 V; j, c4 f2 g) Y
  70. dma_addr_t dmaphysdest1 = 0;9 E6 m. Z$ h9 H7 G1 P* B
  71. dma_addr_t dmaphysdest2 = 0;' ]8 q9 y5 G1 L; T) U) H6 o
  72. : L3 B- x: X1 w. n
  73. char *dmabufsrc1 = NULL;
    ) [. P: U6 m# j" u' |+ c6 X
  74. char *dmabufsrc2 = NULL;
    8 d6 q2 Q1 E& p. H/ [7 n4 Q
  75. char *dmabufdest1 = NULL;
    ( T) d9 B' J, v+ Q' S6 O$ \% \: c  z
  76. char *dmabufdest2 = NULL;# d6 H! u8 L5 K

  77. ' T* U5 S' b! X0 {( t
  78. static int acnt = 512;
    6 X/ [+ E" L* v6 _8 J0 J
  79. static int bcnt = 8;4 E+ n& @5 I# d1 x
  80. static int ccnt = 8;2 I' F! o' Q3 S. H! u

  81. 8 x8 o; V* }" }% U4 u) ]5 v
  82. module_param(acnt, int, S_IRUGO);- [1 N0 m. c" T* K9 z! C: Y" Z4 ~" @
  83. module_param(bcnt, int, S_IRUGO);9 c4 R7 K, H6 j. s) v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ E3 I' s' f* E0 U4 H
: t: o2 V/ R3 F. x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ~/ C2 S$ G& L# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 v* o2 u+ T- D( X1 U* l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; u' N+ i7 b: b

7 c$ F4 n' q2 V3 _9 i9 r6 i/ q3 w) k3 H$ R) h- F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 06:57 , Processed in 0.036385 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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