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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . d% A) f/ h% s% U
  1. [code]EDMA sample test application
    8 E" I; e5 ]9 {
  2. /*
    0 {. I- D/ F# l- o
  3. * edma_test.c* r3 Y& ]' R( l, ?5 `. {5 d" O
  4. *7 ~) F0 H: S2 `4 O% R) E! q
  5. * brief  EDMA3 Test Application
    9 Y8 s( z# ?9 G2 E7 w
  6. *' w( Q3 k1 I* c1 {
  7. *   This file contains EDMA3 Test code.
    3 v& _' R3 T/ C5 |. o  K/ s
  8. *
    . v  J8 @  x/ P) I# \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) w2 R& D8 e0 K# _# }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! G( v8 E. h# i6 g/ D* w. E2 A
  11. *         TO CHANGE.
    $ k8 x& D5 F! r0 }" g5 p4 `$ U
  12. *4 H2 U% R0 z% r: S  a: H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ C/ E3 U- Z$ G7 q8 `9 A
  14. *5 e$ h2 Y: E" ]4 I7 G# \1 T4 ^
  15. * This program is free software; you can redistribute it and/or
    8 y- R$ N1 u/ t
  16. * modify it under the terms of the GNU General Public License as
    4 s. w9 I3 t0 a& b
  17. * published by the Free Software Foundation version 2.
    * h# i1 k" b% e0 E. P
  18. *
    7 s# e7 `" L* g0 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 y8 S8 L! M, O  V' U! Z
  20. * kind, whether express or implied; without even the implied warranty& t8 ]- [$ R7 P) [. g6 E4 y# G4 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & I) g7 c' }& a" q% I; D
  22. * GNU General Public License for more details.
    ' _' v6 O/ J. d% r: Q5 V
  23. */! R$ n5 R( I, P# G! _7 Z! O- s
  24. 4 D: s$ R' Q! _0 r
  25. #include <linux/module.h>
    3 Z+ ~" D) o. X$ W1 t9 U, W
  26. #include <linux/init.h>8 U5 I* e1 }& `. @5 \( C* m
  27. #include <linux/errno.h>' Z5 o$ P1 r  |' G
  28. #include <linux/types.h>$ ~+ N8 C4 F1 u! y  P4 r% K( Y" E
  29. #include <linux/interrupt.h>
    ; Z- k- C" `8 Q( p  [$ h, b# q
  30. #include <asm/io.h>1 p/ h4 o  Y& w6 n  p8 d  U  ^; r
  31. #include <linux/moduleparam.h>
    * L5 r) f) G. o4 U8 Q# H, M
  32. #include <linux/sysctl.h>
      t/ k+ [1 {; n
  33. #include <linux/mm.h>
    " m+ V. R$ A, O4 X
  34. #include <linux/dma-mapping.h>
    $ }- r5 B  a7 g; I1 j

  35. $ F! O: ~, f6 g
  36. #include <mach/memory.h>" x! h4 T# |2 o* F
  37. #include <mach/hardware.h>
    - i/ W) \; N! I4 t. i
  38. #include <mach/irqs.h>
      r  t9 X- `! `/ F, [4 x" S
  39. #include <asm/hardware/edma.h>4 U6 F% W* s$ H! o
  40. + @2 h# ?% @; }6 A: B8 N
  41. #undef EDMA3_DEBUG
    / t; ~8 _, u' H0 @% j2 f5 a
  42. /*#define EDMA3_DEBUG*/
    . O. H' S: F9 ~- I. e! w

  43. ' p. S0 r( Z: Y% W+ o
  44. #ifdef EDMA3_DEBUG
    0 C8 }" e% ^* z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 ?' ?$ C, A. u6 a& Q& `3 C! }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 A: h3 k# l! A; M& f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : b  c; ~/ y" N( x- w/ Z
  48. #else4 X, K- g* t7 l" ]' [
  49. #define DMA_PRINTK( x... )9 R& L; \) G4 u6 W  r0 Z' F+ S7 h
  50. #define DMA_FN_IN- P/ J* p/ p0 J& Y4 o" g9 o
  51. #define DMA_FN_OUT
    ; q) k$ I9 C7 {* w& E0 a; D+ ?. M$ I
  52. #endif
    6 \' q4 S* D$ C
  53. 7 l/ V. k% J3 Y) K; v+ V* {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * u) A' `0 P: B+ X
  55. #define STATIC_SHIFT                31 F, z2 k5 [9 O
  56. #define TCINTEN_SHIFT               20
    / z6 J3 E( v9 p0 v9 S* R& ]5 H2 Y
  57. #define ITCINTEN_SHIFT              21$ p; O2 c7 B3 A7 I- J, c
  58. #define TCCHEN_SHIFT                22
    ) F% ~8 @. h" `+ n, l
  59. #define ITCCHEN_SHIFT               23% `6 Z$ y: l+ P6 q  {, h
  60. 0 \% W" A/ U  h7 o& l$ z- E
  61. static volatile int irqraised1 = 0;
    % ?! ]1 }- f  h5 S
  62. static volatile int irqraised2 = 0;7 s' q% R7 i1 {) L* X/ x' |

  63. 9 ]7 @1 @7 L2 L' e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      w  }3 X7 A/ [7 p+ f8 Q7 T! i! i- Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! ?6 c" g/ R8 p1 E% u' j. g" q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % V' R) @( i6 [$ N) f2 R

  67. * D+ Y1 o; y+ B* L
  68. dma_addr_t dmaphyssrc1 = 0;
    - p+ B; v9 W0 P
  69. dma_addr_t dmaphyssrc2 = 0;
    / V; a0 W% M$ D! Z3 y
  70. dma_addr_t dmaphysdest1 = 0;
    $ i3 z& a1 L; n6 L# q
  71. dma_addr_t dmaphysdest2 = 0;/ u  N* _! d& c& }/ Z

  72. ! O; k* M, h5 \4 f0 |& K
  73. char *dmabufsrc1 = NULL;, U7 m3 ^# X3 b/ t5 n
  74. char *dmabufsrc2 = NULL;
    ( I/ F! n3 B+ z+ m% v# S
  75. char *dmabufdest1 = NULL;
    ! y5 W. c1 `7 `; D+ w' C
  76. char *dmabufdest2 = NULL;
    ! i0 G* A- l' J) X

  77. 2 C8 p3 g! [+ }+ }$ h' I: L$ d
  78. static int acnt = 512;
    . v0 Q, l# L5 z
  79. static int bcnt = 8;
    2 h: F( F: c5 p) Y# b
  80. static int ccnt = 8;
    * f& I* C  \3 o; ~9 [

  81.   H- \1 R5 D5 l0 l( {
  82. module_param(acnt, int, S_IRUGO);8 b9 Q: O; W) u$ B. s0 J
  83. module_param(bcnt, int, S_IRUGO);3 u0 c+ e; v- P" Z$ [0 \) }; n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: a5 R3 `/ m- N/ t* J8 h: P; J8 c: ~  c; s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 d; X- P! E5 C: [# c% e6 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  U# {. n" W. z8 @2 h' R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ g& I; N6 u8 k# E& U( O
  K" q+ N+ [& t/ q" A# t- E# `
: @( t9 v( g/ P8 L$ W  o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 03:27 , Processed in 0.043571 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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