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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 z4 p" I5 H: L  H" Y
  1. [code]EDMA sample test application, E' w3 V) B. {' ^( k) p, @5 n  Q
  2. /*5 v! @% m* \( ^6 z3 ?! n1 t  l2 x
  3. * edma_test.c5 Y' |1 N. j  V  Y/ d6 R  j1 \9 {
  4. *
    / A! j8 t5 z8 n9 E5 X+ R
  5. * brief  EDMA3 Test Application
    1 H/ c6 x6 Z1 I9 {3 K) U% y
  6. *
    ( X3 ^1 {5 A5 ]& Q+ @" v$ Z
  7. *   This file contains EDMA3 Test code.
      j: k6 R4 F& i/ H4 w
  8. *
    5 @" v& x8 i! W2 ~* {7 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ ]1 J9 u8 W1 z' V3 s5 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 c1 \( \; w$ F2 p& m% {! X3 e
  11. *         TO CHANGE.( ]* c) r, D( v
  12. *  v0 n& m/ Y$ k4 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- e/ M3 t' V3 t* }* b9 u
  14. *
    : m: h/ E9 C& r5 [* P
  15. * This program is free software; you can redistribute it and/or' r' Q& }8 [, e# X5 ]
  16. * modify it under the terms of the GNU General Public License as5 T1 @5 R4 j8 N6 W1 g
  17. * published by the Free Software Foundation version 2.
    ) Q; T. a4 D; X% ]
  18. *
    0 u' q( w( k  d$ ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 k8 e4 R* E' d9 C& @
  20. * kind, whether express or implied; without even the implied warranty
    $ Y2 W3 d! ^( b. }8 a9 U/ i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  e1 E9 a# ?9 s/ P/ U2 X; U# L5 v% K
  22. * GNU General Public License for more details.
    & k! g0 g8 O( g( |' f
  23. */# y8 @6 o. O  ]; [/ W, H6 _( D
  24. + e1 L* G8 ?% k8 D
  25. #include <linux/module.h>
    . A+ l# y  B) H" t1 l- F8 B
  26. #include <linux/init.h>
    ! S: y  p+ L8 s) j7 U
  27. #include <linux/errno.h>* Y) s4 f  U; q2 t: _2 s5 c
  28. #include <linux/types.h>
    . \4 f$ h6 Y# H  ~3 y3 @% x
  29. #include <linux/interrupt.h>
    ! d! e+ q2 G+ r# w  T- c
  30. #include <asm/io.h>
    , Z  S8 s* I4 E' @5 }. u
  31. #include <linux/moduleparam.h>5 r4 M* M5 A; z# h$ ^6 T5 f
  32. #include <linux/sysctl.h>
    2 d# q! U7 H4 Y8 M
  33. #include <linux/mm.h>
    # d/ s! i  X: I% a+ i
  34. #include <linux/dma-mapping.h>
    3 I+ t  }# F" |$ x5 G

  35. * m% [7 h* e& u9 G6 `' j  O; ~! Z
  36. #include <mach/memory.h>
    5 E! s, ?" s/ D4 \
  37. #include <mach/hardware.h>
    / \0 k( `( d: E" p: _4 d
  38. #include <mach/irqs.h>
    , c- v# W& z# o) T4 G
  39. #include <asm/hardware/edma.h>
    ( ~( A1 p+ w; Q5 k! ]0 L
  40. * r# u8 o: m" w- S0 G
  41. #undef EDMA3_DEBUG2 X9 F7 h9 ]6 U" D
  42. /*#define EDMA3_DEBUG*/
    0 u6 V: e4 A. V+ m; L$ h# [

  43. ! _' Y3 r3 c$ E: q0 F
  44. #ifdef EDMA3_DEBUG% |& O! }- C+ N3 f, E) h$ ^  w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& R: e" A( _3 Y2 W% r  P' {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) _2 \. s, g3 W6 ^" z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' _7 M% Y+ }) l+ a' y
  48. #else% M- k. ?. r. v7 D# K
  49. #define DMA_PRINTK( x... )! s. u5 ~' j# R. w; e4 }, O
  50. #define DMA_FN_IN
      u3 l; ?5 m" r0 N# e- ~2 p/ m% k
  51. #define DMA_FN_OUT: @  c! i4 z8 [' Y
  52. #endif
      P0 K4 H+ k  k& p" b
  53. 9 e2 y5 a1 J- f2 U; S. M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! n7 i4 u' H$ Z/ m( i
  55. #define STATIC_SHIFT                3
    6 Y' {1 R7 ^; n' a+ V8 T8 s
  56. #define TCINTEN_SHIFT               205 O; ?$ ~5 N7 Z: J+ z' w
  57. #define ITCINTEN_SHIFT              21
    ; T5 J& I6 ?, c. Y& Q% J% S
  58. #define TCCHEN_SHIFT                22
      q: U8 x6 ^+ r
  59. #define ITCCHEN_SHIFT               23; p2 z$ _2 C" N8 _8 ~$ ^/ x6 [
  60. , M4 R* e1 I1 `% {( L
  61. static volatile int irqraised1 = 0;) a( [  H( o& K+ o
  62. static volatile int irqraised2 = 0;3 X7 P. k2 M" d& [8 b

  63. 7 C1 `  ?2 V: [+ t* C/ Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) }+ A& o, c' F: l. N# d% I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: q! w; x1 H$ Z. ~' c8 h7 P  I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l9 m, D6 [8 J' N2 U2 f: C

  67. / e' ~( @4 ]& G# o. i8 x1 N# U
  68. dma_addr_t dmaphyssrc1 = 0;
    5 H. F& \3 W% t2 R* `* @
  69. dma_addr_t dmaphyssrc2 = 0;
    4 l. H( U6 X7 _$ b% l" h1 O
  70. dma_addr_t dmaphysdest1 = 0;
    # E  h5 ~- A6 f) G+ o
  71. dma_addr_t dmaphysdest2 = 0;
    # x0 `* A8 ?* f6 }7 z  |$ v

  72. # g( G+ a. i& ?$ S
  73. char *dmabufsrc1 = NULL;
    3 ~. [+ k$ h* Y
  74. char *dmabufsrc2 = NULL;
    - f2 v% M. ]6 \! o$ j
  75. char *dmabufdest1 = NULL;
    ) J( X# `. x# v. S! o
  76. char *dmabufdest2 = NULL;
    & N& W7 q" H/ C9 t+ S  x% C6 ]1 h

  77.   u" m8 G: u% c
  78. static int acnt = 512;
    2 ?3 Q% R) v7 m# C$ N1 Y; F
  79. static int bcnt = 8;
    ) n- N( U* A( R3 M7 c
  80. static int ccnt = 8;
    4 E  ^# N) `' b$ l# t2 y

  81. * j1 r3 O" G/ L1 A
  82. module_param(acnt, int, S_IRUGO);
    , h3 F7 ?, D% H" [, b8 A5 T1 {
  83. module_param(bcnt, int, S_IRUGO);1 |# }2 Y  E! u/ S* ~0 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 h. R9 c% `" F9 p
  D0 Z8 n8 d8 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 g* m  Q2 Y$ V7 \7 `3 T; N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: C! o5 s: l  P- h* ~) E# J" M8 ^8 k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 x( ]+ |6 f0 v' d9 R/ N( ]
# l7 A6 [- }7 a3 S3 C5 s) |0 Q
: Q* p' x& f% J* [9 h& D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-11 21:15 , Processed in 0.038597 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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