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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 v% j" o" y# u
  1. [code]EDMA sample test application
    - {8 ]7 R- o3 `) C- u7 n
  2. /*# P" s2 n7 E' @- ]5 c2 V- n
  3. * edma_test.c* ~2 a8 W, w3 ~+ P8 K# G3 k
  4. *4 s' H& h" _: k2 X1 c7 M
  5. * brief  EDMA3 Test Application
    ; j& Z: N2 T! Z9 `
  6. *3 G0 {* h* h) ^6 Z: u4 O
  7. *   This file contains EDMA3 Test code.' u8 S( ~! _5 O/ d3 s- k
  8. *
    7 b& A: k# l# ^5 s! b5 ~& _, h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 Z9 w3 B) w4 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 U0 f9 _7 i2 \% D9 [& H
  11. *         TO CHANGE.
    , M  l8 w& t7 M1 [, _+ h
  12. *
    - ?) t. c- t8 n' J9 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& x' y4 j' V& |" R( T  |
  14. *
    9 s  z2 {# ~% |' o4 _- L* R8 x
  15. * This program is free software; you can redistribute it and/or/ x. u% L) T  a$ T1 ~( E
  16. * modify it under the terms of the GNU General Public License as
    ' G' c  G* P: U; X1 r
  17. * published by the Free Software Foundation version 2.
    2 ^: l4 }0 u" `6 M
  18. *( W( v* m5 V/ k9 U* \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 v* ?( M+ ^4 A3 [, |
  20. * kind, whether express or implied; without even the implied warranty
    ( M5 D0 r7 U$ B0 R0 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. V% {5 T1 ~9 _% q. l1 n6 T
  22. * GNU General Public License for more details.
    + @7 L" J1 P2 T- N, Y  \  H) z: m# A5 r
  23. */* f; J* k+ @1 y% ^+ M9 i

  24. % N0 O% b; B& C; s' y4 o$ b# o5 q
  25. #include <linux/module.h>
    $ X; x: i# {: l+ ?, X$ m6 x
  26. #include <linux/init.h>- m) T2 n# x( Q" y9 U" i
  27. #include <linux/errno.h>8 b' Y+ Y) y) Q) J$ V: g* q2 {
  28. #include <linux/types.h>, f# z9 n" K, S3 H, X  _
  29. #include <linux/interrupt.h>
      T5 c4 U9 E. X, d: m( ~* O
  30. #include <asm/io.h>
    ; k# R- K4 ]0 c/ }; [* p, d3 N
  31. #include <linux/moduleparam.h>; o, n. A7 E' t) ?: j
  32. #include <linux/sysctl.h>' t* b( a5 e4 }
  33. #include <linux/mm.h>
    6 e2 k/ c* @: c* Y
  34. #include <linux/dma-mapping.h>7 P0 U& S: C- Y$ U& E! P6 s
  35. 8 ?$ e5 f  f+ `
  36. #include <mach/memory.h>
      O- b1 q( H' v4 w0 \2 D& p/ Z& f& J
  37. #include <mach/hardware.h>
    ) {  s& l, L8 T- O
  38. #include <mach/irqs.h>
    $ d8 Q4 E3 l% x
  39. #include <asm/hardware/edma.h>& p, w7 N' U# c! ~: u) {
  40. , T3 _  \( l. a
  41. #undef EDMA3_DEBUG% r) i. i, [/ A* c* G. h. ?. D
  42. /*#define EDMA3_DEBUG*/. H! F$ ~3 ?7 @% z' K. A7 W
  43. ' |) p0 |: _  ]' c3 @! Z4 T
  44. #ifdef EDMA3_DEBUG  X. j) t  l* p# j. y  u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* u& z  Z+ |+ O. j7 z" F; u# ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 M; R( ?: x: [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 e# J5 O5 s* |1 {* k4 s$ S3 c
  48. #else& U! Z: l' n' i/ s
  49. #define DMA_PRINTK( x... )2 Z8 x" g0 L8 ?2 y% C# v0 l. J1 U
  50. #define DMA_FN_IN
    - j) S4 U( K2 E) ^8 {: `( h' G
  51. #define DMA_FN_OUT
    ' G. G! x3 t# g3 v! [) i% }* n
  52. #endif6 L1 S* J% z8 d* |! `

  53. 0 D  T; x$ L7 w+ U6 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 b* R& \3 Q$ n
  55. #define STATIC_SHIFT                31 ?) s2 S* s+ |( ~  L: W5 j
  56. #define TCINTEN_SHIFT               20  X! A! _) C8 R
  57. #define ITCINTEN_SHIFT              21
    : i$ n6 i% g& a7 t8 B1 Y( c. W# g3 W0 t" E
  58. #define TCCHEN_SHIFT                22
    & H- b4 ]. ~* ~
  59. #define ITCCHEN_SHIFT               23$ M4 m- H* F; [( A7 W3 v

  60. # e+ c. N- F) N# b# o
  61. static volatile int irqraised1 = 0;$ h7 H+ B" a& [! y
  62. static volatile int irqraised2 = 0;
    " l: w# T6 {1 S( l& j) \

  63. 5 b) b8 V7 |" g! F3 N& C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 B/ s/ g: f' b6 Z! I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ~  v) {2 \! ~( A9 z8 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 e1 C8 @5 U/ t8 Y( a2 k
  67. 6 U8 z  r9 X9 P; l4 z& k; y
  68. dma_addr_t dmaphyssrc1 = 0;
      u% C( d4 ~" S. K- a/ O
  69. dma_addr_t dmaphyssrc2 = 0;, q$ X5 g0 h3 N! f; [! o5 J
  70. dma_addr_t dmaphysdest1 = 0;! F; P5 p$ @$ m% k5 ]; F4 G! U
  71. dma_addr_t dmaphysdest2 = 0;) }! ^. V' S# M) S% w
  72. - M. T+ i" }: y- c) V6 P
  73. char *dmabufsrc1 = NULL;/ V' [8 X, B/ y% S! k
  74. char *dmabufsrc2 = NULL;$ u( z' \. W" u  u. e6 B7 l
  75. char *dmabufdest1 = NULL;
    2 U! _9 Y- A+ M- s; g
  76. char *dmabufdest2 = NULL;4 M) Q2 y2 D" \( F

  77. % o2 \3 E. y0 Q( Z! Q1 P( Y
  78. static int acnt = 512;
    * i& P6 @3 E; d9 k0 p
  79. static int bcnt = 8;, Y* d  P$ R/ H  ^/ |, Q2 a
  80. static int ccnt = 8;
      K. z$ p! T" D: V% k7 u

  81. . i3 ~6 e3 @' y1 r
  82. module_param(acnt, int, S_IRUGO);" [$ j3 x6 w* C, n' I
  83. module_param(bcnt, int, S_IRUGO);! P8 {* `, Y; P+ O5 z( q1 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. y+ m: u. o( `

( Y! P- P3 x6 Y& f) X% j1 z; O2 g$ A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 r' e  G# x6 T) j1 ^: s! k/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 W5 _) R8 w' C5 r' b5 r: L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" W# u# b4 d* T+ x! G' _) R% ]& W' p

. o" d9 |0 K; O% W, |% a8 z% ^5 z9 \7 S7 E* E: |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-26 05:58 , Processed in 0.040306 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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