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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, \& v0 C. j- K+ G/ p3 ~3 j
  1. [code]EDMA sample test application9 J8 t$ V4 x# z% g
  2. /*# X7 x' W/ G5 U- B* [
  3. * edma_test.c
    6 w; @3 h) P8 o& n" ?
  4. *
    5 M& a( u& x" t5 I0 r( Y
  5. * brief  EDMA3 Test Application
    3 s2 k# v5 s1 i
  6. *; @+ g# j  i) Q. L
  7. *   This file contains EDMA3 Test code.5 U% j' A( d1 z* k/ T7 w2 W5 k
  8. *3 _* _3 R2 k8 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" K3 w. Y3 N; M' J! Z9 W. L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 F! W+ Z6 g8 Q+ A6 |) ^/ Y& j: v
  11. *         TO CHANGE.
    0 b5 Y- j5 D! a% a- M
  12. *( x9 k. [' s5 p# J6 n, v4 c; M9 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! B0 N: \1 Y. j/ M1 n: G: \
  14. *  d$ Q- r* d/ F2 h+ c$ H( ^
  15. * This program is free software; you can redistribute it and/or- z5 H4 |. Z7 e9 O, j; H1 p& j! {
  16. * modify it under the terms of the GNU General Public License as  Z& V6 w4 ~; }9 b
  17. * published by the Free Software Foundation version 2.
    . g' {) I* H. V/ R
  18. *
    7 A3 _; T6 \; s) i2 z7 I2 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 a- B! m/ X- I3 `) v
  20. * kind, whether express or implied; without even the implied warranty1 t, |- J, K' A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; O/ n% j. Y" S) X
  22. * GNU General Public License for more details., {* c& N+ ~4 c0 d5 I# r1 U
  23. */
    ! H' l/ v$ J# Y" `% j1 `2 y

  24. 7 g7 Y. C; l, B8 d4 Q% F- a/ H0 f
  25. #include <linux/module.h>
    ) I$ ^  e) G$ U9 G$ w. l0 K
  26. #include <linux/init.h>
    # P8 {. l6 S' T" T9 ]
  27. #include <linux/errno.h>- p3 B* z; _) h% w2 @+ B
  28. #include <linux/types.h>. v& `6 D. f* l' ]: K- H0 p" m9 Z
  29. #include <linux/interrupt.h>) [4 g/ v$ @) k& l1 g( f
  30. #include <asm/io.h>' h7 ~) v( ~4 \
  31. #include <linux/moduleparam.h>
    : ?: L2 Y! L3 ^5 @1 |( P3 ?# P
  32. #include <linux/sysctl.h>
    , x; g+ G& E- D
  33. #include <linux/mm.h>1 U/ `4 {) K0 i: s6 L! f$ C* {+ f
  34. #include <linux/dma-mapping.h>1 W) k8 t% {) Y6 i
  35. 8 _# @$ |7 {+ J% A0 S! N
  36. #include <mach/memory.h>6 ~7 d8 R4 E# t
  37. #include <mach/hardware.h>5 T! I8 f  g) e) _' X2 q
  38. #include <mach/irqs.h>5 f' d6 H  B' _) H2 F3 ~
  39. #include <asm/hardware/edma.h>
      \9 \0 L4 G  d  Q- p2 b
  40. - g, n+ y: ^8 b4 C/ S7 e8 O6 S
  41. #undef EDMA3_DEBUG6 m0 B' s2 a9 ~: I
  42. /*#define EDMA3_DEBUG*/
    ; j: |- t  x) w& F3 l

  43. ! w: `5 K1 x$ ^) `+ X2 J
  44. #ifdef EDMA3_DEBUG4 a2 i3 I+ G9 y  L: V& H% d( a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ T% u$ _& e5 y' r' B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , r  _4 U* ?8 R+ V, V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 ^" U+ p, \' |: y: B
  48. #else
    / \% a+ s3 ]" P7 ^# g
  49. #define DMA_PRINTK( x... )% s  D( F5 d3 }( O- X
  50. #define DMA_FN_IN
    3 \5 j9 r  ]- m8 I8 Q
  51. #define DMA_FN_OUT$ {4 R! {0 r0 l  B( y
  52. #endif
    2 C  q2 E. p3 U5 O
  53. # D6 [9 u# `& L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " o+ A3 K0 z, t0 i7 l- r
  55. #define STATIC_SHIFT                3
    / t# {$ @* I. C
  56. #define TCINTEN_SHIFT               20
    : T5 A+ W( T* g, J0 t9 l
  57. #define ITCINTEN_SHIFT              21- V1 n& t3 N6 G% D. N, s
  58. #define TCCHEN_SHIFT                22- u8 n  }0 b" L
  59. #define ITCCHEN_SHIFT               23
    : z3 o1 [* f- r' g* X  u

  60. 0 j: {4 n$ I+ u, ?% d  t
  61. static volatile int irqraised1 = 0;
    / z- ^$ ^8 O3 A. X' m5 `% v2 y
  62. static volatile int irqraised2 = 0;- H! H! @  V. p) }9 y

  63. $ ]9 e9 v& A. b. B5 Q0 d3 g1 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 p* c) D% c  N% g4 n/ H! C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ?4 k, M2 z( U- H" T* t! U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) p* p/ [8 g  a& R1 |- A# {
  67. - m4 |% f. r& C( |" \
  68. dma_addr_t dmaphyssrc1 = 0;" V  c% D; s& z  q! s5 d
  69. dma_addr_t dmaphyssrc2 = 0;' _" L. C% U6 E, J( p* O1 x
  70. dma_addr_t dmaphysdest1 = 0;3 I7 `1 J% W8 ~' g
  71. dma_addr_t dmaphysdest2 = 0;# J# z( [1 L. k7 m
  72. % F) h* o# O$ R: @' g
  73. char *dmabufsrc1 = NULL;
    $ F, Y7 b6 I9 \9 u+ c
  74. char *dmabufsrc2 = NULL;' `) ^3 m7 ?: r) ~
  75. char *dmabufdest1 = NULL;
    ' H" o/ h( }% D8 @/ Q/ E
  76. char *dmabufdest2 = NULL;# N5 X8 z4 `6 R! O8 U2 N; `
  77. 6 g. w9 e4 Y+ J2 y$ X  t: R
  78. static int acnt = 512;
    7 L" }% L% r; p
  79. static int bcnt = 8;
    * V/ x2 j1 A8 ]2 u
  80. static int ccnt = 8;, U. ?. Z$ T" w! t9 Y8 M+ O1 E
  81. 6 j( D/ ~' }: h. {% P
  82. module_param(acnt, int, S_IRUGO);6 ^3 D5 Z) I- T$ ?
  83. module_param(bcnt, int, S_IRUGO);
    - M! p' L/ t/ V+ E& v; ?! t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* D$ x" H* z& z1 |) k  u/ H  L2 C
; e1 q- W3 R, i/ g3 b8 _/ r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. @7 {5 T" U2 @1 a, rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 R: a& U# A, ^% h) ~* f: s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) p5 X3 V& U$ L9 X* ?
6 R$ E- @+ f; D  @7 i

# U9 C6 q# s) m5 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 14:51 , Processed in 0.038528 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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