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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 q' }' l! A, ^* }6 l5 [
  1. [code]EDMA sample test application
    ! M/ a8 }( ^# o* k
  2. /*, x: m4 g& j. W
  3. * edma_test.c3 ]5 J  [* B, M  G
  4. *
    % }* i/ Y  Y0 ~  t( h
  5. * brief  EDMA3 Test Application0 _7 p2 z4 ?* i  v
  6. *
    5 @& W3 M. l, ], }# Z
  7. *   This file contains EDMA3 Test code.9 `, w. F5 `& T( a" c7 [6 N0 B
  8. *
    5 L. e7 w6 v% S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ F# g! r9 g; t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 u5 W$ ?  t- e& E3 H
  11. *         TO CHANGE.
      u; a- U7 ~( P1 M+ M
  12. *8 J$ A) t+ a/ g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 P1 V! w/ v$ f" G$ k2 D
  14. *6 Y$ G5 a8 a4 y* C3 v& @! T- z4 C
  15. * This program is free software; you can redistribute it and/or
    ' ]  }! |. b% w( M& O4 k
  16. * modify it under the terms of the GNU General Public License as
    2 {; b6 n  a6 J% a
  17. * published by the Free Software Foundation version 2.8 ~, i8 u; q/ k, M- s
  18. *
    : a# q5 r! q7 `+ D' D; W) h1 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 Q/ l/ G/ n# R) O/ b
  20. * kind, whether express or implied; without even the implied warranty
    3 k0 f. I6 |* \! V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 P, c7 x) n) o/ u
  22. * GNU General Public License for more details.' r; H* g: Q( X. r' [" L5 D9 P
  23. */
    # M) J- y' L+ l; r

  24. / F5 a! s) I) a, x
  25. #include <linux/module.h>7 I8 T" g# b- v% T
  26. #include <linux/init.h>3 f' b: y# `1 W8 N+ K9 g( h- s
  27. #include <linux/errno.h>
    / t" x6 G) j0 q$ U' R
  28. #include <linux/types.h>
    * L: @/ n: J2 e- X" c
  29. #include <linux/interrupt.h>
    $ |) T( t2 v4 A$ v
  30. #include <asm/io.h>
    ) V' [, F9 Y: P' a* z
  31. #include <linux/moduleparam.h>/ k$ E8 t% a- j& j
  32. #include <linux/sysctl.h>
    + w! H$ v3 k2 u' g+ h' ]
  33. #include <linux/mm.h>
    " b9 ~+ Q+ A7 s: O4 `& z) U$ X
  34. #include <linux/dma-mapping.h>+ X7 Z# Z8 C, Q! |5 j
  35. ) T6 o5 w; s7 z7 u  T2 H4 F
  36. #include <mach/memory.h>6 O! M2 e3 B4 I' v; n, Q7 T2 Q
  37. #include <mach/hardware.h>( R6 k9 m* o3 C) K2 ^2 r
  38. #include <mach/irqs.h>
    2 E) }* H. [( Z- P
  39. #include <asm/hardware/edma.h>
    5 X- [- G0 j" ?( A0 j. Q) {
  40. ( U, F; S6 L, H% B9 M
  41. #undef EDMA3_DEBUG
    ) N1 A5 A. u  g0 ], B* e4 s
  42. /*#define EDMA3_DEBUG*/
    / P# B# Z' q+ p0 X7 {! q& S
  43. 1 h: N+ c, ?3 ?/ s, P
  44. #ifdef EDMA3_DEBUG5 e) z& n9 t7 {5 c, {6 n; e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# v" `+ B. N8 b5 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 U0 Z( E! Y1 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : ?2 R- C% h) u6 h; G9 @
  48. #else) Z" H2 y$ E8 @% X5 C
  49. #define DMA_PRINTK( x... )
    0 s; a. l0 W6 B6 |. v+ u3 S5 ~
  50. #define DMA_FN_IN3 Y( A& ?- d1 h: a( n8 m5 p
  51. #define DMA_FN_OUT' K: s9 ~8 w/ L8 z# B
  52. #endif9 A' B; s' q7 n) F& t# X

  53. / L3 d3 S! U& P' `0 |( U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 K1 T( H4 c+ y) W
  55. #define STATIC_SHIFT                3  ~  z: c( Y8 O1 P8 y  g
  56. #define TCINTEN_SHIFT               20' U. l% q+ f# U4 {& ^
  57. #define ITCINTEN_SHIFT              21
    8 O; A$ L1 L! G0 I# y3 ?. d1 G9 G
  58. #define TCCHEN_SHIFT                22
    % C$ o" x+ l8 N5 c8 C5 y; g
  59. #define ITCCHEN_SHIFT               23, D5 C( K5 w# [) x# \

  60. 0 u: h# m: X4 g% k, g0 C
  61. static volatile int irqraised1 = 0;7 }; N* O9 h; m" w, t/ N
  62. static volatile int irqraised2 = 0;: _: E1 i' V! t# J* x: o; q
  63. , k" u' K3 Q3 h; L! ~: c/ K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & O) |0 F7 o; ?9 N# A% ]5 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  [& |" x/ O  v! J: g" h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! q8 G- R# _( h/ G

  67. : z8 j( }+ i0 b3 _' c
  68. dma_addr_t dmaphyssrc1 = 0;
    % K4 B$ s& h# e7 P
  69. dma_addr_t dmaphyssrc2 = 0;
    9 T  d3 @! e3 I1 {. }( _1 T# V( E$ W
  70. dma_addr_t dmaphysdest1 = 0;
    1 P7 g/ F, u, ?( ?7 e; E
  71. dma_addr_t dmaphysdest2 = 0;9 y! b7 C% x3 T; ^; A2 `
  72. $ e# l0 H6 P7 K- d' w1 G# Y1 D
  73. char *dmabufsrc1 = NULL;* U3 v; O' v! R; a( Y* C8 \
  74. char *dmabufsrc2 = NULL;
    % ~6 G+ D9 ]: ~
  75. char *dmabufdest1 = NULL;* V6 G. y# _. _3 J$ p  t; r
  76. char *dmabufdest2 = NULL;
    4 V( T$ m! |" A# }% ?

  77. 6 B- L( K" B. m' N. x7 n# b0 l( j
  78. static int acnt = 512;; ?$ M' |: f9 o4 y
  79. static int bcnt = 8;1 a, q( t5 q( ?' D
  80. static int ccnt = 8;
    $ x% N5 _+ e+ m. h$ _( v1 V; l1 ?

  81. ! _5 R, [2 |/ O3 A) H
  82. module_param(acnt, int, S_IRUGO);
    ) A2 H3 x) Q2 \5 ^
  83. module_param(bcnt, int, S_IRUGO);: {3 Q/ I9 Q1 y. h) k; V5 k8 |, j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 y% X0 S9 ^# V  M+ I$ o: w
: L2 J# D; s( U3 `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ _/ @) g; U4 m+ t% r) Y1 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- X/ L" x9 X6 V" Z; C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, z" P6 @* _7 q' X$ T! @% n" X- a& Z5 |% e  D6 c9 p; p
1 X3 I  s" M4 t+ u1 l0 @5 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 23:46 , Processed in 0.043568 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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