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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ g- K  ^: s- ?+ r" F
  1. [code]EDMA sample test application
    + _, n- v$ U( [/ l, h
  2. /*
    8 |- S: c& X9 S6 k2 N6 [) i
  3. * edma_test.c4 }- L! Q' X' Q
  4. *. c. i0 k$ ~* a  d4 K
  5. * brief  EDMA3 Test Application
    ; B: C% K* P* m
  6. *
    + m3 }4 k, a- P' i) I0 P
  7. *   This file contains EDMA3 Test code.
    , w9 I' x' u" ~3 C) b
  8. *
    ! _  [6 Q" o0 H2 I" t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 j7 N, \5 y3 U' e7 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' R0 w0 T( @/ |& z$ h$ r- ?
  11. *         TO CHANGE.
    + ^: O( g9 @$ t9 [: Y6 V
  12. *
    2 e& z, B% [% a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 b5 ]8 D. O  v! D! J# ?
  14. *
    4 @! t& S) {- J+ c" A$ q
  15. * This program is free software; you can redistribute it and/or
    : r, s2 J7 {# r
  16. * modify it under the terms of the GNU General Public License as
    4 T3 T7 m  q1 [& P# A' x0 J& ^8 c
  17. * published by the Free Software Foundation version 2.
    , j% L+ w- F7 K5 n1 Y7 U' S
  18. *
    " `4 H6 W2 W) G4 Q7 g& M/ g: m9 Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 f" i  L: h) n% Q) W7 _: {- C" L
  20. * kind, whether express or implied; without even the implied warranty# |( r4 l/ |( h8 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 {: j. W5 m. p3 L0 \2 b; q
  22. * GNU General Public License for more details.
    - Q* F/ ]& U, g8 I  w3 B4 L- X
  23. */
      l+ E9 f" Y6 e7 ^3 B' R
  24. 6 D( w+ Y# P  O& p" q
  25. #include <linux/module.h>0 y+ w( X2 o" w, }5 w7 Y
  26. #include <linux/init.h>
    4 D0 x( @- f  r6 }' o' C# n
  27. #include <linux/errno.h>
    ( z, S& ]* L* T' X. s
  28. #include <linux/types.h>" p' N1 \$ N  P3 m3 J8 I
  29. #include <linux/interrupt.h>
    0 M2 Z1 X! u1 t! n: C
  30. #include <asm/io.h>
    ; \9 D9 ]! K. @$ b
  31. #include <linux/moduleparam.h>: K6 [1 Y9 Y9 n9 q8 ~1 Q9 [. ]( i1 e
  32. #include <linux/sysctl.h>& {& x* w" {3 E) Z( f& L
  33. #include <linux/mm.h>  i" s. \" M. m, H7 n8 N6 A
  34. #include <linux/dma-mapping.h>
      _! M3 F( }! u1 z/ i1 n; P0 w
  35. 6 R2 u1 ~% y( r: L( Q& k) ^
  36. #include <mach/memory.h>4 N" A  {& ]8 O+ `6 j. ?- p
  37. #include <mach/hardware.h>
    ! }2 I/ v# M5 c( z8 o( G
  38. #include <mach/irqs.h># y+ D9 C( _: u7 `
  39. #include <asm/hardware/edma.h>
    & {& w: M; w5 N0 R( B4 e1 ]3 {% Z

  40. 9 l( ]- P' q% T! ^
  41. #undef EDMA3_DEBUG/ m: y; Q+ S1 J% l4 L
  42. /*#define EDMA3_DEBUG*/
    ' A7 |& g0 M% R4 [
  43.   L. `3 k+ r  w, r/ @/ F& K( O9 J
  44. #ifdef EDMA3_DEBUG* i: J4 q' P; N1 A( V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . L) g& {: l! p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* T! X4 u1 n' G. L" e4 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 V" |" f) P6 f' ?! I0 v$ a
  48. #else
    ) y7 Q3 z, t% e: W, ?
  49. #define DMA_PRINTK( x... )
    0 M4 C, D. r0 V3 }. m, b  C
  50. #define DMA_FN_IN5 p9 n# X8 W" N$ s! ?. F
  51. #define DMA_FN_OUT3 E) b1 \/ O. \
  52. #endif1 D2 \7 Z' Y# ?& Y6 j

  53. 8 t, y, T4 F: x% X, ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- d6 r0 r3 j% Q; F$ d3 `
  55. #define STATIC_SHIFT                3
    . S8 ?8 b/ ~! B$ e
  56. #define TCINTEN_SHIFT               20  ^( [6 k' s9 W
  57. #define ITCINTEN_SHIFT              21' \1 P3 j  E( q
  58. #define TCCHEN_SHIFT                221 A- Z8 }, u$ a1 y9 q& ^7 |; V
  59. #define ITCCHEN_SHIFT               232 e) A# z! h) B& F

  60. 5 M/ s6 I6 W" I, }. `9 h
  61. static volatile int irqraised1 = 0;$ E. H: q4 H3 {4 G% g
  62. static volatile int irqraised2 = 0;
    , p+ E' B* L( @: _+ a% U$ L

  63. 2 E/ V4 i% Y- |! [$ T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 y- X9 l5 i, b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 v& g  t2 B7 E/ |5 B- o5 Y8 H& a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 z# M! n3 }9 G' R

  67. * X) {% ~* o7 q+ v/ H5 \- L
  68. dma_addr_t dmaphyssrc1 = 0;7 N7 H$ R) p3 m( p- F" [4 i
  69. dma_addr_t dmaphyssrc2 = 0;
    0 F- A/ P  @/ E! O
  70. dma_addr_t dmaphysdest1 = 0;+ D; x+ N0 t* O( s! t, c! M' c' h3 \
  71. dma_addr_t dmaphysdest2 = 0;
      c9 n5 O; S. e$ W+ O) m

  72.   Q" G, Y3 P. @( S' d& R" s
  73. char *dmabufsrc1 = NULL;4 G5 L+ n4 Q2 h! p
  74. char *dmabufsrc2 = NULL;
    . H7 O7 z% G. ^" H! x' y6 x( \
  75. char *dmabufdest1 = NULL;: Q) a' ^6 H* R7 @, m  f6 b
  76. char *dmabufdest2 = NULL;. q* m2 y) }# j: u; g. {- W  |
  77.   k9 k4 ~$ @1 _. V7 U
  78. static int acnt = 512;
    ! N* L' K2 b- u$ v; p2 R
  79. static int bcnt = 8;
    : ]; l. D+ ~9 T( \
  80. static int ccnt = 8;/ t: C3 s5 W1 s( o7 ~$ l) F

  81. . x( \! I3 Y+ T/ L% y! k
  82. module_param(acnt, int, S_IRUGO);
    8 S" n# C# @0 C! `
  83. module_param(bcnt, int, S_IRUGO);+ G, r7 k" [! e: Z, H: h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% }+ N+ e6 b0 i4 @- W& U+ s5 r
0 X7 ]( s' w% p! J' W; M! h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 M8 w" g0 @, ], y  Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* Q; i' @  q( _, h1 f0 b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 q9 D' V+ Q6 j0 \) p# k! A6 Z5 }5 f3 P- r

. Z! [  J" h" f; G9 [* r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 10:25 , Processed in 0.039463 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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