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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   g& i) i' Y' @( @  M0 Q% \
  1. [code]EDMA sample test application
    . e' U2 Q& H: t$ A1 k) L2 N3 x% _
  2. /*
      P  c- c0 n8 ]  t% a
  3. * edma_test.c, e! b/ e; \/ ^" e
  4. *3 w8 S/ T" |0 ]6 o4 f
  5. * brief  EDMA3 Test Application
    % H. q8 T& ^6 z5 ?. W+ o
  6. *# o3 l  `- I7 \
  7. *   This file contains EDMA3 Test code.
    & w3 {+ v$ b! D7 x# o% [
  8. *
    + O* q( M/ b+ _7 v; E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# _( R9 A5 o9 ?/ Y% Q! u( w* c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + w# P$ ~# c" V6 z5 ]3 I& }
  11. *         TO CHANGE.& c/ `5 _0 @3 u1 s7 a: p8 x
  12. *
    6 A( @% W2 B* D2 F2 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ i9 Y+ P2 u' D% Z, m  |% a$ u1 t
  14. *
    ) E% i; \1 Z, A, N; [& `  o
  15. * This program is free software; you can redistribute it and/or
    $ J% ^/ Y! X0 U' D; w0 y
  16. * modify it under the terms of the GNU General Public License as
    / f: c" W) o( D" U1 R' k
  17. * published by the Free Software Foundation version 2.
    * l! H) n% n6 v1 N2 t$ B' [5 u
  18. *
    & z# U  [+ Y$ ?4 Z: a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 c% b' I$ O( q9 W
  20. * kind, whether express or implied; without even the implied warranty" b4 \4 |$ o2 G3 A* |; y  R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * d4 l" ^1 h3 \. ~# i9 C
  22. * GNU General Public License for more details.' f, v6 d& b0 w$ y1 T8 V! v2 I
  23. */
    # ^+ k# `3 k: C. w6 U" u. L8 {: y& T
  24. ( A6 {" L1 _0 ?& x' R. v( \
  25. #include <linux/module.h>, ~( H  Q# I+ M2 ~/ ]; r- ]' f) l6 p
  26. #include <linux/init.h>8 N2 v1 {( O" e! r7 a
  27. #include <linux/errno.h>
    $ k+ u0 E. o# r: P+ V- t  D
  28. #include <linux/types.h>" B9 \# m" f2 W/ y  J$ p; q$ O. J
  29. #include <linux/interrupt.h>
    6 j/ M( V+ U9 v1 k% D
  30. #include <asm/io.h>0 q4 i/ p$ q' j) S
  31. #include <linux/moduleparam.h>9 z9 J0 o# k/ h# y' [: W" u
  32. #include <linux/sysctl.h>
    8 a( t6 F! W2 N0 e
  33. #include <linux/mm.h>3 o$ }; Z1 P3 ?9 o, N) N& z8 W
  34. #include <linux/dma-mapping.h>/ ?7 U+ E( Y$ f% p* @8 p, T

  35. 0 p4 D( T5 p7 K" z; U( e
  36. #include <mach/memory.h>$ v$ Z; N0 ^2 G7 u
  37. #include <mach/hardware.h>% V6 n% x# _( K! C! ^
  38. #include <mach/irqs.h>; F# z+ M# O& S7 i3 U
  39. #include <asm/hardware/edma.h>+ O7 B$ N! Y% K7 I% q" O0 B
  40. 0 K" Q( N% q5 p% f2 _
  41. #undef EDMA3_DEBUG
    0 ]: P& T- [2 \: b
  42. /*#define EDMA3_DEBUG*/  ^: [" s& B7 q5 B. L# m8 P2 U
  43.   u9 h& W$ H* G* ?. z2 x0 }- S. o
  44. #ifdef EDMA3_DEBUG# Q# [# C4 F, r: J: d. x5 K/ g- \$ V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 L, X1 u$ F7 k/ f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ K7 n: _: ^( A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ s, S+ o" i# P; b) s" h
  48. #else, H. k- H( {4 e1 N" r( T! ^
  49. #define DMA_PRINTK( x... )
    / L1 {4 s; h' [6 v5 [$ K
  50. #define DMA_FN_IN
    1 r, ?; b4 M* T. ~# M: E; U
  51. #define DMA_FN_OUT
    / V, l' @4 E; ?# V! W. w
  52. #endif  p$ |; n' m; {8 U" S+ g. x

  53. " J0 a+ @7 q& A4 I- S8 J, S4 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); v5 {9 c% B6 {0 w' y
  55. #define STATIC_SHIFT                3, c8 w) G9 ?8 j1 r% A- G" [3 v* B& f
  56. #define TCINTEN_SHIFT               205 l* V; L! n8 H  t: S0 h
  57. #define ITCINTEN_SHIFT              216 t3 W% W3 c& `$ G5 b8 b$ e
  58. #define TCCHEN_SHIFT                22
    + ^# g/ r0 f" X/ G6 V) e
  59. #define ITCCHEN_SHIFT               239 w3 F5 N3 w4 M5 [+ Q

  60. + }- X6 ]4 e* n- o& R( B+ z
  61. static volatile int irqraised1 = 0;
    9 u' L3 w  H$ K( ?
  62. static volatile int irqraised2 = 0;6 \: E. k0 R( L( c7 s& Q
  63. ( j/ A8 Z# A5 c' j1 R9 `) k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 @& p. G- t6 A& k3 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 H+ ?: i1 k- T8 w5 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 g% D3 E8 V# j$ {$ f

  67. & y  ~. q- w! W
  68. dma_addr_t dmaphyssrc1 = 0;
    ; i$ Z6 L/ g+ N# I; G8 p% [. Z
  69. dma_addr_t dmaphyssrc2 = 0;# @6 b/ _+ v: i
  70. dma_addr_t dmaphysdest1 = 0;
    ' O3 y6 K: h& N9 T
  71. dma_addr_t dmaphysdest2 = 0;
    6 o, {% ?" P2 G) ]
  72. ! I+ [8 u  j7 c( M1 Q
  73. char *dmabufsrc1 = NULL;( R5 B$ _3 ~1 A, Z2 ?/ ]3 |. ?
  74. char *dmabufsrc2 = NULL;
    " S  U, g7 P' @
  75. char *dmabufdest1 = NULL;
    $ ]. B1 v) p& e5 v' D
  76. char *dmabufdest2 = NULL;3 X5 S% }& e4 T9 r! R& A8 B
  77. ( x0 M# G% G- |5 R
  78. static int acnt = 512;
    ( A, U4 h+ S; O+ e- L2 C- Q! X1 f
  79. static int bcnt = 8;) M$ Z& ~. Y; ~* ?; q" @$ b- X1 T
  80. static int ccnt = 8;( Y5 G3 H$ G) q) N; |2 _

  81. # G5 [( B1 s( z6 _' x+ D
  82. module_param(acnt, int, S_IRUGO);
    % }) c# K) T' W' p$ @
  83. module_param(bcnt, int, S_IRUGO);( i, R' f' D8 a) {# O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: \& k4 I+ c0 @; Q4 r( ~' F6 A% W. [( I$ o& M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ _/ n7 C8 L8 m& F; {  s( T
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% v6 `( a9 c( V9 j" I) o3 `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, i( J2 Q& ?3 T2 i# x- \# V# y5 L6 k! R! Z1 Z9 f3 L! a

# v! R- M. C: m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 03:51 , Processed in 0.040539 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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