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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: y: s4 f1 w% N
  1. [code]EDMA sample test application# [& @; c2 y( {1 }8 ?3 ?
  2. /** W4 z" a: |/ Q8 c
  3. * edma_test.c4 Y3 S% Q) G6 S. B; j
  4. *, c% {/ i7 p5 f* W6 t2 J, o
  5. * brief  EDMA3 Test Application2 r: Q/ \$ v2 q0 h, U% G- A
  6. *
    / [2 a0 _/ F( K% D: a: x, F) b+ o
  7. *   This file contains EDMA3 Test code.
    6 J$ j2 `0 C! v5 L: Z% v
  8. *
    / n' o1 b# U9 _! i9 ~. S# D3 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # Z  V2 F1 Z8 |& n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  T$ k3 n+ F2 r- R4 G5 q; ]
  11. *         TO CHANGE.
    4 F6 F4 r. y6 O
  12. *) X* _4 Y1 K6 z3 I; V8 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 E# |5 P' x0 d7 ]0 C+ F
  14. *
    . c. ]6 m2 }; r& Z6 y% }* J- c
  15. * This program is free software; you can redistribute it and/or
    : ^3 @3 g; U$ W0 S8 J$ h7 Q5 V
  16. * modify it under the terms of the GNU General Public License as
    5 k' @$ C  k* O% F
  17. * published by the Free Software Foundation version 2.2 p4 b  V) H. K
  18. *3 g# s1 o9 ~# e/ x+ r# u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' C, x7 @8 e4 D- _7 z' |
  20. * kind, whether express or implied; without even the implied warranty, \, t( y. Q1 j  A9 t' ]. m8 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, C% S3 N! O  H! r0 H/ p; j
  22. * GNU General Public License for more details.
    0 V1 |7 n0 P( W  W. H/ ^" b
  23. */
    8 S$ u6 k# i# Y  x& o9 @. ~- R9 o7 r
  24. + N0 R! R2 \  Q( T; N
  25. #include <linux/module.h>
    ( M0 Q. P1 }2 }) @
  26. #include <linux/init.h>- ]7 ^7 L; L1 b  F
  27. #include <linux/errno.h>: `5 b( k. g* i( m4 U7 s7 S
  28. #include <linux/types.h>2 F4 |) P5 \! {, l
  29. #include <linux/interrupt.h>. v1 j: \; B7 J# V& T
  30. #include <asm/io.h>4 J) \5 r! `# y- g* i* U
  31. #include <linux/moduleparam.h>; k& _0 M. q0 E6 P
  32. #include <linux/sysctl.h>
    $ {; u6 H4 H" t( F9 z! e7 {
  33. #include <linux/mm.h>6 V3 g8 u5 s: m8 e' K
  34. #include <linux/dma-mapping.h>
    ( a6 N9 Q0 m5 s. n: L$ q

  35. $ |& W0 t/ |$ @! k
  36. #include <mach/memory.h>" m$ f, C! \0 p5 a- K2 S
  37. #include <mach/hardware.h>
    ( c: e- E0 A& D
  38. #include <mach/irqs.h>
    4 x$ Q, _7 X" \* x4 b* {# e/ w5 M4 k! z# |
  39. #include <asm/hardware/edma.h>- Q/ {3 q/ s) ^8 q

  40. ' b1 g8 S* k7 }  [! z& F5 c/ q1 l* P
  41. #undef EDMA3_DEBUG
    ( Y; q) h4 g* ]1 R
  42. /*#define EDMA3_DEBUG*/
    1 g1 H  R! S5 h  q# ~  \; Z

  43. 0 R) e( q" ~8 f& h
  44. #ifdef EDMA3_DEBUG4 `; a5 ~: @8 b/ A: B1 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 \, K& Q! N; H' Z% P, ~' H  H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 c# S+ Y. M. X# I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 [& W  H' @, _4 U4 g# A- X1 e
  48. #else: i1 A2 [- N. c1 V1 m8 `
  49. #define DMA_PRINTK( x... )/ g9 Z' L" e) C6 A* d% X6 L3 s( a
  50. #define DMA_FN_IN1 ?2 A1 ?: F7 t1 e' F4 k+ H/ m* t. ^
  51. #define DMA_FN_OUT4 C  S* l% y; @/ K7 y& S/ i
  52. #endif/ F2 ^0 s9 N% c

  53. 9 j- Z3 `8 g- k6 I6 k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' v) u, P# t& H8 a) z, K
  55. #define STATIC_SHIFT                3
    2 d7 i) [- E5 Z: v- Z
  56. #define TCINTEN_SHIFT               20) I* ?$ L) P* F/ G, P2 H3 U0 V
  57. #define ITCINTEN_SHIFT              21* H2 N  _' @: X4 U8 k3 ]
  58. #define TCCHEN_SHIFT                226 O) `% z* ?; |: q) _. B4 [# g
  59. #define ITCCHEN_SHIFT               23
    / H. A& Y$ c: O; s# F( X! a

  60. 6 H1 N5 X1 _8 w/ O% j. @& [# |4 N
  61. static volatile int irqraised1 = 0;
    : A1 t" s% ?6 _$ p, y7 f& w6 ~
  62. static volatile int irqraised2 = 0;
    ( }& U' k; r! d, C% ]" w: s) E
  63. ) l4 g; n1 B) i) t( O- Q- j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 W6 _5 Y7 J8 V" b. z# G( d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 o  P  k4 a9 @5 E5 V! x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) p  B2 K6 X$ x  O6 m; w

  67.   n# y& f2 ^  @, C+ @# m$ s9 _
  68. dma_addr_t dmaphyssrc1 = 0;
    - i2 [5 o0 L3 u
  69. dma_addr_t dmaphyssrc2 = 0;' e" I. P: F: _
  70. dma_addr_t dmaphysdest1 = 0;8 G; s& V' L. J1 S3 o# S" U
  71. dma_addr_t dmaphysdest2 = 0;: M- y  Q- g: y4 T4 @) V; L9 R
  72. # N; k7 }1 l" S# y+ J3 `
  73. char *dmabufsrc1 = NULL;: U4 |& y% Y1 V, V% a
  74. char *dmabufsrc2 = NULL;' q! M, D- B) m. r: k
  75. char *dmabufdest1 = NULL;
    ( n8 e' Q- Z6 }3 M- I
  76. char *dmabufdest2 = NULL;
    & R; l7 Z( ?+ v9 F" l, u  K

  77. + D7 Z2 T5 _9 n( a
  78. static int acnt = 512;; L. y, h& J1 Z6 g% C8 x
  79. static int bcnt = 8;# T9 X; v1 r  X8 X
  80. static int ccnt = 8;4 L3 A! L, v9 A2 |: Y
  81. ; M4 o$ {! ~& F) ~  ]: I+ j
  82. module_param(acnt, int, S_IRUGO);
    2 l1 j* G3 N$ L: w" T
  83. module_param(bcnt, int, S_IRUGO);* V7 J# {- v2 B; ]& s! y1 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# z8 }/ ]6 g; h2 N6 S5 A- \% }3 g& ^( F5 p, Q7 O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% R% T1 C! u# X: w5 t3 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 m* {1 J2 a4 Z0 E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 |% T5 v/ S2 Z3 P
' K; {" t  b2 @3 U- w8 o. e, Y5 z
. z$ a- H/ V/ y" G2 |8 a1 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 12:41 , Processed in 0.040057 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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