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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* }2 X6 W: C- o* F9 Y
  1. [code]EDMA sample test application# Z, R, q+ @4 x( l* W2 B
  2. /*
    8 P) `4 M( C0 Z3 V
  3. * edma_test.c
    . V& T7 S4 U4 p1 ?1 g7 ?
  4. *
    / t. Q* S2 P# C: }/ V+ T
  5. * brief  EDMA3 Test Application% E) I. @2 \6 i2 `6 @) t1 O* L! d7 b
  6. *
    2 C, q  u6 g" I& j- N" b
  7. *   This file contains EDMA3 Test code.5 X; S8 p3 e! ?( p3 g, z
  8. *
    ' O6 p: H9 R. `. `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% n! N: C- t. L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; }; ?4 @6 `7 P. D: ^
  11. *         TO CHANGE.
    : n+ Q- V3 z0 P0 Y4 V3 Z% f: x: a
  12. *
    0 v% S" F) \' b/ a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 ~4 l% N0 T# z8 W6 h
  14. *% j6 ^! R* \3 W) s9 z6 ?' ?
  15. * This program is free software; you can redistribute it and/or$ Q. T4 n. U# T& e  `# [
  16. * modify it under the terms of the GNU General Public License as
    ) W  H& Q0 X: }7 d: A
  17. * published by the Free Software Foundation version 2.
    - g5 \2 g, n- |! M2 J7 M0 f9 P
  18. *
    $ _- O2 M( E2 g' X9 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 N* R$ B9 D# s4 x4 A5 M! O
  20. * kind, whether express or implied; without even the implied warranty
    ) R( r& }9 E" x& W( \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* e$ }9 _+ E* _
  22. * GNU General Public License for more details.1 Z. S  R  e# p) }2 m
  23. */# t5 }$ V' V) C$ h+ |7 [+ b( J) [
  24. 3 k6 v3 t, l! y
  25. #include <linux/module.h>! n; E% O( N) |! j" S7 n
  26. #include <linux/init.h>
    4 |$ Y9 j  H7 e; ?
  27. #include <linux/errno.h>3 ?' N- c7 C5 I( z: F
  28. #include <linux/types.h>
    4 J. y3 k0 u) o0 N
  29. #include <linux/interrupt.h>2 j5 I2 W9 P; L1 _# `5 P/ \# M7 E% S
  30. #include <asm/io.h>
    - S/ }0 w9 h2 @, h7 y  U7 ?" x
  31. #include <linux/moduleparam.h>& i  N& Z  l& z- }  `' e' H
  32. #include <linux/sysctl.h>
    : s6 x8 z% ~4 {5 B
  33. #include <linux/mm.h>8 C5 ^& @! N5 f; C  R3 ~1 H2 J4 j
  34. #include <linux/dma-mapping.h>7 L5 m8 q) r. y: g4 o

  35. % B  s6 j0 t+ P
  36. #include <mach/memory.h>
    1 w9 y1 R# z% y
  37. #include <mach/hardware.h>- t. O( ?5 B) W7 ]1 z3 P0 r
  38. #include <mach/irqs.h>
    0 K/ u& t5 k6 K/ N: D# B
  39. #include <asm/hardware/edma.h>
    $ k6 U# j8 n& ~9 R5 ]

  40. & h) `) F+ H5 y2 M$ Z8 x
  41. #undef EDMA3_DEBUG
    . ~! h4 d  v, O! w# n. n! Y
  42. /*#define EDMA3_DEBUG*/$ r" z5 b( Q. v: v6 @
  43. 7 K- ^% h( q( a; s
  44. #ifdef EDMA3_DEBUG
    3 D! R5 E% k7 o3 U7 u, N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& E4 x) Z/ T  V9 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / ^6 Q- L  n; e% ~, ]4 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 e4 a+ J, h# V) l( K7 k( F4 L, S! X
  48. #else
      P+ W* f' A% @2 f1 b# ]
  49. #define DMA_PRINTK( x... )3 B. z. O% d# g, r6 g4 R
  50. #define DMA_FN_IN/ r' K. O4 f; c! d/ M1 G) T  Y) R3 o
  51. #define DMA_FN_OUT
    * [4 c( C5 r5 ^/ v+ e8 A; G) G) p7 @' `
  52. #endif
    - O4 b$ f1 H  a( ~

  53. + E# d& V1 _) N4 [8 y6 O! \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& e9 v' v2 |) J9 D, T) L- N9 k6 i& D
  55. #define STATIC_SHIFT                3) G% Z' R+ I5 X  x  T
  56. #define TCINTEN_SHIFT               20* a, }1 D8 ^) V: P5 f
  57. #define ITCINTEN_SHIFT              21
    ' `! a' u: [+ e& e# {1 l
  58. #define TCCHEN_SHIFT                22
    1 x2 m1 L0 k6 c4 a# y# y
  59. #define ITCCHEN_SHIFT               23# v; v7 v" G6 J! T" _; Q' x
  60. / D/ _5 G, [( b" j
  61. static volatile int irqraised1 = 0;
    1 H6 O) R6 Q, Z: H0 v6 S. z
  62. static volatile int irqraised2 = 0;! c4 g8 \5 Z% K; V- I# k+ X6 ]+ x

  63. 5 W3 g/ \% o: Z" C. ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 w* w' U0 k. P# {9 W! s$ |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * q% b! L" m/ }) g. B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- B9 g# v9 S  Z2 b7 T& K5 s6 D

  67. - @4 [; |+ c$ \  o& s) t! q
  68. dma_addr_t dmaphyssrc1 = 0;
    ) Q6 Y. c2 T! Z" T
  69. dma_addr_t dmaphyssrc2 = 0;
    0 `7 Q% e! B1 o8 O  f$ Q
  70. dma_addr_t dmaphysdest1 = 0;
    6 b5 U5 L- s: @/ M
  71. dma_addr_t dmaphysdest2 = 0;) z* p) ~" K# v3 |- y: ]; @

  72. 7 |3 f5 B! I7 m7 y5 G! I- d* Q
  73. char *dmabufsrc1 = NULL;
    6 e1 y/ h6 f/ K6 X  J6 p
  74. char *dmabufsrc2 = NULL;
    1 y, P  D/ U5 F# b$ e
  75. char *dmabufdest1 = NULL;- z* h+ p9 g( b3 X9 I
  76. char *dmabufdest2 = NULL;% T* J3 c/ W1 F+ ?9 _

  77. , _( _: f9 z8 e& n+ j- ]
  78. static int acnt = 512;; Y* b2 M" o! E) u
  79. static int bcnt = 8;  C/ T% F  `. Z6 P0 V. q$ G
  80. static int ccnt = 8;! s. V" j% }8 n- l4 X
  81. ) I$ k3 c; y1 [# g! `% i6 m$ @
  82. module_param(acnt, int, S_IRUGO);0 T$ p( _) }: R/ @
  83. module_param(bcnt, int, S_IRUGO);+ i. G" [' o: F% X  {1 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& W. T. x( e8 R. [8 A
7 ?( Y* e  Z3 i: g  `; x  G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" ?' I: p, L% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" L% v! F. X, f! I6 f/ f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! n0 ]9 ~, l; P7 g' o

( m% r( `5 k& ]' Q
4 K9 \5 @7 E- o) Y) s/ f4 Q8 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 07:21 , Processed in 0.035294 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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