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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( i6 a6 q5 M6 h: _
  1. [code]EDMA sample test application
    5 t* o  q& M) A% v1 \; d( p5 W
  2. /*
    + E2 r7 S9 `8 n% e6 q) z, ?
  3. * edma_test.c2 R' v1 d6 Z  O' u' N: B/ e
  4. *. \9 M! c7 [: W+ j" r
  5. * brief  EDMA3 Test Application6 b6 C; ?% Y' O( q* O9 v$ I/ ~6 i$ q
  6. *
      B0 \) d) U& Q8 q. @
  7. *   This file contains EDMA3 Test code.
    - M# J* [% \- G
  8. *+ \) p5 ^7 K7 ^. @! n3 M& W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 h, k4 M( Y& g+ L: q1 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' o! Z* I, K8 g0 X8 U& m$ s5 m' L
  11. *         TO CHANGE.* H# W6 F% ~- o& g  e
  12. *
    8 q' I" _0 C6 h' j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 R* X7 [/ A7 j  `, X
  14. *
    6 R+ a/ ^4 n& {9 }) l' O
  15. * This program is free software; you can redistribute it and/or
    3 |" y6 v6 Q/ Z# H
  16. * modify it under the terms of the GNU General Public License as" s1 p4 [9 H/ m0 ?* {2 ~% ]' g6 _
  17. * published by the Free Software Foundation version 2.) @+ @3 P, @$ G/ `; \3 k
  18. *, i2 r% W0 h5 l" ~* P7 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) O/ ?/ R! M0 u9 p6 K& a4 I1 y
  20. * kind, whether express or implied; without even the implied warranty" D* ^. Q% d  ^, M, c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 K: I6 Z8 |0 O( R2 y( A! ~. D/ q
  22. * GNU General Public License for more details., J9 [4 C5 N' q
  23. */1 a. |2 L5 c, J' c5 h

  24. : d4 H) M8 u0 r- P% C% v/ @
  25. #include <linux/module.h>. s$ q0 t; s! y6 b1 l4 f
  26. #include <linux/init.h>/ [5 M% A( K; f4 |. J
  27. #include <linux/errno.h>
    9 S' Q( M  t2 d" f5 v* l
  28. #include <linux/types.h>: D# e! y' @) A2 N
  29. #include <linux/interrupt.h>
    / w, H1 T, {2 R6 k" f
  30. #include <asm/io.h>2 w' K; P4 H% k" M& t' p
  31. #include <linux/moduleparam.h>
    - a7 |% H0 u* _% Q* l
  32. #include <linux/sysctl.h>6 z0 ^$ ]0 M6 a' T
  33. #include <linux/mm.h>4 F# z  }+ b4 f- x' }" o
  34. #include <linux/dma-mapping.h>- E" M2 ?3 {' T% |, M- p

  35. 3 F+ [& L( `& c5 J4 G9 f
  36. #include <mach/memory.h>, b/ X' c) j$ P3 Z
  37. #include <mach/hardware.h>
    , ]' q0 y& |; V" m5 T; Q8 N# k
  38. #include <mach/irqs.h>5 ~# S& e3 \% x5 B( w
  39. #include <asm/hardware/edma.h>
    " t7 _1 N; g/ d' D6 x; R; I* V

  40. * y3 e, y+ l. P* r
  41. #undef EDMA3_DEBUG
    - q9 t3 @# J0 u: E0 k
  42. /*#define EDMA3_DEBUG*/8 S. z5 [3 ?+ a+ \: b  Q3 ]

  43. / n% z7 h0 {+ n' x
  44. #ifdef EDMA3_DEBUG+ k0 j' Y% l7 A8 s/ ^1 t+ ~9 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , ^( |& u+ |% o$ j2 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% K- [, U% {7 j. d6 S6 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ \1 Z% n7 y# h3 x
  48. #else
    . |* J2 ]. L$ O+ M1 D$ f: j
  49. #define DMA_PRINTK( x... )
      F+ m! {. C( d$ d" r
  50. #define DMA_FN_IN8 f1 r' h+ d; g( Q
  51. #define DMA_FN_OUT
    ' p- o( v0 u) d- i; {
  52. #endif/ H" C% m9 V8 h/ o

  53. . \: M! W+ b& p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). k5 O2 m- g; s8 z% M
  55. #define STATIC_SHIFT                36 h& ]* r7 H+ k+ y3 e7 o
  56. #define TCINTEN_SHIFT               200 K; {8 e+ i+ x1 Z6 }! W
  57. #define ITCINTEN_SHIFT              21
    ! @8 [; H, \6 s: D( v
  58. #define TCCHEN_SHIFT                22, k+ T7 Z$ N, A1 d! o
  59. #define ITCCHEN_SHIFT               23
    ; v+ I! l4 v5 l2 I' n: z! ~

  60. , G0 g+ u& z# ~# ^* i8 R, }
  61. static volatile int irqraised1 = 0;+ R6 x  J9 w: ^  w6 T. Y! Z# `# f4 X
  62. static volatile int irqraised2 = 0;
    ( R! V" e7 z% A% e5 F

  63. 3 p8 X2 V+ n: r7 N: ?3 f  t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 @4 Q$ ?8 L2 k# v# v, R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * r8 o; q$ ^5 n: V- g0 `! ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : o; A  k' _( C" x7 C- [
  67. % O" n# e; q& \. Z( s& g$ v7 ]( N
  68. dma_addr_t dmaphyssrc1 = 0;
    1 O* g& W" ]2 H1 t/ x2 \$ o
  69. dma_addr_t dmaphyssrc2 = 0;# L6 L5 U, Z+ {" n7 [$ g
  70. dma_addr_t dmaphysdest1 = 0;
    9 @! U# K) i% x( ~1 i
  71. dma_addr_t dmaphysdest2 = 0;7 s! N7 s7 m4 L- l- F+ H) u6 U
  72. 2 k( [, v# w9 v- K4 p  a
  73. char *dmabufsrc1 = NULL;' V: S/ n) R) s3 M: W
  74. char *dmabufsrc2 = NULL;
    1 a3 S* w: t/ K7 Z5 {' U
  75. char *dmabufdest1 = NULL;
    ! w. k0 \3 u$ i5 r9 r( y
  76. char *dmabufdest2 = NULL;; f, S; V- u, M) K1 u/ b# {- ^0 U

  77. * W* a1 g+ [2 m5 ]0 t
  78. static int acnt = 512;5 B. G. p- |8 b
  79. static int bcnt = 8;
    % Q5 G8 q% Y6 F! M
  80. static int ccnt = 8;
    - c; v" N( \; S% Z

  81. ( \" A$ r- \, V2 W2 n. n
  82. module_param(acnt, int, S_IRUGO);
    . A/ E, `% n( i( N" F
  83. module_param(bcnt, int, S_IRUGO);
    4 P  ?+ K4 D0 s& Q! g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* a% S+ K8 z: I2 n, U+ |9 _* y1 S% k6 c. \4 \: j( Y  h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ ~% r% p& F, P' r3 {4 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. s7 z7 y" F0 m4 U/ [+ w; s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 h8 H& s5 z7 a! Y. r& G* M. z
& E; I5 l6 O6 N6 M. |3 o
+ a4 ^( R9 y: b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-25 23:06 , Processed in 0.056382 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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