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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   O4 Q/ ]4 _" [7 m6 g
  1. [code]EDMA sample test application
    $ g1 O+ _' h3 p0 ^
  2. /*
    " V5 l2 u2 X- W
  3. * edma_test.c
    # I7 d1 K; F* j& j" H) m! }
  4. *
    ) c' a. a6 \6 i: j3 R/ Z' F" }/ [
  5. * brief  EDMA3 Test Application
    ) [' v" w! W9 \
  6. *
    ) ]0 ^; f+ S3 c5 K
  7. *   This file contains EDMA3 Test code.
    & L) U4 y" p0 \
  8. *
    4 x- c% ]( z0 m1 @8 [* {& ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + R; j2 M8 q3 E$ a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 p6 g( |5 F! }
  11. *         TO CHANGE.6 _2 ^1 u. }1 Z9 d; @! i
  12. *
    . L$ I' h( x! \' i: p- j/ J) ]. T* T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- M- \9 J3 Z: x% a% P$ ]4 c8 z
  14. *
    7 a5 ]7 r" G; ^4 z4 j
  15. * This program is free software; you can redistribute it and/or) J% B2 V7 H( o) s8 h
  16. * modify it under the terms of the GNU General Public License as& W& h2 [' B& S( s% ]6 r' C8 s* [6 [
  17. * published by the Free Software Foundation version 2.* r  k- X" ?/ x$ C1 Q* U8 g
  18. *
    ; F: P* L; w! j' _* [/ X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * M& r/ R1 _5 i: Z- u# x2 E
  20. * kind, whether express or implied; without even the implied warranty
    4 \) U9 b' [9 k, e# x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * K2 m; F5 i$ W6 {
  22. * GNU General Public License for more details.6 R! j2 M" v% w! w; l- |1 }; v
  23. */0 s  [  \$ g) U) h' m
  24. 0 f. k4 Z! U! g8 k
  25. #include <linux/module.h>& F- m; i! S1 P$ r8 ^) k5 s
  26. #include <linux/init.h>5 M8 s1 @: V! H- o$ H+ a/ d) M
  27. #include <linux/errno.h>
    ! q$ j3 P, I( r$ A; B
  28. #include <linux/types.h>  W8 C" W! F0 q+ ]8 j" n$ V
  29. #include <linux/interrupt.h>
    4 Y0 ^; E9 r) i+ |7 P7 f
  30. #include <asm/io.h>9 w+ V) J* T* _) B
  31. #include <linux/moduleparam.h>
    5 F) r3 t! K! h# ^2 h/ J2 U
  32. #include <linux/sysctl.h>
    1 u) r' v9 [$ ~/ s+ z
  33. #include <linux/mm.h>
    - `4 n2 g$ E& e
  34. #include <linux/dma-mapping.h>- @; o1 v% f" M, p8 Y, `

  35. 9 {9 N  H: V4 k8 c9 u# F
  36. #include <mach/memory.h>+ ?0 m; ?' d+ {0 g# x3 m
  37. #include <mach/hardware.h>
    $ e* `1 l7 J+ W5 k) h' w* A
  38. #include <mach/irqs.h>
    / E* r# _! R6 S+ \# a* r% e& G
  39. #include <asm/hardware/edma.h>
    0 w$ F5 X8 d, `8 e1 F- K& F0 [

  40. ; `& F2 c" b- d9 r, b/ n. ~
  41. #undef EDMA3_DEBUG
    + Z0 c5 l$ N4 D0 ^; c
  42. /*#define EDMA3_DEBUG*/
    ! e7 Z3 c5 y& i
  43.   O3 j, i6 a( |- }
  44. #ifdef EDMA3_DEBUG" y. q- x' O* |& a4 |/ B) r( y+ o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' L( M- X! x5 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 a! j' m  r3 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 U0 V' F& w1 Q. K; K; R
  48. #else
    ( v9 x$ h' T% Z( n; I! J0 [; x
  49. #define DMA_PRINTK( x... ), L6 o* Q7 |6 ^1 K+ D/ y4 m! c1 R' u
  50. #define DMA_FN_IN( Y2 A( {! Y6 G6 F+ I+ x+ }7 i9 G
  51. #define DMA_FN_OUT
    : s7 m6 X  |& s3 W# I& K. [3 M
  52. #endif# z+ F6 B  }2 y3 g

  53. % F0 ^$ d) O# m3 H& ~& F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): ?  U. b$ {0 P/ W2 V* P) ]* j
  55. #define STATIC_SHIFT                3
    : [; o# d9 i* @; ?$ j" ]# a( f3 u
  56. #define TCINTEN_SHIFT               20
    9 j' ~  V$ x/ ]. N
  57. #define ITCINTEN_SHIFT              21/ |( d$ |* \  t( Q) g
  58. #define TCCHEN_SHIFT                22' b$ b% a0 e1 Z& V7 k' F
  59. #define ITCCHEN_SHIFT               23
    ! B2 f/ L8 L0 _( H' Q1 o4 g7 {6 R4 Y
  60. 1 \1 ]: ?& R% V
  61. static volatile int irqraised1 = 0;
    & ]+ |" _, u. @( I+ a. v8 V
  62. static volatile int irqraised2 = 0;8 k% c2 w  l' w: n: @& s' C

  63. : ]- n4 w+ N4 R9 w# ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) O/ q7 ^0 z. c4 f$ R) i$ n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# e) `8 F" U' R+ e+ z" e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ i$ ?7 N. ^1 p) p- X9 N; \
  67. - }6 a& t+ }; q9 A: G+ @
  68. dma_addr_t dmaphyssrc1 = 0;! [- x# I) w: |& ~0 K) b6 c
  69. dma_addr_t dmaphyssrc2 = 0;
    1 E& O* p# Y/ R% v9 l: s
  70. dma_addr_t dmaphysdest1 = 0;$ m2 E9 K3 ^9 P& B
  71. dma_addr_t dmaphysdest2 = 0;
    ' n& [% o3 E0 k  Q- A+ U7 {9 _6 o4 i
  72. 3 c0 K5 y1 R/ [& t' k3 j! n
  73. char *dmabufsrc1 = NULL;4 P# f+ N3 b( F# B
  74. char *dmabufsrc2 = NULL;  x( ^1 I4 e. {; z: n
  75. char *dmabufdest1 = NULL;
    9 x, }- \* _) h& c3 g
  76. char *dmabufdest2 = NULL;
    + L: d$ ?: T& N3 G
  77. + X- x: S2 \. Y$ F. J
  78. static int acnt = 512;# m/ ^( w# l% l" z& Y  l5 U$ T
  79. static int bcnt = 8;
    1 f6 Z8 j6 C. W
  80. static int ccnt = 8;* }, t! {- z9 I1 b) t7 F" e) X

  81. / b5 G8 ^6 g3 {
  82. module_param(acnt, int, S_IRUGO);
    3 w- d7 Z! k0 C" v, T5 o& g$ f
  83. module_param(bcnt, int, S_IRUGO);
    ( h+ g: b+ d0 D& N) x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 i1 L3 g% E6 f, D
( r4 f5 x3 m3 y: ^* y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% {) x: B& u( w( }+ m5 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ q! l5 [; \  N: N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( E: l# S$ B4 X! X, V% I( T, W
4 ^: T  k! o5 M4 j  H& ]6 Z! Z. O; a# `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 06:31 , Processed in 0.038619 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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