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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! ^. L9 u# D- k" ?# x- M
  1. [code]EDMA sample test application
    % ?* \+ ]8 g& s% W* f# P( \
  2. /*
    ! o( P0 I! I$ ]# f2 J2 Q
  3. * edma_test.c$ ^* W1 z% y5 U& d) W; X- Y
  4. *
    8 }' L- {, m' R
  5. * brief  EDMA3 Test Application
    6 y/ _5 Y9 v9 Y+ q; M
  6. *
    % a0 W" B2 I  w' Q; C# k; H3 P9 r
  7. *   This file contains EDMA3 Test code.
    : w* o$ B, h$ M  R* ]
  8. *
    % y: _9 C# r4 M& i( {9 L2 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 z4 q! s  H. i* O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 ^, u/ o' L+ x# h7 F
  11. *         TO CHANGE.
    5 x6 s7 \( I" Q) v- _5 t
  12. *5 Y; e& e* L" ~% N' t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( |" B+ Q4 R/ I4 J7 Z& g
  14. *8 E) Q6 ?6 @. Q$ R
  15. * This program is free software; you can redistribute it and/or7 C; s- [6 g% u
  16. * modify it under the terms of the GNU General Public License as
    , j/ U/ F, i& H: Y. Y; ]
  17. * published by the Free Software Foundation version 2.
    8 o; ?0 P/ n9 z7 i: T& d0 F
  18. *
    ' D7 I, _' `% W7 H' I- X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! F7 ?; ]7 ?( v! f: K
  20. * kind, whether express or implied; without even the implied warranty
    . C/ b' v1 q: |- M4 J: g1 t" O4 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : O* e4 m6 l6 T. C) Q! e3 i
  22. * GNU General Public License for more details.
    / R. A! l! p7 y, `; ^5 G9 K
  23. */& g9 J1 h5 m( L4 K1 [
  24. . w5 V) u3 P. k8 A. Z
  25. #include <linux/module.h>
    0 K  F% a* L: Q% c2 S+ _( ?
  26. #include <linux/init.h>
    . y  ~& R5 R' e( E+ v6 ?' C
  27. #include <linux/errno.h>
    ) O/ m. K: z$ r8 `& k
  28. #include <linux/types.h>
    ! P7 W" i  `: F8 w# t+ |
  29. #include <linux/interrupt.h>- e8 J6 k$ m: x- C% Y6 M
  30. #include <asm/io.h>
    / [- R! T2 s5 G+ S2 S
  31. #include <linux/moduleparam.h>  B2 U3 p, [5 a4 I, |1 s( t
  32. #include <linux/sysctl.h>, E9 }. n4 M3 g  U" P2 A8 Z9 w& t4 G
  33. #include <linux/mm.h>6 S: c2 j8 L* s) L2 v( F" N! w
  34. #include <linux/dma-mapping.h>
    1 W& ~+ U* \& M6 Q# a5 {

  35. 5 `) b4 M! a" u2 M
  36. #include <mach/memory.h>; H0 C: [' ^% @( H/ R7 x
  37. #include <mach/hardware.h>- B8 l  S9 W# J4 n
  38. #include <mach/irqs.h>
    / u& B6 L* e7 F( l9 {5 [
  39. #include <asm/hardware/edma.h>
    0 n4 h, L$ j; \1 f. x3 c+ D
  40. 7 Q; b0 ?0 G! C  W' m
  41. #undef EDMA3_DEBUG
    9 R/ a# t+ e9 ^. R
  42. /*#define EDMA3_DEBUG*/
    : u; v9 K5 o9 y( |/ n& \& u
  43. ' N1 k0 h0 Z" z2 v/ v2 S
  44. #ifdef EDMA3_DEBUG- Q/ r$ ]' g- C. R0 ~% V3 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% c9 {( j* w* \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# O6 b6 C9 U0 r4 H5 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - h" z& U4 `5 D* g1 f2 ~5 }
  48. #else
    ) G; m2 A  T& G: r/ \
  49. #define DMA_PRINTK( x... )6 w/ {/ m1 {7 l( x$ D& J) O
  50. #define DMA_FN_IN6 m" N" Z7 m7 A; K- H- p" N
  51. #define DMA_FN_OUT& Q6 I& T' Y$ I$ N% G2 l3 a
  52. #endif$ a: S5 H8 g2 u4 x8 ]( l2 D1 v
  53. ) C, W% O* G& c8 N/ r  y0 q" S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " U3 K: a2 j0 ~3 c9 [. P! a4 c  q/ a9 E) E
  55. #define STATIC_SHIFT                3) i" r- V, t# c
  56. #define TCINTEN_SHIFT               20
    ; `" S0 i: l  W" E& g" U
  57. #define ITCINTEN_SHIFT              212 ]3 b! g8 {* S$ u8 m, e
  58. #define TCCHEN_SHIFT                22
    ' m! L$ ?4 J0 \; E
  59. #define ITCCHEN_SHIFT               23/ t: c# P6 i, U* E
  60. 0 W' _4 B' v& R) ]0 k2 P% [# B& ]/ _
  61. static volatile int irqraised1 = 0;
    " z8 v* Q- T1 a6 z4 i: A
  62. static volatile int irqraised2 = 0;
    6 v: U% w. I: Y/ I5 u0 o. s$ V
  63. 9 }  r2 v9 o, a. n0 n1 G; S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ q; g- j8 W3 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) C! A/ s4 W5 n8 R, t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  R. P/ m. V- L

  67. 5 Y# S7 {% s: M! _( a. E
  68. dma_addr_t dmaphyssrc1 = 0;
    ; g' B" U! h1 }% M2 j0 S1 t
  69. dma_addr_t dmaphyssrc2 = 0;
    ( i2 {& V) J: {
  70. dma_addr_t dmaphysdest1 = 0;$ T2 q9 X  g! V" n1 T& L- D/ H4 ]
  71. dma_addr_t dmaphysdest2 = 0;
    1 J) j' [! C2 K) @/ r) v& U
  72. 8 ]7 V. g- Z# h1 k# Y& L
  73. char *dmabufsrc1 = NULL;, c7 d) D5 S. _( h+ N) M3 i! g
  74. char *dmabufsrc2 = NULL;8 Z( z5 b2 r. N$ i0 N
  75. char *dmabufdest1 = NULL;
    & |) Z1 w- @3 |* c
  76. char *dmabufdest2 = NULL;
    ; s% _; K8 t. k

  77. - Z+ @2 t8 q2 T4 S' R; A7 D
  78. static int acnt = 512;
    3 j: @: z2 b1 n9 |6 B* X
  79. static int bcnt = 8;' ^6 @+ {2 f  M6 m& }
  80. static int ccnt = 8;
      q9 D. Z6 `& S/ F5 w

  81. " b; h- r5 ]- f% y; r: w: Z& X7 y( s
  82. module_param(acnt, int, S_IRUGO);
    / v2 U8 B' _- O9 c, X* `& o* ^
  83. module_param(bcnt, int, S_IRUGO);, H% }: C& U# [) j, f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# Z, m$ T' R2 _8 l: j7 s7 Z* K7 |7 C/ i/ T" c3 z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! H. h6 o, H9 V- L  {; aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 \8 I6 Q6 |5 \0 @7 R  x$ z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& d4 I+ q2 A5 d: N7 O7 H$ T1 @9 Q

& k5 X+ G9 C8 n! {- ?7 _; k+ j" N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 13:43 , Processed in 0.039880 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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