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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # @% M1 c7 V5 y( e. c4 v
  1. [code]EDMA sample test application. O9 k, b  x& D
  2. /*
    , s; V+ ]  }, C- o) {" q
  3. * edma_test.c9 ]; o5 z# w' Z$ Q/ ~) s
  4. *
    : q' k* F$ G( z, v2 C+ p3 b5 l+ p
  5. * brief  EDMA3 Test Application2 C; W* R# E* \9 @! b( @. n
  6. *
    ; A* n8 t/ x6 S5 X: X
  7. *   This file contains EDMA3 Test code.0 r# w4 h) L( w0 l( B' C% q% U' P
  8. *& H- f+ B% P* M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  z* D$ ?8 V& m$ b! R1 n1 O' K& |% w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , J, ]  y, y( w% }
  11. *         TO CHANGE." e  }: {# F9 j" [# S/ `# v% b2 j
  12. *5 J1 x( [8 a- |$ l8 p# S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( w- G+ @* g1 Z+ v& C4 g1 `4 p
  14. *' ]% k& r9 ~: [3 Y6 T
  15. * This program is free software; you can redistribute it and/or5 s4 S: J; {- \) G) A/ s0 _' l
  16. * modify it under the terms of the GNU General Public License as
    ; W- U4 {, m+ r( }& a5 }) W
  17. * published by the Free Software Foundation version 2., @. l. K( K$ z' v; [5 \
  18. *
    ; m6 {, c- B2 ?' x9 Y+ `- l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! K) T5 M  J% u2 k6 i% s8 B
  20. * kind, whether express or implied; without even the implied warranty  }! T. D* L/ V! T$ t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( ~+ f& O6 y4 E+ Y, ~" N( G
  22. * GNU General Public License for more details.1 }& j: U" k1 B$ ?; u0 N
  23. */
    # \2 n* W' g1 f" s9 P( X

  24. 4 @6 I6 N( l  \
  25. #include <linux/module.h>
    4 _0 J3 a! b" z& y
  26. #include <linux/init.h>5 X! M$ p' H! P$ E( a! i- t; {
  27. #include <linux/errno.h>8 x& h: E1 G. o4 `3 q+ ^+ T
  28. #include <linux/types.h>
    , V$ x% o5 A: Y1 c* P
  29. #include <linux/interrupt.h>: B9 t2 l  m7 b, y0 ?" [, l
  30. #include <asm/io.h>
    + p( r' h9 D0 o
  31. #include <linux/moduleparam.h>
    % Y/ Z5 G0 r" \! k% U: \
  32. #include <linux/sysctl.h>" Y% g0 R3 e9 H1 I, T* l" d5 f
  33. #include <linux/mm.h>
    & k! G/ \  x# e+ q7 R
  34. #include <linux/dma-mapping.h>" u! ^; ]$ \0 D0 q

  35. ( l; N3 }9 G; T
  36. #include <mach/memory.h>1 ~0 V4 o! T9 S! `; p3 V& u( y5 Q
  37. #include <mach/hardware.h>
    % V1 u) H0 F/ t# S
  38. #include <mach/irqs.h>
    * _' ~, ^) D4 G! n# \" ?4 r' ^
  39. #include <asm/hardware/edma.h>5 V" c% A) U+ Q$ ?9 D
  40. $ `0 T0 `+ O. ?
  41. #undef EDMA3_DEBUG5 m1 J/ L' {6 g2 ^
  42. /*#define EDMA3_DEBUG*/
    ! i' K: u8 U/ \9 h" y  m( x

  43. - Q- d4 q9 O. g: l$ w( q) k  s# t
  44. #ifdef EDMA3_DEBUG/ G% p; r' v. f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 v0 Y" }% d& L- j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 m+ G& C/ @8 J3 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ G( y$ }, E8 Q8 w
  48. #else
    ' |+ j% a8 [+ J" _8 c
  49. #define DMA_PRINTK( x... )
    4 z& j/ X0 x, Q& j9 M4 j: k3 {/ f* T
  50. #define DMA_FN_IN
    & Y3 L# f( {' ~
  51. #define DMA_FN_OUT
    * h6 P+ G3 E' H- a1 x
  52. #endif
    ) K$ v' M4 {  j

  53. " _/ X; L- q3 R! \( [$ O8 J* o3 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). t+ ^" \" l! `5 L4 D
  55. #define STATIC_SHIFT                3
    0 t/ x+ S7 x, U0 h
  56. #define TCINTEN_SHIFT               20" O1 g6 c. `' q3 U" v
  57. #define ITCINTEN_SHIFT              21" U0 q6 A; K' g1 c* I
  58. #define TCCHEN_SHIFT                22( R/ E1 v- V8 r* }) {1 ]2 g
  59. #define ITCCHEN_SHIFT               23
    3 u  D3 o8 Z) |5 Q- H; y3 F

  60. 3 e. F8 w8 M% @( C6 a  E0 e
  61. static volatile int irqraised1 = 0;+ G# j" I' [& S" Z% W4 `0 \3 ?& @
  62. static volatile int irqraised2 = 0;
    ; B2 y1 M2 s# @/ m' d- ]/ v, h

  63. ; u3 H+ G6 f" ?8 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ T& m6 d7 I0 J! t4 k$ W7 M8 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% B' Q/ _, s& s4 J/ i3 g6 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : W1 Z: u7 C9 ~  g. F5 [
  67. ( N1 B8 D; V/ H3 f$ N' d
  68. dma_addr_t dmaphyssrc1 = 0;
    8 e6 j3 m: J# s$ I5 X
  69. dma_addr_t dmaphyssrc2 = 0;
    5 [, I+ a% O% m, X8 k
  70. dma_addr_t dmaphysdest1 = 0;
    - ~  K% c/ J. y* _# r* f  I
  71. dma_addr_t dmaphysdest2 = 0;
    8 D. `, D6 x) @$ R) k

  72. $ }/ p1 D5 Y& z0 W) ?
  73. char *dmabufsrc1 = NULL;
    6 K9 L' ]5 e- i" e# I- j% [  z
  74. char *dmabufsrc2 = NULL;
    2 S. ]/ n6 w9 F" B
  75. char *dmabufdest1 = NULL;7 N3 y* u! C! @- P
  76. char *dmabufdest2 = NULL;
    0 o; L5 G- t" {4 W$ O

  77. + u$ `7 E+ ]6 f" C4 X+ f7 {: ]
  78. static int acnt = 512;, m3 Y: |# A# c) ]# f
  79. static int bcnt = 8;
    ( @; e; y; E9 G
  80. static int ccnt = 8;2 A: q; H2 x1 H, M" G

  81. 3 I, J( E  p$ H! }- V$ \
  82. module_param(acnt, int, S_IRUGO);
    # x2 c' ?$ ~! S" |. t
  83. module_param(bcnt, int, S_IRUGO);- Q- Q4 P+ t- k3 c4 `& G1 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 U1 W2 Y2 s; R
$ \6 e$ Q2 b% h! U8 O3 g/ m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* s8 R3 c4 t( ]' p+ a3 G% ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. \' x  h8 r# }) W1 r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 G3 g' h2 B, \* `/ k9 ^
! i( {4 R4 g. s0 ?3 i* `2 |% s5 _: j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 23:10 , Processed in 0.042990 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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