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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! V- i% O; ]2 X, C
  1. [code]EDMA sample test application
      {: k/ U# E: x# i* T
  2. /*: b7 j* \% X7 |. C3 w" {" Z/ B
  3. * edma_test.c
    * O% p* Q! y. v# Q# |( p* d% ?
  4. *1 X1 p- O1 f$ x: A& w. r+ q
  5. * brief  EDMA3 Test Application+ e! F5 w7 v  j, J: a% T8 Z
  6. *! C  X) k+ L7 m; w7 W
  7. *   This file contains EDMA3 Test code.
    9 J3 ]9 r: C9 Y! \
  8. *
      z6 Z+ d( k" |9 ~, L  S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 t  l3 x' O8 q' T; O/ w3 l7 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 h! w' D: |5 N0 `+ W
  11. *         TO CHANGE.+ N3 v( _4 e1 m5 g
  12. *0 V; [0 f: P, f1 B: ^4 j9 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 ~4 }7 _! ~/ Y/ \' D5 r
  14. *. X$ C9 m. [, `& w) p5 T' y+ A8 z
  15. * This program is free software; you can redistribute it and/or: c. E/ c& ^9 F( U* ]$ g
  16. * modify it under the terms of the GNU General Public License as
    8 v( G0 h- P; f/ {$ y; S
  17. * published by the Free Software Foundation version 2.
    / a. d. p3 |; {/ K7 M- N& |
  18. *; E$ |( ?, \* S' U5 @& z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; }/ D, K& v' _" h" N
  20. * kind, whether express or implied; without even the implied warranty6 l) n$ ~0 f; ~4 d. P* x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' n; G7 g1 N" d$ G# d. i2 `  Q: B/ J: \- v
  22. * GNU General Public License for more details.
    6 [  s) B0 D% a, z
  23. */' m0 q7 H# \7 P/ ]8 o- ^

  24. , ]' o1 v3 h' O9 n* K8 r' y
  25. #include <linux/module.h>
    - N/ y6 F1 v" u, {8 i; R
  26. #include <linux/init.h>& _0 o9 S$ A! z* F) G2 `
  27. #include <linux/errno.h>
    7 B8 v7 S( o0 i5 b# ~
  28. #include <linux/types.h>
    1 K; q  R; d+ y$ K
  29. #include <linux/interrupt.h>
    7 a# \: t9 Y8 s
  30. #include <asm/io.h>- f" s- f; [# O6 R
  31. #include <linux/moduleparam.h>
    . v2 P5 t5 U8 X' K) ^7 A, j
  32. #include <linux/sysctl.h>6 l6 ]; f) B, t5 R7 c
  33. #include <linux/mm.h>+ W* s$ }3 M4 Q: n
  34. #include <linux/dma-mapping.h>0 O) f0 u* N/ H! f
  35. 6 ^  Q  ^0 e$ {+ b8 T5 e
  36. #include <mach/memory.h>
    + j1 T/ j+ F) J; c
  37. #include <mach/hardware.h>  g/ ]: k4 k( l& Q2 C% A3 i
  38. #include <mach/irqs.h>
    , P% [+ P. h& p  n% G- B
  39. #include <asm/hardware/edma.h>
    5 P8 }5 T! X" q. n# B+ [; ~
  40. / `0 C8 K  B0 T# d1 X9 R+ C+ C1 d" Y4 b
  41. #undef EDMA3_DEBUG
    / I$ i. G3 W0 P# D0 _# j, Z
  42. /*#define EDMA3_DEBUG*/' x6 }$ a0 ~( O+ p8 h1 O8 P
  43. # U, {! y- c+ ^& D$ B& X& M# c
  44. #ifdef EDMA3_DEBUG
      i9 E% p& B$ L8 W! E6 U8 F3 e) i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! Z; t3 P0 y) H* u0 }) O# u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" U% ^' i$ t( }& y$ Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / o! c. T8 a8 I# n0 p# o
  48. #else
    # k6 v8 g5 k2 f7 ^& D1 }# @: [
  49. #define DMA_PRINTK( x... )
    " P* A1 P- ~9 b7 G
  50. #define DMA_FN_IN
    " a5 I, P# h) e/ k3 r/ T! D6 v
  51. #define DMA_FN_OUT1 J% K7 k; C1 B8 l7 i) e8 I" y0 ^
  52. #endif% L7 D3 m- {  ~! x5 z  G: M: w4 s

  53. 1 j$ w3 d, b( z, u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & M, k2 ^, d- E' [! `
  55. #define STATIC_SHIFT                3* W* @8 D0 M" X* C+ E* f- Y1 [
  56. #define TCINTEN_SHIFT               20
    ( G. N9 B9 U- l3 L8 g+ K
  57. #define ITCINTEN_SHIFT              21' l, F9 ?9 t' |: u$ ~
  58. #define TCCHEN_SHIFT                22$ \- W- w7 D; a- q& {  s, w$ Z' S
  59. #define ITCCHEN_SHIFT               23% X9 ^4 I' O) U  Z: y# J
  60. 9 |9 c3 z( D5 r1 Q
  61. static volatile int irqraised1 = 0;( M% i( D; b* J7 f- r+ B
  62. static volatile int irqraised2 = 0;; J! D" p5 V0 _& v
  63. : x, V- y  k9 L. r6 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( Y. C3 Y+ T) f6 P) e  p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 A* ^* B$ }5 `/ `. @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % {4 g1 s5 ?% `7 N$ h

  67. 3 e1 j; Q/ O& c$ B0 w
  68. dma_addr_t dmaphyssrc1 = 0;7 n$ I$ y6 A$ i4 w
  69. dma_addr_t dmaphyssrc2 = 0;
    & P( \8 L3 K9 ?" K" Z
  70. dma_addr_t dmaphysdest1 = 0;$ O0 p% }, }7 L  }  R. X% D5 r
  71. dma_addr_t dmaphysdest2 = 0;8 g, [2 H& q. ^
  72.   C  P4 b- V1 }5 Z/ U# m( o
  73. char *dmabufsrc1 = NULL;
    ) h  f! h8 d$ w
  74. char *dmabufsrc2 = NULL;/ d7 I. i: a) I  R
  75. char *dmabufdest1 = NULL;; M$ K1 L8 w# [& q5 b
  76. char *dmabufdest2 = NULL;
    # s: e7 B' X3 L4 w
  77. + B3 B! ^# c. b1 |# y/ V
  78. static int acnt = 512;
    # J, W- O# `9 I) _3 M, p0 {. v
  79. static int bcnt = 8;
    # t7 z6 Z% j2 z. N. f9 R7 u
  80. static int ccnt = 8;. P2 F# i0 |4 x# ^. m+ b8 n7 E

  81. % L7 L% S# w6 X2 L! d
  82. module_param(acnt, int, S_IRUGO);
    : }6 q$ K) K* ^+ }2 {1 y
  83. module_param(bcnt, int, S_IRUGO);
    " B) ^: G7 s! N5 c, V  R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- R. F' p; L: e* e8 r% ~9 D4 m3 i9 K) D/ U$ g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! V9 T4 A  G/ H% w& ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ _7 _+ ^* e- n! C! N' U& Q( i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: }  O- K% V* C4 Y5 O- p( r

0 ^. o2 L) u5 i: e: X4 q/ U3 g3 S0 _, w+ L! k" g/ @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 23:58 , Processed in 0.038837 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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