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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 c" C8 H4 d. o
  1. [code]EDMA sample test application
    " r3 k, R6 _7 F- C0 A
  2. /*
    ! t% S, E* x3 Y! C# Q# _" g
  3. * edma_test.c
    ; j. W1 e! I$ ]; ]* K: {
  4. *
    5 U5 l# |+ E! i. e3 O
  5. * brief  EDMA3 Test Application
    . B4 R* Q% a8 Z: Y; y
  6. *
    * E1 a% c. [/ I/ ]: l4 d/ G
  7. *   This file contains EDMA3 Test code.
    5 Y& i7 T0 ~5 r' y
  8. *
    6 {3 w0 H: g5 j+ ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! u' [- Q  Q8 }& Y$ U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 J- \5 K8 y$ `( s1 j0 d
  11. *         TO CHANGE.! v( @7 W/ A' L, y5 r0 B  P
  12. *4 l8 j8 G6 W1 s5 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' E& W  |6 v: O: W- J
  14. *
    . N7 m& f5 L$ X6 C" }% N7 q/ Y
  15. * This program is free software; you can redistribute it and/or. A4 e5 m- G0 |  }$ L1 U
  16. * modify it under the terms of the GNU General Public License as  C% B3 x4 T3 ]* B- `* h
  17. * published by the Free Software Foundation version 2.
    & b& D3 F/ H) t6 q
  18. *! {% |0 ^* t$ X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 L/ J+ V* N7 q4 X' r
  20. * kind, whether express or implied; without even the implied warranty. f0 Z. b9 P3 v0 p9 x. C9 O# B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 f5 B' a5 g% L+ L2 A
  22. * GNU General Public License for more details.
    2 I+ U' u( c, o
  23. */
    $ J/ Q( @( _" S% c9 A

  24. 4 X1 P2 H9 \  F5 K7 z
  25. #include <linux/module.h>
    ; V- ?: m  o& ?/ ]3 F; |3 e
  26. #include <linux/init.h>. Q: U% K1 G& k0 H; e" B  e$ r5 ]
  27. #include <linux/errno.h>
    * |% s4 t6 j* O! ]) g7 X5 T
  28. #include <linux/types.h>( e' A: G# T% y6 x* e
  29. #include <linux/interrupt.h>0 {; C4 P2 f  u6 c8 a
  30. #include <asm/io.h>
    5 d# l7 ]! h1 u* z7 q* T
  31. #include <linux/moduleparam.h>
    - c; }6 U$ Q3 V
  32. #include <linux/sysctl.h>
    & H$ a6 _: u1 K! m( I% q( s1 Z
  33. #include <linux/mm.h>
    7 k# }5 K0 f  m4 }4 H* C" E& T7 s
  34. #include <linux/dma-mapping.h>
    . f4 G  v" W3 d

  35. % @& L( t$ E% R% Q- a
  36. #include <mach/memory.h>
    . v$ K+ y5 A) G- c  c- N. I
  37. #include <mach/hardware.h>
    # E+ T* x8 D1 I$ V/ @" a& \
  38. #include <mach/irqs.h>
    2 f% m3 `& z& Y5 t; b0 ~* s
  39. #include <asm/hardware/edma.h>
    9 b  G- J0 @. F! h) ~

  40. 3 }& H3 h0 F% {, [
  41. #undef EDMA3_DEBUG9 Q/ Q* O0 l6 [: P* {" l
  42. /*#define EDMA3_DEBUG*/
    : t# H5 l- `, \  Y8 x9 M
  43. . r) Z! A/ L2 F
  44. #ifdef EDMA3_DEBUG, x$ o5 M7 R* _4 |) j1 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * H- A7 L$ o; j! Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 ^. ~( a8 O3 G. v$ c3 r# Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) M# [) U9 Z: ]; R1 ~
  48. #else
      G5 u; E; V/ A; w5 t$ {7 C9 P' g
  49. #define DMA_PRINTK( x... )+ v4 U+ K5 |. t9 [' J
  50. #define DMA_FN_IN/ i( o2 @, ?$ U5 }5 j
  51. #define DMA_FN_OUT
    # x& c/ C9 Y5 w! r  V0 H3 D
  52. #endif$ a/ p* x' d7 H5 A7 q1 F- a
  53. : v8 v* B( n% U: ^( x  p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 O2 o. F2 h& s
  55. #define STATIC_SHIFT                3, M8 k% i1 R) E9 }9 Y
  56. #define TCINTEN_SHIFT               20, q+ {8 a' [  ^5 s) \3 J
  57. #define ITCINTEN_SHIFT              21+ \  t# K' w' {; T$ K9 g: D
  58. #define TCCHEN_SHIFT                22* h5 `3 P/ L. U6 M
  59. #define ITCCHEN_SHIFT               23& T$ W1 z% \+ \0 Z

  60. ( g( F! T+ b; L7 l2 F8 k
  61. static volatile int irqraised1 = 0;
    / g5 A7 p: t8 r
  62. static volatile int irqraised2 = 0;4 ?) c9 R1 G$ T2 ~2 A3 L$ I
  63. 2 ?3 w: M& c+ f2 ~  L) S1 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ D- O3 o, Y9 n: k- r  {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; f: X. h8 Z3 W0 ~4 V! W, i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + K$ g% S) O. D9 S8 E
  67. 5 c9 P" q/ X2 N2 W# a- |' I% J$ T
  68. dma_addr_t dmaphyssrc1 = 0;
    9 w7 M# G9 _+ x: p
  69. dma_addr_t dmaphyssrc2 = 0;
    4 f' m9 Q0 c& u( _( y$ G
  70. dma_addr_t dmaphysdest1 = 0;( U; d, G; M( L/ Q  u, m# N7 h. P
  71. dma_addr_t dmaphysdest2 = 0;5 j9 R5 s# S* c0 f

  72. $ {! H& Z3 K/ _4 H
  73. char *dmabufsrc1 = NULL;  T2 W- v0 a9 R3 h, f7 Y) {! w
  74. char *dmabufsrc2 = NULL;
    " Y! i4 J; x4 `
  75. char *dmabufdest1 = NULL;
    * m& R. w* Y! c7 w! s$ _
  76. char *dmabufdest2 = NULL;9 F/ V3 i* t; t8 V
  77. - ~- i4 p7 j, J. J3 k9 T" b2 O' K0 f& O
  78. static int acnt = 512;
    6 s* a  d3 H! [  D9 A
  79. static int bcnt = 8;
    & c  y& E7 R) Z2 b& H% s( a
  80. static int ccnt = 8;
    - Y& B8 O; C$ i2 i+ r

  81. & V4 {2 X( y6 t
  82. module_param(acnt, int, S_IRUGO);+ z, |' c# G/ W6 j4 |
  83. module_param(bcnt, int, S_IRUGO);
    5 O( q# S: m( c" \/ p* ]& G$ _8 K. Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 v' v/ V$ V7 B! m0 r' v7 E- d4 O! S! E2 Z1 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, `  U3 i5 |; R2 r9 {4 ?0 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 Y0 Z) n+ k: J0 v( h5 M. I1 X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 R7 m% l6 W8 `0 ?
0 j  d1 Y1 Y8 v0 }1 V; c4 ?
% p; l; D) l; w6 ?9 g$ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-19 04:50 , Processed in 0.042775 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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