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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* U8 g5 M, m- y5 J  u6 S
  1. [code]EDMA sample test application
    2 ?( e; v. e8 d2 q# j
  2. /*
    : h" i- e5 b8 }
  3. * edma_test.c" K$ l* x! I- k6 M% g) x
  4. *
    5 \! a# `/ T" e* b0 S4 }; c- v
  5. * brief  EDMA3 Test Application( U1 S' d  C8 k. Q/ |0 [  C+ ^
  6. *1 ^; l, X" k5 ^0 ]! u4 }
  7. *   This file contains EDMA3 Test code.
    & i/ V/ f+ l; u+ r5 H( r, ]
  8. *
    - E! h  p$ o! {! w" R. |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 E+ U. X# k9 o& f' r0 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . ?9 U1 d9 d2 j
  11. *         TO CHANGE.6 g: U" L0 I/ k5 G( {
  12. *# i/ v9 f$ l# t# d/ B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 H0 W9 M9 R, O( T5 c3 [" i
  14. *' b  o2 [& h3 o; x+ @
  15. * This program is free software; you can redistribute it and/or
    " Y0 D! v* \; U8 ?- @( Y
  16. * modify it under the terms of the GNU General Public License as# S4 K0 h( k! i& @
  17. * published by the Free Software Foundation version 2.
    . ]% y8 {4 }/ U4 v
  18. *
      {2 w1 ^" q& y6 Z4 v. m  {' x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. `7 y" H0 v- c% _% U" c
  20. * kind, whether express or implied; without even the implied warranty8 }9 }/ {' l: D4 r' r& f/ G8 o& t1 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 p. B6 T5 B% C) W' U
  22. * GNU General Public License for more details.3 Q8 \1 E! k! {* ~% W
  23. */& }4 V$ X( }* j1 ]) q

  24. + F0 N1 f0 P# g, L; I0 U8 G
  25. #include <linux/module.h>
    5 b% `. I3 O% O4 H3 c
  26. #include <linux/init.h>
    # E; _( o# Z- h7 y0 t, g9 K
  27. #include <linux/errno.h>6 J8 c: d0 Z9 f5 L$ q
  28. #include <linux/types.h>
    3 N9 m# }) _: h9 N& b
  29. #include <linux/interrupt.h>
    4 M& W9 |+ h, y
  30. #include <asm/io.h>
    # y; K. a, ^; D9 R) o3 Y
  31. #include <linux/moduleparam.h>
    ) m9 ~- C3 k  T* ?( E- Y5 T
  32. #include <linux/sysctl.h>- U  N- Z# Q% l9 R. p9 d* b8 [2 E1 j
  33. #include <linux/mm.h>9 y" M& P' e; D9 y3 b$ W/ J! O  U7 o
  34. #include <linux/dma-mapping.h>' k8 i6 p4 b, H

  35. # O! g% e( k0 C# [* S, f  `
  36. #include <mach/memory.h>
    + [: q  g( l: P* u% d( s& T: Y: H
  37. #include <mach/hardware.h>
    # t; Y9 t9 ]0 [* G- G
  38. #include <mach/irqs.h>
    + s* U4 N7 v4 I* j
  39. #include <asm/hardware/edma.h>
    - w) P0 h* h  p+ ?# Y
  40. 3 a1 Y/ ~* x' ^& z
  41. #undef EDMA3_DEBUG2 D: N3 [% J& k( Y# b
  42. /*#define EDMA3_DEBUG*/+ Q, `1 a  N" E5 G/ [! b
  43. # z$ J- c* y. A1 G" j9 N* ^
  44. #ifdef EDMA3_DEBUG
    ; E: W. C  c0 ?% n- d% a- I) A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , A* x) g0 ]- |8 {( s2 M" ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( E5 e! k8 y8 a4 J0 V' C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" P: V+ Y7 M* B$ T% h- C8 s. J
  48. #else
    % R! {4 r; x9 f- s/ \5 j* c) g% ^
  49. #define DMA_PRINTK( x... )* L/ V: P, \9 x- ?( i
  50. #define DMA_FN_IN
    % f  o& r  B$ R9 ^( V
  51. #define DMA_FN_OUT
    5 {. G5 M9 K) S! k, N
  52. #endif
    . Y$ j8 u8 ]! @) N

  53. ) Z& H$ N# Q6 _  y2 ]) `( }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* u: G  n- `, ^! }3 P$ F4 I2 V
  55. #define STATIC_SHIFT                3& ^! b: P1 ]; V3 ]- H; Y
  56. #define TCINTEN_SHIFT               20' I# ^9 b/ {4 K  B' e! k9 b
  57. #define ITCINTEN_SHIFT              212 V3 S& Y, m1 j1 ]! W# v# W
  58. #define TCCHEN_SHIFT                22/ v0 }+ ~  n  H4 R- V5 S+ h$ p
  59. #define ITCCHEN_SHIFT               23
    : q5 @% J0 b% j5 S& K

  60. , U/ K5 j9 `% ?2 {, m4 K
  61. static volatile int irqraised1 = 0;# g: j" Q! g+ q9 V
  62. static volatile int irqraised2 = 0;1 a5 R7 u: o/ {2 l* P

  63. / m) j8 \5 \+ z" v) f* ?. T! f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + c$ j* |" X* Y: s, \6 p& J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & t# ?, n  S! W) A; x, j: q% f( R0 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . n. S1 {0 o4 e/ `# e: j5 t
  67. 8 a: ]4 s( c. X
  68. dma_addr_t dmaphyssrc1 = 0;
    , }# a. Z7 l. j0 ~5 r
  69. dma_addr_t dmaphyssrc2 = 0;  {# u! l. H# o2 N
  70. dma_addr_t dmaphysdest1 = 0;
    ( q: b1 W( [: ~8 V: S
  71. dma_addr_t dmaphysdest2 = 0;) p$ I1 l. `! L! y9 Q& K3 ^
  72. 3 v7 d! L9 q8 o+ m8 _
  73. char *dmabufsrc1 = NULL;9 l% G! k6 g+ x$ [1 [
  74. char *dmabufsrc2 = NULL;
    4 @5 c9 S. _" v% m
  75. char *dmabufdest1 = NULL;! w1 p7 ]; I5 V9 j1 }
  76. char *dmabufdest2 = NULL;( f, J8 _$ d; r$ P
  77. / ?3 Z0 n1 H; D) L% N/ E
  78. static int acnt = 512;$ s" v# M; `) E/ O
  79. static int bcnt = 8;
    " V% d% e' o+ }: J4 Y- H" e) Q
  80. static int ccnt = 8;# ~5 T5 e5 ^* i3 k

  81. % }+ K3 b* E7 j- u) t. m
  82. module_param(acnt, int, S_IRUGO);
    , G  A  D4 ~: ?
  83. module_param(bcnt, int, S_IRUGO);
    + W0 [& x, C0 j% U4 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 e9 ]/ E6 v7 }4 y6 _- |

( f/ }+ V# G/ j; I: \% S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. o: k- q' Q. x2 }, @; N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 }( Z7 S/ e8 `  [4 S' i& z5 ]' M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ w+ b2 H1 @* a: Q: B# l8 ]$ A8 K2 E. q3 @
; `: u4 {+ U/ }3 @+ m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 03:05 , Processed in 0.039439 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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