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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % K* j1 x3 l1 }1 _: T3 x" {; q* D! Z
  1. [code]EDMA sample test application/ j) F* g+ r, b8 k
  2. /*, {& _: t0 r$ j. q9 {7 _
  3. * edma_test.c
    ) b, H- ^3 d; U, l, F
  4. *3 @) ~5 f% {9 e* L
  5. * brief  EDMA3 Test Application
    3 E  s1 I5 q9 g8 R
  6. *! f5 S; T$ |; r) |) G, ?
  7. *   This file contains EDMA3 Test code.8 p3 z7 P1 G3 `8 N% E! z
  8. *8 H4 K: n% }9 W6 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ b! k3 I5 P+ t; H. z8 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 b8 E1 D( m0 w& `* A
  11. *         TO CHANGE.( o$ h& `7 I2 A! _4 [
  12. *8 n/ D2 A' f( b& c5 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ _' D7 M9 X; S! `
  14. *
    ' G. g/ Y! F4 ?8 m
  15. * This program is free software; you can redistribute it and/or
    + r. ^  |6 G/ F
  16. * modify it under the terms of the GNU General Public License as
    3 W- C7 K3 |- I. W
  17. * published by the Free Software Foundation version 2.# G; \. @9 b. Z5 n" n
  18. *
    % Q" o2 J0 V) ^8 v; u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  Q8 O* R2 i; X/ Z* x0 a
  20. * kind, whether express or implied; without even the implied warranty7 W7 p- `& A, c# m* K* f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 @8 P5 w9 J: B. ?% x6 V/ I6 w
  22. * GNU General Public License for more details.
    5 y, j" N$ R/ Z, r; j& ?
  23. */- b# W1 E+ p0 d; d# Q- p5 j# P$ x" y
  24. 7 y" d* l1 p6 U+ o& b5 g% \6 U
  25. #include <linux/module.h>1 z/ S2 M/ p8 ~. S: y- C
  26. #include <linux/init.h>
    3 T; U, q, Q! ^, G2 m
  27. #include <linux/errno.h>
    * g9 [2 I% a: c8 ?
  28. #include <linux/types.h>
    # M  ?0 \6 M  X: j0 Z
  29. #include <linux/interrupt.h>" J. S* ^" E' o3 m
  30. #include <asm/io.h>
    # ^% I1 Y( z/ j' K& P5 e
  31. #include <linux/moduleparam.h>
    & d5 }7 _) }* a$ w: R5 V9 [: z( \
  32. #include <linux/sysctl.h>1 _' I5 D. n- v2 m- D5 G( o
  33. #include <linux/mm.h>
    + |" G! U$ o; z9 F5 p  H
  34. #include <linux/dma-mapping.h>9 s6 J. Q# o; T. _

  35. 2 ]& N3 ^0 M2 _% A
  36. #include <mach/memory.h>
    " o6 x3 K; F  W, ?
  37. #include <mach/hardware.h>
    ' M- D5 D- i0 A2 x
  38. #include <mach/irqs.h>& z4 \9 U. _$ Q" O0 T1 ^" H
  39. #include <asm/hardware/edma.h>
    ) ?! C1 Z" i$ {. q, \; Q

  40. ; L8 m. ~8 O9 z9 d! h& d- w8 O" O
  41. #undef EDMA3_DEBUG
    - o$ M! [, e; U
  42. /*#define EDMA3_DEBUG*/# ?4 ]# j0 ]  _" U0 T

  43. : R; ]; J2 a0 f* W9 l% K9 |
  44. #ifdef EDMA3_DEBUG& F/ f/ |  h- i/ q6 H- E. \+ y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : M/ G1 B" K- O8 W6 \5 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 G# f" {7 Y3 k+ u+ T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ t& |! @6 k" h. G$ y0 ]
  48. #else9 m1 |4 z$ c$ R5 @0 U  T) M
  49. #define DMA_PRINTK( x... )9 }8 F: }! B, C2 m+ A: I
  50. #define DMA_FN_IN
    / J" s" X$ Q4 i, N5 a7 _$ D
  51. #define DMA_FN_OUT" c/ I9 ^  T2 W3 W+ o
  52. #endif
    ! V( q: K: b- J, M" D7 s3 v: m

  53. ) y; _0 h/ }# o6 X; @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ X4 g6 F* t' V2 }* n. E) d
  55. #define STATIC_SHIFT                38 y; `" r4 c  l: z
  56. #define TCINTEN_SHIFT               20+ ~4 c* d2 L5 }- h1 C
  57. #define ITCINTEN_SHIFT              21. q( p' z& ?' Z7 K3 D( A
  58. #define TCCHEN_SHIFT                221 h8 ?+ z) ~+ R5 t- L- `; _
  59. #define ITCCHEN_SHIFT               23
    ; W( N! U" y7 n1 b  Q/ q$ I0 k

  60. ' j$ m' }$ I: s2 I- R% e, g+ ?. I8 h
  61. static volatile int irqraised1 = 0;. t4 @3 b1 ~7 [6 @. R
  62. static volatile int irqraised2 = 0;' \( a2 i' U' [) {3 p

  63. / \8 X+ G- F" S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 ^/ r' q5 @, h0 t! B5 ]$ j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 k0 n8 v: h+ [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 i7 r$ Q- C- n# K2 U  Z

  67. $ h& |) j; @, K  D1 q- g( A# C
  68. dma_addr_t dmaphyssrc1 = 0;2 \" a  i. J, m# I' N# d
  69. dma_addr_t dmaphyssrc2 = 0;8 P2 T' [" @4 \+ w' F7 z
  70. dma_addr_t dmaphysdest1 = 0;
      B" r  G0 D. Q* D, q1 C/ k
  71. dma_addr_t dmaphysdest2 = 0;* @% m4 Z5 `, d- U$ k  O

  72. 4 P% P( {2 {- l0 a8 ?( c& U
  73. char *dmabufsrc1 = NULL;4 d$ b  X% d7 X4 E  P. n
  74. char *dmabufsrc2 = NULL;
    + \; F3 e/ K( E/ \1 z
  75. char *dmabufdest1 = NULL;
    5 |- N* b; v0 Y5 I1 ^( s7 R, d
  76. char *dmabufdest2 = NULL;/ O' Z% b! H4 e, K9 ?! i  {

  77. ; G( _6 X+ X$ ?" Q  \0 A& L
  78. static int acnt = 512;( e' E2 _) A" K6 D/ ~5 G
  79. static int bcnt = 8;) p3 O2 {' ?/ Q+ D( Y
  80. static int ccnt = 8;
    9 `+ k+ M0 E) R$ h

  81. & X. u2 |: H7 }% B# a# i
  82. module_param(acnt, int, S_IRUGO);
    6 \& c8 q, A4 @1 I  q1 ^
  83. module_param(bcnt, int, S_IRUGO);" h& I) N0 F+ Q3 E3 E: \4 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. O4 o- b* T2 S; t8 g; ?% z+ d* ?8 q
- H: J! B% O5 U; U5 L8 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 k! M% C+ e. d2 o! z$ T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# O( H5 o5 }8 w2 r  J' @$ o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  Z- z, u2 |. K5 Z$ E6 w

6 n. p) t# K  h4 w% u, S8 J' M
) a7 z) @8 n) e5 x) X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 15:38 , Processed in 0.038508 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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