OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 n0 q& a6 y5 \! @8 B' B
  1. [code]EDMA sample test application- w1 \; o' e$ r8 g9 }1 j/ h& R
  2. /*! Y" e! [+ b% ~7 s+ y8 v
  3. * edma_test.c! ?( R7 a% E& e- M7 T
  4. *+ G! H7 J: M. e% Z9 {
  5. * brief  EDMA3 Test Application
    1 r8 U2 e5 D8 E/ c7 b# \
  6. *0 r) ~$ E. h  |% S5 o6 |1 e* A
  7. *   This file contains EDMA3 Test code.
      K( p% D+ q+ y  V
  8. *
    ! S* q( w8 P0 L- b1 n  m. ]. x( {9 b( ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + b! b  r" Z0 g) J8 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' k1 n4 a) }1 g, g' J9 j2 S
  11. *         TO CHANGE.( C; V! z# l/ R# @7 v' {3 I3 y, n& S
  12. *
    $ I, R+ Y4 x' P7 p$ l; r9 h) w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 z' E; W. U- t6 f* {
  14. *
    3 O! ~  G" K# E4 o0 ~2 K8 P
  15. * This program is free software; you can redistribute it and/or
      ], I4 Y, S6 _+ s. S) Q6 @! Q- O
  16. * modify it under the terms of the GNU General Public License as5 ]- ~, I( p3 K6 i
  17. * published by the Free Software Foundation version 2.
      w  j6 {  g4 I1 y8 x
  18. *' Q+ g# w1 z8 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; m* H: M, S+ E% X# K7 f3 z2 J
  20. * kind, whether express or implied; without even the implied warranty
    ( S5 F9 C. R! o. W$ M' n2 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 k3 p* R2 y3 R$ ^5 s$ Y
  22. * GNU General Public License for more details.
    4 b& O6 w* `+ @" S( ~
  23. */
    # _9 F( l" T  }1 |( D

  24. 2 n: M/ G( d  K+ o4 P2 F- d; j
  25. #include <linux/module.h>3 L; B$ v5 f# Z, M# z
  26. #include <linux/init.h>0 e! }" D% c% `( E! y
  27. #include <linux/errno.h>
    5 b* W) p5 R! X
  28. #include <linux/types.h>% n- ]* L4 F/ T
  29. #include <linux/interrupt.h># e4 g' W! Y% k6 A; h! ~
  30. #include <asm/io.h>7 ?0 Y6 i6 C. A
  31. #include <linux/moduleparam.h>
    * ~: {4 Z: S" j- w5 I. V
  32. #include <linux/sysctl.h>( O4 o: X& s* }$ Z) d$ a) j2 \
  33. #include <linux/mm.h>
    : u- R5 h( j8 A/ Y
  34. #include <linux/dma-mapping.h>
    $ o% b- W8 G4 c. ?7 q

  35. & B* y$ \& |7 u" [) B% n8 X3 N! y
  36. #include <mach/memory.h>+ |$ L* Q$ T1 h( \" W9 U
  37. #include <mach/hardware.h>9 A/ N, q, B# W; R2 M3 n
  38. #include <mach/irqs.h>3 T1 E! I! J' @4 s
  39. #include <asm/hardware/edma.h>
      j1 L* q" X2 u6 j
  40.   [& D  J1 V/ V) z# X, e+ a
  41. #undef EDMA3_DEBUG
    : J  [( ]5 J! u# Y) p3 c4 T3 ^
  42. /*#define EDMA3_DEBUG*/
    5 J# @' T0 ^2 {4 W8 ^9 u

  43. 2 U9 D& @+ o+ F" O- P
  44. #ifdef EDMA3_DEBUG9 L' y( w' [9 N4 Q" W1 ~2 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- \; J  i1 a0 i$ u7 n6 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 p& C. Z' E* @5 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + ?7 A( g0 P; y& I2 f0 v! Z5 I! }. e
  48. #else
    : V6 p- M$ o7 j0 J. y3 o
  49. #define DMA_PRINTK( x... )
    7 _/ ~/ b. S/ M/ ^
  50. #define DMA_FN_IN
    ' m4 W% [( D- {8 J2 W9 U  \
  51. #define DMA_FN_OUT
    & P! y1 J$ r. Y& Y6 W# g
  52. #endif+ s' q6 A% j4 f# E6 a! E1 ?

  53. 9 C% P2 l8 `$ s; B: G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): n: @6 ^# Y: |
  55. #define STATIC_SHIFT                39 q) l" |  n# X
  56. #define TCINTEN_SHIFT               20
    " S! |' Y5 O# T% m; |; h
  57. #define ITCINTEN_SHIFT              21
    8 {# e( B# ~' @; @; V, [: n; ^% e) [# Q
  58. #define TCCHEN_SHIFT                22$ M; Y" k2 e1 W
  59. #define ITCCHEN_SHIFT               230 P* U6 E* p6 G

  60. : `" |8 Y# ]5 k
  61. static volatile int irqraised1 = 0;
    . R3 F3 ^6 z" y: i
  62. static volatile int irqraised2 = 0;. H; I# U% G% _+ u
  63. " L+ H9 j$ u2 v# w: a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 k3 {3 O! T* {" ~7 x. G5 z+ \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 L, r( o+ p8 s" R* C  [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % {. |4 j& k# k2 I8 E
  67. 8 R; {# N2 `9 A5 _, q# q' M& R
  68. dma_addr_t dmaphyssrc1 = 0;: L: n  h( T3 R( l2 x8 J5 _" K
  69. dma_addr_t dmaphyssrc2 = 0;
    6 Q- u, ~, |3 o1 f
  70. dma_addr_t dmaphysdest1 = 0;6 k# Z+ S- @. W( }
  71. dma_addr_t dmaphysdest2 = 0;" ?& }2 G# e3 z7 B3 Y+ T

  72. 6 U0 r) v/ q# b. y7 C* p
  73. char *dmabufsrc1 = NULL;
    ( H: J" ?8 i& t/ \, W
  74. char *dmabufsrc2 = NULL;" Y; U/ X0 a1 _7 }( j
  75. char *dmabufdest1 = NULL;5 N) ~7 H0 B! f1 P! ?) e6 H& ?
  76. char *dmabufdest2 = NULL;9 ?  V: i" K! [+ }# x8 ^

  77. + U7 q/ a/ x2 N, D  _$ |
  78. static int acnt = 512;, X5 |$ y! v  h2 ~
  79. static int bcnt = 8;
    3 C% E( I9 P% h" i
  80. static int ccnt = 8;
    ( B3 D% @: v& k4 f' b7 j, R, c

  81. % k0 s9 ?  ?6 i* s( d* Z/ ]; F
  82. module_param(acnt, int, S_IRUGO);# X- V1 A  D: G) |; P
  83. module_param(bcnt, int, S_IRUGO);5 n! W2 N0 X2 ^9 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 l& x; x5 @3 a$ x: e

0 y- M; `1 i) |% r7 f/ _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  _. m' R$ p3 H, S) E- Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 G; T8 @! ~% Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, p- z9 f% S5 o9 ]
3 o7 N- X; O$ b9 v$ Q2 e* e* o. _9 y

  Y9 a) q" l# y3 K, c" N5 I8 Q# a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-4-9 01:03 , Processed in 0.041969 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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