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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & h+ J) X( ^' c) y
  1. [code]EDMA sample test application* U! B" M! i2 ~$ ]
  2. /*
    + W8 T' o* e( J' u, `# z
  3. * edma_test.c
    $ O0 H1 i- d4 ]7 `
  4. *
    . C7 E3 f7 u9 c$ N; a
  5. * brief  EDMA3 Test Application" b2 D5 N% ^1 p6 M0 q0 Q( Q
  6. *
    4 z/ F5 Z/ A, J7 p# c
  7. *   This file contains EDMA3 Test code.
    + P8 T: B4 v2 u, L3 \
  8. *  @% A+ I' B9 @5 U+ b7 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 I8 Q( G+ O' [* c% v8 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, o, M/ C# `- d: e+ q' g
  11. *         TO CHANGE.
    # K9 p  d0 K4 @
  12. *- w/ j: F1 N. p" J. y1 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 w1 a$ Y+ l: W9 h6 M3 g: _2 _
  14. *
    $ L/ a( c. g" C8 A. V
  15. * This program is free software; you can redistribute it and/or
    2 P) `  [& w9 [, u4 C3 w9 y
  16. * modify it under the terms of the GNU General Public License as6 o- q$ F8 K/ W+ C7 c  v+ ~$ p8 ^
  17. * published by the Free Software Foundation version 2.
    3 z2 T( r' T5 n6 Y% k
  18. *
    ' n2 k0 F3 \& L% U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; h7 E2 C9 M7 M' d9 l; K
  20. * kind, whether express or implied; without even the implied warranty/ n% g1 ^  A+ h6 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 ?5 Y: F- y$ E% v0 Y) z" W' Y3 _! \
  22. * GNU General Public License for more details.
    + e( A: ^, O' h2 R/ J
  23. *// {( q5 O! P, y* Z) }% e
  24. % J1 [: W8 h% B& c8 R: l! H
  25. #include <linux/module.h>- w" Y1 M6 e7 x% T% B4 B6 ~
  26. #include <linux/init.h>2 [$ O" c4 z: j( R
  27. #include <linux/errno.h>
    ! q/ o8 {+ [# {/ _9 p; ?
  28. #include <linux/types.h>$ U1 t2 r8 _2 K: R4 {
  29. #include <linux/interrupt.h>. h9 ]( |. S  ?+ T; n
  30. #include <asm/io.h>
    ) N& l4 f  m  a( W
  31. #include <linux/moduleparam.h>: j5 Y* C4 P: p% m' L8 _
  32. #include <linux/sysctl.h>
    " x2 P8 u( |( B& `, m
  33. #include <linux/mm.h>
    ! v& a: n& R' d% b8 m5 |
  34. #include <linux/dma-mapping.h>' p$ @$ l8 J0 K0 V# A, ^5 m

  35. - }; ]8 v1 A8 @  E+ \
  36. #include <mach/memory.h>
    5 M6 o" p. k1 X5 Q
  37. #include <mach/hardware.h>
    $ G1 E3 f, u  J( e3 k# ?5 n
  38. #include <mach/irqs.h>
    ' L0 X! e# r7 u( R
  39. #include <asm/hardware/edma.h>
    $ D7 J; I+ [" n
  40. ( v6 `: H! O! X. c- F& M/ U8 Y6 [
  41. #undef EDMA3_DEBUG5 W) z1 ?3 |; R% O
  42. /*#define EDMA3_DEBUG*/& k$ U- F4 x; {; r1 U  m

  43. + ?: e* O* k7 ]% a, t$ l
  44. #ifdef EDMA3_DEBUG# ?5 b# \8 w+ I/ L9 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' }3 b, b( ^9 C7 w9 J2 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 M& s' W. v1 O* Z# y9 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + ?1 O8 f+ q7 m1 C' c
  48. #else
    * p4 @0 o4 N  @8 ?  o+ {9 g" @
  49. #define DMA_PRINTK( x... )' O. P- g: N7 p! X$ o5 y! b- ]* J. r
  50. #define DMA_FN_IN
    ! X; c' ?! g  W
  51. #define DMA_FN_OUT  l$ B2 ~0 }9 |- P# k5 V6 Y
  52. #endif
    # x3 o& \9 d1 U- K! Q; L
  53. ( |: n; A# s. G* o6 T, `# |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). m1 [# ~* B7 p: I" R8 W
  55. #define STATIC_SHIFT                3' M( [/ h' d0 `+ z! I
  56. #define TCINTEN_SHIFT               20
    ; `7 Q* s, o/ w
  57. #define ITCINTEN_SHIFT              21; r4 o; C6 y: a* }% {, Z6 D
  58. #define TCCHEN_SHIFT                22- ?# N+ i* D+ A2 [
  59. #define ITCCHEN_SHIFT               23
      p' I, N: Y1 |

  60. + `( j6 d1 G6 e
  61. static volatile int irqraised1 = 0;
    . e) L' n) W; V% }* L
  62. static volatile int irqraised2 = 0;
    - u; M3 L* b+ _

  63. ! P8 ]# O+ a6 [" Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C( Y9 I/ d# M8 ^$ h/ g6 M7 m4 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : U5 n9 V/ o! U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- I# {! T# y/ P3 A

  67. ) a% L7 k3 S  e6 e
  68. dma_addr_t dmaphyssrc1 = 0;/ `3 d/ q( [9 t( d' V, I
  69. dma_addr_t dmaphyssrc2 = 0;% x, O9 Z% s- D; i& \
  70. dma_addr_t dmaphysdest1 = 0;
    * v* p6 S/ N9 b9 w6 g1 {
  71. dma_addr_t dmaphysdest2 = 0;
    8 I8 i% Q0 Q& v6 N7 @$ t+ [4 F: S

  72. ; y4 e2 |  b2 F  ?" v3 [
  73. char *dmabufsrc1 = NULL;
    3 {* p5 W4 E7 p3 I
  74. char *dmabufsrc2 = NULL;
    ' |* W; C! I+ G8 m7 i$ L
  75. char *dmabufdest1 = NULL;. k6 @/ `& \% o( M3 j8 S- E6 s
  76. char *dmabufdest2 = NULL;
      \3 z3 u/ k) A) I
  77. . x. j* g$ t7 G8 N
  78. static int acnt = 512;2 R+ [6 r" t8 L0 y5 p5 j; v
  79. static int bcnt = 8;
    & V7 y" T/ A, L
  80. static int ccnt = 8;# `" ?5 z9 l& I" J* N
  81. - Q! g4 F: O. m- A+ ~
  82. module_param(acnt, int, S_IRUGO);/ d# Z) ]" f0 ~$ a* L
  83. module_param(bcnt, int, S_IRUGO);
      }6 [9 F+ V) N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 \& {5 u" j7 K8 {1 ~1 |. V5 @) [: Z# N; Y& |. x( ?3 @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 Z) j8 ]+ Z( M2 h9 m5 M6 W! Z2 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; n# ]8 u- F+ M3 A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 N2 {0 r4 U; c1 y5 a

  I6 g- R+ r0 g7 [
8 U  F* N3 y+ h$ I" h" S9 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-17 04:24 , Processed in 0.049631 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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