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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 R" S+ t1 {5 F. L3 a7 w
  1. [code]EDMA sample test application/ t/ K3 S+ U5 x, V: ^
  2. /*9 g2 Z7 O( r( t' H3 z% V# j
  3. * edma_test.c! {1 o# w$ q9 p: |0 Q% F; I6 I
  4. *: a' r* P/ E% ], j6 ~! D
  5. * brief  EDMA3 Test Application
    4 E2 `6 q' S5 j+ c
  6. *5 F7 b+ D8 L% n) U
  7. *   This file contains EDMA3 Test code.& B) ~- R: l! t+ j
  8. *% m% }* |: t- ~: y" n, F7 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- o7 Z7 Q% x. {# m" V; g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & |  F+ X/ K/ H' T$ _  }, R' @2 k
  11. *         TO CHANGE.) c+ a3 \" E7 x. k) a! u
  12. *
    # h0 w, g3 K" \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# i8 O3 |& H0 h
  14. *
    1 u- r) c; Y5 @9 X2 w) b
  15. * This program is free software; you can redistribute it and/or
    ' A2 E; ]* Z9 N: w- |" k4 Y
  16. * modify it under the terms of the GNU General Public License as
    1 _4 G! l  C; T' c3 J9 m) z! G: V
  17. * published by the Free Software Foundation version 2.1 X- \! W" |  {# S( Q
  18. *
    3 p  @7 l+ L6 |" l1 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 [3 N% h' \8 j  X: ]
  20. * kind, whether express or implied; without even the implied warranty0 v; I; C4 d& G! r7 V8 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 |4 [$ a1 D4 P7 B; P
  22. * GNU General Public License for more details.
    ! Q% Y, o' P% ?8 |- `+ O* Z8 Q. |
  23. */
    ! H- f. a) s: @. o) u5 f

  24. ( `2 }, F$ u6 T* x: g" W. ]! g
  25. #include <linux/module.h>
    ! j6 U) P# e1 D6 Q+ k3 Q( \
  26. #include <linux/init.h>; b/ r* f# a3 h- ~& p
  27. #include <linux/errno.h>" F1 s$ l/ y+ Z6 `* Q( a$ n8 P# X
  28. #include <linux/types.h>
    2 i5 n8 S6 m( ~1 f
  29. #include <linux/interrupt.h>, H5 Y3 N2 V, @+ q! x. n
  30. #include <asm/io.h>! w( \0 c. I. \6 R) w# \2 U% p# ~
  31. #include <linux/moduleparam.h>% p0 Q$ V' ]' f4 Q# a. `3 d
  32. #include <linux/sysctl.h>
      q4 N9 Y2 _5 a$ w7 O$ ~
  33. #include <linux/mm.h>
    / A# E$ \8 u5 W
  34. #include <linux/dma-mapping.h>9 ~6 M' J5 m& n
  35. 7 d4 E) b7 ?$ n. x% Z
  36. #include <mach/memory.h>
    $ Z6 c' P0 }0 g+ T
  37. #include <mach/hardware.h>
    3 z* B( D3 q1 D8 V; y
  38. #include <mach/irqs.h>6 n+ m0 M+ s7 s& \( N
  39. #include <asm/hardware/edma.h>
    " o0 v: p, i) l5 b
  40. ) W$ k# T+ Q* z$ E/ A- W% x# a0 r& e' F
  41. #undef EDMA3_DEBUG
    0 \/ w# j- h: j+ V% M4 w
  42. /*#define EDMA3_DEBUG*/
    7 g, ]7 }# b9 t! L
  43. ! J, w0 b' N% R& T" I/ D7 x
  44. #ifdef EDMA3_DEBUG! `( b( Q- c2 n5 }6 Q) a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 [2 S/ ^3 `+ v) Y3 c% o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , @, _& i4 M, S* ~& ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 L  D6 B, R" [- J
  48. #else
    ' C% P7 M* r1 V  S4 y# A
  49. #define DMA_PRINTK( x... )
    ' E5 s0 Z. n* l6 z- J; Y
  50. #define DMA_FN_IN
    3 Y7 t# w$ |# e! W6 H
  51. #define DMA_FN_OUT
    ' h; G1 E4 e* N/ I
  52. #endif
    9 f% K2 N" @$ L% C7 X

  53. ' h" j, g, \9 T; ?" [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 T' S4 n0 ^8 G* k9 y
  55. #define STATIC_SHIFT                3
    1 Z! W* s9 Z# H. v% C
  56. #define TCINTEN_SHIFT               206 }, y! X7 q# G! T+ @# @
  57. #define ITCINTEN_SHIFT              21
    3 Z8 p6 F9 n% C. W9 _; Y  G7 p
  58. #define TCCHEN_SHIFT                22
    * y. d1 [- w$ H& i6 m) C* }
  59. #define ITCCHEN_SHIFT               23
    ' ^! I/ z9 B9 z4 p1 X
  60. 6 Q9 d. e. v+ Y1 W
  61. static volatile int irqraised1 = 0;' T. {; k, j" v$ s. i" B
  62. static volatile int irqraised2 = 0;+ f% N7 w" n2 V+ Q! W- i9 Z" O
  63. ! n$ |* u( Y3 S. B6 O$ }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , p, i7 l2 a5 E* v' S0 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 N1 _7 x) Q# Q* J6 A5 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 g) C" ?, c; t/ |+ {& U
  67. * j- z+ u& n3 a8 |- \! t8 O0 {( I
  68. dma_addr_t dmaphyssrc1 = 0;4 E7 f0 {- Y: l' Z" V
  69. dma_addr_t dmaphyssrc2 = 0;& i, c: c. v7 t1 q8 D$ M( ~0 n
  70. dma_addr_t dmaphysdest1 = 0;! ]9 \/ M2 s& a* m
  71. dma_addr_t dmaphysdest2 = 0;/ j: A( m$ F, P' G" m

  72. . g' c5 m. m( p( K
  73. char *dmabufsrc1 = NULL;
    6 S! D4 G1 i& |9 z. x3 ^! Z
  74. char *dmabufsrc2 = NULL;
    ( n2 ?# Z' m4 Y" ^6 p" n  B
  75. char *dmabufdest1 = NULL;* n5 i9 i! c; z7 ?7 x
  76. char *dmabufdest2 = NULL;! d. B9 i% Z! w+ g4 h4 @% Z
  77. ) a* w) E3 w, ]" n2 c$ {
  78. static int acnt = 512;4 p) k( |. L) G. `0 a
  79. static int bcnt = 8;
    " j* z5 K( ]: d4 D
  80. static int ccnt = 8;
    ) T/ m2 o  R6 ^* A& i) _; {
  81. ' w/ I( K8 ]6 S0 K; Z. j
  82. module_param(acnt, int, S_IRUGO);- e1 z, y5 g. C) D, Z0 w* f( O' `
  83. module_param(bcnt, int, S_IRUGO);8 W2 x2 w  \: K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. \* l# i+ g1 C2 h6 `" w0 E5 ]9 z& F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 R0 q. [6 t0 A7 r  j& y, marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 n6 L0 V' m% ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! @! _* @7 n% h1 D0 d( h3 b; `
, T1 O& d' h4 M8 l
) ~8 i$ t  Z. f# j9 m/ c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 01:17 , Processed in 0.045878 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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