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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * S0 T5 w( B0 {2 k0 b
  1. [code]EDMA sample test application
    0 A& [" v, J0 E4 e
  2. /*
    ) @+ N/ Y3 R. Q7 M6 [7 h
  3. * edma_test.c
    / Q# a# J7 G" h& e( ]6 F) w
  4. *
    ! U1 h8 l! p% g
  5. * brief  EDMA3 Test Application
    7 E% p* @" W" V9 S3 {" l: H
  6. *0 M% u" W  i1 t( }
  7. *   This file contains EDMA3 Test code." i, D' P0 W1 j- L  U
  8. *
    : I7 t, z  G! Q7 z+ e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / K5 l$ r9 t- u9 v; f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 ^3 a: v$ w' O" |4 W5 ?
  11. *         TO CHANGE.
    0 U/ x! Z4 L, S3 L# s) U3 i* T
  12. *- y# T+ s' o- m8 w0 R  s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 G6 b' B/ R4 n8 C
  14. *
    & K0 W& l7 x! c# [. g) R& \. W
  15. * This program is free software; you can redistribute it and/or
    3 a, K& d4 z, @1 G
  16. * modify it under the terms of the GNU General Public License as
      [2 H: W, A1 H# I7 I
  17. * published by the Free Software Foundation version 2.% H, D& `# M7 Z# G/ A
  18. *3 E& f, G( Q' N- m3 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- G8 P" o% w( c4 {* ]8 ~
  20. * kind, whether express or implied; without even the implied warranty0 o* p7 r0 c1 C1 y! ?6 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) j  B$ B0 P* I- ]
  22. * GNU General Public License for more details.1 Z6 s$ R0 y$ {
  23. */
    $ F  |* @6 L. s+ s! R

  24. / }. M& H+ B! d5 \0 _% }2 _
  25. #include <linux/module.h>7 A) n( ^9 W6 s6 i
  26. #include <linux/init.h>
    8 Q6 u4 `  K7 `
  27. #include <linux/errno.h>4 O& i5 E+ B: j8 i/ ^# }
  28. #include <linux/types.h>
    + w! @. H+ X3 F; z  ^
  29. #include <linux/interrupt.h>
    9 y: W8 a! y, r" N
  30. #include <asm/io.h>
    % R$ q, e: A+ M
  31. #include <linux/moduleparam.h>
    # {' j, G& W1 W) J* {4 V5 I
  32. #include <linux/sysctl.h>
    9 W5 n& \! a4 {+ D0 D$ x
  33. #include <linux/mm.h>
    7 x. U9 s' ~" W; _2 I/ p0 ^
  34. #include <linux/dma-mapping.h># [2 N* o: F7 W% r: m
  35. 7 _( {% V* b* B  Q6 H3 V! T
  36. #include <mach/memory.h>' n! z  h. Y$ j3 G8 _
  37. #include <mach/hardware.h>) d: ?& u5 y" y0 k
  38. #include <mach/irqs.h>& R2 }" J; t. p3 v  }, t4 g
  39. #include <asm/hardware/edma.h>
    & Y- }1 i" s3 e+ k- e& U

  40. . Q: |8 F$ k0 e. _
  41. #undef EDMA3_DEBUG
    7 c" s2 D* ^3 {0 J/ Z5 g
  42. /*#define EDMA3_DEBUG*/
    ' q1 E5 F; U$ k0 [

  43. & \/ Z; Z: t% |6 }
  44. #ifdef EDMA3_DEBUG
    9 v7 M3 M, Y( w( Q& Z! ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * b/ j& L0 d/ t# i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 b- x- q% b) X) G( c/ H. |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ r) @: j2 b2 u
  48. #else
    1 ^9 N" u4 g2 J
  49. #define DMA_PRINTK( x... ): O+ W3 Z: W' ~; l4 U
  50. #define DMA_FN_IN
    * s7 O& l$ b* w; W$ S* z- c! z
  51. #define DMA_FN_OUT
    : J2 r! s$ Y0 n2 _
  52. #endif
      D9 x& |' K# \8 O' e' S, a4 H
  53. : L- Z' i% J! S8 m+ Y: [4 S: T6 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- G# I! G6 |  s, ~! H: ?
  55. #define STATIC_SHIFT                31 S3 d0 Y8 ~: {. M: Q3 w9 T3 @1 k
  56. #define TCINTEN_SHIFT               20) k0 r* W2 D+ l
  57. #define ITCINTEN_SHIFT              21
    ( @, g1 v/ p. g- ^& A8 L
  58. #define TCCHEN_SHIFT                22& F+ F) @9 M, H
  59. #define ITCCHEN_SHIFT               23
    3 F. M' O* M  Z9 k
  60. # Y. X7 x% n( t
  61. static volatile int irqraised1 = 0;
    1 Q. F! N4 J" ?: T- D% i
  62. static volatile int irqraised2 = 0;
    7 U* D/ T6 D3 M& H3 D( [

  63. ' G$ L- d( J5 F( R5 p0 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 n8 `! [, i2 z1 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 i  P& }$ ~' A6 l, m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 {- d( r: s$ t# w4 r3 I
  67. * E* L! K3 \3 s2 @6 f
  68. dma_addr_t dmaphyssrc1 = 0;5 ?; f! @* y/ S
  69. dma_addr_t dmaphyssrc2 = 0;  \, b1 c" m5 J: \% X  T- U" u
  70. dma_addr_t dmaphysdest1 = 0;) Z0 |2 w% e* M  z
  71. dma_addr_t dmaphysdest2 = 0;
    9 [/ Q# r. i9 j( e
  72.   E# m7 |- H  E4 `9 a
  73. char *dmabufsrc1 = NULL;
    + n6 L- P1 I5 d+ Y5 ^8 }0 O
  74. char *dmabufsrc2 = NULL;0 _1 h  A% v! K) c* k7 z
  75. char *dmabufdest1 = NULL;* P# j# j2 o2 X  `" b- R3 J% H8 `
  76. char *dmabufdest2 = NULL;
    + X: ]% a% `; J5 |# b; g, s
  77. % B; q) G( E( U4 h. W  R
  78. static int acnt = 512;
    % S3 N) @! ?1 {
  79. static int bcnt = 8;
    * [0 E# d* n5 ^2 f$ N
  80. static int ccnt = 8;
    & i% h" k  p0 ~/ M1 E" ~1 ?

  81. ) O6 u# U0 e6 U  U5 Z- L  G& b1 d
  82. module_param(acnt, int, S_IRUGO);
    7 `/ O! f- {- R  h
  83. module_param(bcnt, int, S_IRUGO);
      N0 o- o4 G+ C2 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 E& |+ U! ]: P6 \

4 s/ |3 B$ r7 I4 ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 h4 s- m1 C2 N. n& h5 Varm-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 \: y" ~7 o! z6 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& E- _$ @2 u2 k9 l

+ h# U( K+ D" F$ v9 G. G
9 b: n6 v' S/ q* A" {. d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 13:25 , Processed in 0.038380 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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