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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& s; d& s2 e* R/ ^5 G* S9 |: V( l
  1. [code]EDMA sample test application
    7 a% X, |9 K- `& J5 q$ a
  2. /*4 a% O7 m4 o% c0 V
  3. * edma_test.c" C) }- u- ^' D9 r; h+ [
  4. *
    # k) Y8 p" z, j; A0 B8 L
  5. * brief  EDMA3 Test Application
    ! T  w3 S% [) u7 i2 T
  6. *
    - Y2 O1 G7 m! T/ F# t, }
  7. *   This file contains EDMA3 Test code.$ v: q* ^7 P1 q: l
  8. *# ^3 D+ S9 N, {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) G( r5 h) \0 U, F6 z' e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . A% M8 K% \* }& K3 p3 }
  11. *         TO CHANGE.- s: w/ V$ d& Y: S+ x, n
  12. *$ ?; `8 h! k2 y6 k6 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 l" m3 |7 w3 r0 H7 u
  14. *
    & V' ?9 f1 ?( e4 t9 j/ o
  15. * This program is free software; you can redistribute it and/or6 a9 _, s; X; y
  16. * modify it under the terms of the GNU General Public License as& J' @; i, x0 c, x  w' R
  17. * published by the Free Software Foundation version 2., M+ H# F& R# v% B! Y" ]) n# ^  I
  18. *
    6 K/ ?4 V& C5 L& L% k. k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! A& O+ m) ^4 s4 V! r! b
  20. * kind, whether express or implied; without even the implied warranty: W( ~7 @+ R& b; d" [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# j: |9 N3 f( ]. ?: w* l# ^0 D' `! i
  22. * GNU General Public License for more details.& ~; `8 h1 F" v2 B
  23. */
    + [# C5 |, K' @) y* j

  24. " k0 P' d1 W0 P% m* T' h, M" s: P! i* G
  25. #include <linux/module.h>9 Q' G: P6 h( C0 O+ i% {  I2 a
  26. #include <linux/init.h>
    / T/ g. I8 n1 M8 G' T: |. q, r* \, n
  27. #include <linux/errno.h>4 q: s& C/ A/ \8 [( ]$ G9 Z
  28. #include <linux/types.h>
    8 W) j, o% l, A2 X1 C
  29. #include <linux/interrupt.h>; B% C6 f+ n: w" Q+ S  A
  30. #include <asm/io.h>
    / U1 _# \4 ^7 R$ C% ]+ b
  31. #include <linux/moduleparam.h>$ e: y. y6 W# z7 f' \( V! U
  32. #include <linux/sysctl.h>
    : _* H9 n2 u, g6 }( ~
  33. #include <linux/mm.h>
    6 w( o4 v+ B9 {; d% c# \
  34. #include <linux/dma-mapping.h>7 A/ {* u9 W! {! B

  35. & P' d; `; a9 d! O& l" h- }$ ?: z
  36. #include <mach/memory.h>+ P6 `- g5 H4 ~' Q
  37. #include <mach/hardware.h>4 b2 E8 O. }& U5 ^4 A0 S4 l
  38. #include <mach/irqs.h>
    % n+ Q8 a0 R/ |6 R
  39. #include <asm/hardware/edma.h>
    6 _- W+ z! C; U& H7 I+ }7 A
  40. 5 s1 d( q5 J# @
  41. #undef EDMA3_DEBUG
    ) o! I  C. a/ b* L! q
  42. /*#define EDMA3_DEBUG*/: ^1 r3 ~1 k' s- `8 |! j

  43. % W8 T' r) V9 i
  44. #ifdef EDMA3_DEBUG
    , l9 ]+ T. L1 g& D2 f+ e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# Z5 E1 M' F: H1 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); e) v9 U  t$ `) B- g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 y! e' f" y8 b8 M, n% U% z4 G; _
  48. #else4 X, z! Y4 q1 g3 N; v: v. ?
  49. #define DMA_PRINTK( x... )! L/ R& m' L: {$ R7 q
  50. #define DMA_FN_IN
    9 l7 M2 A* x0 B8 }
  51. #define DMA_FN_OUT
    / v- U- v7 P0 `5 f
  52. #endif, I% }* n: v: ~/ \8 e

  53. 1 K7 P7 z  Z6 g( A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); P+ j' ~, C6 \# \% D
  55. #define STATIC_SHIFT                3" }. U4 _" @- Y
  56. #define TCINTEN_SHIFT               20
    % Z9 b7 m( q# e. @
  57. #define ITCINTEN_SHIFT              21
    + f. E: {) ?! O/ T& Z. `
  58. #define TCCHEN_SHIFT                22
    4 D" T9 ?4 W( E0 {2 p
  59. #define ITCCHEN_SHIFT               231 l' H; I2 V' p2 R4 f) l) P" j

  60. 8 c2 O3 J$ Z7 x! I
  61. static volatile int irqraised1 = 0;) x! e# c+ H4 x' p- D$ D- a
  62. static volatile int irqraised2 = 0;
    7 v$ I, N3 c" p* l# g6 _

  63. & i6 S+ M9 e4 g7 E; L5 o0 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 n% T4 u" z1 w2 _+ T- i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 f/ m) Q" T4 M4 |$ b- q- T( L9 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 h& U5 k- `# F6 L

  67. 9 @, S4 O; E! ?# ?  S" `9 T
  68. dma_addr_t dmaphyssrc1 = 0;
    - h- j6 p' M% B. z! K0 c# s! c7 B
  69. dma_addr_t dmaphyssrc2 = 0;( ]! ^9 S7 S2 t, Z1 @$ R& r& T
  70. dma_addr_t dmaphysdest1 = 0;
    - E5 s3 l- S6 A( y
  71. dma_addr_t dmaphysdest2 = 0;- ~& p1 K" ^- \& R  Q1 P# h4 q

  72. 9 Y/ L7 C, V) \* |
  73. char *dmabufsrc1 = NULL;/ o3 o% x; z! A. s- |5 k, b; T
  74. char *dmabufsrc2 = NULL;
      d- x9 b$ ~% N  m' _) ^: v
  75. char *dmabufdest1 = NULL;
    - g  Q- b5 N) v2 {) \
  76. char *dmabufdest2 = NULL;: }# e% s8 }4 @' s( p6 X) P

  77. 8 B) E5 e) E6 m& D, a  L
  78. static int acnt = 512;
    $ g+ a+ }4 ~" i4 e3 R* a" B
  79. static int bcnt = 8;. V& s: e  s/ U
  80. static int ccnt = 8;
    6 m6 v9 q/ n' [6 P8 p3 J* D

  81. 8 [  P2 P* H9 y9 W+ l
  82. module_param(acnt, int, S_IRUGO);
    . r  N+ J5 R( w  @3 j5 N
  83. module_param(bcnt, int, S_IRUGO);+ [. @$ c" A! D, Z! s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ p- `7 |, t/ @- Z" `* I: m# z5 h
" K- ]% x% X) @8 w3 s& @1 Y0 V6 `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ k1 H' \' p" I9 U/ U) sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 M, U$ Q/ h6 ?. v/ S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 c3 }* E) u/ ^* M7 \0 q$ Q

1 ?9 @5 H% T( T8 m1 ?5 F5 l6 e8 I& ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 15:32 , Processed in 0.045555 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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