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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 n% b* d6 {" b1 Y; C8 k. C
  1. [code]EDMA sample test application
    % [  s! N1 G9 O, L* ?% Z9 O! j# W( p
  2. /*
    - V  T3 }+ k: W- D& l
  3. * edma_test.c) q% U4 Q5 n5 w% S; }; Z; ], b
  4. *
    ' {. h( I6 ~+ _
  5. * brief  EDMA3 Test Application1 g+ v) H  C# }2 v- a9 n( I
  6. *7 N0 d6 Y, `4 N& \& V/ q4 m
  7. *   This file contains EDMA3 Test code.1 U5 u$ Y% Y) Q/ r2 L* m
  8. *) z; Q9 Q+ [/ A0 H3 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 C* q3 |3 h. b, L/ R& L: s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; t% f: {- u' T" a
  11. *         TO CHANGE.: ^  B1 e* i, e8 V5 L0 C1 t3 S6 U
  12. *+ |- P5 {( m, ^. @. K' g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! U% I! W2 S3 d  F2 L8 }3 i
  14. *+ m) K/ G3 c/ }: {, z, d" U7 F
  15. * This program is free software; you can redistribute it and/or
    + |" i9 J% J7 I, w6 b
  16. * modify it under the terms of the GNU General Public License as. ~0 l( x& C& \  k( N8 l! ?$ C% y
  17. * published by the Free Software Foundation version 2.1 ]0 Y: O+ K' o- B' \1 B
  18. *
    ; L, v+ o8 O3 x4 e. a& ?7 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 n! J& D; |3 y
  20. * kind, whether express or implied; without even the implied warranty
    9 l7 H: F* c. `# y  F, Z6 P8 y. D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: Z8 l- j+ M) o- g
  22. * GNU General Public License for more details.
      `- s7 B  _- ?/ o1 u5 y
  23. */
    # Y; d1 S+ G3 G) |# t
  24. 1 @0 L; ]  o1 g7 l8 c+ s
  25. #include <linux/module.h># f; V8 g. `1 D# L0 d
  26. #include <linux/init.h>9 T! Q$ t; \1 n% D+ g5 W
  27. #include <linux/errno.h>, L, N2 ~! O  l2 z/ E/ ], Y
  28. #include <linux/types.h>
    ) d$ R$ I% S. ~! u
  29. #include <linux/interrupt.h>
    3 l4 Q$ y" a: R% h
  30. #include <asm/io.h>5 k3 `! H, C- U+ h  ^$ D+ [+ D
  31. #include <linux/moduleparam.h>
    8 e9 G& l& n/ f4 L0 L# {8 ^; }
  32. #include <linux/sysctl.h>
    * }4 I7 z% L! _- X' R8 T- Y& c' b
  33. #include <linux/mm.h>
    ; E6 o4 C' b+ z# Q1 ~* o1 V5 v
  34. #include <linux/dma-mapping.h>
    7 u! X. L# ~9 Y: S% A

  35. 7 L  d, V* m) ]
  36. #include <mach/memory.h>
    , g$ k* L( ]" @+ p0 H/ o
  37. #include <mach/hardware.h>
    7 H+ V! t9 |, X( Z- ^) @3 |
  38. #include <mach/irqs.h>
    ! k# D2 k8 }8 q
  39. #include <asm/hardware/edma.h>& F! z+ b- N# j( k$ l  ?' i

  40. $ u/ O! k5 F; P# O+ Z( ?$ x" r
  41. #undef EDMA3_DEBUG% R6 F- V* y$ \, |, N3 x
  42. /*#define EDMA3_DEBUG*/
    5 L7 R- i* O/ @2 T2 H! B8 s+ Y

  43. # s8 c# ^3 F3 g$ q7 w: h8 S6 i
  44. #ifdef EDMA3_DEBUG
    4 [0 t- d( ?2 F! Z7 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  _- L. }5 x9 t4 @, p& R: C/ ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), A: u& o. Z4 Z0 R$ Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! V* T; A  h' B
  48. #else
      G/ @" P+ o4 `4 L- W
  49. #define DMA_PRINTK( x... )
    9 U: M* X% d. J7 F4 u% Q
  50. #define DMA_FN_IN
    + ~6 t2 \% K* W) i
  51. #define DMA_FN_OUT7 y: {  {" v8 Z$ [
  52. #endif- V5 N  F8 a( V) z. |
  53. , \# [9 I3 W) F8 i8 ?  k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 G+ W7 K# U$ T0 }, o
  55. #define STATIC_SHIFT                3
    7 ]! j% K) z5 p# l4 T/ g
  56. #define TCINTEN_SHIFT               20
    , N# R/ t( s0 l3 I3 M( _
  57. #define ITCINTEN_SHIFT              21
    4 G9 H2 I& t+ A) a- h* {0 M
  58. #define TCCHEN_SHIFT                22* `* f$ O. `* Y+ _( D$ G! |
  59. #define ITCCHEN_SHIFT               23; g3 B4 j/ x; b! G. V
  60. # O4 f" P4 V+ U: ~8 k( V" M
  61. static volatile int irqraised1 = 0;# }4 j% I- J/ x+ E8 h
  62. static volatile int irqraised2 = 0;
    3 S! s2 H9 o% ]3 u# w0 k, B1 L

  63. * x, R: I, b8 ?$ V& m9 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- h+ m, V( c( z$ o, d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 r& u: [& |2 C, Q0 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" x% T: Z% u1 n3 F/ _
  67. 2 ^6 F( z- e/ n+ S2 V* V6 d
  68. dma_addr_t dmaphyssrc1 = 0;' S0 e' w& G3 \5 V0 @4 g
  69. dma_addr_t dmaphyssrc2 = 0;
      m% L$ F% M( {3 g7 V& J8 v
  70. dma_addr_t dmaphysdest1 = 0;
    8 }* c- c" y2 g1 b7 t, ?
  71. dma_addr_t dmaphysdest2 = 0;
    / B  I: o' @+ X

  72. ! t+ [0 F- ~* t) |9 a7 z
  73. char *dmabufsrc1 = NULL;
    , @! Q* M9 _/ m9 m
  74. char *dmabufsrc2 = NULL;: E4 ?% t. \# Z# Z
  75. char *dmabufdest1 = NULL;" |/ G+ k, j8 I( l' w  s1 e: M: A
  76. char *dmabufdest2 = NULL;5 R/ P8 V3 }: b5 G+ v6 W4 T
  77. % D8 s: K+ l4 C& W% \. W
  78. static int acnt = 512;, m7 |1 j0 U. @1 g
  79. static int bcnt = 8;- r2 F+ z3 a3 V7 S' r; w
  80. static int ccnt = 8;6 g0 J8 l7 |% [% v

  81. / |, W" s( [7 h  B: F- O& N
  82. module_param(acnt, int, S_IRUGO);$ F! |0 v; H6 _7 o
  83. module_param(bcnt, int, S_IRUGO);
    4 f) t2 I5 J( _* k& y8 h, p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- S. s' d: u+ e, Q* j8 }& L( {' h+ g7 K' F6 o+ [( G: s8 l' f, V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 _. O  x3 z' H  @7 H7 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. J: [4 X# F# Y4 }. d9 q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& R& }3 b5 Y6 W' G* W, X  M% o

. m8 j2 V$ X, ~. B# I- d1 o* I2 M/ W) W% Y1 H; w; Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 05:29 , Processed in 0.037072 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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