OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % ~& P' J* j1 p9 @% V
  1. [code]EDMA sample test application  v, B- q3 F' {( K
  2. /*- F1 K( c# G% b( d1 I! c
  3. * edma_test.c8 q4 V7 d; I' A9 n# ~
  4. *
    8 D% o9 D% D5 a2 Q! A% N
  5. * brief  EDMA3 Test Application/ e7 G2 M  f# E# s, J. N
  6. *
    , `/ p* M8 h" e! x' c. E
  7. *   This file contains EDMA3 Test code.- A$ Y# ~) s% w" |6 m' f
  8. *
    9 O' O5 J0 @  K8 D3 i" T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 ~) B6 [9 U9 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; f; c5 J% u) u1 m5 u
  11. *         TO CHANGE.; w7 ^+ m$ M* i& n& r
  12. *; @/ p/ R3 {# I4 k( O* K2 F9 Z7 z1 j0 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( V4 i; D( e, q8 G
  14. *
    & s* g, h" h2 c. `1 P1 J+ G: i
  15. * This program is free software; you can redistribute it and/or- }4 x( P/ p0 f' ^: X( a5 X' t
  16. * modify it under the terms of the GNU General Public License as) e0 q. m# ~, g+ B% c+ r7 R5 s
  17. * published by the Free Software Foundation version 2.4 h5 a: o7 ~# u5 b
  18. *
    8 c3 E6 @# H& X2 f, `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& {+ N! G* i1 g( M
  20. * kind, whether express or implied; without even the implied warranty
    7 O1 }; u: |7 D% q* a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) @8 O9 x+ H5 O8 H8 ^( n9 a3 l9 L
  22. * GNU General Public License for more details.8 I# ^0 R, B+ K( ~) @6 r
  23. */, N2 \7 [6 @5 Y3 T2 F6 S, Q3 B
  24. # B" Y& ?; W8 I4 C! E, \
  25. #include <linux/module.h>
    ' f) `' ?" i! L, l# ]: V( Q* N
  26. #include <linux/init.h>; U5 @+ y2 d) ~* ]  B8 j
  27. #include <linux/errno.h>
    + S& U" d  `" \' o
  28. #include <linux/types.h>/ a# B/ J5 ~4 ^$ K
  29. #include <linux/interrupt.h>! z# S/ E3 k5 v# J1 r) W& X
  30. #include <asm/io.h>' r$ B4 [  `" a8 E( X: S: q; U
  31. #include <linux/moduleparam.h>% s% q  X# C! l- {. z6 m- O
  32. #include <linux/sysctl.h>
    5 a+ `% L( P, c3 X
  33. #include <linux/mm.h>. u' O/ p( `: g6 o/ |; f* o
  34. #include <linux/dma-mapping.h>! J" H1 G& s1 w0 R3 y9 D
  35. % b+ A. i0 t5 y! i( a
  36. #include <mach/memory.h>7 i7 N; P6 d7 V
  37. #include <mach/hardware.h>' f) e# r0 P- X; \0 l
  38. #include <mach/irqs.h>
    % ^$ {. x5 N$ q9 O# t! z; S/ V
  39. #include <asm/hardware/edma.h>$ X5 Y3 c1 j8 G4 z* Q

  40. - p; i& c1 d6 @
  41. #undef EDMA3_DEBUG/ [& K" x/ \2 |
  42. /*#define EDMA3_DEBUG*/
    & K0 l+ |/ d! V8 D* z# d6 l
  43. + R1 q8 }0 f! F% [# U. i
  44. #ifdef EDMA3_DEBUG
    2 @! V. y' z  L; `% r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! b7 Q  @. O/ m0 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); m5 I, @. u% X+ V6 v; a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 v6 g. w" `& c# J3 b
  48. #else/ I- y) K+ X! c, E, T
  49. #define DMA_PRINTK( x... )
    ' ?! F& y, q: _1 P, ^& J9 n4 J' v
  50. #define DMA_FN_IN; G3 e; v) c6 R8 ^2 O$ g1 a- {
  51. #define DMA_FN_OUT
    ' k; w4 }6 {  N
  52. #endif
    8 p7 A' @4 y; i6 V

  53. 5 P( d1 b8 U+ q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 x7 ^3 A4 ]- Y8 f9 X
  55. #define STATIC_SHIFT                3
    4 ?( f5 ?* Q0 C% z8 G
  56. #define TCINTEN_SHIFT               20. f8 U0 K! C# V6 H
  57. #define ITCINTEN_SHIFT              21
    * ~: {7 c3 Y0 v2 \+ P- X
  58. #define TCCHEN_SHIFT                22
    + \3 c  X* L7 c$ d# _; X
  59. #define ITCCHEN_SHIFT               239 k. |' a! `: d2 j: s2 r& f6 R+ F: K, X
  60. 2 M& T# L9 S/ h/ q8 j6 O4 g, T/ V
  61. static volatile int irqraised1 = 0;
    ' [( e8 v& r! X/ U9 P
  62. static volatile int irqraised2 = 0;
    3 Z5 O$ ^2 Y1 G! X2 S

  63. % _0 A# Y1 l" H( z' g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! X/ o5 o! U, ~3 @" \$ Y( u! A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ~; `: e3 s. l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' S5 o# f) V8 C  D1 ?$ ]- b

  67. . H+ |" ?8 D" j0 K. D$ Q3 e  ^1 g2 B& v
  68. dma_addr_t dmaphyssrc1 = 0;
      a$ @. }9 m+ F; W4 n) g
  69. dma_addr_t dmaphyssrc2 = 0;
      N2 F7 e$ q$ @# d7 ?! u
  70. dma_addr_t dmaphysdest1 = 0;/ s  M" R3 v$ R, n
  71. dma_addr_t dmaphysdest2 = 0;$ m8 W* w% q8 T& R
  72. 5 L, n9 K. [: ^' g1 E0 C
  73. char *dmabufsrc1 = NULL;/ G5 j9 R# M) }  q" K/ j
  74. char *dmabufsrc2 = NULL;
    ! ?( _) W5 }; @4 A) w. M3 q7 g
  75. char *dmabufdest1 = NULL;
    , |8 \% f0 k1 j
  76. char *dmabufdest2 = NULL;- h: W. g1 Y, W0 I

  77. 4 s% q/ j; X3 \+ R) h  Q) C' @
  78. static int acnt = 512;- S$ ~8 Z3 }4 b; Q/ C+ @
  79. static int bcnt = 8;
      x: B: U( j3 p* K# P
  80. static int ccnt = 8;
    % u' j; i! j2 `7 P' N

  81. 8 W- Q' V9 j/ j, o, V3 L6 J( k! G
  82. module_param(acnt, int, S_IRUGO);8 b4 ?0 E! L" S- T8 d) \+ u
  83. module_param(bcnt, int, S_IRUGO);4 T5 D% y0 k' o3 M3 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 j# O( l: V3 ?1 i7 X1 R2 R

! ^) ?: ?: f* z+ n4 P/ M9 g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" f, P9 x8 @6 b, [) farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, f4 s9 N2 q8 a/ m# Y5 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ S; K+ [; U/ Q) H* `; p
3 O) E4 a9 K$ X8 L% q
' C! Z# \9 m# V8 s% U; t4 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 09:44 , Processed in 0.051189 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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