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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % j, }0 P  M7 _
  1. [code]EDMA sample test application/ E* t0 w7 w& I- K# P- [, r
  2. /*) e5 |' J4 `$ w! Z
  3. * edma_test.c6 u; t6 e) Z" K% K
  4. *
    & H/ k1 a3 K- i5 E5 K/ y9 ]: }
  5. * brief  EDMA3 Test Application/ F6 u( h# Y: @! i1 l/ h" V* |: |
  6. ** g5 t9 y% b/ `; }/ O8 V% C0 k
  7. *   This file contains EDMA3 Test code.. t' N% @- S* Q) }  G$ H4 u
  8. *
    6 S% H0 F  z& A. J4 V! y: J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 e" F  k0 D! Y4 G' G  Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ L1 ~1 H2 Q0 r& q$ |2 R5 R4 g
  11. *         TO CHANGE.
    # I8 j3 a7 j9 I# b2 c5 q
  12. *% P* d% }1 g+ x  c. M8 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 S8 R& U" Y0 s, I9 _+ V
  14. *
    5 ?* O! s. N, n4 y! {6 _& k2 d) e
  15. * This program is free software; you can redistribute it and/or9 `4 t( @5 y& ~% v
  16. * modify it under the terms of the GNU General Public License as
    1 O8 w! j5 R2 e5 a& ]( d) I
  17. * published by the Free Software Foundation version 2.7 ?7 s1 I' K, v/ |' \4 V3 Z2 `
  18. *! t1 h% u; \$ X  h  o! Q6 Q5 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; {- R- \" b; F( n7 m5 |* @
  20. * kind, whether express or implied; without even the implied warranty
    + d0 Q( R0 l. b$ |, }# c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! m6 B" G- i* H: `8 r: L
  22. * GNU General Public License for more details.
    % I; K! j0 u9 I, @$ U
  23. */" @$ p7 c5 C& e5 z( d) D

  24. % }+ V. |! R* L' O
  25. #include <linux/module.h>' K( N5 N1 b+ \2 O6 W
  26. #include <linux/init.h>
    : l: s2 h5 ~% i
  27. #include <linux/errno.h>
    3 J& w% N1 H- x3 O' L3 r0 G
  28. #include <linux/types.h>
    * Z8 S, @4 B4 {' A
  29. #include <linux/interrupt.h>$ j$ D4 B$ b* F# @! L
  30. #include <asm/io.h>
    % \. e' a3 V' s7 ~7 e" d- I- e
  31. #include <linux/moduleparam.h>& Y7 t7 Z# F- h3 |$ x$ O0 L
  32. #include <linux/sysctl.h>6 o8 n7 T6 U$ k/ ]) Y
  33. #include <linux/mm.h>
    * F$ V# ]3 X/ z7 x! X4 ~. |
  34. #include <linux/dma-mapping.h>
    ) s9 i9 M" {1 y8 ^* n

  35. ( ^7 O/ k( L+ d5 H$ l8 U
  36. #include <mach/memory.h># v8 Y2 U# z5 B. R; M) ?4 r3 M
  37. #include <mach/hardware.h>+ Y% \( @  h  |4 r) T) s
  38. #include <mach/irqs.h>9 A) g8 M1 O& @( V( x1 t4 s( |- I
  39. #include <asm/hardware/edma.h>, v* n  d9 `) M3 W7 o
  40. $ K! M8 S6 `5 y2 @+ s
  41. #undef EDMA3_DEBUG' j- n4 c5 k* X& u; A
  42. /*#define EDMA3_DEBUG*/7 v2 o( J: k# \

  43. ; D, ?( v- w( `' x
  44. #ifdef EDMA3_DEBUG
    " Z) J2 y' Z7 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) s9 u* @* f; X* l( |0 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 G- ]  }; g5 \/ P% |' x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! A; Z9 T4 Q* r  }- F. v, V+ I
  48. #else2 j  k: {$ g5 C0 ^
  49. #define DMA_PRINTK( x... )
    3 v2 s8 X) P5 H) T
  50. #define DMA_FN_IN
    , t. i7 ?" h( b8 @9 _" ]3 Z! a! Z% S; C% [
  51. #define DMA_FN_OUT9 }" w7 Y& `( f) J; |6 e7 G
  52. #endif
    5 x+ _& B. z( |# o! W: Z
  53. * \# B8 h/ M% m1 z, [% R: E' A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" n- f2 x( @5 v) Y
  55. #define STATIC_SHIFT                30 g, ]9 r) k: @7 |7 }
  56. #define TCINTEN_SHIFT               20
    ! I4 C* g9 m7 r* g2 }+ H
  57. #define ITCINTEN_SHIFT              21
    . P4 n% F  x; x% u8 r2 b6 c
  58. #define TCCHEN_SHIFT                22
    ; c7 ]  U9 F5 P/ r# u6 s+ n7 l6 q$ M
  59. #define ITCCHEN_SHIFT               23+ `& ~4 I3 v+ O0 v2 p
  60. 6 V$ L* {- M; ^1 Q( A
  61. static volatile int irqraised1 = 0;
    # }/ _) i  {9 y( {0 [
  62. static volatile int irqraised2 = 0;
    / ?; N2 _: c( g/ \. i8 v

  63. ' P# F, [$ D/ X* s! K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( K% ~: K3 \% m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 L" v2 ^4 V  t6 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 j7 i+ ~9 [5 d9 z* @

  67. " R2 P1 f" z) S* d- W
  68. dma_addr_t dmaphyssrc1 = 0;
    " p$ \8 ~- o  N7 S- B6 `
  69. dma_addr_t dmaphyssrc2 = 0;7 }! J7 O# P5 e6 Z) B
  70. dma_addr_t dmaphysdest1 = 0;
    ' f7 ]+ E1 v, i; G: W0 W' {
  71. dma_addr_t dmaphysdest2 = 0;' q4 ~, E+ J+ q3 F: k! J0 {
  72. 0 h- y. i  _4 t0 O/ y. m7 i
  73. char *dmabufsrc1 = NULL;
    ( i4 m' ~6 p( ]% |# U5 K7 ?
  74. char *dmabufsrc2 = NULL;
    / U0 c3 U  l+ o. b4 a& A) g) {
  75. char *dmabufdest1 = NULL;
    - Q, Z' Y' H. u6 |- t
  76. char *dmabufdest2 = NULL;
    9 {( o5 X! c1 S0 q' R' _

  77. ( i$ W, y5 K2 _9 G
  78. static int acnt = 512;
    % Z4 _' U" w9 `9 ~+ d9 b2 t
  79. static int bcnt = 8;
    3 [+ B  o, q3 M7 v9 z
  80. static int ccnt = 8;
    5 D# p: U* }; T2 r( U- _, _

  81. % L$ m: a, @% h' i" C
  82. module_param(acnt, int, S_IRUGO);8 z. `' h+ w* f. I- i& p
  83. module_param(bcnt, int, S_IRUGO);/ s* b$ q0 c( i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 S8 P2 Z- l4 M. y* c2 I
% X+ W- K6 D$ c6 ?/ p( z' c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 o* H+ ^7 p2 Y6 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 W$ J0 `4 z, m- Q0 ~! v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 P5 Z- |. D3 p4 l
1 I- |  r6 Q3 X4 y
! S: X' e: B" d/ ?9 Q6 F5 s; b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 16:34 , Processed in 0.037386 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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