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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 F# @0 R/ w; @! L& H/ m9 z, d9 s" R
  1. [code]EDMA sample test application
    ' l9 f) T, O/ x/ [
  2. /*0 k0 h; t- p% G; F& p
  3. * edma_test.c0 ]0 o% l5 `' o* R
  4. *
    & S+ G% g8 f: U9 G
  5. * brief  EDMA3 Test Application' Z3 H# T: z3 R  L9 B6 H; s+ i$ j
  6. *- W/ r* u) `- K" f. K
  7. *   This file contains EDMA3 Test code.
    6 R, W: v. {# v" V
  8. *$ w5 m$ {! v3 r$ x8 D: k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      q% u4 `3 _  Y: p4 F) F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& F# D4 Y4 z8 a3 n9 ^6 {1 G
  11. *         TO CHANGE.: g7 ~% b' ]! S$ U5 [8 W; ?
  12. *
    8 X$ I- C% k- y6 m" V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      x" X5 B; }3 B
  14. *6 p) I+ q) L( H
  15. * This program is free software; you can redistribute it and/or
    " }7 N. d9 ?9 D: a7 h; F- S7 r& A
  16. * modify it under the terms of the GNU General Public License as
    3 B$ \0 U4 E, e& ]# n" P( ?
  17. * published by the Free Software Foundation version 2.0 U- e$ F% C/ s, B% n- J
  18. *
    ) g$ q/ q7 B% ~  r6 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 D. G, E  M  w( o0 E5 k9 `
  20. * kind, whether express or implied; without even the implied warranty  `  w  [9 J0 s- r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, b! e- j8 _, {: ?. y, N3 q8 T
  22. * GNU General Public License for more details.( ~9 U, k) L! s6 V) ]
  23. */+ P. R' ^* {9 T. v
  24. 8 b* e0 L5 }( c! p$ w
  25. #include <linux/module.h>
    2 M* T( k. n: T8 W7 K5 U
  26. #include <linux/init.h>+ T2 V' O1 M' s7 ]2 G7 ^
  27. #include <linux/errno.h>
    % V5 j' g  r) X0 f, A
  28. #include <linux/types.h>
    $ F" k7 [! ?' ~# ^1 z1 [
  29. #include <linux/interrupt.h>
    , ^: |" j. @1 M) V5 r
  30. #include <asm/io.h>
    5 S% D9 Y% _1 ~7 F5 X) d0 h, h
  31. #include <linux/moduleparam.h>' _/ @$ {2 w" s! U
  32. #include <linux/sysctl.h>  \# f* w' U. m: Y
  33. #include <linux/mm.h>% E1 @% U/ d2 I) d1 {# S3 I
  34. #include <linux/dma-mapping.h>
    # E9 |# N! s% E9 n$ o5 Y
  35. * z& D5 c5 @5 b1 F3 M3 ]! \, i* v
  36. #include <mach/memory.h>
    3 Q! A3 t& U/ t; g7 x3 ]9 I1 }" t
  37. #include <mach/hardware.h>& t: l$ [) ~% q
  38. #include <mach/irqs.h>" P$ v" i6 A" r( G9 I
  39. #include <asm/hardware/edma.h>* r) e- o. X9 A% t

  40. 2 D. ]( }. G3 W  D: L: ^
  41. #undef EDMA3_DEBUG
    ( m# ]1 h2 e" g$ u, S- y
  42. /*#define EDMA3_DEBUG*/  h" J  @3 _4 _$ h$ p+ r
  43. . B0 q4 `: f( [3 j2 G) P: {+ C
  44. #ifdef EDMA3_DEBUG
    * I8 h- H' y- V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 m5 `+ g3 V8 L+ R$ g. ?; H& Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . |- R0 d3 @& c  g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 f6 R1 d2 ?. U# A) x3 B6 y& h6 v
  48. #else
    * T0 j' x' r" h$ H" Z5 H
  49. #define DMA_PRINTK( x... )! |# w7 S" U4 Q; v# L
  50. #define DMA_FN_IN
    " f8 \! C7 y9 s# y
  51. #define DMA_FN_OUT
    $ B8 x' @3 Y6 ^/ Y
  52. #endif  j; X+ E& r6 f6 X8 f0 a
  53. * B: Q9 `& r( j- S1 f4 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 \8 B1 f' m2 e! [/ V7 b
  55. #define STATIC_SHIFT                3
    2 s+ [( X1 z9 i8 ?. g' I3 x
  56. #define TCINTEN_SHIFT               20
    : W% U+ L0 B4 O; m" X
  57. #define ITCINTEN_SHIFT              21
    ; L5 `: A- @' R' z7 u0 f* @
  58. #define TCCHEN_SHIFT                22
    # Y; I1 F+ F3 G* F3 A) Y- @
  59. #define ITCCHEN_SHIFT               232 Y( X: C) x1 m) }; @% W- r

  60. 6 V! s: s' K7 m2 t5 c. Q6 n5 I
  61. static volatile int irqraised1 = 0;
    0 z& x  P, [, G
  62. static volatile int irqraised2 = 0;9 h) ^2 x, A. `) s2 n; n
  63. 3 H' W6 V0 }/ r" l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! J* t% d& s' ]- ^+ @% ?. Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  }, Y" D8 R; W# p; Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 L. @" l6 Q& K: F: ^0 X8 f  z, t
  67. $ g9 b# F8 N0 w* Q/ Q* B9 B' B
  68. dma_addr_t dmaphyssrc1 = 0;; [+ M: h* ]' o( I3 _
  69. dma_addr_t dmaphyssrc2 = 0;
    , j$ {$ ~! S) O! \# k! f
  70. dma_addr_t dmaphysdest1 = 0;
    ) O  O0 q8 ?1 x8 h9 S  A/ ^/ P
  71. dma_addr_t dmaphysdest2 = 0;
    : l+ q7 \- f& M4 e' d3 X0 O

  72. % N( R, B2 I+ Z. N1 y
  73. char *dmabufsrc1 = NULL;: b9 \4 ]+ ]4 d* F" G% [
  74. char *dmabufsrc2 = NULL;+ S8 f3 \$ C- U% s
  75. char *dmabufdest1 = NULL;
    ! o- k- m, H* o7 `' X
  76. char *dmabufdest2 = NULL;
    : f/ W1 I2 \5 p& D0 d

  77. / k" n- [/ L0 b6 q4 W
  78. static int acnt = 512;
    & C- y/ K3 k8 B
  79. static int bcnt = 8;2 N, l$ G* U# b( Y4 ]$ N0 o7 ]
  80. static int ccnt = 8;
    5 O9 o% x; D0 N, s/ i+ t
  81.   m* |/ G% X: O; Z
  82. module_param(acnt, int, S_IRUGO);6 c; f) m( D8 ^/ Z3 K
  83. module_param(bcnt, int, S_IRUGO);
    4 c* ^% ]) k5 W& y/ v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. R1 I' r) n! @
  K) d) b$ v* `8 n6 I) g5 i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, L3 O3 @% _% ^) l+ i* p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, O9 E! t2 O- e# j% P, J. A1 j8 U' J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ?0 P& c' w) j1 l) X  G; c. o8 v" E4 r3 U

7 \+ p; ?6 s7 ~; l  g' y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 16:34 , Processed in 0.040680 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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