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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # B3 K8 A. T+ K+ C% D! w& ~  o
  1. [code]EDMA sample test application
    " y) a  ?& k8 o- L% `- ~- r
  2. /*
    8 i7 Q& F$ e' _& S
  3. * edma_test.c
    ! g8 L- }4 Q/ I: Q1 ~- G3 V3 g  G
  4. *% R0 G9 w* v5 M9 n- f
  5. * brief  EDMA3 Test Application
    $ h1 T9 @& \- @3 Y5 m+ X% y$ {" l
  6. *
      {8 [4 I; T( l% T) E, _
  7. *   This file contains EDMA3 Test code.
    $ u5 Y9 ~* y* s& I7 [$ a
  8. *' X6 {. S" B7 r& D9 G" D8 V' d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 g+ X& h8 c: c. H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , D$ B6 M' s  ^2 n
  11. *         TO CHANGE." h" D& w% T* w8 b. a4 Q
  12. *
    ' f+ M- q* `% @+ G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 F" ~) |8 V( F% n3 I
  14. *4 }. R% o5 t- q( }2 W  p
  15. * This program is free software; you can redistribute it and/or
    2 h$ b- x) v1 v/ c- v# X
  16. * modify it under the terms of the GNU General Public License as
    ! {8 H# p( n& k
  17. * published by the Free Software Foundation version 2.
      _% o$ j- K4 P! e
  18. *' p! s% W" {& s& L/ z' P7 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 d- v, y" z& p+ m4 U
  20. * kind, whether express or implied; without even the implied warranty' s0 q' k8 K/ V  C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # F1 n2 P( h$ Z7 B' y
  22. * GNU General Public License for more details.
    ' k: y* i+ W& A) [
  23. *// V9 A5 \1 P+ l- M+ m

  24. / m+ L% Z: U6 {
  25. #include <linux/module.h>/ I$ y% w$ A* U. l) J% j4 c: a
  26. #include <linux/init.h>; H4 A2 n" ]% c3 k
  27. #include <linux/errno.h>) d5 I, _$ d' ^1 y% a
  28. #include <linux/types.h>
    4 V3 h6 ~. ]; \# N1 T) U2 \( U
  29. #include <linux/interrupt.h>
    / U2 D8 E' ^8 G1 h( f7 x
  30. #include <asm/io.h>) q! u% K+ G. m/ A- s$ O# i
  31. #include <linux/moduleparam.h>+ X' L& }4 M& v, Z/ u
  32. #include <linux/sysctl.h>
    ' y- `. u- T, w/ W3 h9 ?
  33. #include <linux/mm.h>
    8 k$ m  `! C6 G% ^# ~6 o3 J* m
  34. #include <linux/dma-mapping.h>/ i) i- c+ U2 z0 G+ X4 n
  35. * D) Y1 Y8 T: l1 C6 }) e. v
  36. #include <mach/memory.h>" c8 b0 V- D6 J% a+ a
  37. #include <mach/hardware.h>
    1 b: f/ u# p# I1 O5 r; P
  38. #include <mach/irqs.h>; x( i2 D% Z! g. @
  39. #include <asm/hardware/edma.h>7 z0 o1 n$ w( b# C) r3 H( l
  40.   l) }2 T1 A% j9 p- T: m( c
  41. #undef EDMA3_DEBUG" G6 d& Q; Z! d' z1 Y- v$ k
  42. /*#define EDMA3_DEBUG*/- l0 W/ I# I/ l+ i3 t! w
  43. / M4 C+ i1 [4 y; ^* t
  44. #ifdef EDMA3_DEBUG8 j: F4 b& [# g# N8 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 p, u$ _/ ]; O5 x& P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& h" |  i1 ]: _1 L; D; S( s- d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' |+ x; p/ S: x" s8 T6 U1 o
  48. #else
    1 Z9 X! f: N# Y
  49. #define DMA_PRINTK( x... )+ ^  X* }: W3 j. {! x% @/ g3 ~
  50. #define DMA_FN_IN3 B. k/ `3 `8 U
  51. #define DMA_FN_OUT- q* h$ }6 D4 @' @1 x
  52. #endif' }9 e- v1 q1 z* Z1 x" |
  53. 9 i; j* J% @3 C5 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& l( b- U! j) N$ f
  55. #define STATIC_SHIFT                3- [1 t, O9 Z! T
  56. #define TCINTEN_SHIFT               20
    / [' p" g# W/ X5 L4 t( o$ f
  57. #define ITCINTEN_SHIFT              21
    ! l. o& i! V- u9 T
  58. #define TCCHEN_SHIFT                22/ u: t, K/ c4 b, h  L9 y0 |9 `
  59. #define ITCCHEN_SHIFT               23
    , Z5 Y( d% V  {4 ^
  60. 3 n* w; Y2 d& Y9 ^, X" a2 c6 v
  61. static volatile int irqraised1 = 0;
    4 M) n' Z; m5 @* z
  62. static volatile int irqraised2 = 0;$ [8 \* ?5 J! S5 c% w1 O

  63. : Y3 N. @3 F; J- m. i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! |% O1 N) y" s* V: H. C0 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ^. e5 M" T' {' d5 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 I8 g; q3 _/ D5 e  E
  67. ! `* Q! R) A) t+ R) v, z' i0 s
  68. dma_addr_t dmaphyssrc1 = 0;3 s1 D- d" s) h# B6 t2 L4 p% n
  69. dma_addr_t dmaphyssrc2 = 0;4 U& w1 X! ?9 W9 n
  70. dma_addr_t dmaphysdest1 = 0;, p4 R# M( B6 f' E+ _
  71. dma_addr_t dmaphysdest2 = 0;5 s- F! C% @+ g) @
  72. 4 y! @& a' a2 y3 D
  73. char *dmabufsrc1 = NULL;
    - s6 c; e$ o% w: S; i8 _- q0 L, c
  74. char *dmabufsrc2 = NULL;9 S; P  ^8 H' Q) S' `9 x+ x- T
  75. char *dmabufdest1 = NULL;
    , |# H! }2 y0 @- h& f/ T
  76. char *dmabufdest2 = NULL;, P0 k- Y% ]% J3 C+ l, V6 V

  77. 2 l5 Y2 u: J3 F
  78. static int acnt = 512;! g; s: ^& g2 ]) C: w
  79. static int bcnt = 8;6 u( [) S# v% d, o% V4 R5 j
  80. static int ccnt = 8;
    " G/ j' f( x7 i, d

  81. # J9 E8 \1 s6 X) l. @" f
  82. module_param(acnt, int, S_IRUGO);7 r& x5 ^7 J2 t5 ^; E8 q* T% o" k( Q0 }
  83. module_param(bcnt, int, S_IRUGO);8 |; ^5 b7 |0 H& J. w: m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; s) \; I1 f+ u4 U, J3 @$ a
. l9 w# G5 [  `( r; N. q- @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ^8 R9 j0 }) F$ B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 N6 E+ B8 Q8 W/ d. d) j: }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 Q6 a" b; X. A( p" ]* L3 e

, Y- s* \& c! o8 d; \8 Y6 ]$ q/ F0 I: L; ^* C" o$ w2 |1 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-31 04:06 , Processed in 0.041390 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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