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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 g( Z# T1 H, J0 W' U
  1. [code]EDMA sample test application, m1 u1 K1 y2 u7 s5 q6 [( F
  2. /*" z" L& M8 y# P# D1 v+ E. G
  3. * edma_test.c- D( s0 ?# E, l
  4. *6 ^1 ^2 w3 n7 i$ d, t) ^) c$ R9 i
  5. * brief  EDMA3 Test Application
    $ }6 g. C0 _4 H' n
  6. *9 H7 H) H6 h2 x* d6 S/ E
  7. *   This file contains EDMA3 Test code.
    ' C  O, x. d! L( b! {0 x
  8. *" l$ T) Q$ e3 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( W1 [# |- _# i% Z! f& q: E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* b8 r1 x5 I+ G& `& v0 l+ S2 R
  11. *         TO CHANGE.
    " \; l7 N. V2 t% N" w
  12. *
    5 f1 z% k0 J% f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : V. A7 F$ D3 Q( G0 E2 }6 J
  14. *
    ( h( f4 L4 C, h9 }
  15. * This program is free software; you can redistribute it and/or
    ) |6 a! L* T* J, f
  16. * modify it under the terms of the GNU General Public License as
    % K1 O+ t1 B+ t5 P  t, {# K4 G
  17. * published by the Free Software Foundation version 2.
    0 p; ]& u# B+ D1 y+ t/ E, m
  18. *& a6 J9 G% f$ K( l7 }  Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ?+ U7 c6 n$ u" p& ?0 ~$ _
  20. * kind, whether express or implied; without even the implied warranty
    * M  ?9 n5 m6 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 |( y9 n. J/ k
  22. * GNU General Public License for more details.0 R/ ?  s7 o9 _1 ?. _# F' X
  23. */8 r. {/ O  r3 p, [" o$ n  w; n7 }

  24. / t1 @8 {# I, B7 v7 i8 F% ^
  25. #include <linux/module.h>8 X/ \/ S1 x  h, P7 j- ?
  26. #include <linux/init.h>
    : i8 C. M0 S& ]
  27. #include <linux/errno.h>6 z  G: {+ D, r9 b7 U
  28. #include <linux/types.h>
    ' @1 {2 t9 v3 @: Q: `
  29. #include <linux/interrupt.h>  D- E4 s) x) Q4 f
  30. #include <asm/io.h>' P* x: h+ M  n. e' i( g9 Q% L4 a3 s
  31. #include <linux/moduleparam.h>
    $ K" i' D& A  y' v  q4 T2 n. _9 l/ i# [
  32. #include <linux/sysctl.h>
    + D0 G3 |( a; _1 c. ?
  33. #include <linux/mm.h>
    # @4 u5 W9 ]; W; F: b
  34. #include <linux/dma-mapping.h>
    6 B1 h4 Z* C7 m, n
  35. ; \  o9 X, _( n/ m
  36. #include <mach/memory.h>
    : [8 g6 w6 C. j6 l
  37. #include <mach/hardware.h>
    / L+ M& ~+ q% s$ ^4 q8 {
  38. #include <mach/irqs.h>3 ?9 s/ n, V' X
  39. #include <asm/hardware/edma.h>  {" i- W9 [9 W
  40. , V/ O" G* U$ v  K  F/ H! L
  41. #undef EDMA3_DEBUG
    5 W6 U0 a9 A9 J0 A6 k. X1 \, c  ?
  42. /*#define EDMA3_DEBUG*/
    ! O2 X$ C3 G! ?7 Z2 V/ h

  43. ! k  Q) X) [) Q; i- A9 C9 ]
  44. #ifdef EDMA3_DEBUG* O7 ~3 C# r+ Z. Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ ~3 S2 q) O$ F6 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 L0 f5 C9 b7 ]) }! K; f! F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : V  ]$ V3 X# u0 a
  48. #else9 G2 I( B) x7 w4 C' E) E. f7 J
  49. #define DMA_PRINTK( x... )
    & n7 }/ l3 r( ?# n0 Q
  50. #define DMA_FN_IN) O% \6 ?+ f2 i7 K9 O
  51. #define DMA_FN_OUT
    % Q4 R+ {( z8 |) q1 g, p1 B
  52. #endif
    , T) ~3 u1 t+ u" m* [+ m# _5 B1 [
  53. ! R( ]9 }3 d. S& ?; S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * }" z( `$ \6 W/ ?, K1 z. t
  55. #define STATIC_SHIFT                39 k% t2 R5 J: R; o: \
  56. #define TCINTEN_SHIFT               20
    - N/ b4 s3 x" _- V. X$ l+ r. X
  57. #define ITCINTEN_SHIFT              21
    $ C8 z2 R. o1 L4 [
  58. #define TCCHEN_SHIFT                221 T# R3 |, O* B$ `4 M5 a
  59. #define ITCCHEN_SHIFT               23
    * W7 c& w* u8 z1 w" g
  60. ( W3 {% x9 G3 O
  61. static volatile int irqraised1 = 0;9 I, ^2 r% {  Y2 S; c! @9 d& ~
  62. static volatile int irqraised2 = 0;6 W6 C  m% L$ |, ?2 _0 y

  63. ! d) ~! n5 g! r, r  h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 J& s& f% N3 K3 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! f+ }. c' T! U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( |" M8 g" n" h0 ^# z0 l( O

  67. ! G6 \; [/ {/ J# @1 x* x: b
  68. dma_addr_t dmaphyssrc1 = 0;
    ' Q- ~, O$ p$ A- u# [
  69. dma_addr_t dmaphyssrc2 = 0;
    8 W( R- p8 F: V! s
  70. dma_addr_t dmaphysdest1 = 0;5 v. P1 {* j9 f$ H0 T. u2 B9 s* d
  71. dma_addr_t dmaphysdest2 = 0;6 ]# O& X0 c  i1 g
  72. ; N4 V3 b6 z) q" D' z" |8 n
  73. char *dmabufsrc1 = NULL;
    ! ]7 k; ]% f" x: C1 r" N
  74. char *dmabufsrc2 = NULL;0 f/ @1 v7 X6 D1 I2 k% ~
  75. char *dmabufdest1 = NULL;
    9 }0 B& q! c3 ?, ?! N4 N9 z
  76. char *dmabufdest2 = NULL;
    , [6 d& r. d7 m' m2 p
  77. ' B3 s4 s5 I( ]4 K
  78. static int acnt = 512;
    0 j. R. K! r1 F2 k
  79. static int bcnt = 8;  r- Y, Z- Y4 u5 F3 O
  80. static int ccnt = 8;/ a  C5 v& C! r, ~2 [9 f- s# v

  81. " F- A5 I2 N4 K
  82. module_param(acnt, int, S_IRUGO);
    $ V, h/ P: C: O5 v8 x& g1 H
  83. module_param(bcnt, int, S_IRUGO);
    . V7 i4 {- u/ ?' U% M' u8 p9 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ D7 X8 \6 D8 k4 g
9 \- e* o+ u/ G* a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ E! U0 L0 j2 |; J. N* o' Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ T% S' J. J3 m) h. F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 a2 o8 S6 M6 j* @$ [. r  @4 R$ N9 T) t. f# L; h$ \. j

1 _6 P0 E* i3 \( P* N! K- [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-16 06:41 , Processed in 0.037250 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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