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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( J! t! \, `- f4 U3 y
  1. [code]EDMA sample test application
    2 U) i. e0 u0 b8 }) S; k
  2. /*
    5 i( Y& E. t8 R9 x7 G" l$ e1 g
  3. * edma_test.c
    & R8 j: S. f3 [
  4. */ ^: u) S9 \2 Z- F7 U
  5. * brief  EDMA3 Test Application
    , a" e% u! D4 x& c/ G3 L
  6. *7 L) b# H# T  a0 {
  7. *   This file contains EDMA3 Test code.
    9 Q! ?% _- ?7 a* B4 M! p3 V
  8. *& u9 p( M" z* ?4 H( j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 D( |% q3 w6 ]* P4 T9 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) [  S1 Q, l4 _0 E5 `
  11. *         TO CHANGE.
    : p. W: \3 ^3 N1 |$ w
  12. *
    / }7 D, g/ H  N1 Y% V4 |( s; p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 [/ H5 B# W3 o' T
  14. *
    0 U% B4 J- i" c  [8 F! D5 [
  15. * This program is free software; you can redistribute it and/or) {5 B0 e1 e9 X4 s; h
  16. * modify it under the terms of the GNU General Public License as: j2 M+ q2 @" `# ?9 ~1 r  }
  17. * published by the Free Software Foundation version 2.( T  L# u' s& h2 Q' o1 u
  18. *
    ' I6 e: K4 {! Z# M. p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , v3 Q, {# }0 f) _! o# R; z
  20. * kind, whether express or implied; without even the implied warranty
    ! [3 `& [1 p+ F6 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 K) O/ A% o/ I9 b( f" c; J
  22. * GNU General Public License for more details.
    - ^1 {  W, r  O2 {6 W3 h. E- r( m  c' Y
  23. */
      ]. c* p1 r0 B" e; U

  24. * c6 u- J- v* R' L
  25. #include <linux/module.h>' K0 t2 G2 M' O1 C7 B, x
  26. #include <linux/init.h>0 B% ?  v5 Z2 e5 ~9 ?% L  U- F- i
  27. #include <linux/errno.h>
    7 g- y6 ?, ]0 P( _, _
  28. #include <linux/types.h>
    8 f6 R! u( F1 H! l
  29. #include <linux/interrupt.h>
    : U7 G- E! L. y5 d
  30. #include <asm/io.h>
    $ |+ f; D" v4 @! O
  31. #include <linux/moduleparam.h>
    & h, R8 a- w1 n$ }
  32. #include <linux/sysctl.h>
    ' F, R) P8 n- Z4 g
  33. #include <linux/mm.h>
    . h; Y" ?. E' [4 b) b
  34. #include <linux/dma-mapping.h>9 W( f  H7 P' L! ]" w

  35. 8 k3 a2 s- g5 k( O& o0 u2 T- u
  36. #include <mach/memory.h>. a6 _- A4 k' L; W
  37. #include <mach/hardware.h>
    ( X& [) s8 V9 ~& L' K" Q
  38. #include <mach/irqs.h>
    / m9 \8 m# m4 H
  39. #include <asm/hardware/edma.h>
    0 j6 e* ^0 K+ K4 J4 {* U; B
  40. ) {, ?$ V. q1 m9 k6 a
  41. #undef EDMA3_DEBUG$ L1 D( B. r: H! d' k  H. p% W
  42. /*#define EDMA3_DEBUG*/
    5 \9 C3 X, |; H" `( X; U+ @! D
  43. 5 M# s  p* r. `+ y* y
  44. #ifdef EDMA3_DEBUG
    ! [4 I. R4 a( f- O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 G. O8 _& L, t% G( G- b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 _0 O. b$ G) U& |* h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & M& A, s( A" m- Z
  48. #else. b+ B, q: U7 T+ R
  49. #define DMA_PRINTK( x... )
    9 m! {, I& R. ^2 c4 R
  50. #define DMA_FN_IN
    ( C( ]/ @2 X& M1 h+ D1 f
  51. #define DMA_FN_OUT
    " i( V( r7 |4 G# g* Q1 Z
  52. #endif
    ! D# \) T8 x! H% Y7 K& W& R

  53. 4 U0 a4 H- b8 m' |1 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 c9 \7 ]' F4 ^( |" A4 i, l
  55. #define STATIC_SHIFT                3. t  P7 A4 ]+ c0 j
  56. #define TCINTEN_SHIFT               20& a' C* J5 I1 A0 }1 u! j
  57. #define ITCINTEN_SHIFT              21: ~. w! ?* |3 g; s7 U. X' D; e
  58. #define TCCHEN_SHIFT                22
    5 Z. J6 v$ X! d  u# r
  59. #define ITCCHEN_SHIFT               23/ P9 |* Q8 {! y' @4 ^6 j

  60. " Q0 z' ^, l% Y: `1 @7 t, c( L( f
  61. static volatile int irqraised1 = 0;
    * H* o& M! Z- B" P; q; R
  62. static volatile int irqraised2 = 0;  \3 `8 J* @# f9 S5 X

  63. " B( _- T( O, k6 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  D; B5 G8 y* m& d- j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( m' w- J# D- ]/ l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * \) ~  s3 g$ q5 c6 d
  67. 9 t! T8 m4 x4 d* G* B
  68. dma_addr_t dmaphyssrc1 = 0;! L/ m, [5 D" m" d6 t1 Q& ]
  69. dma_addr_t dmaphyssrc2 = 0;
    # y3 y8 U: r- o& v7 e& a% @
  70. dma_addr_t dmaphysdest1 = 0;
    , ]7 a0 N' o9 e, n  Z: V
  71. dma_addr_t dmaphysdest2 = 0;% v& T4 Z7 c* ~$ ~* O4 m: T
  72. : C8 f4 V9 \5 q# L4 m
  73. char *dmabufsrc1 = NULL;
    2 l, O, n# K0 {2 I6 l, |& y
  74. char *dmabufsrc2 = NULL;
    $ Y2 V8 @1 P# z, n5 e/ q+ Z
  75. char *dmabufdest1 = NULL;
    1 t; q. _9 ^8 Q% j! \8 B% _
  76. char *dmabufdest2 = NULL;3 a( r- U7 h6 I" X
  77. : s$ f( Y9 E# K% o" I
  78. static int acnt = 512;
    0 a5 y8 u+ \4 [- U8 H
  79. static int bcnt = 8;& o& A! x  ?( r/ R9 G% A
  80. static int ccnt = 8;
    . ?9 e) m2 l2 ]# u! X% ?

  81. ; e/ ]9 d7 x: Z8 |
  82. module_param(acnt, int, S_IRUGO);) R+ o& x! m. U
  83. module_param(bcnt, int, S_IRUGO);
    & D; X- j) ^5 D1 X( Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ |' @. [" w* K( t/ l0 O1 |3 z2 g
9 F$ `/ a" P3 T$ e! e  d+ y: p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& Z1 W: W8 W! Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) u4 }' M9 m. ~2 K( l$ b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& T' @6 Z: T/ E
( {' B9 @( h# D3 J; T$ |5 F9 B( b
1 p& j3 X5 b* _7 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-19 22:38 , Processed in 0.037974 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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