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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% x7 A' p1 }6 ~/ F  I
  1. [code]EDMA sample test application
    & f+ n2 e& M7 g  [; S
  2. /*0 n( n& D) q* O5 o6 C
  3. * edma_test.c1 b6 b( S8 y3 k
  4. *
    + a9 e* X+ z) i. K
  5. * brief  EDMA3 Test Application
    # @4 l$ D, P5 _) ~6 B
  6. *
    $ q" e4 n; F: z4 x, p0 i1 X4 U
  7. *   This file contains EDMA3 Test code.
    ( z# }$ \: v5 Z6 [
  8. *2 t2 h9 l9 ]4 g) X3 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # k6 f( {: T2 g& ^- i4 z; p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% x) Z! n9 }7 P1 h6 g+ V8 `  Y
  11. *         TO CHANGE.
    4 R7 a4 f1 w# i) Q# T
  12. *: y7 Y0 N  @( U9 f- J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 G/ M) h7 h$ P, Y. e. H
  14. *
    " A- I) K9 F# `- M5 o
  15. * This program is free software; you can redistribute it and/or+ s; W3 Z4 G, ?" |
  16. * modify it under the terms of the GNU General Public License as/ h& _) T4 A$ k% N( I
  17. * published by the Free Software Foundation version 2.
    7 H) a9 \& S; V/ C
  18. *+ r( a6 \8 g% a$ y9 e1 N( a9 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 U4 d7 ^+ A4 T  A
  20. * kind, whether express or implied; without even the implied warranty
    ( \0 R0 @& q  C1 l& w* z- m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 m- j7 T2 G! Z9 D5 F' W: t8 C* E' i
  22. * GNU General Public License for more details.
    & X; s3 ]- [3 j& o1 d6 p
  23. */
    0 r* @/ |- ]1 m! n" b6 p
  24. 5 o; U" N- k6 s3 {: T' c' s
  25. #include <linux/module.h>
    / U% J4 B% H" {
  26. #include <linux/init.h>
    ; {3 E3 k5 m# z( B! L1 J
  27. #include <linux/errno.h>- R7 j  L1 j. h5 B
  28. #include <linux/types.h>
    - t& v. M( p& a, b) t
  29. #include <linux/interrupt.h>
    ! k6 E5 z& }7 a' b* p
  30. #include <asm/io.h>( f' e1 j6 q5 _; Q% d& W. k
  31. #include <linux/moduleparam.h>
    : j, B; w; S  ]! K
  32. #include <linux/sysctl.h>
    + b( o1 N) D$ |0 Y5 r$ L  u% s5 G; y# Y
  33. #include <linux/mm.h>; B9 h% G, p2 ?7 M1 e
  34. #include <linux/dma-mapping.h>
    0 [+ X/ G( ^% x  A
  35. 6 ~9 h  n5 {% F
  36. #include <mach/memory.h>
    . b; Y# F2 |6 Z& c/ y
  37. #include <mach/hardware.h>  [1 X- V! \0 Z4 K
  38. #include <mach/irqs.h>' C- _5 [/ _- F# x
  39. #include <asm/hardware/edma.h># {- s  E) v/ r6 q  L
  40. * @) K0 ]" V( N' j
  41. #undef EDMA3_DEBUG
    + Q5 Q  P, T) X( C# O& C5 C9 z. v
  42. /*#define EDMA3_DEBUG*/, u8 j/ H( g& k$ b  O

  43. ' _6 H) }$ n( e  P
  44. #ifdef EDMA3_DEBUG" Z, L: ]7 C/ u# |8 D# C% E2 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ y9 f/ L/ M- ~# R9 a  w0 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% j$ ]. u- q, b2 H; V% \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " W# W' F, m+ E5 y# h
  48. #else
    ! D0 K6 F. {. ^0 |# l% F2 p' E
  49. #define DMA_PRINTK( x... )/ w. C7 R+ D3 V  p, d  d3 s
  50. #define DMA_FN_IN
    & W- Q1 T9 u* b0 q2 @
  51. #define DMA_FN_OUT1 f/ }0 l( D6 ]; K$ B  |
  52. #endif# F" t. N9 U+ e& M

  53. 4 e! J( w/ x$ n# j! C' J+ G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # D' j# J. W) {* F! ?2 t
  55. #define STATIC_SHIFT                3
    * o/ R4 _' x- e3 e
  56. #define TCINTEN_SHIFT               20
    " g: a, ^, o9 y% x, V$ j1 e
  57. #define ITCINTEN_SHIFT              210 x* j% j4 V0 K
  58. #define TCCHEN_SHIFT                22
    4 t* M" H/ J/ j" }3 c
  59. #define ITCCHEN_SHIFT               23
    5 p4 j$ ^7 X( x' Q( i8 F% F  n2 S/ [+ w

  60. + s" h) ]  u. m$ i9 }+ E) \$ ~
  61. static volatile int irqraised1 = 0;& o/ j" D# @1 i
  62. static volatile int irqraised2 = 0;
    4 |/ Y% g5 \9 c) s7 s9 C
  63. " q! ^8 V3 B0 r1 F" I* k" l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ A7 P8 N8 @  ]0 t/ e7 M: F( Q7 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - a1 O/ \7 _2 L* O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! m- n: y; S2 P

  67.   o5 ~" g+ _- e3 h" a+ i
  68. dma_addr_t dmaphyssrc1 = 0;
    : r, E% n/ g  S; @
  69. dma_addr_t dmaphyssrc2 = 0;. r- a. z. _- Q# i: [' j- u. U
  70. dma_addr_t dmaphysdest1 = 0;  b5 M$ T& S4 w4 c! ~
  71. dma_addr_t dmaphysdest2 = 0;3 |5 V& p- d. m+ L9 O" E/ l
  72. & g; z6 E/ k* A" ^
  73. char *dmabufsrc1 = NULL;: j% n2 H& z* R. l: r0 V
  74. char *dmabufsrc2 = NULL;
    ' D! G2 W; v* z5 }5 q
  75. char *dmabufdest1 = NULL;
    . Q# g5 U$ M& I: ~% ~5 a' k, X) p
  76. char *dmabufdest2 = NULL;
    ( h- f% C: W- g; {* ^$ w6 q
  77. - W# F/ z0 I+ C
  78. static int acnt = 512;
    $ H3 j% K' i2 [5 W( h. I
  79. static int bcnt = 8;
    3 H/ ~- }( E. y1 c6 f' {
  80. static int ccnt = 8;. @# d6 }. k* @2 h1 M  c1 I
  81. 1 d) I  J+ v2 t' ]' V; P
  82. module_param(acnt, int, S_IRUGO);+ D# W# g; ]: c# p# D( t
  83. module_param(bcnt, int, S_IRUGO);/ e7 u6 ~# d4 b. K* l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* e& H1 N, C" t# V" D3 a: Z8 \. h9 ]. m2 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 T) r$ U6 p& R& l7 M/ ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# b- x8 g. o+ ?9 V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* m' [" u2 K  b3 I# i6 X; l: Z- {* E- b! c5 o5 U* C
' {2 w- k. R8 T/ [) s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 15:27 , Processed in 0.038916 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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