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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% M0 `! b( y4 D6 J
  1. [code]EDMA sample test application
    $ m( w0 g' {, J* v2 _- z
  2. /*8 x' C( v0 E: ~1 s5 N7 D( r
  3. * edma_test.c
    ' p  \% M0 p0 C2 k5 |& U2 [/ Z
  4. *
    ! |9 d! ]* t" Q
  5. * brief  EDMA3 Test Application
    & q, ?4 \8 C. q& W4 e; P% Q
  6. *
    * U6 }& J. i8 N  O6 e
  7. *   This file contains EDMA3 Test code.
    % V2 l! s/ c+ m) A- f4 f
  8. *! ?$ z5 z" Z7 |2 {1 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 |2 \' K/ s2 g7 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 E7 R5 P/ G/ @( L  I/ j/ ?# Y
  11. *         TO CHANGE.
    ' @4 H. y: ~( h+ C
  12. *" a3 ?% e+ ^" q. A0 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( e! @6 Z' \. h5 E" r
  14. *
    6 G( t" r5 G; d* X2 b5 T* u3 s
  15. * This program is free software; you can redistribute it and/or! u, i) |7 J2 }! h
  16. * modify it under the terms of the GNU General Public License as& `  W8 t2 S2 {; i( }, A
  17. * published by the Free Software Foundation version 2.
    8 R* D& m% Q( S' c% K. M
  18. *# n! R6 G% j8 }$ C6 I2 c- M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# Z7 f1 z$ D6 a# P, T. _, M1 W
  20. * kind, whether express or implied; without even the implied warranty
    4 c+ y9 F# z3 _/ u. Y7 r" @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 L+ b/ [7 z& t* Q! S2 Y
  22. * GNU General Public License for more details.
    - q; @( k. p" @
  23. */  }/ v  a, @+ s) ?
  24. , I% J+ w0 ?4 W, P. K, ?( E
  25. #include <linux/module.h>
    ( |' X% ~  K2 G: x. M# B
  26. #include <linux/init.h>
    8 Q+ n' n! r! P; i0 M
  27. #include <linux/errno.h>
    ' t4 y5 S. ~9 @8 @/ C: B
  28. #include <linux/types.h>
    ) j2 M3 h" V+ l
  29. #include <linux/interrupt.h>5 ]3 G! z1 K. p4 L. }
  30. #include <asm/io.h>! O' Z; ~( N4 H  w  @
  31. #include <linux/moduleparam.h>6 t, ?1 U! v9 n- y
  32. #include <linux/sysctl.h>( i  I3 J. X1 ]# O) [
  33. #include <linux/mm.h>
    # `$ J0 s: O. f/ x# @
  34. #include <linux/dma-mapping.h>% V1 M9 [1 o8 `2 N" Q) U2 ~

  35. 0 ]* N  \" k1 k  `! @7 {1 _' ~# k
  36. #include <mach/memory.h>
    3 L5 M- t/ C1 E. F' T5 U8 N
  37. #include <mach/hardware.h>
      x; K* P7 x1 V; u9 y
  38. #include <mach/irqs.h>
    ) Q4 N* I: G! p$ Y: |+ Q: {
  39. #include <asm/hardware/edma.h>1 M5 v! V# Q( I) Z- T$ C5 k9 G

  40. 0 p8 Y4 X" m7 o! r- H
  41. #undef EDMA3_DEBUG
    8 O! Y6 Z  \- W# m
  42. /*#define EDMA3_DEBUG*/
    6 m6 m7 W/ Y6 B+ G* t" h/ I0 V
  43. 6 X. W7 y7 h. o9 i7 j) w$ x) }
  44. #ifdef EDMA3_DEBUG
    " R0 @8 R9 y6 r  H% Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 D2 i, e# R$ L0 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( ~6 v8 E- w6 A4 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 l; c, |, O/ G: Z, z- F
  48. #else6 o4 L# u) u: ]* k
  49. #define DMA_PRINTK( x... )& D5 i" j6 [  b" Q
  50. #define DMA_FN_IN
    6 n) A2 }+ l$ ?1 I. q0 t" @) T% r
  51. #define DMA_FN_OUT8 s) j8 V6 [1 i9 q7 _5 g, k$ U! S5 J: s
  52. #endif
      \! c* v4 o% K

  53. $ p( i3 b6 O  I# }! j- D. u; m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 [5 T& i. m) N$ f6 S% c
  55. #define STATIC_SHIFT                3
    6 a4 P0 J) F2 c( g# O9 g
  56. #define TCINTEN_SHIFT               20
    $ @+ T4 e* u2 Y
  57. #define ITCINTEN_SHIFT              21
    - J8 R( [$ Q  @- E! ?  ~; C
  58. #define TCCHEN_SHIFT                22
    $ r; O" @: F! T6 k( |- N
  59. #define ITCCHEN_SHIFT               23
    ) {1 P+ Z; p. T1 S7 s
  60. + G' k5 T- v( |8 p! Z, H
  61. static volatile int irqraised1 = 0;
    . B- _3 x% D* Q8 Q* e
  62. static volatile int irqraised2 = 0;. c; j4 r; P" e+ Y( ^; l/ G. x, |6 m8 @' [

  63. $ {2 X# D" d+ V' r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , R. ]4 R5 W2 H6 P0 s, Z. Y5 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 h2 v9 i& O8 \/ |2 q  l. g. v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ g+ P$ b' ]7 x: F
  67. & c3 D1 u1 {' L' f
  68. dma_addr_t dmaphyssrc1 = 0;
    1 l* w' S; P6 i! R# |- i# U
  69. dma_addr_t dmaphyssrc2 = 0;! e8 \8 P( g0 C  a+ [6 R9 \6 O' s
  70. dma_addr_t dmaphysdest1 = 0;
    / T: [+ O' \1 A
  71. dma_addr_t dmaphysdest2 = 0;
    $ ?: W; _: G, U. r* H1 P, _
  72. $ y% @2 Z  P' ^) B" q
  73. char *dmabufsrc1 = NULL;
    - j3 U7 z9 K; [. ^5 s
  74. char *dmabufsrc2 = NULL;0 L& e" A+ u% f1 `* p# B
  75. char *dmabufdest1 = NULL;% B( t# Y$ C* P+ p
  76. char *dmabufdest2 = NULL;: W( @  c$ @  s2 a5 [# b
  77. $ o9 a9 B& Y9 q) L: M3 ]
  78. static int acnt = 512;4 J4 T; K5 |4 W
  79. static int bcnt = 8;7 G" c$ y3 [# j4 \' O
  80. static int ccnt = 8;
    4 v6 s& J, a* \( m) z

  81. 8 e5 i' r( r4 @9 g) T- r: L# [
  82. module_param(acnt, int, S_IRUGO);
    - V( J. k5 Y. z- ?5 J3 B$ C
  83. module_param(bcnt, int, S_IRUGO);
    . r$ l6 _7 `/ ?* ?  n1 y" B8 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  W5 e' V- Z3 L
' h( t& z3 {5 k0 ^5 ?' f% D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 f, Y: ^3 A8 p$ J2 \8 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, w0 a7 T( l5 u2 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( K* e& @9 G& x7 P# _2 Z4 q" U9 L5 ?" \. h! w/ _) w' ~% F

+ n3 A9 _2 |& r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 23:24 , Processed in 0.038242 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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