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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, J8 Y9 i( M" X" U/ U; o1 I
  1. [code]EDMA sample test application
    5 M. V- M3 F3 s9 N7 {/ s
  2. /*  K8 F9 L$ Z4 O4 ~: h  n
  3. * edma_test.c
    , ~" U* q6 g; h) {* c% X1 R
  4. *
    + Z4 V- ~' r) T  N: c3 `
  5. * brief  EDMA3 Test Application* [* m, D1 T% G6 E* E
  6. *
    ; b% r; o) Y: \+ N
  7. *   This file contains EDMA3 Test code.* n2 M: f0 m4 X. @/ I  z, E* N
  8. *- s7 w" V9 S5 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 v, L% D- u2 f; b6 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - W% M+ N1 n( e9 F( {/ Z) {
  11. *         TO CHANGE.# l+ k  n. o! s. ]( y4 |& L
  12. *; f% b9 p7 d. H6 W4 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 [: m  \# `9 v- S8 x2 H
  14. *
    1 P1 f$ W' k" F7 r
  15. * This program is free software; you can redistribute it and/or% x9 V. [4 V8 A7 f' b; s3 C$ H& P
  16. * modify it under the terms of the GNU General Public License as
    - w2 K, w9 R6 [) q2 |8 K
  17. * published by the Free Software Foundation version 2.
    ( B7 N+ [7 R5 t( G. D% D" L
  18. *
    8 \$ ]5 F, I3 \) M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 ?3 K/ |3 E. L
  20. * kind, whether express or implied; without even the implied warranty
    % W) p' A! ~$ m8 j7 l4 x0 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : |( U6 h9 B% [& g+ f+ R+ t
  22. * GNU General Public License for more details.
    6 I1 z6 K/ y7 O9 }  `5 O
  23. */
    7 n& v, t7 q! B1 L9 L; z( N2 H- U# R/ Y

  24. # C" C5 X6 _+ w: j
  25. #include <linux/module.h>9 }4 _- _- U2 V* R! C. G% Q
  26. #include <linux/init.h>9 s8 I( z/ X6 `, S! w8 R( N( N
  27. #include <linux/errno.h>8 A& a9 U  g4 z2 I9 K5 i
  28. #include <linux/types.h>7 B) c$ E( v2 G5 y8 x% W
  29. #include <linux/interrupt.h>; |' E9 w! O, H0 V  J" t
  30. #include <asm/io.h>
    0 o3 x$ P; h8 r: O
  31. #include <linux/moduleparam.h>2 N  X; C% F& C+ J  X, s
  32. #include <linux/sysctl.h>
    $ |! v4 K+ a3 n
  33. #include <linux/mm.h>
    8 O1 g" p( W, c! k
  34. #include <linux/dma-mapping.h>( P' H# c2 Y. p# }1 a6 }

  35. 3 z( q( B( c( Z$ y# d
  36. #include <mach/memory.h>0 [  X2 a0 B/ @- _) S8 s
  37. #include <mach/hardware.h># G  i  O' J( i; s, |& \& t
  38. #include <mach/irqs.h>
    6 l  g8 z% ?6 C0 x* R! C
  39. #include <asm/hardware/edma.h>* H2 O' c# p! s2 \8 e0 T. F/ D" H
  40. 0 X) K( T% M# T( x3 f  m
  41. #undef EDMA3_DEBUG& ~5 h' C- Z3 a! t; t4 K
  42. /*#define EDMA3_DEBUG*/  @) h: X- D0 i- \6 q2 r
  43. 4 Q8 o" L2 l  a( T
  44. #ifdef EDMA3_DEBUG
    - ?- m. j! @+ |& k: P; X* _  f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 r6 T* v( l% P4 o1 \$ ]/ x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' k4 V# L! _" Y' |- h$ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 Z: f" }( S& x2 Q' e+ Q
  48. #else. c  H. j) f" J* m4 `
  49. #define DMA_PRINTK( x... )
    ! B- L' w- ]3 c; J
  50. #define DMA_FN_IN% g" ~% D( j! F/ G0 e
  51. #define DMA_FN_OUT( f3 a5 B. F2 x! D/ M) u
  52. #endif1 h8 H" P; b" Y; E
  53. ' G" G4 d% S* a2 Y3 ~" Q1 T" ]: Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : N7 B# U+ S. s
  55. #define STATIC_SHIFT                3* m! [7 Q- ]' l1 M
  56. #define TCINTEN_SHIFT               205 }! x1 O# z- o0 _$ J7 n- w0 {
  57. #define ITCINTEN_SHIFT              212 U) `! d% O# ?! ?
  58. #define TCCHEN_SHIFT                22# i) F5 W2 Q$ a9 c( j
  59. #define ITCCHEN_SHIFT               232 K9 |/ f" x2 J6 G) s
  60. 7 Z) E$ C! N! l" _6 z$ O, |
  61. static volatile int irqraised1 = 0;  H1 N+ H' Y- x: H& E
  62. static volatile int irqraised2 = 0;- C* Z* @$ `) M& e

  63. / Y" S0 f" O0 e& ^+ @* |, E$ {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 M* |* `0 ~; k4 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y8 l+ `' G& \; h& e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % m- W- }& ^9 s8 g5 v6 N
  67. * m/ Y) _. `+ R' M
  68. dma_addr_t dmaphyssrc1 = 0;5 f" L- j( E. d  x* b
  69. dma_addr_t dmaphyssrc2 = 0;
    / P6 A2 r: y/ i' O9 P( d1 j
  70. dma_addr_t dmaphysdest1 = 0;; ^: D' i3 [  y3 i
  71. dma_addr_t dmaphysdest2 = 0;+ l3 k& W7 {( b: n% Z9 r$ q

  72.   U; }/ a- E0 o$ b0 B
  73. char *dmabufsrc1 = NULL;- j2 j! r& R7 h  m/ g; c
  74. char *dmabufsrc2 = NULL;
      `0 x; e$ e1 ?0 v) _3 Z
  75. char *dmabufdest1 = NULL;
    0 S! o. T- ^. C% Z0 P7 A
  76. char *dmabufdest2 = NULL;' |, _5 @$ l3 I6 K3 c% R5 }
  77. 3 w$ b' I% w% k, ?
  78. static int acnt = 512;% M- \/ w+ O1 S6 y
  79. static int bcnt = 8;5 l% x1 g) E% Y+ k
  80. static int ccnt = 8;
    # `- H# m; v9 ^2 l+ Q8 k
  81. 7 c# R" ^+ c- w) C" }3 F: Q2 C9 L
  82. module_param(acnt, int, S_IRUGO);
    , ~  z# c; ^+ p7 \
  83. module_param(bcnt, int, S_IRUGO);
    7 a! T: l7 q2 \9 b6 C1 F: w* h, b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& _) h+ \3 L: ]$ K  m) h- D# Q" B* T

5 \* k; ^5 g' q8 W4 V/ V7 q& \0 ?* N  s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 A$ @5 b& Y% g2 G, G& garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. ?5 I" N3 L' [. Q7 |, ~) J, \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% O! D+ G# I0 ?$ N; p& J! q  ]6 T1 _  c
' f. K1 l% ~% b6 |0 R% z; S! s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 05:56 , Processed in 0.037026 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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