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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 L: {7 F" ?8 i0 ~# w: S. o! X, g
  1. [code]EDMA sample test application
    0 _& c, F1 a2 s/ B6 g% |; L1 `
  2. /*0 B0 x) @. q2 g; G" i3 V+ f
  3. * edma_test.c5 I/ e& R* w3 T3 |+ d2 Q
  4. *
      l$ B' \* R4 t' U  @. w1 {
  5. * brief  EDMA3 Test Application) U+ j+ t# c  ]- d' W# T/ Z& z
  6. *
    ! Q& V2 S# R' E1 w
  7. *   This file contains EDMA3 Test code.
    " m: H  i/ ~5 P& l: d( g
  8. *
    2 H6 r  t$ S: l) ]1 t& W" M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 A1 {( o$ z- w' c4 m7 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  v3 D7 q4 i: ~" V2 J
  11. *         TO CHANGE.% ]$ x6 ]2 y1 J
  12. *
    5 U, ~" Y. ]5 x& M8 l5 k; g/ y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 \! X+ V* Q; k% I
  14. *
    1 a! R1 d6 R9 o8 C3 [
  15. * This program is free software; you can redistribute it and/or+ M$ Z6 Q( @* Z1 C3 X1 m
  16. * modify it under the terms of the GNU General Public License as" A6 M) p# w( n$ z/ s3 U3 U
  17. * published by the Free Software Foundation version 2.- O  G9 T* n2 z% H
  18. *
    ; D# X% |' H1 F6 e( D+ W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# \5 r( H6 ~3 g$ j1 L6 k3 U
  20. * kind, whether express or implied; without even the implied warranty
    & t0 O) g: s  ^  t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 \9 [$ d  }$ N1 z
  22. * GNU General Public License for more details.% b: H* p3 s, H$ G0 k
  23. */
    & E/ J, @3 }# d2 S

  24. . \* E% ?* g) U" J$ b  X. B
  25. #include <linux/module.h>: Q5 S% K2 w7 r+ }
  26. #include <linux/init.h>
    7 @6 Q- u# A% ^" J1 a
  27. #include <linux/errno.h>
    . v: o- p: a" B% _6 e$ f, j
  28. #include <linux/types.h>
    6 a: L7 Z! a" z
  29. #include <linux/interrupt.h>
    ' F; W7 e# D7 \( k1 {8 J3 h
  30. #include <asm/io.h>
    : T" M" X% O  A" s# ?# p
  31. #include <linux/moduleparam.h>! t* o9 ^# s# i# A5 t: Q
  32. #include <linux/sysctl.h>
      C  P0 f  U, r  h" I" V$ X
  33. #include <linux/mm.h>
    1 f3 [8 I( C- _" r1 Y& ?% ^
  34. #include <linux/dma-mapping.h>( M4 q3 M2 _* G) K* y
  35. # q! P4 q" _. ?& m, e# h
  36. #include <mach/memory.h>2 ]5 x* k6 E. y3 t
  37. #include <mach/hardware.h>& b9 C8 n# `; S8 n: N' g3 L
  38. #include <mach/irqs.h>
    7 ^! y0 @8 u. O0 T
  39. #include <asm/hardware/edma.h>/ t1 @3 C6 H0 Y

  40. , q- C  k4 L2 Q7 O) p
  41. #undef EDMA3_DEBUG
    ) V' U) k- ^; `8 M: T# O
  42. /*#define EDMA3_DEBUG*/
    ; u% k' }; `# ?  x( ^5 K8 D

  43. , ?* U' R( _% @; p( C7 }
  44. #ifdef EDMA3_DEBUG
    3 u1 ]0 D2 Y$ |' v% I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 @1 S, r6 z9 y* _1 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % h9 m- p2 Q9 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # Y9 F! Y: ^; d# O+ }4 t, A
  48. #else
    . }/ p+ z, P& s& K) V, }' ]) B
  49. #define DMA_PRINTK( x... )# F+ N" Z& z3 [' s* G7 p0 `; H
  50. #define DMA_FN_IN( y$ C" f  N, C* S: r" \6 _/ A
  51. #define DMA_FN_OUT
    " `! b/ p% b7 _. U
  52. #endif' H6 X) W8 u# t' ~$ r

  53. 6 V" {+ s3 t' u, W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( i, H/ N: @; d' s/ e
  55. #define STATIC_SHIFT                3- [6 b0 W% Y9 S4 S5 P1 @  Q9 b$ s6 O
  56. #define TCINTEN_SHIFT               206 _8 j, P  w1 [2 V. D9 B
  57. #define ITCINTEN_SHIFT              21" N3 d# Y+ i9 z# D! V' s4 ]) B
  58. #define TCCHEN_SHIFT                22$ }, Q7 G1 L( Z2 p
  59. #define ITCCHEN_SHIFT               23
    3 W- d$ n# p9 ?. T+ v' S

  60. 4 n: N5 ~7 h0 k8 _
  61. static volatile int irqraised1 = 0;8 P  M8 p9 @! s+ v/ ~
  62. static volatile int irqraised2 = 0;
    8 |7 i0 [: D+ |" O
  63. 4 w- ]. I% H9 S+ V1 R# S! e$ v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: @, I) ^1 i& Z$ c9 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- \* q, s% q$ T- E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( D* ~+ E" g  C4 v0 s: B

  67. 0 ]0 E( @6 p* G+ t) l4 v( w
  68. dma_addr_t dmaphyssrc1 = 0;) ]4 L# |8 G2 G
  69. dma_addr_t dmaphyssrc2 = 0;
    - r& C4 B, ^' l, g6 m2 K2 S
  70. dma_addr_t dmaphysdest1 = 0;4 u1 L/ ]- g$ f( ]
  71. dma_addr_t dmaphysdest2 = 0;
    3 a$ ^6 n& O! h  W

  72. * y' s3 d+ n9 R6 j
  73. char *dmabufsrc1 = NULL;
    2 q7 x2 ]# Z- `
  74. char *dmabufsrc2 = NULL;
    & }' K" k! @; L1 r1 b! _: H
  75. char *dmabufdest1 = NULL;
      V" J" i5 V( }
  76. char *dmabufdest2 = NULL;  N& L$ G: Z9 X5 k

  77. 5 ?+ L; G, G5 g
  78. static int acnt = 512;1 H. j9 k! v4 S5 H/ x) Y( H1 F# d
  79. static int bcnt = 8;
    ) \7 `  p: B% G+ C0 ~! j+ s6 S
  80. static int ccnt = 8;% R6 C. @1 |/ U( H  c7 j$ \
  81. & t6 D/ a6 G3 }3 U4 P
  82. module_param(acnt, int, S_IRUGO);
      H0 Z" m. ]" A; `4 K2 Q
  83. module_param(bcnt, int, S_IRUGO);2 z, _4 D% R' s2 \4 F1 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# A* f; y9 n  s" s2 K6 c
  W2 N9 P9 F. b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" B" v. l% n3 Z* s2 X' O9 Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- L% K' V5 C- o+ R' r1 m) Q' k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" k! P% `* Z& l
! s% U, @4 F2 X; b: R8 h/ }, ]; ?1 z
+ F; S: M- d, ~, ~9 J7 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-19 09:40 , Processed in 0.038763 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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