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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) r- g7 \/ ?* ?4 k2 ?+ q* E$ P# D
  1. [code]EDMA sample test application. y, B! N/ X$ k& o% |2 q9 Y6 W
  2. /*3 [: n2 j% x' T5 F; |0 D% n4 T0 {
  3. * edma_test.c
    3 u5 p) q1 V% [
  4. *+ R6 y6 v: X' d
  5. * brief  EDMA3 Test Application9 S3 E8 E2 U8 `7 N  f7 X
  6. *
    # q9 @6 P* R! _) ]% S
  7. *   This file contains EDMA3 Test code.
    5 Q9 n% B- q" o* y# U% [( Y
  8. *
    ' H1 w) X! _- i# X4 M, N! E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & Q/ |8 t" K1 P  s: L* w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 y! O5 U. D2 M( [3 a
  11. *         TO CHANGE.
    " x3 b% }, e% r* ]1 R6 i. [1 p5 e3 a
  12. *1 g6 W; ?) r9 ^/ i  ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 |6 q  s# T! o' y3 i: t
  14. *
    $ C- R, Z: U* v( [3 r
  15. * This program is free software; you can redistribute it and/or( d" t4 ^2 k; F7 u: }4 U; Y$ |. g, H
  16. * modify it under the terms of the GNU General Public License as
    . P5 e' }2 u$ ?* x1 s* [
  17. * published by the Free Software Foundation version 2.
    + V3 I+ v2 U9 ^+ H
  18. *: ]* t0 D0 B' O$ {8 Q- _6 ?  \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" {# y6 u' I6 F+ f1 C
  20. * kind, whether express or implied; without even the implied warranty
    / g1 a4 `0 m, R# J1 B8 w3 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% r% ?. [; A6 H1 ~; f+ h4 W
  22. * GNU General Public License for more details.
    8 Q( e% M# k0 e* D0 ?
  23. */, `  b2 o1 q$ x; i( l& f/ W& \* e

  24. + N+ M$ p3 j4 m' z
  25. #include <linux/module.h>2 P, U1 i$ a" l" }2 i' i: [/ W2 W. L
  26. #include <linux/init.h>) X- W9 ]1 B' _; T) }
  27. #include <linux/errno.h>
    ' q! {+ A9 r  @# n0 Q  n
  28. #include <linux/types.h>
    ! y' g- N7 P2 D! S& Q, [3 ~
  29. #include <linux/interrupt.h>& @, C' v; h. z+ s6 r( f
  30. #include <asm/io.h>
    # U, F, q5 P/ p% o* @( \0 i
  31. #include <linux/moduleparam.h>
    - R9 H2 O; g) @. ^$ Q7 T8 K5 ~7 U1 b
  32. #include <linux/sysctl.h>2 ]" p6 N1 B  y3 x5 G
  33. #include <linux/mm.h>$ V; C1 g# c# ~" a  @. u
  34. #include <linux/dma-mapping.h>5 A$ {- ]5 r7 N( ]. B

  35. . H2 p+ O% S* G6 q0 W2 G' @2 b/ F
  36. #include <mach/memory.h>" Z5 |$ s' `; `% E$ J+ Z
  37. #include <mach/hardware.h>$ i6 p& z  V, e( E$ X2 R
  38. #include <mach/irqs.h>
    8 v9 A0 e6 o1 b) V
  39. #include <asm/hardware/edma.h>5 [: F- s/ d0 H' U
  40. + _% r" h5 z% w- i2 e9 _
  41. #undef EDMA3_DEBUG
    8 N0 F$ b( I; }" f! H
  42. /*#define EDMA3_DEBUG*/- j0 a( A/ X1 R1 y& R8 t) p

  43. # L, z6 S' r( x' G; [/ [4 D* }0 ~7 N6 p
  44. #ifdef EDMA3_DEBUG' j, e, I  }3 n( p$ m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * \, i. Q/ U7 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 Z) q% a/ i1 q4 ~( g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / G* V# `* A; K
  48. #else
    + J5 M0 o7 z! O
  49. #define DMA_PRINTK( x... )
    8 e5 B4 k- g, O% i
  50. #define DMA_FN_IN
    5 v) g+ C$ U5 |* f5 i2 p
  51. #define DMA_FN_OUT$ E$ o3 w+ S4 B: ^: w! A. {( t* \
  52. #endif$ M7 G( G" G( Y& g: ?

  53. . D2 O+ o8 f  i8 q! q, I6 C$ B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 F, b6 R' p( r' A/ ]- L# g/ T; D5 w
  55. #define STATIC_SHIFT                3( Y- ?8 O/ K+ W
  56. #define TCINTEN_SHIFT               20! N4 I, ?) ~! `, o) K$ g
  57. #define ITCINTEN_SHIFT              21+ a  G  [# S3 ]: H4 C% J
  58. #define TCCHEN_SHIFT                22/ [9 q, C! t" \$ K5 I5 {' u$ `# I
  59. #define ITCCHEN_SHIFT               231 u7 H# e! f" V

  60. 1 Z  h( ~3 D: \$ v  [# u% d
  61. static volatile int irqraised1 = 0;  W! ]' [1 d* R; e4 ^2 N/ K
  62. static volatile int irqraised2 = 0;
    / d( y2 }% P' @3 D+ B- ~# g
  63. + k% q  c; n1 T7 h8 v# [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + p; \' M( i8 b; R# D) V! K* \: h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( S; [  m* G; \: [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ h2 k( }/ v% J; k
  67. ; i6 c4 u6 v, B- P, ^( S# a
  68. dma_addr_t dmaphyssrc1 = 0;% U. ~, f6 q; Z$ S' z
  69. dma_addr_t dmaphyssrc2 = 0;5 d5 ^9 ^6 s# Z% H8 Q
  70. dma_addr_t dmaphysdest1 = 0;! T5 I" L: J7 s  G" ^5 T5 [
  71. dma_addr_t dmaphysdest2 = 0;
    , I* O# X: |3 S, k4 K

  72. $ Q3 U: ~2 Q! a: T
  73. char *dmabufsrc1 = NULL;; D, J  h5 A1 [; Y
  74. char *dmabufsrc2 = NULL;7 Q9 c( [1 Y# i" y' g! M1 E& ]
  75. char *dmabufdest1 = NULL;
    / K3 M# x4 m' \! E* x7 q8 j
  76. char *dmabufdest2 = NULL;
    5 }7 P. G/ m! {% _  F9 w

  77. & [4 q' A/ o9 o9 A* ~! R
  78. static int acnt = 512;
    $ B; ?# Z, q2 G; y. |
  79. static int bcnt = 8;
    ; R' t! Q; Q* h  H% H. C9 L
  80. static int ccnt = 8;: G' M# n: q+ r
  81. 7 i4 W3 B) v" `
  82. module_param(acnt, int, S_IRUGO);6 `+ S$ Y) R4 B5 H2 n" G
  83. module_param(bcnt, int, S_IRUGO);
    ; B# F" S7 h7 H! T7 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ _* X$ M! n- e+ v( B- U, q8 O& `: O& m1 [% P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) @, t" S& ?% [* \  }: {/ }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 n. D8 y+ }+ z' X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% C" B% N  y. f) D! @. }6 v- k4 `# D0 n6 R8 g' |8 u( Y
  r  r1 z. E3 C7 z! S" S) `- z/ \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-12 17:52 , Processed in 0.042868 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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