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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, Q0 o! K% T7 \8 U' Q# {
  1. [code]EDMA sample test application
    % j) a$ H  {- l' e3 |
  2. /*& Q# H8 p+ r5 S' I6 ?
  3. * edma_test.c8 K2 ?7 e, z; s" G
  4. *" H+ p0 U6 s2 t6 z2 T$ Z3 k
  5. * brief  EDMA3 Test Application! B  r" X  Q' ^' n: V. C1 O
  6. *- v% ]9 f/ B7 L! ^$ @, n) c
  7. *   This file contains EDMA3 Test code.
    * ?- d1 j7 o* ?5 G7 a* d6 X. o
  8. *
    " P8 C& f: G- C2 _: _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( a6 ]3 D1 s) ^0 h5 q& K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + ?8 b4 M3 ?* s- }
  11. *         TO CHANGE.
    ; i8 J& G  F  j: e( i6 T9 Z, e3 h* }
  12. *
    ! K& \6 h+ z1 n7 X& b5 C  R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 h, D/ j" c0 o( f. v8 }7 V
  14. *3 p! |$ M+ g  ]2 A" R! P
  15. * This program is free software; you can redistribute it and/or
    % z8 T% h' G# m$ e" O' ?/ N: Q
  16. * modify it under the terms of the GNU General Public License as9 p- Q) l- H1 E; T
  17. * published by the Free Software Foundation version 2.
    & x# N7 d$ d9 |; x
  18. *
    % K- e5 ]) y. i3 f0 u1 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' v: Q7 H5 F5 ]2 E0 I7 Z. |
  20. * kind, whether express or implied; without even the implied warranty
    * T& b/ A. h- V! ~+ B1 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; ^' S/ K" [% x2 @' Z' D  a/ \) D; I
  22. * GNU General Public License for more details.0 \9 D5 g' b6 t; n+ e
  23. */
      Y9 [' l% P" i& ?

  24. + d& S+ {. T. B' r& b
  25. #include <linux/module.h>
    + R4 y7 T! N. N2 _( U; Y
  26. #include <linux/init.h>/ `* V* T9 ]$ U4 X( S# f9 E
  27. #include <linux/errno.h>
    6 C2 E3 X. f- u, l/ d
  28. #include <linux/types.h>
    1 b: ]0 I% T+ A3 P3 @
  29. #include <linux/interrupt.h>
      q: ~, A" b, y
  30. #include <asm/io.h>0 z# v& A7 g" I/ O- V
  31. #include <linux/moduleparam.h>
    & w+ c7 u% k$ h0 L. D
  32. #include <linux/sysctl.h>
    # ~. F9 C1 j. p& |
  33. #include <linux/mm.h>
    # m' @5 A! b5 L0 X) f' D
  34. #include <linux/dma-mapping.h>, l/ @( r( j. d/ c7 ?, @
  35. * t- G6 s* H  k* m
  36. #include <mach/memory.h>* u6 c! v7 J- r$ ]5 B, o
  37. #include <mach/hardware.h>$ N5 C& y) X" }2 @2 l$ T1 x! s; q* z
  38. #include <mach/irqs.h>4 y; L$ ~/ a" E, p0 y8 x' n, M
  39. #include <asm/hardware/edma.h>/ u7 c/ E  }1 c& s
  40. 4 s' u5 o# b8 }! k% l
  41. #undef EDMA3_DEBUG
    4 D/ d2 N* a- y/ @2 Z
  42. /*#define EDMA3_DEBUG*/! G( r( l7 }; Q6 e

  43. & _- Z+ y* K6 u0 a; n; {
  44. #ifdef EDMA3_DEBUG
    " o; x2 g  C0 S2 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 T2 `8 B9 Z2 E( `7 T% v: j* [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 U8 i! i" w. z1 I- F8 g9 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      F" v/ B9 {1 @# Y
  48. #else
    : F7 Z/ b' Z- I5 q
  49. #define DMA_PRINTK( x... )9 p: f; j; F2 a
  50. #define DMA_FN_IN
    4 ]5 c7 F/ N: B" F
  51. #define DMA_FN_OUT
    * A/ l5 Z) H! G& C1 g
  52. #endif# h) W& e: ^& o$ ?" `. y* J7 i
  53. / f+ N8 z  S) X1 D. Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + f$ e3 M$ s7 k# @2 T4 J/ w
  55. #define STATIC_SHIFT                3
    3 k7 `4 ?- _9 d+ \
  56. #define TCINTEN_SHIFT               20
      m2 A0 J6 m' j3 N& F
  57. #define ITCINTEN_SHIFT              21* y5 v- ~$ a* ]
  58. #define TCCHEN_SHIFT                22
    3 m" F/ o5 L" N& G; p' n( C
  59. #define ITCCHEN_SHIFT               23
      M( a' U8 v  k0 ^  E
  60.   d- L& b0 }/ D, q( K2 Z
  61. static volatile int irqraised1 = 0;0 q& Y* `4 d! f$ ^# `
  62. static volatile int irqraised2 = 0;
    2 M% q3 j3 F) G5 k4 T
  63. & C+ j" `7 T9 T  h, {6 j4 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - S, ^- ]# l6 P2 N: U  Y8 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , J2 C0 E. H( V: z9 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 Y4 @4 G! t4 R5 Z$ j. {$ _4 I
  67. # R0 b6 F7 R5 @; s/ G7 l1 l. d
  68. dma_addr_t dmaphyssrc1 = 0;
    9 C6 S6 t1 g" y5 h- }
  69. dma_addr_t dmaphyssrc2 = 0;
    % e( w# @! {' a
  70. dma_addr_t dmaphysdest1 = 0;
    # P( {4 Y, @. {6 ?, s1 u/ U
  71. dma_addr_t dmaphysdest2 = 0;
    7 Z5 ~& X* N  y; w; C6 V

  72. ; q+ c$ u2 q  @/ d) @
  73. char *dmabufsrc1 = NULL;
    / r0 w) f9 x7 H# e5 q9 }
  74. char *dmabufsrc2 = NULL;8 {# f( A/ R; E0 Z3 |& U
  75. char *dmabufdest1 = NULL;- ~$ K7 l0 a6 G" o
  76. char *dmabufdest2 = NULL;& Y  g1 K  X8 Q- ^6 q+ J& E" L
  77. 8 S! R2 Q0 W4 e) f  @" F
  78. static int acnt = 512;
    , o3 \1 _0 x4 N4 R2 V7 |
  79. static int bcnt = 8;7 m% R  {9 q3 @+ t
  80. static int ccnt = 8;
    + M! Y+ t- C- K

  81. , D2 @5 {; Y) H1 @/ o2 u# d3 V+ X
  82. module_param(acnt, int, S_IRUGO);
    3 f2 D" B& O4 M+ ]
  83. module_param(bcnt, int, S_IRUGO);8 c6 T8 {, |, q- b5 q& @8 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% c) I! L4 ^$ w! ~  C8 r

) u1 S& q! K# n) F* D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# c. p# }4 I, C$ U: f) Aarm-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+ |( c6 J% l. {$ N6 @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" v9 N: t% M5 w1 s( a/ g# c8 N: G
6 |2 E/ D: _* ^$ v
5 Z* U9 e" T; e. W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 16:52 , Processed in 0.040480 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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