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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! X' p& w* d0 ~
  1. [code]EDMA sample test application/ t, w$ G& B# [" ?
  2. /*5 \+ J5 Z' k/ t! Y& w
  3. * edma_test.c
    1 p5 \3 M; z7 H" }) {
  4. *. h  v  g/ P. K9 g4 V# U
  5. * brief  EDMA3 Test Application' h$ g3 L* k2 ?4 P2 t  {* S
  6. *4 U5 l, {9 ^( C" n8 y
  7. *   This file contains EDMA3 Test code.  @( F! k* V# @/ u6 V: V
  8. *
    " b3 Y8 |1 b0 z+ A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' S3 X' b% B8 M2 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . P) b' q) _2 F+ j; v6 a
  11. *         TO CHANGE.
    7 u6 a3 e- `! @: G7 ?2 ~
  12. *
    / [' \; K" M6 O% Y' o. W4 y% S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 t  t* p4 \% k( [2 c! j
  14. *
    ' k; W  M, l( P% x# ^( s
  15. * This program is free software; you can redistribute it and/or
    $ O/ n% i& H5 T& ]$ C9 {; P, L
  16. * modify it under the terms of the GNU General Public License as
    ; i' H8 D- t  g2 |
  17. * published by the Free Software Foundation version 2.) k! |1 Y- T) b; l
  18. ** A( x- ~9 E$ Q7 Q/ @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( a, c2 d9 u! u. u: t5 n8 l9 z* ?
  20. * kind, whether express or implied; without even the implied warranty; v, k- a" n7 m$ d& N8 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 s1 G0 _# o" e8 p0 ?/ G
  22. * GNU General Public License for more details.5 W" A3 g3 u. i' `' m+ I- E
  23. */
    $ R5 Q) y  @( l, t8 D
  24. # G: C# k6 [7 {5 z' X1 M4 P
  25. #include <linux/module.h>
    . d, N' w! _( W% l0 }1 u1 C
  26. #include <linux/init.h>1 O8 A' ?+ m! E3 e9 ]
  27. #include <linux/errno.h>  n6 S$ z# K, k5 {: H
  28. #include <linux/types.h>
    0 {) G9 @1 y7 f- }: U' u& B
  29. #include <linux/interrupt.h>" j+ v9 y5 `2 l6 G) P
  30. #include <asm/io.h>+ t; b" e+ A# n. _9 u
  31. #include <linux/moduleparam.h>
    ! ~& j; I; ^- [+ b
  32. #include <linux/sysctl.h>
    1 l5 }, n2 ?$ i( M( {7 S
  33. #include <linux/mm.h>2 c# t% u/ `2 k6 r
  34. #include <linux/dma-mapping.h>
    4 t' J* B2 m: j% |* T: R& G5 c& ~

  35. 6 v; C3 U7 E# j0 h0 p
  36. #include <mach/memory.h>1 a* Y# ^! }) b6 p+ r
  37. #include <mach/hardware.h>
    / R9 x( \; y+ o! w
  38. #include <mach/irqs.h>+ G& {* j) j  d' K% b2 x5 Q
  39. #include <asm/hardware/edma.h>
    ! K9 ^, h3 _+ g* h2 N

  40. $ M2 L& P* u, _- p6 a  C% {* {! ?
  41. #undef EDMA3_DEBUG
    1 t, ]  q, a  ^. V
  42. /*#define EDMA3_DEBUG*/" o0 _1 M: X; ]3 `4 h; q0 ?! F" R
  43. 9 a  u/ O$ v+ k
  44. #ifdef EDMA3_DEBUG
    # x3 ]# U' {* v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . E5 S! _, K, x% [. n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- d1 W  L/ F5 f- v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % m( s9 g3 m* d
  48. #else. ^! f5 B. H' \0 {; U+ ~
  49. #define DMA_PRINTK( x... )
    2 v& e0 ]6 w" m! V5 ]
  50. #define DMA_FN_IN7 b2 `7 Z% b$ t( @* g# ~2 Z
  51. #define DMA_FN_OUT
    : B% L+ C# N/ z% ]
  52. #endif! A& u: W  s( m

  53. 0 T1 ~$ p+ ~* P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& [, [( e/ P+ s2 i: R  Y
  55. #define STATIC_SHIFT                3  R) e- e3 K( ~: _7 W
  56. #define TCINTEN_SHIFT               20
    $ u9 S+ l( H  p& v: A7 ]1 I
  57. #define ITCINTEN_SHIFT              21! @& z6 J) J5 b0 I! s' P1 r
  58. #define TCCHEN_SHIFT                22
    1 D4 O9 \* J, u6 C
  59. #define ITCCHEN_SHIFT               23
    " p" R, t/ D- c9 A( A7 C

  60. ( p) l; c7 G( |7 U% f9 d) @
  61. static volatile int irqraised1 = 0;
    4 n/ z0 t# ], w- N1 k# W, i
  62. static volatile int irqraised2 = 0;! y2 g! Q1 A. ~) w) Z! [

  63. ) k; ^3 T, E9 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 o( T0 Y8 b4 g! p% \) n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . ^; @. @( K: Q' X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ?; F$ A% g: f8 R) f8 R
  67. 6 i% \/ y7 W% Z4 l' G5 t' `' }
  68. dma_addr_t dmaphyssrc1 = 0;$ T5 h/ G5 ?/ ]; o4 K  E6 T
  69. dma_addr_t dmaphyssrc2 = 0;- M* q) `8 S. ?2 H8 h( D1 w7 k
  70. dma_addr_t dmaphysdest1 = 0;
    4 Z$ n8 [1 o9 U- v
  71. dma_addr_t dmaphysdest2 = 0;
    1 L0 a0 g8 c; B, n

  72. 0 j/ ?: F2 J. A9 D$ ]
  73. char *dmabufsrc1 = NULL;" u; O' Q/ z1 g! T
  74. char *dmabufsrc2 = NULL;
    ; y# a" @3 W, k0 O* p
  75. char *dmabufdest1 = NULL;
    ' o4 s. W! `5 F" p/ u1 f1 @
  76. char *dmabufdest2 = NULL;
    , B; N: k( ]& u  c

  77. & [/ z9 @" M/ v# K" b6 @" f
  78. static int acnt = 512;9 H  d; v; }2 M6 X5 H
  79. static int bcnt = 8;
    ' D9 G% J! L5 D" c/ b0 V- ~7 S
  80. static int ccnt = 8;; g, c+ f. P0 U* n( X
  81. * z2 y3 o7 l! k. C9 O6 x; _2 g
  82. module_param(acnt, int, S_IRUGO);/ c7 A+ C& O9 |9 D7 A* e7 Y+ o
  83. module_param(bcnt, int, S_IRUGO);
    + [. S. Z- M1 h1 p* k; Q3 B7 m2 J5 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; T. c4 D* K1 K3 l, c8 g. c

8 {0 O, K. V# J. U+ u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 C  y; R4 y. N. A8 E4 e' i! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 W' e" `, X8 F3 |% s# U& |) R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 x3 j3 I, G/ N5 |. y. g' @3 s/ U. `6 T" t7 Q2 ?" q9 U
0 E( M& E& F9 x7 a8 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-17 15:26 , Processed in 0.039800 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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