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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & k* h) p$ r; ?7 l2 G' C
  1. [code]EDMA sample test application- S/ m' v$ m1 u) a1 S7 _% W4 l
  2. /*: S6 ~. H  a1 ~; ^9 R5 Y0 W8 }
  3. * edma_test.c
    ' f- q8 S3 ^' X5 Z$ A
  4. *
    3 F+ A! w: w4 H2 I  W' O. Q, j
  5. * brief  EDMA3 Test Application8 ^0 N+ ?, m6 Q9 Y, u
  6. *, c/ ~6 @/ _( ~: Q8 |, N
  7. *   This file contains EDMA3 Test code.
    * ]6 F2 e  g6 }: H$ o8 v$ _
  8. *
    6 d$ K1 j* m2 t0 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 _2 N' J& w7 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " f3 L9 w! d7 W
  11. *         TO CHANGE.$ t: t% O! U0 o. H, d( h
  12. *
    : _6 F( p9 w9 C" c# }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 Y0 E2 ]9 l% H0 q* b
  14. *- R8 b, y7 I" ~& {, E0 k: F; O
  15. * This program is free software; you can redistribute it and/or6 M+ o1 I1 Q9 e5 V' e3 L4 {
  16. * modify it under the terms of the GNU General Public License as0 G3 [/ {6 W  }
  17. * published by the Free Software Foundation version 2.
    * u0 i" U& a: _4 Q5 m( k
  18. *# J0 r+ l; ^0 m) @8 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 W4 M; c$ C9 U/ d7 w
  20. * kind, whether express or implied; without even the implied warranty
    9 ?% i" u2 R  A/ r/ i/ H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. H' g* p1 ~5 P" C3 {
  22. * GNU General Public License for more details.
    % w0 d0 C2 [2 F
  23. */4 N  F/ D8 o: G6 ?( m5 L
  24. 3 ?7 I. b$ w/ |+ i9 q  q8 y
  25. #include <linux/module.h>
    0 D/ v+ d' i9 U
  26. #include <linux/init.h>
    ! z- c$ H- A3 M; l! Q4 d: d% I
  27. #include <linux/errno.h>! C9 j0 S; [! n
  28. #include <linux/types.h>
    - I0 G5 T- R/ _" d' ^/ {6 p0 ?& I+ q
  29. #include <linux/interrupt.h>
    . p; J1 F, W& \. x# b! L
  30. #include <asm/io.h>
    2 R; q( I6 e- ~7 B, B
  31. #include <linux/moduleparam.h>4 e& u- i" Z/ ~1 {2 [! z! @- ^
  32. #include <linux/sysctl.h>
    $ P2 N3 L5 R2 A' [. g3 A! G
  33. #include <linux/mm.h>" p! k  r9 p- i7 p% j. l
  34. #include <linux/dma-mapping.h>
    4 B7 g& B. j6 o1 r% z, X8 w/ K# j. H
  35. ( K' G# U! x5 v9 {! {6 ]( A6 Z
  36. #include <mach/memory.h>
    ) k: a+ W; f/ i9 s5 P
  37. #include <mach/hardware.h>
    - a* d- }. g6 i9 a: }# j8 M/ `
  38. #include <mach/irqs.h>
    ; j% i* G# k& {8 [2 d7 N
  39. #include <asm/hardware/edma.h>
    & C# Y$ \; r# a" R, ^( P0 X5 K
  40. 5 x+ ~! k% o0 N6 K; e
  41. #undef EDMA3_DEBUG% c* w/ s/ z( X- A1 n
  42. /*#define EDMA3_DEBUG*/
      n# a! P7 ], k/ c+ x3 l  `+ {
  43. % ]5 y$ W2 g: `* K) R* N
  44. #ifdef EDMA3_DEBUG7 L! `1 N3 v$ }2 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ [" V. n" @) @/ L* l, A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 m0 g8 G0 R0 g! g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # A! J( I8 V- h* A
  48. #else; F% L# v  T. }" q" a2 C
  49. #define DMA_PRINTK( x... )
    , t+ q1 U' X4 E/ i! f
  50. #define DMA_FN_IN
    5 F9 [9 z4 e5 a" f% d$ j; N
  51. #define DMA_FN_OUT! i8 @( t( J( B! Y
  52. #endif
    6 N5 L9 Y1 {& i; y

  53. 3 E! M9 N$ i" S1 s& l% s, \* h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 z( b7 X$ s3 J; I+ _# {3 x6 p, C
  55. #define STATIC_SHIFT                3# c6 v- i3 T9 {* o1 Y9 i
  56. #define TCINTEN_SHIFT               20
    8 Q$ c6 {2 M  w% s
  57. #define ITCINTEN_SHIFT              21. G  o3 h* W  x$ b1 l! g
  58. #define TCCHEN_SHIFT                22, t6 L1 L) Y2 X7 t0 ^
  59. #define ITCCHEN_SHIFT               235 {2 m# O2 G5 O. Q
  60. ' n5 b9 k! J) ?/ L4 D! U* r9 G6 [
  61. static volatile int irqraised1 = 0;
    6 m& P0 P& L. w  l& [9 k/ K; E
  62. static volatile int irqraised2 = 0;
    ; p" \, I1 C0 V- c3 G5 k) C& \- X
  63. 8 w: ^# O7 v! m- |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      G0 P. Z) a' ?$ B( k5 f9 @  T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + k1 X9 j3 v; E5 z. i% M* c! u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 \5 o; E" y2 B

  67. 7 C9 \# H6 p$ j# F4 `5 ?! \
  68. dma_addr_t dmaphyssrc1 = 0;
    3 ?0 s# d. S8 l: A
  69. dma_addr_t dmaphyssrc2 = 0;
    8 l4 F- x" n# ?8 T
  70. dma_addr_t dmaphysdest1 = 0;
    , f0 l, D4 W* s4 W- T* b1 v
  71. dma_addr_t dmaphysdest2 = 0;
    ; S2 c8 Z0 S8 w
  72. $ Q) c+ E! s  B* v0 q# L
  73. char *dmabufsrc1 = NULL;; [0 `6 V3 x% P: _, P! `
  74. char *dmabufsrc2 = NULL;
    8 G( G/ V( d1 u
  75. char *dmabufdest1 = NULL;9 [6 H0 h% p# v4 t" D" ]8 w
  76. char *dmabufdest2 = NULL;
    & j/ p. _6 T, N; u0 X

  77. 2 g$ Q4 D/ Z) R$ a
  78. static int acnt = 512;
    : `7 ?/ f5 B& E) b, F
  79. static int bcnt = 8;
    ! J$ D0 s- P0 z9 Q
  80. static int ccnt = 8;  \/ I& C" I/ U7 Q+ N5 w& \

  81. 1 d+ \! n9 j% K6 i
  82. module_param(acnt, int, S_IRUGO);" A5 o) O- }! R
  83. module_param(bcnt, int, S_IRUGO);% ~1 U+ W# o# A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! H! H7 M6 c: |8 ^) D0 G

8 l  P+ A8 h: @3 o$ @/ g! Y* J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. f8 U3 m; C* P7 ^) }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 D- X' [6 P0 j. D8 Q& f( F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- k4 I8 w. ?9 ~$ S/ \" E+ f5 l+ `$ V4 x; O

/ D/ q+ Z) a- a! Y( D9 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-10 06:31 , Processed in 0.052370 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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