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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : K& t* P) F. R4 W- z
  1. [code]EDMA sample test application: E4 E1 r9 e$ c+ O$ S4 N
  2. /*& V& h3 C& X, b1 d/ R# Z) K8 f+ H
  3. * edma_test.c
    ( k  |4 b, ?0 `& Q" Q
  4. *
    4 d4 V+ u9 T6 ?
  5. * brief  EDMA3 Test Application
    . O% W2 f) ]2 ~- e3 W
  6. *
    + t2 B( c$ d/ L" n
  7. *   This file contains EDMA3 Test code.
    9 m3 t$ f$ j- a& b
  8. *
    0 b/ D2 S$ E: e  F# a# p& h7 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 V$ K1 Y  I- c! [' r8 \! y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 T! ]6 _5 x: R- D' i
  11. *         TO CHANGE.
    / E! M0 }1 h  @, O) C
  12. *
    4 [$ w2 m/ G7 D- a4 B6 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 p% Y4 x$ z  O0 N6 I6 Y4 ~
  14. *; p4 u. _/ {4 B$ x  f
  15. * This program is free software; you can redistribute it and/or  a$ S. c7 k+ P3 ?* t
  16. * modify it under the terms of the GNU General Public License as. b) l' @% F5 M) J  a+ R
  17. * published by the Free Software Foundation version 2./ j% _7 M$ F! @! o2 q3 v
  18. *+ y* ?/ C! r% q+ f. C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % @9 `- B4 l- ^1 A* z, }# }
  20. * kind, whether express or implied; without even the implied warranty3 @& w4 t1 }- |( d1 X! K  Y: p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 \& a3 h1 J: @4 q* X
  22. * GNU General Public License for more details., Z) L) u9 m, _+ C4 _
  23. */
    ) r$ X6 j* J- k) ^; M9 v/ z. Q

  24. # t9 f" J( ~1 j! D$ B3 A$ M
  25. #include <linux/module.h>1 s& A' W' y! d$ r$ H
  26. #include <linux/init.h>
    $ R/ |" Z1 x. Q9 O% H" q  n
  27. #include <linux/errno.h>, h& u: e, d! q
  28. #include <linux/types.h>' K3 j0 y6 _) q0 {& M& \
  29. #include <linux/interrupt.h># G3 `& u, x3 G- N% _! R
  30. #include <asm/io.h>
    3 G0 f- y' F' B% d. ^  O
  31. #include <linux/moduleparam.h>
    1 ^5 K2 j7 k9 E+ e$ V
  32. #include <linux/sysctl.h>3 a. |% x" W- X: Q( R
  33. #include <linux/mm.h>
    ! z7 _0 i- m# @4 W9 u0 E' W
  34. #include <linux/dma-mapping.h>7 z; v- D8 ^% E! c# h
  35. 0 f$ k/ d' V2 E$ I- ~8 ]
  36. #include <mach/memory.h>+ j8 i& Q! F/ h& p) u) g' @* [
  37. #include <mach/hardware.h>* m' c! p# z4 k, m6 u; g
  38. #include <mach/irqs.h>0 B1 i- f# m  f2 p
  39. #include <asm/hardware/edma.h>6 p1 z* e  `8 A4 e2 B8 l* {' T

  40. 5 D9 H3 b7 G' ~5 u! p* d
  41. #undef EDMA3_DEBUG# E2 n2 d: @" V9 Y( t
  42. /*#define EDMA3_DEBUG*/
    ! K  W" z% y( U/ l
  43.   L+ L% C( B1 j) t- N; R
  44. #ifdef EDMA3_DEBUG" g6 M2 R9 Y" W- T  d9 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ C4 Z0 j  [3 M' `5 ^- k3 p) z( R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); g8 }  u6 p/ i  p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! V+ A% q( u, v6 I
  48. #else
    : g7 w4 b; R; U+ ?# l
  49. #define DMA_PRINTK( x... )" Q  }$ p. P( f, P. }4 R/ e1 s
  50. #define DMA_FN_IN
    # Y& E1 x/ _3 r; t+ T; s
  51. #define DMA_FN_OUT
    1 Y% L2 g! x% B6 t) f- o
  52. #endif' ^4 m* k) |* s( ^! v
  53. + Z; j: m! H0 w5 a9 {) l1 N& D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" y- `( x  ^0 y* t9 a$ k1 a3 p( G! M
  55. #define STATIC_SHIFT                3
    3 ]  @. T1 Q/ W" V& _0 `7 C
  56. #define TCINTEN_SHIFT               20: y, ^: p* O* H3 J
  57. #define ITCINTEN_SHIFT              213 m4 g5 ~3 s* h. O. [
  58. #define TCCHEN_SHIFT                22
    : X) I* v6 `9 [0 I. @. z
  59. #define ITCCHEN_SHIFT               23
    . r6 s, l- a. ?7 C+ N4 v

  60. # D! N% d# o7 X  ?% s, n
  61. static volatile int irqraised1 = 0;
    - l* L  D8 J# e% P
  62. static volatile int irqraised2 = 0;' Q" A1 Q5 ^5 I6 }$ R( q, h2 N
  63. 6 w. Q2 q6 D' q0 N% e: ~$ L9 R+ ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v' c: D. s" f$ x" r. P, d% X# Z# R& y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ x0 @7 X  i8 o8 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. j% \7 m- l5 a4 I7 J

  67. " B. i, W$ h9 U6 p# v
  68. dma_addr_t dmaphyssrc1 = 0;
    / E# K. x3 {# t7 u
  69. dma_addr_t dmaphyssrc2 = 0;: |! \4 |% X! G$ M9 O" M
  70. dma_addr_t dmaphysdest1 = 0;  O& g- ~3 e. p- K
  71. dma_addr_t dmaphysdest2 = 0;
    # [$ ]- @; m6 i; O& ^
  72. / d0 e. U2 z3 a. c
  73. char *dmabufsrc1 = NULL;2 c- Z% Y, @0 T* S
  74. char *dmabufsrc2 = NULL;
      _* I+ {: ^% ^+ U; N
  75. char *dmabufdest1 = NULL;
      [: O) y9 R5 t9 |
  76. char *dmabufdest2 = NULL;
    6 P! z- O) A) \/ @

  77. $ q) T# d! w" N6 n0 ?  x  }
  78. static int acnt = 512;
    " ]% h& o9 A7 f+ }4 d
  79. static int bcnt = 8;
    9 _" d* ^8 p* I' h5 P% P5 r
  80. static int ccnt = 8;
    6 @, D/ Q. c$ a  z
  81. - h4 J8 S! x# t0 g" W- C
  82. module_param(acnt, int, S_IRUGO);
    $ R& ?9 D9 }5 o- K* n* G4 N
  83. module_param(bcnt, int, S_IRUGO);
    0 F0 u/ _9 J. @+ E  p$ q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& A2 p* w+ Y: B6 `4 m
, J; C6 P7 ]) U) x2 M' c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& ~+ b- i$ u; }8 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 e" C" D) n+ \' H# Y& \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* a, n0 M  H* l- i$ u3 W6 t: d/ n5 g# V+ {
. |& H% B: U% O. u* t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 05:57 , Processed in 0.037139 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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