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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 z- C9 W! P9 o% J# t4 j
  1. [code]EDMA sample test application
    % s( N2 T; e8 C$ L3 O, C* H( O
  2. /*  q& T" F; t1 J) g- W0 |
  3. * edma_test.c( n, g$ F, y4 v$ J( L6 d8 o: r/ r
  4. ** g/ z, p+ J  i- f( J1 p- g
  5. * brief  EDMA3 Test Application
    + s6 a' Q" V: w+ l8 F( m# q5 h; t7 v
  6. *- u' b9 W, ?8 ?
  7. *   This file contains EDMA3 Test code.. o& O3 h/ q3 a$ `/ j
  8. *! C2 f$ I3 s" W/ j. Q& P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 \0 @% }" A9 G1 P7 @3 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* z  {6 l/ K& ^
  11. *         TO CHANGE.
    . c5 c% v2 U9 ]/ A' C0 T- C5 }
  12. *+ p5 {- U, Q5 J/ J+ N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * {0 E7 s+ y3 k) R
  14. *
    6 D' I1 {4 y8 b' F
  15. * This program is free software; you can redistribute it and/or/ a" e" L; w5 ^" \
  16. * modify it under the terms of the GNU General Public License as
    $ ^- @" w$ B& {; M7 w
  17. * published by the Free Software Foundation version 2.
    8 p4 C4 w6 Y% y3 ^( b' B! K  x
  18. *) [9 }2 o/ n2 T; j/ G9 z( l& ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 V6 p; F  ]/ N; Y
  20. * kind, whether express or implied; without even the implied warranty
    7 f. ?+ l; _$ s& @) v2 L5 `7 v- `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( j. Y! Y# q) Z
  22. * GNU General Public License for more details.
    0 c7 j& @4 k( H* o0 y
  23. */
    . ]" A# v& i" R" l
  24. ' ?4 y' Y0 R5 \0 \9 R* @
  25. #include <linux/module.h>
    . D: ?' |8 `( l1 B+ H
  26. #include <linux/init.h>
    ' e8 M/ \/ y# [& o9 X5 b$ i
  27. #include <linux/errno.h>, k1 F4 D  j' e# A9 V
  28. #include <linux/types.h>: X/ Y% B* T7 h5 F$ @3 w
  29. #include <linux/interrupt.h>
    ! ?& ]0 t+ Q8 O6 k6 b: W
  30. #include <asm/io.h>
      n0 _: T* w3 N0 [  f
  31. #include <linux/moduleparam.h>1 \6 Y& M5 n7 W, I) V
  32. #include <linux/sysctl.h>0 @2 Q1 _( Y/ X& g
  33. #include <linux/mm.h>, P: I8 O+ o9 m' {* H. S4 m  a9 g4 g
  34. #include <linux/dma-mapping.h>" l. _' P: u! T3 b

  35. 0 L9 s* F4 P$ U) c. {$ Q& v, }
  36. #include <mach/memory.h>( u5 L1 f$ H- L1 u# [- n/ ^; k
  37. #include <mach/hardware.h>
    - V8 J$ M* V/ R" K
  38. #include <mach/irqs.h>) z; Q/ g4 b  x* U; R
  39. #include <asm/hardware/edma.h>7 g# B3 l% N/ q+ Q$ q
  40. 3 U2 I& |) N2 F& F2 L; H9 h
  41. #undef EDMA3_DEBUG
    2 {/ M* y1 y% F
  42. /*#define EDMA3_DEBUG*/; L& `; y# M( C! u

  43. ! r& t" D# N; P/ j5 N6 |
  44. #ifdef EDMA3_DEBUG/ K3 g$ N, p+ j4 S. y, b, t) v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 d3 ~# X0 {8 j  W6 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- ]& V2 ~  \4 h2 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" T9 Y* w! ^% H4 [
  48. #else
    2 C2 M, k7 x; P1 i: v# P  H
  49. #define DMA_PRINTK( x... )
    ! B+ o# Z1 P4 h7 H$ B+ M
  50. #define DMA_FN_IN
    + M& z0 y2 U9 Q6 T' G* w9 [$ _
  51. #define DMA_FN_OUT
    1 N! J$ ?/ t: N& B. U/ T
  52. #endif1 L% R1 w# e3 [* S

  53.   d' ?3 |4 s: i9 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" g. p8 w/ m  n# k
  55. #define STATIC_SHIFT                3
    $ ]- B  J6 E0 `3 P
  56. #define TCINTEN_SHIFT               20' Q" ]- a* T1 y, N4 ^9 u" ]
  57. #define ITCINTEN_SHIFT              21: i$ n+ n2 U6 v1 m6 M% s
  58. #define TCCHEN_SHIFT                222 A  D' P- w9 J7 {( ?, X
  59. #define ITCCHEN_SHIFT               23+ Z' X) u  X* O
  60. 6 B+ [# {2 a2 Q  C  p# Q. a% ]) i# ?
  61. static volatile int irqraised1 = 0;
    7 b2 k5 W5 p- B
  62. static volatile int irqraised2 = 0;5 K" m/ r+ ^( h

  63. 6 M7 ]5 @6 u" M4 Q7 u3 N; E. C) a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * U6 q# U  N, b! n" r' g, \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 N1 M$ m2 u% _2 C& k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& S- ~. H$ U: O) m6 C, a4 N& d

  67. ; y: a) Q3 W3 s2 H' K7 y1 ~: O7 ?- D
  68. dma_addr_t dmaphyssrc1 = 0;' N8 l  ^& T5 R4 F. ?
  69. dma_addr_t dmaphyssrc2 = 0;6 {" E5 b9 }# @7 I- Y; U% E9 Z
  70. dma_addr_t dmaphysdest1 = 0;
    # d4 R' |1 |% W8 [1 ^9 T
  71. dma_addr_t dmaphysdest2 = 0;
    $ E: x0 K; i) y0 l
  72. " P: D% F8 I/ v  v0 t
  73. char *dmabufsrc1 = NULL;4 h/ o9 v( q7 t$ c& ^
  74. char *dmabufsrc2 = NULL;
    6 B) k, V4 @# V/ x3 [
  75. char *dmabufdest1 = NULL;
    ' Z  l: L) o: S  K  l  P, i
  76. char *dmabufdest2 = NULL;: e# F0 g8 v1 F4 i2 @) \3 e

  77. # {' _: ]& H! X! A& i
  78. static int acnt = 512;
    $ \/ m* r) {( E! D3 w& Y
  79. static int bcnt = 8;  b% D) N- a% W: X, N9 _6 N# ]( q/ p6 a
  80. static int ccnt = 8;
    * B( D* i. z8 C1 Y( |) u
  81. $ Z* l4 P- v% W; p8 v
  82. module_param(acnt, int, S_IRUGO);: I, f  H7 i3 j$ _, ]
  83. module_param(bcnt, int, S_IRUGO);# Z  ~1 f+ `! r! @/ v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. a! }) c' e& G& W! s# a' P
' L* w- l( F* z6 G+ t& |( K3 j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 D5 k7 j$ e+ I* R" B: karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( i3 l0 j) s7 ]0 m/ V$ A7 ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" [" U9 V9 O/ d) q! R/ n( K, B
/ y( O) q  e5 O1 B! Q0 s1 L% k" ~7 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 06:06 , Processed in 0.039865 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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