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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " ]; M4 M' J2 B) }! L
  1. [code]EDMA sample test application
    7 a5 D+ M) A3 S; h. Z4 G! [, F
  2. /*& w  Y( U) U& Z* o
  3. * edma_test.c% s6 f) X, S2 T. G( u' x% Q9 b
  4. *2 [# }) F! \& y) M( `/ p; H
  5. * brief  EDMA3 Test Application! s1 T, _4 r0 K2 g* `
  6. *
    # w6 q, i2 `" F9 O1 v: b8 }0 J
  7. *   This file contains EDMA3 Test code.
    " w; _' g+ Z0 C
  8. *) C# A1 V3 S3 b( B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  l  G) h* N6 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + x' X! L+ @5 g: t! N( X+ V; ^
  11. *         TO CHANGE.
    , j6 @7 r! l: j' L" R6 B4 T
  12. *
    6 _; D3 t: o) i7 D1 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 l7 R( H* |( Y# n, S. ^7 Q
  14. *
    7 _. N9 P( t# k* [+ D# }; q
  15. * This program is free software; you can redistribute it and/or! n& |: x/ ^$ G2 f3 ]6 y
  16. * modify it under the terms of the GNU General Public License as# A; z9 ^$ v$ }% |: p) p4 a; p2 U5 X
  17. * published by the Free Software Foundation version 2.
    5 {. l1 C( p4 |+ {, u" H
  18. *
    7 O5 W/ l2 A, T+ H- k  m0 `* e. v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- l: a: m8 R4 E
  20. * kind, whether express or implied; without even the implied warranty4 ^( l) Z. |: _# O( P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 E+ I* S) @2 r) W) l! w+ X* D
  22. * GNU General Public License for more details.
    ' y( B7 J$ G4 w% h: M  r% n4 T
  23. */+ t2 k) s. [4 ^9 x
  24. 8 f) y; l) U9 U2 y9 U
  25. #include <linux/module.h>' c4 T* G# `8 @! b( s
  26. #include <linux/init.h>9 \  H; Y" W! o
  27. #include <linux/errno.h>
    ! L0 a  h; E, g6 Z6 a4 J
  28. #include <linux/types.h>7 h5 |; M, U% {$ S/ L6 e  v/ O2 M
  29. #include <linux/interrupt.h>
    / u; O/ N4 f! f5 H3 a
  30. #include <asm/io.h>1 a* v1 q) a7 e2 K+ H! y
  31. #include <linux/moduleparam.h>; e, T5 _- p- K3 V* t! \/ e! u
  32. #include <linux/sysctl.h>
    ; m" V% o, ]& J$ W; u
  33. #include <linux/mm.h>) A/ A# T+ w2 N3 x3 S/ P, V
  34. #include <linux/dma-mapping.h>
    * w2 Q7 Y5 u2 P4 L* T/ l$ J
  35. 7 U% L9 O& y5 T  k
  36. #include <mach/memory.h>7 a; Y% e. _, l# L! Y7 h  m
  37. #include <mach/hardware.h>
    ' {+ s' T5 H" i* \( M
  38. #include <mach/irqs.h>  I, f( ]4 T8 x" V! c
  39. #include <asm/hardware/edma.h>
    & |7 E) \, O2 Y

  40. " d2 K& X9 d8 N
  41. #undef EDMA3_DEBUG
    & g5 }! y5 l4 a/ `# h9 W
  42. /*#define EDMA3_DEBUG*/
    0 X3 g1 r  B5 j8 `8 j+ Q

  43. 4 w# a; H3 M5 H2 N) p5 ]
  44. #ifdef EDMA3_DEBUG
    8 p9 Q$ T+ l* y* B" l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 K% [* ]! h( n7 z' E, f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): G9 A2 n, E8 M9 l" ~  e; J7 B! ^6 Q2 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . E8 `6 ~5 X) T3 n  h1 F
  48. #else- @3 j: p& t. r" G9 z( T
  49. #define DMA_PRINTK( x... )0 v/ b$ `9 s9 z$ R: U8 p
  50. #define DMA_FN_IN
    . A. C$ Z, O; ~; K: y7 J/ C* R
  51. #define DMA_FN_OUT
    : P* `+ r* P; v/ n5 V
  52. #endif7 s4 ~; L. J; S: V' h% J. h/ H9 }
  53. , L1 T4 u5 ?5 S2 |5 q3 T; r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* O3 r/ a  M  h
  55. #define STATIC_SHIFT                3
    ( \: r2 f# t5 Z$ w: a# _
  56. #define TCINTEN_SHIFT               20; p! E$ b7 [" ~: i# J5 k5 l" @, k/ J
  57. #define ITCINTEN_SHIFT              21
    5 F# B* r5 z/ c! E$ Z
  58. #define TCCHEN_SHIFT                22/ C7 z# q% W7 n0 C3 M* P; B
  59. #define ITCCHEN_SHIFT               23
    - Y4 q, r' }( U3 F9 w, G

  60. 4 ^" x/ e1 X  L6 S9 Y% e0 Q
  61. static volatile int irqraised1 = 0;- Y; R1 a0 X* x' }, [% N
  62. static volatile int irqraised2 = 0;+ `' h3 X1 Z% {5 Q
  63. 9 a: Z7 N% Q0 A4 D4 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 O, I0 X6 y  ?5 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ [- L( @) `: }, \, ?, F' n% X2 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 x/ j+ i/ W4 R8 |: ^5 x" J

  67. 6 o! Q" U: x3 e8 C# @! i' @
  68. dma_addr_t dmaphyssrc1 = 0;
    : W1 k/ X; L+ a% p, l
  69. dma_addr_t dmaphyssrc2 = 0;
    + c: R/ j1 N" c+ ^; i  e8 G3 T
  70. dma_addr_t dmaphysdest1 = 0;6 ?2 ~) Q6 v5 F, F6 k( v: M
  71. dma_addr_t dmaphysdest2 = 0;% c! h: l4 v& g4 n  i6 X' K

  72. 0 {& X2 `8 h% O- p
  73. char *dmabufsrc1 = NULL;
    8 [/ ~7 C0 W' x- m
  74. char *dmabufsrc2 = NULL;
    % Y8 t0 {0 O& \( W3 l
  75. char *dmabufdest1 = NULL;6 e& b+ o1 T# N0 I( a" W# W
  76. char *dmabufdest2 = NULL;
    & P- P8 g6 E0 U  b8 d: H  e

  77. , ]/ k" r3 a0 ?1 c  N
  78. static int acnt = 512;( p% I- [5 \* {# Q1 ^
  79. static int bcnt = 8;9 N5 m6 X7 {6 ~: P1 z
  80. static int ccnt = 8;+ m" t7 {. \; v& d
  81. ; I$ r6 ?2 F1 Z- |4 R" f0 H
  82. module_param(acnt, int, S_IRUGO);" X( a+ Z* ]; q: [- N% c8 ]
  83. module_param(bcnt, int, S_IRUGO);
    ! S4 |2 T- L3 j, @& V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ w' W2 |& g! S( A0 _0 [# \& @2 W- w& B, i  I& @/ g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, k, {8 I8 W- i. m, h, Karm-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 F% S3 x" V. S+ n+ \; H) s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: }& I7 u" |$ f6 C& m
( h0 i7 I1 i+ h
4 C1 A+ n/ y; q& a/ U1 U& L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 05:37 , Processed in 0.041704 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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