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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - F7 F2 Z) _- l
  1. [code]EDMA sample test application
      c# a0 t( H7 P" E( \
  2. /*
    " i, l9 V9 l/ i& v- q/ H
  3. * edma_test.c
    & h0 ?) F/ r% V
  4. *
    ! y4 w! L! P8 ^8 [  J4 D
  5. * brief  EDMA3 Test Application$ B/ Q7 _  R9 Y4 U2 d
  6. *% P9 {5 y+ F5 i4 `7 g# l
  7. *   This file contains EDMA3 Test code.
    0 Z8 z. C# |7 E) O( |$ k& M0 o
  8. *' f7 `$ o" A" w. f& t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& C, j0 t& a: ?+ v/ \0 H) G" }8 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  a/ p* _. L8 ^. {  R5 @' T/ t2 [
  11. *         TO CHANGE.
    # k2 w* z# e) K
  12. *
    $ s5 ?+ L. Y) N; i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' l( `1 j6 K% w( l% M
  14. *: {0 D4 X4 M& M$ K5 h
  15. * This program is free software; you can redistribute it and/or
    5 G/ u5 u$ h- x$ \
  16. * modify it under the terms of the GNU General Public License as% b1 G( ]; v! M' Q7 h' M9 a
  17. * published by the Free Software Foundation version 2.
    ; Z+ T& M' G, i! ?6 E, w9 f1 m
  18. *
      E( ~- f  i5 C; t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + T) Z& s, T4 ~4 z8 t" w
  20. * kind, whether express or implied; without even the implied warranty  f5 G/ {8 W3 r8 A, g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 a6 N- c# N  }& R5 a/ k
  22. * GNU General Public License for more details.4 A+ ?* r5 q4 @6 g# v# F$ |6 q
  23. */
    ( ~' r) s1 [4 C% @0 ^  A/ g

  24. 0 }& u: x. b. S7 C
  25. #include <linux/module.h>: e" R2 ]  j5 f, f* W; x
  26. #include <linux/init.h>& c8 {% ^" q+ `: ?1 U1 z
  27. #include <linux/errno.h>
    6 y! R( x% h+ f& @- {- R
  28. #include <linux/types.h>
    / ]% v3 D% @6 V& ]' b/ l* H
  29. #include <linux/interrupt.h>
    9 v6 s4 ?* |; v4 A/ i
  30. #include <asm/io.h>
    4 |- `0 L" r5 G/ t. N
  31. #include <linux/moduleparam.h>
    ( `! m/ J- x2 p
  32. #include <linux/sysctl.h>
    / }4 U9 X6 ~5 Y: T6 _
  33. #include <linux/mm.h>% Z" B7 v/ j! E8 N% v2 T
  34. #include <linux/dma-mapping.h>* d7 {* q3 L( _4 ?8 z: j; v
  35. ( B- \, [3 z3 J9 I/ v
  36. #include <mach/memory.h>; A9 _& r2 {8 l: c0 k2 V0 [
  37. #include <mach/hardware.h>
    , {+ W* g$ j7 D" u1 }9 D- V  q' R
  38. #include <mach/irqs.h>+ p/ {; T3 @; [
  39. #include <asm/hardware/edma.h>( g/ N) Z' ]! [3 A/ z
  40. # R( T' a  Q' o6 \
  41. #undef EDMA3_DEBUG1 _, k) Y9 H3 o+ d) u
  42. /*#define EDMA3_DEBUG*// U- o' G1 K. _

  43. $ X3 @4 U- f! U( J4 C$ N
  44. #ifdef EDMA3_DEBUG, l  Z, E6 M1 u6 `) r! s4 e$ |/ D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 M; c9 p$ r7 s* H- q/ j) T, B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 c6 ^- s! F# F: X8 p) i0 p5 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . G# n. e, l4 K% H
  48. #else" q  E% R. z5 z* e
  49. #define DMA_PRINTK( x... )
    8 o1 A" Q- V* w% e8 S8 t
  50. #define DMA_FN_IN
    4 s1 _  \/ f. C( c: H7 H
  51. #define DMA_FN_OUT
      L- Y$ _: E. W, `1 l, W1 J5 K( F
  52. #endif" b4 P) ?7 R" e* G2 i: f4 N( {

  53. , k! }! ?/ `  A8 e: {2 v: s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % |3 q1 R9 V3 m+ n; f7 p
  55. #define STATIC_SHIFT                3
    ' n# s. n" L7 L: L
  56. #define TCINTEN_SHIFT               201 i0 `9 p6 X1 a% B2 f! Q
  57. #define ITCINTEN_SHIFT              21
    % [: @& K6 x: X( {  e$ [' B9 X
  58. #define TCCHEN_SHIFT                225 y7 T/ {* |. N* ~
  59. #define ITCCHEN_SHIFT               23, p' F# W; m/ _' p, H  V2 h2 b
  60. . e7 g( W5 K  D
  61. static volatile int irqraised1 = 0;
    - i: Z: {% k4 {% K. J4 W( W! x4 U
  62. static volatile int irqraised2 = 0;5 |0 Y6 C. o" h

  63. 2 Y, i. u  n  q, m" ?* w2 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ]; T& m( Q* U4 d0 i+ h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 [& |* M( ?4 \& m7 X7 X1 S9 w& C/ `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 T! b% N7 Q/ `. F& l

  67. % \( Q4 Z: |: J$ ?4 f; ]
  68. dma_addr_t dmaphyssrc1 = 0;) B2 T, D- o$ b4 V" V3 S
  69. dma_addr_t dmaphyssrc2 = 0;
    ! J# |7 R  x' U! P! u7 c
  70. dma_addr_t dmaphysdest1 = 0;
    3 t) R$ N9 b% i2 M8 R
  71. dma_addr_t dmaphysdest2 = 0;, J% M, R  n, L  n, }
  72. 2 Z* N7 i; s* a% l
  73. char *dmabufsrc1 = NULL;
    4 {* X! Z( Z- m5 V0 B6 B
  74. char *dmabufsrc2 = NULL;6 l7 @: v# ]" I6 u
  75. char *dmabufdest1 = NULL;0 c' ^* n/ r: A3 J
  76. char *dmabufdest2 = NULL;
    # G* S# V3 \1 G

  77. " J6 A% d% G9 V* z: R; m
  78. static int acnt = 512;
    2 X5 `# H6 E7 H7 `
  79. static int bcnt = 8;6 l3 p5 l3 U4 f$ z+ W5 o
  80. static int ccnt = 8;
    / t8 Y( Y& R( p( b
  81. 4 b9 j  g3 [- `9 P, j
  82. module_param(acnt, int, S_IRUGO);
    , |) ?) Z# Z3 M! `. L" P$ o
  83. module_param(bcnt, int, S_IRUGO);
    6 m4 L6 `1 E' S) }4 K, y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 F  L( k( n9 e# b2 D# E' v
) @" O$ U( r2 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, U3 p+ d3 Y6 G& l: Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- T9 r9 U( t) A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; c1 f; C2 x$ j1 I3 P$ }; o2 q6 b& E* h) h8 B9 N

, l  |1 s4 I5 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 01:05 , Processed in 0.058240 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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