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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - a& g5 ]; X) l+ y6 V) v
  1. [code]EDMA sample test application
    8 z% A( c+ \$ v
  2. /*+ [0 g+ K+ |' ?/ I
  3. * edma_test.c) K. k  I9 E7 p9 s3 e0 L7 a. b1 Q
  4. *( O/ R' w; |1 n& q% p  L/ C
  5. * brief  EDMA3 Test Application
    3 t1 ?  }5 O2 S0 y1 [. B
  6. *
    $ H3 X  t: H2 ?& M% @/ A4 |% l
  7. *   This file contains EDMA3 Test code." F# j" R% d! j4 }
  8. *7 d/ q( d( s8 ]* C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: m  z  y& F4 t; m* O, Z) D$ ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  w# s$ Y  L" r) t$ O2 u. V
  11. *         TO CHANGE.' C0 J& _) e( Y2 M2 _6 i' r+ I" e. o
  12. *
    ; R8 T& m$ i0 J8 S% e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 o4 O" T, _  Y7 N. p- f
  14. *0 Z, j: ^/ K) x2 i2 p9 i" F
  15. * This program is free software; you can redistribute it and/or
    ) n! l  }5 ^: C: ]4 s9 M$ O
  16. * modify it under the terms of the GNU General Public License as
    . h# b1 {1 p) e4 J
  17. * published by the Free Software Foundation version 2.
    , _0 H- v! v* _0 u% s
  18. *
    1 `7 Z- q& o" }& H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * b2 h( b! E" [4 z% G$ G% l1 p
  20. * kind, whether express or implied; without even the implied warranty9 j. A3 q7 g- ~7 S+ h9 f2 b" r, D! a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & Q/ M9 |& N! B0 }1 P' W
  22. * GNU General Public License for more details.
    % E7 W( V. U  }
  23. */
    , M8 I* p0 c8 {0 x; H% |

  24. 3 P5 `3 d! Q- {
  25. #include <linux/module.h>
    0 T/ ]/ F) P5 Y4 K( W5 r
  26. #include <linux/init.h>% w7 f( C' [7 i  g. x6 y, D
  27. #include <linux/errno.h>
    4 e* R2 Y, [6 x
  28. #include <linux/types.h>3 q% c* h+ y3 _
  29. #include <linux/interrupt.h>+ l% `7 h3 W, [2 m1 W3 i
  30. #include <asm/io.h>
    & u4 |8 m) b& T) N
  31. #include <linux/moduleparam.h>% F' C, Z. k2 Y
  32. #include <linux/sysctl.h>: J" I3 u1 \' ^1 }+ a) D0 y
  33. #include <linux/mm.h>% y! o$ ]" V$ S  q
  34. #include <linux/dma-mapping.h>
    ) ]* B9 D. o% Y+ v* o* v

  35. & u/ ^9 {3 u. ?
  36. #include <mach/memory.h>
    ) N9 o  A) \% S% S# I
  37. #include <mach/hardware.h>- l0 G- f# u7 `3 t0 w: u+ `
  38. #include <mach/irqs.h>
    3 b9 f# W! ?4 o
  39. #include <asm/hardware/edma.h>- L: K  n9 O3 A' Z/ i* |/ Z$ Q
  40. 4 `1 H- _/ k( b
  41. #undef EDMA3_DEBUG# Z* N7 a  F7 \, v/ g
  42. /*#define EDMA3_DEBUG*/
    ( R; r) Y# F) w+ X, y" t4 m/ _
  43. 4 B# }6 y6 n. `/ d4 A5 w
  44. #ifdef EDMA3_DEBUG
    & k; n: a( w  r2 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % h4 G0 g  [3 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* G7 d, m! T" W# [! G  {, w( o$ _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - U: G. p, d) T# t
  48. #else# D$ T  ^- v, |) g" E+ o1 n
  49. #define DMA_PRINTK( x... )7 W! _- |5 H& F
  50. #define DMA_FN_IN9 Z* }; P9 V, J6 p  c6 [
  51. #define DMA_FN_OUT
    " L% h6 `) a3 `5 ?2 J0 m0 f$ x0 s
  52. #endif# [1 M3 w' A, q' T9 u% P
  53. 0 }- A/ V$ X9 Z. X- G: W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      Y- U" C; w3 Y& L% u- `
  55. #define STATIC_SHIFT                3, R% c5 w9 n& ?" F" E0 o3 x
  56. #define TCINTEN_SHIFT               200 d+ V0 Z( p/ |  f, L7 B6 p' G
  57. #define ITCINTEN_SHIFT              21
    & H7 y* l& [4 ?7 C: V: D% ]7 K+ q
  58. #define TCCHEN_SHIFT                22
    3 {* Y. |) `2 l# S9 ^
  59. #define ITCCHEN_SHIFT               23. g; {  e2 _) X6 k6 ~) j  j
  60. ' _' {& ~$ z) C( ~# K4 g
  61. static volatile int irqraised1 = 0;8 Q  p0 N& I+ a5 e, V! v- U
  62. static volatile int irqraised2 = 0;
    4 ^7 r3 [8 x; v$ H1 y
  63. ; T3 }; l+ E+ q/ \! x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 m) c2 K- X! m, S9 d/ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% D4 L$ ~7 h: d$ ~- G- z2 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 }+ I' U  I, f6 p, [  `

  67. ' n4 V  ?; Z- @8 K4 N
  68. dma_addr_t dmaphyssrc1 = 0;. m/ }' ~) \* Q# c$ h( n
  69. dma_addr_t dmaphyssrc2 = 0;
    + m% o: u( K0 h* L' i- U
  70. dma_addr_t dmaphysdest1 = 0;( s( {) z6 X( U. k+ X- w5 F" ~
  71. dma_addr_t dmaphysdest2 = 0;5 e, c9 {  Z' z* u: j) d3 I4 C

  72. ' h; \" Z& f8 ]4 {, \& G' }
  73. char *dmabufsrc1 = NULL;1 t; G" I" D5 {! O8 a" `
  74. char *dmabufsrc2 = NULL;! L/ F$ J, I4 q+ W; u" ^& y
  75. char *dmabufdest1 = NULL;
    : ~& B! W  |. m( z9 c0 q/ q
  76. char *dmabufdest2 = NULL;
    ; L  t1 h8 w# K) Y7 F: b

  77. 9 M8 I4 h% o" T! w9 p
  78. static int acnt = 512;
    & V. K2 F) N+ M3 e6 J
  79. static int bcnt = 8;
    0 j) D5 P3 x9 T" K
  80. static int ccnt = 8;
    % {. T& B* _7 ?7 s+ K6 {

  81.   f  U1 M% B  y' M8 a$ g
  82. module_param(acnt, int, S_IRUGO);9 S7 T% x9 w6 @7 G& L
  83. module_param(bcnt, int, S_IRUGO);
    / W6 _' W- W5 x/ J/ T# I8 N6 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 t: e$ n" L3 N2 q& b* X% E* x
, R# k( a0 K' O2 A2 ?4 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 w( T% [8 Z+ @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 x- [( g; @6 f' ~- ^& \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 x5 D3 z* r3 j/ G( f
& F, o& {# [- T, P0 H  ~2 Z0 \

# ^! o! l# R  ]; G- j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 19:41 , Processed in 0.039253 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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