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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: Q+ c! P. Y# ?
  1. [code]EDMA sample test application& ?7 T7 p( X# N% z: y% K
  2. /*' e. ?! t3 h) ?+ @* z2 Z) B
  3. * edma_test.c
    : K9 W3 W* {% k. n
  4. *8 Z) U+ G; E/ E4 S+ k0 p
  5. * brief  EDMA3 Test Application7 z% \0 A1 y" {7 [! a* Z$ ^
  6. *
    5 k; p) m- S, u) q: G
  7. *   This file contains EDMA3 Test code.
    ! v% |$ u! n4 h! ]" F
  8. *
    1 F- x, f9 M% N4 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 J4 S" U! R$ r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# E7 D) f  i  F# j! w
  11. *         TO CHANGE./ o' g& ~# U  [6 N1 [' C3 M7 i  C: G
  12. *
    ! m8 a7 ^$ U0 Y% ]0 _$ }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 W! X( E* n& ~; h6 J7 I
  14. *9 j  B- n! o6 b! F: C5 ]. W( G
  15. * This program is free software; you can redistribute it and/or$ F1 t+ F/ _7 M. d
  16. * modify it under the terms of the GNU General Public License as, y3 J4 h( Q2 d. h
  17. * published by the Free Software Foundation version 2.. A9 i2 l* o7 M
  18. *, e4 ^7 M! V  P% b+ ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# C# u* c0 A+ w+ o
  20. * kind, whether express or implied; without even the implied warranty& v" L' G8 `+ H" @% @' Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 V( H  v; D5 y2 i5 Z: Z
  22. * GNU General Public License for more details.
    ; ?# g- W8 z0 [: Y1 X
  23. */
    3 R: E3 @8 K& ~* U( M0 W
  24. ( p! M- T+ S: K2 U; }
  25. #include <linux/module.h>
    - Z1 p9 k! p# w! m- D( r+ _
  26. #include <linux/init.h>
    # y) e& Q- z$ B/ b
  27. #include <linux/errno.h># Y  v, w4 H6 e" o6 q
  28. #include <linux/types.h>
    " Z5 B2 L1 }/ q4 U2 B  |
  29. #include <linux/interrupt.h>
    ' V7 X/ g- \2 O. H* ~0 d4 i6 T- C
  30. #include <asm/io.h>
    . B- R4 ]. ]* Z% v! G+ v+ e
  31. #include <linux/moduleparam.h>
    ; V) M" y) z& g' C+ t
  32. #include <linux/sysctl.h>7 Z+ g+ s# d. D& ^6 j7 T
  33. #include <linux/mm.h>
    # {3 }# S' I& T6 N* R/ ]  \& }: f
  34. #include <linux/dma-mapping.h>
    7 a  H: q6 F8 ?- w
  35. 1 Q! L* r/ h5 K3 t2 {9 G& `5 C
  36. #include <mach/memory.h>2 f4 R- c3 F" N
  37. #include <mach/hardware.h>  J8 f& Q: x, P! a. F) h5 S
  38. #include <mach/irqs.h>/ F4 L6 u1 o( J% O$ _
  39. #include <asm/hardware/edma.h>* U" ~" _) @, P. g4 E/ J) O& @+ g
  40. 3 W3 U- O9 h. I& k" W1 ~
  41. #undef EDMA3_DEBUG9 {8 E! U2 {3 E% f3 `- {1 X8 T+ b
  42. /*#define EDMA3_DEBUG*/! {& G: p% O8 h3 y
  43. , J% y1 K( Y1 J# U" u5 P4 V/ w2 E, W
  44. #ifdef EDMA3_DEBUG, D$ Y/ G9 a: w7 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* [0 T& c1 o3 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); q8 s) b; |! B1 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 I0 [4 z$ i- G# H2 i
  48. #else
    : Z6 \2 x5 \/ U: B; D% R3 Q. k
  49. #define DMA_PRINTK( x... )
    . h1 j- {% S' g
  50. #define DMA_FN_IN
    / l+ `8 G# H3 T$ J
  51. #define DMA_FN_OUT
      Q; k  s4 F0 G* L' h
  52. #endif
    / N% J4 P, A% `9 w0 I. [
  53. # W4 I! e/ e7 Q* e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 o- [" R! }$ U& M  ~3 _; c- J& k- S- ~
  55. #define STATIC_SHIFT                32 v; h4 i% o1 \( w/ B7 o9 q) u
  56. #define TCINTEN_SHIFT               20
    & Z* M0 l: K  m( x7 a) q
  57. #define ITCINTEN_SHIFT              21
    5 K2 G8 }; v$ ~* H- N3 o0 e
  58. #define TCCHEN_SHIFT                228 Q9 F' |5 V, {- P4 ^. u3 w/ n
  59. #define ITCCHEN_SHIFT               23
    . m# Q, G  E$ l, M
  60. % s# x" A" u! D( |) a6 V
  61. static volatile int irqraised1 = 0;
    - F6 L4 Y+ q3 r4 s. |5 I
  62. static volatile int irqraised2 = 0;
    % E" m2 [. b( D$ Z! D# Z

  63. - p! ^5 C* f9 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; N4 N/ j) {$ [1 F* _1 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 C2 |# X: o2 O- r$ J/ G+ t7 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* U  Q" J2 \) n6 g: Q1 {. u2 }

  67. # b2 a) m' `% N" k
  68. dma_addr_t dmaphyssrc1 = 0;! D4 P+ P! J8 x$ w
  69. dma_addr_t dmaphyssrc2 = 0;
    - N; ^* F. _) P' Q
  70. dma_addr_t dmaphysdest1 = 0;* a/ j; n% L" l6 u5 R) y. t
  71. dma_addr_t dmaphysdest2 = 0;
    1 |, D: T2 H/ F0 r
  72. ; s1 z  A0 z8 _- p3 B0 z; T! _. Z+ `+ q
  73. char *dmabufsrc1 = NULL;
    & l7 f9 ~" A5 Q& n$ I
  74. char *dmabufsrc2 = NULL;
    0 V  U$ K; e, u* p
  75. char *dmabufdest1 = NULL;) x6 E; I5 L: ]: Y$ }+ Y
  76. char *dmabufdest2 = NULL;/ Q2 b" K% F6 t1 w2 r
  77.   J- T& h! _+ K0 r/ ]$ O
  78. static int acnt = 512;
    - N: _# E; k$ ^
  79. static int bcnt = 8;, f) J. K6 r! P2 m% x
  80. static int ccnt = 8;+ P/ b% m; M2 x/ U  M8 \# ~. H

  81. 2 P0 a6 e0 G+ F9 v9 u/ x+ T7 R
  82. module_param(acnt, int, S_IRUGO);
    1 @; w: I7 O9 V, y* ?4 _9 P
  83. module_param(bcnt, int, S_IRUGO);
    ; @6 D% Q$ T( ^/ R! ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( t" P$ P# X( M0 R( ^9 @! ]0 I& \, }' R% {$ w) a) X9 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* p2 [! @9 @7 n/ [% e. Q  barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" h! X3 H. X4 U9 ]! l1 G+ _9 ^; O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. [: k4 u) [+ |, a* P# j# K6 H$ U. ^8 |  {

* t5 q- Y/ `, L9 `! @, ~8 [- Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-21 12:32 , Processed in 0.043343 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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