OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 g( Z: t' h5 u5 B3 ^
  1. [code]EDMA sample test application+ u2 S6 J/ c/ p. J2 ?6 K! }' k; L
  2. /*: C: h2 m1 S; B( Y
  3. * edma_test.c/ I- ]* h" D+ P
  4. *' u# x% W, E9 U, [" R
  5. * brief  EDMA3 Test Application
    ( q7 r; \4 K& r$ w3 B$ O
  6. *9 Z' \  o; T3 v; b
  7. *   This file contains EDMA3 Test code.& U/ z7 S7 [- Q" P# p: N0 |4 S: q
  8. *+ O% p. f* y* |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) A/ a( o7 K' q- I' k- e' Y% O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" C) l# J( V7 }2 i( X# v/ c& V2 C) V
  11. *         TO CHANGE.5 t& ~3 ^3 L# n' d
  12. *: ]3 j( a" ^: {5 K1 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ~2 @% M1 _* U& e
  14. *" G, I7 b" R$ G; Z
  15. * This program is free software; you can redistribute it and/or: U) U/ x" K: |: r$ I
  16. * modify it under the terms of the GNU General Public License as
    ! Z  {7 A! {9 G
  17. * published by the Free Software Foundation version 2.
    2 V" N) d1 v( l4 C9 x; d/ f  ?) m% S
  18. *
    9 g7 z$ Z& [4 y. A- d9 G3 I% C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# B) V% J" b' t2 U& K  h. j: U
  20. * kind, whether express or implied; without even the implied warranty
    4 p" ~+ O# `  T2 g2 I3 g7 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 E# S2 ^: R) m. }7 Q) W
  22. * GNU General Public License for more details.
    ! `, b6 k9 W" d* U" n
  23. */
    ' \9 q: o/ n0 H3 g) ~

  24. 7 X1 n1 K8 C8 Q" S" j% P
  25. #include <linux/module.h>1 ~+ B( J" y3 H" N% y" T, j- Z
  26. #include <linux/init.h>
    . [% m0 J" A# }5 B! F* q/ L
  27. #include <linux/errno.h>
    & v1 x( n0 ^& e- K. ]
  28. #include <linux/types.h>: w. s: \( K9 c
  29. #include <linux/interrupt.h>
    1 t$ ^. I% A8 ?$ h/ ]
  30. #include <asm/io.h>, i  o. j9 @% [6 L
  31. #include <linux/moduleparam.h>
    % u7 e# [$ b1 X# J. L
  32. #include <linux/sysctl.h>, ^$ Y8 @9 j7 w
  33. #include <linux/mm.h>
    ) L2 y0 N0 Q( J% V! j
  34. #include <linux/dma-mapping.h>9 I" a* y1 O+ T0 H. @( \

  35. . c) c. Z4 a8 `7 q9 u
  36. #include <mach/memory.h>
    5 ]! ]+ U8 [$ M# l4 [6 \7 K
  37. #include <mach/hardware.h>2 h: v  O/ l! N: x9 t
  38. #include <mach/irqs.h>
    : q2 {' w9 ]+ r, k; m4 i! K4 X
  39. #include <asm/hardware/edma.h>
    : o9 i0 E6 Y8 |/ w
  40. 9 j. g, X( U. T( F, v
  41. #undef EDMA3_DEBUG) n5 y3 {1 k9 T' x
  42. /*#define EDMA3_DEBUG*/7 Z" P( D5 N3 F

  43. 0 O3 i0 N3 p" U
  44. #ifdef EDMA3_DEBUG
    ) c0 |7 s* S' [5 f. A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : K- H3 n) p# A+ k! Q2 e5 L( _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 ?* r+ R# K4 i% [4 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 s' c+ Y. w9 [: }& @  `. y& ?& X
  48. #else3 L5 o4 P, w1 |2 c1 K- m4 \/ X& V
  49. #define DMA_PRINTK( x... )
    , a# k# m2 D+ B& p4 h. d
  50. #define DMA_FN_IN
    0 ]  M" ?% s2 {0 B! P1 s
  51. #define DMA_FN_OUT
    5 B$ b1 X5 ^! x, l# A
  52. #endif# n8 D& U0 u) Y8 _$ h9 W
  53. 7 [) a, I# ?6 y9 M2 H% E7 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); Y4 J' V( e: J- a. T, p
  55. #define STATIC_SHIFT                38 R7 ~1 n+ H2 [  T4 A$ Q" {  w
  56. #define TCINTEN_SHIFT               20
    5 k  D% Y/ l% _9 _) i( I7 u- F
  57. #define ITCINTEN_SHIFT              21
    ) |6 Y: S0 s8 G0 ?! D
  58. #define TCCHEN_SHIFT                223 M# N1 ]! h8 k" ^' \  @2 B
  59. #define ITCCHEN_SHIFT               23- a( D$ ?$ I2 R7 _! O6 V7 [, Y1 Y
  60. * |2 B4 e0 [- f5 {
  61. static volatile int irqraised1 = 0;9 G& h8 E% `( M) k
  62. static volatile int irqraised2 = 0;
    " M9 O! X8 W# j) n" |% u

  63. ' a' z9 u& s; {; f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 O! y- q. g& m; f* Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- O3 V$ N  O2 q/ n2 a1 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      ^* A$ M; F) }6 h; y) O9 m

  67. 8 K) o, `" d8 r, i: V& T$ ^! d
  68. dma_addr_t dmaphyssrc1 = 0;( j9 w0 l  z/ k5 n; i: @5 j
  69. dma_addr_t dmaphyssrc2 = 0;7 P, x) ?- B; \
  70. dma_addr_t dmaphysdest1 = 0;
    " h* F  L6 v7 N( r3 k  }
  71. dma_addr_t dmaphysdest2 = 0;) b& B$ T2 n, H$ q. C: L3 _+ m

  72. ; h7 b0 U0 y: Z, ?3 w+ j, w
  73. char *dmabufsrc1 = NULL;8 s+ H2 K0 D  [1 z
  74. char *dmabufsrc2 = NULL;
    8 {, D! J5 ?0 w' [/ \! L! J
  75. char *dmabufdest1 = NULL;
    ! O; m9 _0 U( c4 @/ j1 }- y  S5 o) {/ o
  76. char *dmabufdest2 = NULL;/ A8 R8 a  E! x  }1 D
  77. " G1 d. O6 G! H! S/ i0 V' i
  78. static int acnt = 512;3 X* k9 H6 N2 J' i
  79. static int bcnt = 8;
    4 u. A( U$ a% H. i
  80. static int ccnt = 8;
    + v) w0 U+ ?& X; }: D

  81. * K( Y9 ~' i6 ^' D1 |
  82. module_param(acnt, int, S_IRUGO);
    6 R! i8 B, d# n
  83. module_param(bcnt, int, S_IRUGO);
      w  Z, `7 P4 e' [9 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; T, t+ P, r; ?: c: d5 ]
4 }/ h% y9 }  {$ p8 |4 W" f, p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% m6 i+ q* p( M: e9 oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, V, ?- _" e: B9 y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- h# ^) X! [7 u% w  P
3 w, p/ n. M2 c. }8 u' v1 d- k& W
$ x2 f# Q" N% R4 f  c/ }. [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 09:14 , Processed in 0.036758 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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