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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* T$ R, V/ h6 G7 X( b7 j2 ~
  1. [code]EDMA sample test application
    ; B8 w/ p3 R* n" b2 M- l% K
  2. /*$ c5 Y6 N* I" \  o. g8 J6 i! l9 S
  3. * edma_test.c
    ' r% S  ~+ c1 f5 L. V% H
  4. *2 q0 y2 K* r, j, W/ P
  5. * brief  EDMA3 Test Application
    ( {4 n) s5 h6 u; q. ]
  6. *7 C# l" z1 j2 `: e: A+ B% _" ~
  7. *   This file contains EDMA3 Test code.
    . x% S% e; _" ]: g, J! v
  8. *& v; l$ x, m, E- B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 w3 o( E9 W6 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 ^& s, [7 j- x, e* B4 P
  11. *         TO CHANGE.
    6 M" Y* k: q0 t( I$ x- p
  12. *
    0 S* Y8 @0 E8 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: o* W: @7 D, D$ ?1 e) e5 P" `
  14. *
    5 r4 h. P$ X6 v0 y* z  u
  15. * This program is free software; you can redistribute it and/or
    ) M! F& \# r# e: Y- A
  16. * modify it under the terms of the GNU General Public License as
    3 p& N, R+ S6 H  z+ w% K
  17. * published by the Free Software Foundation version 2.
    2 T3 A3 B+ i1 e! B0 ~; r+ Q
  18. *
    5 C7 \$ p6 M5 a  `4 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * `4 h* @4 i& x" Y4 n0 `  K- j1 s
  20. * kind, whether express or implied; without even the implied warranty
    ' a$ z7 |7 x2 }4 J% e& \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! Y1 R  r( F! ^! G+ [& i, t
  22. * GNU General Public License for more details.( q& B. L" I% e$ j2 w0 k0 N! [) V
  23. */
    5 D1 q7 ^6 ^4 t, M- H/ w: F- @% f5 E

  24. ! X" j) ~$ m# C+ o% q) |& l
  25. #include <linux/module.h>  |7 u6 W" W; U5 P
  26. #include <linux/init.h>* Q# M2 W: ?0 W6 J" c0 a/ j
  27. #include <linux/errno.h>* K- |1 g) F" Q6 Z, `2 @
  28. #include <linux/types.h>9 x/ p% Y9 \% u7 {3 A
  29. #include <linux/interrupt.h>
    + X7 S, P7 O8 g
  30. #include <asm/io.h>
    7 l, V, Y: g2 H2 \; K3 G
  31. #include <linux/moduleparam.h>
    ) h0 r4 p( v- a$ C1 O, H1 T
  32. #include <linux/sysctl.h>
    4 ?' b, u, K6 N' i7 V$ l  ?
  33. #include <linux/mm.h>
    2 [" z' [4 |$ ^2 M+ T$ v
  34. #include <linux/dma-mapping.h>
    . N! Z0 j0 C6 f2 N9 M

  35. * R% [! x7 M; @( U
  36. #include <mach/memory.h>
    $ U7 L7 G6 e. _& u1 c
  37. #include <mach/hardware.h>
    $ ^8 ~3 r+ ]. _1 \
  38. #include <mach/irqs.h>2 I8 \* ^4 k3 K" @% n- t
  39. #include <asm/hardware/edma.h>
    6 X; F' u. e; n+ D
  40. * E+ F# s! @* h3 T! k6 r
  41. #undef EDMA3_DEBUG
    1 f' s, H+ s5 W; C) C
  42. /*#define EDMA3_DEBUG*/
    5 t' m3 _$ t6 ^. S

  43. : `0 d6 h9 i: G! t5 D6 Q
  44. #ifdef EDMA3_DEBUG1 _2 n( |+ L0 a- b& b8 [! |4 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + |8 c( W/ _% w8 d: T# _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). J$ s2 A' m4 r  V! [2 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# @$ v1 J- l) O$ u7 ~/ o
  48. #else
    , K! D, B+ b8 G  L: T
  49. #define DMA_PRINTK( x... )" I" W2 Q9 l) ]4 i( O: |0 E0 Q
  50. #define DMA_FN_IN
    + }1 s; N9 C' t! n( d) \/ S) ]
  51. #define DMA_FN_OUT) ]3 O: \9 A. n9 F
  52. #endif* j0 @1 R; {- p( J$ c4 f1 `

  53. # P* f- W5 |  f2 M; R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 ]- W" f  O3 f; s( i
  55. #define STATIC_SHIFT                3
    . J3 x+ J1 V8 Q( X( j! z
  56. #define TCINTEN_SHIFT               20
    ' ]) w( @# B# {4 J/ O# z( X( {
  57. #define ITCINTEN_SHIFT              214 c7 W& t! l  F1 Z, O0 q0 L  V
  58. #define TCCHEN_SHIFT                22+ s5 O9 u6 ^9 \5 y; X' z
  59. #define ITCCHEN_SHIFT               238 A( d+ ?' f- Q# s
  60. ) @2 C5 f% E  Q5 R
  61. static volatile int irqraised1 = 0;& z4 X: \% Y! c6 B" w$ q! R
  62. static volatile int irqraised2 = 0;
    : F2 H! _( S" A9 k4 D$ {

  63. . j( z0 h: b$ p$ R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ]* @' d  n& g2 X6 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" T  t& O8 p* n1 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; s0 N1 F( X: ^
  67. ) c( Z( }% Q: n8 W6 ~; k% G' a' d
  68. dma_addr_t dmaphyssrc1 = 0;  e+ {' p, M- j# S9 m  }, z# k
  69. dma_addr_t dmaphyssrc2 = 0;
      U2 v2 t9 p  s+ }9 x, _) P
  70. dma_addr_t dmaphysdest1 = 0;9 N5 o+ q4 e1 a$ |& A
  71. dma_addr_t dmaphysdest2 = 0;. l( t. k* z& W$ Y
  72. / L. t7 p1 j$ ?/ s. u( H3 N
  73. char *dmabufsrc1 = NULL;: o3 K+ ^, c" x: Z
  74. char *dmabufsrc2 = NULL;  J& N6 z  L4 W" K6 X: z7 m
  75. char *dmabufdest1 = NULL;
    ! _  o# q1 ~. \: U( J' C
  76. char *dmabufdest2 = NULL;9 {1 p# W* o6 q) Z) j1 d

  77. : V* x  N, X1 I" T
  78. static int acnt = 512;) B& K0 c6 V* V6 ~2 [
  79. static int bcnt = 8;
    5 d$ {  ^$ G% M# N( R
  80. static int ccnt = 8;
    " ~6 L- a9 r2 g; A$ z# W5 Q  m& I# @

  81. ) W1 E" Y6 ], N$ L
  82. module_param(acnt, int, S_IRUGO);
    2 ?0 z3 x9 m) w/ u8 s/ S( U3 g
  83. module_param(bcnt, int, S_IRUGO);3 j+ W9 d( A# ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) B6 Z# H: G' z  l+ ?# G& s7 }6 e. n7 I% x2 I3 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 v8 ^) c0 G# Z1 ]: V' H5 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ d" P7 g. ^, {' T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ B) v" z, _5 {6 ^/ @* t7 q

0 ~$ {* t! U2 f4 G. u& g0 q! `& j6 a- Y6 f( [6 r. b0 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-9 11:32 , Processed in 0.039651 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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