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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& C) F9 h, d8 Y9 o' M' R, G+ N
  1. [code]EDMA sample test application
    % N0 x2 z4 l" ^8 K/ w
  2. /*! P- ~5 R* u  ^2 u# J9 Y+ D7 ^  ?( u
  3. * edma_test.c" R0 l% ]  o7 ^1 B
  4. *' k$ T: P4 p, [
  5. * brief  EDMA3 Test Application
    * X8 |4 w" l6 I# ?# j
  6. *5 w* E1 ~% A+ E5 M( h
  7. *   This file contains EDMA3 Test code.
    . B, S, r$ {5 Q* n: Q
  8. *$ \2 l7 P. h+ Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % _" P' W7 X$ H" R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & @0 B% `7 z9 v% ^* B- c, `& W
  11. *         TO CHANGE.* F( i2 Y+ I: J5 j- [' K9 }
  12. *' G. a* _5 F3 y, Q! R' r3 @$ j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 L8 [( ~3 X9 w& j: C5 I/ h
  14. *3 w# _( e/ I! n9 w  H, J2 z) k
  15. * This program is free software; you can redistribute it and/or
    9 P1 c; ]1 q* o
  16. * modify it under the terms of the GNU General Public License as
    2 [' c% P1 G4 U# q( D
  17. * published by the Free Software Foundation version 2.
    1 u$ g6 o  X' h9 b
  18. *
    " \: A3 D% I1 d& h% M  t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 F7 D0 B3 y  |
  20. * kind, whether express or implied; without even the implied warranty
    ; y. M) P' K8 Q" p" O0 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" G; m5 [% K) S5 h! e
  22. * GNU General Public License for more details.
    ( L: K' y  q- ?. n
  23. */% d' f# C) w) h2 A0 W' U
  24. " ]4 H8 f( J: s, ?$ y8 S
  25. #include <linux/module.h>
    ; Q3 y; ?9 y$ `3 p! d
  26. #include <linux/init.h>9 Z$ a9 N1 v* \& h& X0 d
  27. #include <linux/errno.h>
    , }% y5 y4 X# F" i. B9 q4 o
  28. #include <linux/types.h>5 U; N9 I5 R/ Y
  29. #include <linux/interrupt.h>
    ( m; `$ J+ v, k# {7 s4 G9 S- X
  30. #include <asm/io.h>
    " ~' b9 c% I7 y3 Z
  31. #include <linux/moduleparam.h>6 I, O% }: r0 S! A/ U+ v( ~
  32. #include <linux/sysctl.h>6 I7 g7 f2 h2 O7 f! e" j. L
  33. #include <linux/mm.h>
    : B7 \8 O/ E7 R- a, z- y
  34. #include <linux/dma-mapping.h>1 ~. b" `+ m$ A" ^

  35. + `' E; W' y$ P2 q
  36. #include <mach/memory.h>- u/ Y) y; i  g
  37. #include <mach/hardware.h>
    9 j. p: V8 d/ |8 ~. R
  38. #include <mach/irqs.h>+ c6 d1 W3 t3 ^7 p
  39. #include <asm/hardware/edma.h>* t2 t! c6 {- ~; {1 S6 I
  40. / H  D2 Y, W  q$ C
  41. #undef EDMA3_DEBUG/ `7 @8 S* p) _6 T) K8 U9 t- c
  42. /*#define EDMA3_DEBUG*/, S4 }, ^/ y- t2 f+ ]) @' P. M

  43. 9 E0 O# C- x1 R2 V4 P! x
  44. #ifdef EDMA3_DEBUG
      R8 M$ M) A5 c0 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 W0 @! r: [5 K; u8 X0 m% V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 T) `, n2 N+ o3 _6 i- B! X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * c$ a2 w( A8 ]( Z) l1 \
  48. #else
    2 f/ T2 H7 f, E
  49. #define DMA_PRINTK( x... )
    + V# q0 R0 J- V
  50. #define DMA_FN_IN
    & @" W$ z% _2 m/ t, B! a0 }
  51. #define DMA_FN_OUT4 }, i! C8 l6 Y6 j6 n' j
  52. #endif
    & u. }) |* a/ j4 E
  53. % ^: |% v" a6 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # u. d  q6 a* B2 w% O6 t
  55. #define STATIC_SHIFT                3
    $ B9 t5 h4 u7 a2 c6 o5 I
  56. #define TCINTEN_SHIFT               20$ l& O- o, \! ?
  57. #define ITCINTEN_SHIFT              21
    1 v/ P5 i" k) H4 L$ |% X8 a4 b
  58. #define TCCHEN_SHIFT                22
    3 B6 r+ i( ^8 g. ], W
  59. #define ITCCHEN_SHIFT               23( A2 N0 }; F! X/ C: @
  60. $ j+ j4 m2 V7 L/ V: }) c2 w$ g
  61. static volatile int irqraised1 = 0;: k7 s# G: ?3 g2 s' B( k6 j
  62. static volatile int irqraised2 = 0;
    ! A9 `  l+ I- D

  63. + j% A6 `. \( A1 `9 h4 |4 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 i% c" L7 Z9 y% j0 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / q3 b4 m) u( n) H+ `$ P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* T/ `( o* G6 r+ H

  67. 6 E$ I* k* _( R. @, ]4 O
  68. dma_addr_t dmaphyssrc1 = 0;
    ' C! P5 `- |) W
  69. dma_addr_t dmaphyssrc2 = 0;( h6 H  J, U# ?( \
  70. dma_addr_t dmaphysdest1 = 0;
    ( M' T( l) v" U: ^, j. S
  71. dma_addr_t dmaphysdest2 = 0;
    3 X' N- O' s6 c/ L) R- l' X* t& q

  72. & P1 e# ~" P& d$ O. \8 `0 y
  73. char *dmabufsrc1 = NULL;
    ; l& D* z- d' e: c' L. [2 Y
  74. char *dmabufsrc2 = NULL;
    4 b+ f" p5 a# u5 N
  75. char *dmabufdest1 = NULL;1 g7 e- b+ G* L$ v/ D% S4 g! }
  76. char *dmabufdest2 = NULL;
    * ]! }9 Y" _5 Y. u  F1 m' |% d

  77. 9 Q3 V$ v7 k2 L- x' X* |
  78. static int acnt = 512;
    & e/ r7 O2 T- t3 Z: @3 f# y
  79. static int bcnt = 8;
    : p/ @$ e9 }8 W6 u' D
  80. static int ccnt = 8;* f5 I" H, M3 {6 p! G

  81. 7 p7 R+ t4 s/ {5 h6 m$ a2 Q
  82. module_param(acnt, int, S_IRUGO);% N, g9 i( V( l5 P) `; v0 o
  83. module_param(bcnt, int, S_IRUGO);
    0 L0 I! J1 A  d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 F. |" h3 c9 A

9 C% C! x* O6 q* _" h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 t+ j( Z6 i& _& I& j6 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ G8 X7 Z9 ?& _9 h  ^8 ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% x% X! p+ Y+ m* B4 _3 B2 [
7 |# t8 V* i5 u0 |% ]6 N/ O( a
& {. @2 L* v% Z. C. A1 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 22:35 , Processed in 0.049154 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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