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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 j9 v* V4 w: \. c
  1. [code]EDMA sample test application
    ! ]- q( g% x0 V2 o+ {
  2. /*
    % T: @9 P' W% y' E  S1 A, A
  3. * edma_test.c( h; J4 D! c2 A! b: ]
  4. *
    ! [# V, _# r& Y3 J
  5. * brief  EDMA3 Test Application4 e# q9 h9 }) u. K5 j! l" w& p
  6. *
    7 b! C5 k0 g6 |* p
  7. *   This file contains EDMA3 Test code.
    # ~- R- A5 e/ {" R3 g5 ]; P1 i
  8. *: Q) a, n" T; G# n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & w% I( n3 [9 g5 V3 h& ~" l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 [# ]/ [. q, D6 F3 r# _* B) t
  11. *         TO CHANGE.3 R) D2 X/ f7 i2 X7 U' h
  12. *
    3 R" p- o$ j0 H9 }5 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( T1 e: g4 A* d- Q8 h6 K
  14. *9 B9 j' b/ t. U. h4 @; |5 X
  15. * This program is free software; you can redistribute it and/or
    : g/ Z$ n! I/ [/ }1 B1 N1 D3 P# P
  16. * modify it under the terms of the GNU General Public License as' P$ a3 z6 d# y2 j1 D; }
  17. * published by the Free Software Foundation version 2.  Z& b/ g3 B$ Q$ B5 Z( _$ ^
  18. *9 T% H& z: }& y& f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 i% Q7 j7 V. i4 A, M( x, P* m
  20. * kind, whether express or implied; without even the implied warranty/ y. S2 h( Q( Y/ k: i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& V2 u8 x1 t, {
  22. * GNU General Public License for more details./ j3 E7 l/ T9 A" M4 n3 c: \
  23. */7 U& s% W& e' \  Z+ G
  24. * q1 U* U3 Z6 }9 s' X
  25. #include <linux/module.h>
    , Q4 l$ C; v- \  t9 e0 K& b% c
  26. #include <linux/init.h>
    # S5 a1 Z$ v  o" D. M3 G) P- Z
  27. #include <linux/errno.h>
    7 r$ z1 c$ M# p3 U' z
  28. #include <linux/types.h>3 C  v# [4 g+ {0 G8 ]! k
  29. #include <linux/interrupt.h>( D. `( d6 M3 U0 c+ e
  30. #include <asm/io.h>( S8 T) o, X* l6 P& ~$ l* I
  31. #include <linux/moduleparam.h># b3 l$ x( K) V2 F# S. e- z+ l3 a( a
  32. #include <linux/sysctl.h>
    8 {7 Y) W$ e: R; n& l* d$ w1 Z
  33. #include <linux/mm.h>8 h: N; \# U; P1 F: [& B) D5 r
  34. #include <linux/dma-mapping.h>
    8 y& k& c6 X% Q* ]
  35. 2 y, `2 }) [: [
  36. #include <mach/memory.h>) m) U5 k7 K9 T8 Q
  37. #include <mach/hardware.h>
    / d8 L* t( d! |% B2 G
  38. #include <mach/irqs.h>
    6 t+ ^( p/ w+ b& k
  39. #include <asm/hardware/edma.h>
    & |: A" s1 x: E; M$ L
  40. + ]1 {1 A+ ^, J. S
  41. #undef EDMA3_DEBUG
    6 Q( |+ X7 [& y; m0 b$ E
  42. /*#define EDMA3_DEBUG*/, H" m, o/ y  o: n1 n6 k4 l: O$ a
  43. , o+ }$ g6 e* o0 O* u8 G
  44. #ifdef EDMA3_DEBUG
    : {% p7 `) ]' \  W# W$ z) k5 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 @, }8 Z/ W$ j* y5 E9 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " `% p) |1 N+ \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! ]# g6 d) `7 l% X1 r
  48. #else
    . [; h, y) Y4 u( T) }! V
  49. #define DMA_PRINTK( x... )
    7 w4 }. o( O' W. M2 H
  50. #define DMA_FN_IN
    - N1 S- r2 N$ d- n. Z+ Y
  51. #define DMA_FN_OUT
    4 K$ ?8 e+ J% l+ A1 \8 v4 z% L
  52. #endif
    & z4 |6 n' r- m1 d' q7 Q
  53. 9 x; J; a2 N5 @. O& |1 m1 q* f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & J( h: h* z3 I1 s
  55. #define STATIC_SHIFT                3: q  L3 [4 b0 E1 k! v! h
  56. #define TCINTEN_SHIFT               20
    $ N: p7 X0 Y7 I1 `! z
  57. #define ITCINTEN_SHIFT              218 G( K% N7 i$ [! B; [. t1 Y$ v5 p
  58. #define TCCHEN_SHIFT                22/ S1 i. D: m+ d* _" j' S+ q: ^& |
  59. #define ITCCHEN_SHIFT               23% c. O7 b) ?: r' D% p7 x, L& j

  60. 5 S4 @9 m; Y/ [/ L4 Y
  61. static volatile int irqraised1 = 0;8 ?. A4 @& i) }0 T/ h
  62. static volatile int irqraised2 = 0;
    ' a0 W3 p; P8 Z' l2 p3 o  [& V
  63. 0 ~  `# b; [2 G7 P4 y+ S# H5 z  v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 _  `$ {- k$ L2 N) U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # u) X% Z' p9 @$ Z. e4 Y. U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ~/ E$ Y( [6 r: z3 X! |% G
  67. , O' x2 B' a  T2 B6 D9 y
  68. dma_addr_t dmaphyssrc1 = 0;# e6 h1 A  {2 \
  69. dma_addr_t dmaphyssrc2 = 0;7 s, [: M. q5 E  s8 Y3 }
  70. dma_addr_t dmaphysdest1 = 0;
    , E* \) i% l( Y+ k, W: B
  71. dma_addr_t dmaphysdest2 = 0;( f2 L  C0 s# y. H( w" W

  72. 1 s5 p1 t5 U/ m  |6 d
  73. char *dmabufsrc1 = NULL;
    ( R  Z) R( @7 O0 J$ a4 Y
  74. char *dmabufsrc2 = NULL;
    8 h( Q; e2 s0 u& Q) s
  75. char *dmabufdest1 = NULL;6 y5 l  `9 g/ Y3 @, [) Q/ A; m
  76. char *dmabufdest2 = NULL;
    % P% @2 _) q$ ?' ]
  77. 0 S; O* T2 ^$ b
  78. static int acnt = 512;' z% ^/ `( t- \  T3 B- _
  79. static int bcnt = 8;- E5 A% H, Y. J9 T  p( \
  80. static int ccnt = 8;& k" C8 X. B) X( h* q
  81. 2 C3 O2 I# Z. P
  82. module_param(acnt, int, S_IRUGO);# |; {* _! O. e5 r
  83. module_param(bcnt, int, S_IRUGO);
    : ]* G* j8 L+ e% ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ p% `! M3 \, i. C; w! B+ }9 X) i+ B9 h/ a* P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) f& F* z% L2 p- |# B/ @: a  w- ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( w3 I! V. s& m; m9 _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 v+ S6 m& z( ~- `8 \
* u, ?- H6 k0 E1 \) ]( q$ {4 [6 I: T& h' S# q1 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 06:37 , Processed in 0.039076 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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