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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 v8 F( t7 r3 e+ N0 J
  1. [code]EDMA sample test application1 H. J' w6 {, j8 M- Q% S" y) B# ~
  2. /*7 j; w; u7 q( l! p6 [" ?
  3. * edma_test.c
    8 \! V$ |3 c, z( z
  4. *& d/ ~) `2 c- B7 G
  5. * brief  EDMA3 Test Application
    6 v5 y+ N' R3 l
  6. *
    % q) S" p! X" q
  7. *   This file contains EDMA3 Test code.
    0 L1 F+ i9 K: C  O; N
  8. *
    / R/ r, n- w+ `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ R% X, t6 C6 s8 R, F( W* l4 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& }* C+ o/ p5 C! R0 R  D4 E0 ]
  11. *         TO CHANGE.# p. h& e, o. ~1 O4 m2 M" ]% C
  12. *
    0 U+ Z/ m9 `) ~7 g! T. ~2 Z7 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 V  p! F! I: d9 A/ L& a
  14. ** h" B- O& D6 y, ~+ q& U
  15. * This program is free software; you can redistribute it and/or! A7 T% }( n) Y* F
  16. * modify it under the terms of the GNU General Public License as2 l# X# e, }* T4 u' x4 s
  17. * published by the Free Software Foundation version 2.! B4 s+ c7 Z( [( A
  18. *
    9 Q4 ~2 W6 H; p2 `% U8 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Q" S9 l& F7 [* q0 `
  20. * kind, whether express or implied; without even the implied warranty
    $ \% |7 `/ {/ z4 M1 X* B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - E5 t! }( Z  h3 b; Y& Z  _0 t
  22. * GNU General Public License for more details.! b7 k6 G/ D4 u+ b6 d* p
  23. */
    ! x( C2 ^8 i; P9 t
  24. ' H0 a- y6 A% E6 i  Z; _9 V" f6 l
  25. #include <linux/module.h>
    / K# c3 W/ T7 M* h; d! Z% f. L1 ^
  26. #include <linux/init.h>3 X5 ~, y5 S- J
  27. #include <linux/errno.h>* @7 t5 [. k0 g
  28. #include <linux/types.h>! I4 \. T7 L6 x! x3 f  B
  29. #include <linux/interrupt.h>4 b4 m3 K5 G+ d5 X. l3 M3 o' l% ?
  30. #include <asm/io.h>
    % U( {4 R5 b' z% p& V7 r
  31. #include <linux/moduleparam.h>
    ; \$ h* `* \% H
  32. #include <linux/sysctl.h>9 |: |1 [8 Y4 d3 v
  33. #include <linux/mm.h>3 }9 t' F' }# J, `
  34. #include <linux/dma-mapping.h>0 v( ]5 B& b7 p3 G. M

  35. , d8 W$ z8 H. P: G0 S
  36. #include <mach/memory.h>
    9 L9 O: P9 z+ {+ O. }5 z1 r  I
  37. #include <mach/hardware.h>
    . J" j+ ]. e6 w  I2 i3 U
  38. #include <mach/irqs.h>! [, N; Y! D+ b" n, s( j
  39. #include <asm/hardware/edma.h>$ w( B6 ^8 G, S) u2 p
  40.   _( u. I3 P1 r) g+ ^# ^1 m0 U
  41. #undef EDMA3_DEBUG
    : e( b1 G5 x0 h  Q0 |8 r
  42. /*#define EDMA3_DEBUG*/
    / _) ~3 p4 t1 e# O2 f4 h) ^- F' h! A

  43. % h0 `2 g# j) J9 G( o$ C
  44. #ifdef EDMA3_DEBUG
    2 r: a5 f8 g4 M5 y$ X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 Q! ]2 x0 ?! M$ W/ ^; s" ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 B' _8 p; |* M  }! Q5 x: ^7 ~/ ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# [$ K; ], Y8 ~  k& I! Y' i% P) n6 [5 t' B# t
  48. #else' ?. f( u. U3 y- _; @
  49. #define DMA_PRINTK( x... )
    4 h0 f1 ]  L4 K5 J! o$ p, k4 [
  50. #define DMA_FN_IN
    . D- I! ^' y4 U3 N! v8 S! K
  51. #define DMA_FN_OUT
    3 V' @/ ?  p3 A: Q
  52. #endif# q# h( Z4 K9 f

  53. : D1 X. s3 s) K  m9 B) L  Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . S( V, f0 s  H! U5 r
  55. #define STATIC_SHIFT                3
    * D: j7 e0 |. E
  56. #define TCINTEN_SHIFT               20
    3 P, t) g0 H8 p; U
  57. #define ITCINTEN_SHIFT              21
    5 U3 E- J2 w; B6 @; n4 D9 E
  58. #define TCCHEN_SHIFT                22
    ! e' R5 m2 x* N2 u
  59. #define ITCCHEN_SHIFT               23
    5 u& w. c% z5 i1 Z/ `2 a4 |

  60.   m" M% |- z, B9 |; [
  61. static volatile int irqraised1 = 0;
    % ?4 [( S( U8 @( P2 v  s7 T) d
  62. static volatile int irqraised2 = 0;
    3 f+ j) `: {( C7 N" Z3 K' i$ t
  63. " F' J' q' X% Q2 ^, G. \( x; v4 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  d: F0 O7 w1 O! r' y( c; _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( v5 W, _! _, V3 s0 j& U8 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - W% C6 \: @* w( d: e3 j

  67. $ D1 }: ?7 a$ g0 z6 A7 h$ {$ U0 g7 l
  68. dma_addr_t dmaphyssrc1 = 0;3 p& n$ u- i( @. ~; i
  69. dma_addr_t dmaphyssrc2 = 0;7 h; o' v; s0 n5 N, ~/ ?
  70. dma_addr_t dmaphysdest1 = 0;' w/ x  {& C. F& w; K. L! p$ Q
  71. dma_addr_t dmaphysdest2 = 0;
    9 ?) p  k. Y  w( d' p0 D
  72. 1 o3 L% H1 Q& G7 f' _
  73. char *dmabufsrc1 = NULL;
    ! b2 G$ }+ a/ C) r( v# m
  74. char *dmabufsrc2 = NULL;
    / f9 d& v3 k3 I" E, y  {/ J
  75. char *dmabufdest1 = NULL;
    ) M3 M! H' h1 J0 Y4 [& s1 L) k
  76. char *dmabufdest2 = NULL;
    8 R' w' A0 J! |8 l
  77. $ S$ }  y' Y: j3 T5 i" C
  78. static int acnt = 512;0 u/ Q' D, c1 r& C
  79. static int bcnt = 8;
    + a& J1 @$ }+ O0 z: M
  80. static int ccnt = 8;
    * L4 K. W, L/ g3 i! x
  81. 6 Y. T6 c0 Q- F5 e7 V
  82. module_param(acnt, int, S_IRUGO);' m, \4 l/ R0 A9 s! z+ w2 a
  83. module_param(bcnt, int, S_IRUGO);) [5 q" i$ _( H% O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" I4 h. s: B0 `1 _- |7 B  R

/ ]" ?* ~! y; X4 ]$ c: t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* ~6 s+ i* `. P7 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 s' P8 J" j+ l" G& Z! U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* v2 C% m, g! Y: `* O6 s3 [- e9 T2 C1 B$ H0 M1 R) U9 @

; h& d/ F  |' D' l1 D( @7 V  G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 02:43 , Processed in 0.040299 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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