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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + S6 `7 X. p: ?8 t. c
  1. [code]EDMA sample test application& B4 p0 x1 Z& h0 e  T# i
  2. /*
    8 e7 v1 E! M7 a7 V- |
  3. * edma_test.c# `0 {) H; G/ u% k1 I
  4. *2 ]3 t9 l9 o) Z/ `) m0 i: f
  5. * brief  EDMA3 Test Application
      Y2 A- A' l2 w2 r: T( B) j
  6. *% @9 \) x# g1 n' l
  7. *   This file contains EDMA3 Test code.4 y( n/ B0 y* |( S( t+ R1 A1 v
  8. *
    ' N/ C0 ~; ]3 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & j3 ]1 S" w/ `" H+ S+ ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; L7 c- {  {. D2 t, {% f
  11. *         TO CHANGE.& t5 K! h; I- o7 |" g' k
  12. *
    0 j( l; R0 |( K; t, @* m# B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ a9 [; p  i" I& y# q6 J/ e
  14. *4 F1 Q" Y0 x5 F1 S0 n
  15. * This program is free software; you can redistribute it and/or
    ' t) r/ [  u. u  C  S3 C" k% Z
  16. * modify it under the terms of the GNU General Public License as
    : y5 u0 s  `  z& {0 ^" F0 v1 D
  17. * published by the Free Software Foundation version 2.
    0 [  Q. H& q) @
  18. *" h0 [5 b! s8 j  `+ c- U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 J0 d: D! k" @5 i
  20. * kind, whether express or implied; without even the implied warranty" l6 ^4 J" D+ g& H  ]0 a0 z* J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ K* P' h1 w3 D4 V9 Q. V3 `
  22. * GNU General Public License for more details.( v2 a6 e- U" C) u* }% D8 c
  23. */7 t1 @$ V0 }) Z6 j2 l

  24. 0 R! n% d7 O1 A. z
  25. #include <linux/module.h>3 [% M' K5 `3 \9 N, y( q
  26. #include <linux/init.h>8 M2 \/ k% @- L/ }- ]
  27. #include <linux/errno.h>
    2 [& [$ v% G0 Q- R) `. R. Z3 T
  28. #include <linux/types.h>
    ( v& K( s' C$ Z. C1 C
  29. #include <linux/interrupt.h>; M5 ~, r6 z+ F, j! T. x- m
  30. #include <asm/io.h>
    ! f7 N3 V( C. D, z" ?; V8 ]
  31. #include <linux/moduleparam.h>9 o6 y. X5 F! O4 A+ P! X
  32. #include <linux/sysctl.h># q# X- x+ \- P: V% G0 i; X: _
  33. #include <linux/mm.h>
    . l' Z, }% }# ^! k. O1 m1 t
  34. #include <linux/dma-mapping.h>
    * V9 D/ L# p. _% ]/ A$ L
  35. 6 x0 Y& u7 j+ c, f  {) ^6 F
  36. #include <mach/memory.h>
    # t1 \* @' b5 R( g1 V9 R
  37. #include <mach/hardware.h>
    + U' K1 f0 ?1 I  V2 {5 t2 B! L
  38. #include <mach/irqs.h>
    7 B* E, w$ B% C* |! k
  39. #include <asm/hardware/edma.h>
    1 N6 D* `; g5 D; A$ w- R! U

  40. 4 D- @& r8 E) b
  41. #undef EDMA3_DEBUG5 b/ c  N& j1 a; V6 G, B- x% G. E
  42. /*#define EDMA3_DEBUG*/+ q# c  d9 F. X4 m2 H, r
  43. ) a3 Z  r3 u$ Z" K1 I  L; F
  44. #ifdef EDMA3_DEBUG
    ' u2 V! D5 ?/ `+ P, {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 a2 c, P6 ~, ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # }4 }. b6 H/ a. \: W" `2 f# p$ B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' p) G1 J5 \7 s% I; H
  48. #else
    & j4 J# d! I4 O
  49. #define DMA_PRINTK( x... )$ j: ], T2 x; i) ?* s
  50. #define DMA_FN_IN
    + N: i( r* a6 l, J, ]' r
  51. #define DMA_FN_OUT; S$ }$ ?% R( V5 {0 C# M- Z& x$ f
  52. #endif/ J+ Q8 q( {& k6 R1 E

  53. 4 G" e# L* z, j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / z; o9 P/ _' w% q, z( V- c
  55. #define STATIC_SHIFT                3
    ; ]6 G* K: E7 `: I, }0 W& u
  56. #define TCINTEN_SHIFT               20# S; @2 A% |& v1 F" c7 E
  57. #define ITCINTEN_SHIFT              21
    $ G7 b* ~3 H) ]5 V% K6 W6 P
  58. #define TCCHEN_SHIFT                22* T  ]5 j" f% w0 z" b3 u) |0 c
  59. #define ITCCHEN_SHIFT               23* c1 r+ e$ k( F5 ^
  60. 0 p( s! ?1 j! K2 z" h+ m3 x
  61. static volatile int irqraised1 = 0;
    3 l  Z! f5 F0 M( M  I& o) _" ]
  62. static volatile int irqraised2 = 0;
    4 R) w0 O8 ]& X* j1 ]# n! A
  63. 4 u6 N% S- u- \! c- {0 H! d/ v% I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {, Z" _# O4 z0 \; I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Q) X3 x- S3 f' Z/ \: I, O: i; E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 b8 f  [# {  h( z3 [

  67. ! ^  @/ m" J4 Z! E0 Y' y8 C
  68. dma_addr_t dmaphyssrc1 = 0;% T' Y) h4 r. O. b
  69. dma_addr_t dmaphyssrc2 = 0;+ w) `3 B, G: p  w
  70. dma_addr_t dmaphysdest1 = 0;  B  g' z6 @) f9 M. L  R, o3 H
  71. dma_addr_t dmaphysdest2 = 0;" I- {5 B; j! b, p

  72. " v2 T2 O- B5 [5 O6 C: W
  73. char *dmabufsrc1 = NULL;  ^" N2 O0 O" ]
  74. char *dmabufsrc2 = NULL;
    + }; p( Y8 Q, ^2 f
  75. char *dmabufdest1 = NULL;- ^9 ^( s4 \" E# ]; L
  76. char *dmabufdest2 = NULL;5 W, g+ Y$ ?2 S6 T/ a6 ^4 P

  77. - o0 Z; f  f$ n* H" l* k
  78. static int acnt = 512;
    , R& l9 e% U& _9 T
  79. static int bcnt = 8;- l6 n8 q1 t% J
  80. static int ccnt = 8;+ ^5 R  ~' r% Q/ O+ I

  81. 1 [; P' T" }7 ~/ H. V0 r3 z) F9 K
  82. module_param(acnt, int, S_IRUGO);
    2 }0 ]- {+ t8 E5 O" K
  83. module_param(bcnt, int, S_IRUGO);$ Q+ G5 b  ~& t, g0 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 b9 [! q! K+ b
! W5 M) G1 ^) j7 ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, Q) P+ N+ b, A  H( x7 ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% I( k; b" |: ?  t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 }8 a( T3 I2 E' q9 U( P& u
; B* F2 d0 P* \1 S3 Y
& v( z( W- q) ]( p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 10:52 , Processed in 0.041133 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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