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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & d/ p; p. Z* [* O
  1. [code]EDMA sample test application
    ) y# s( s' s7 G1 i! u
  2. /*
    " W' G" T4 q3 O5 D4 H
  3. * edma_test.c/ R" b$ ^- q$ U0 M. p, w5 A
  4. *
    3 d" `. {, w, ^, e* K
  5. * brief  EDMA3 Test Application
    8 Y7 v4 f0 j' a1 i+ A9 W
  6. *8 P* e$ n9 U9 i: s
  7. *   This file contains EDMA3 Test code.
    ) }, u0 z7 V: ^1 {2 B* B
  8. */ x; ?9 @# a: L# f' F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; B1 u1 d/ h0 J& T! E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; t+ F$ ?$ J$ P: ~3 j: r1 O3 L; K
  11. *         TO CHANGE.
    7 t0 l. _4 H) i2 ]: w: A
  12. *: p6 J1 ]' Q# s% q. v- U  G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, I0 V/ q6 B% t0 ~
  14. *" F: K" H5 o% _/ n- J$ k/ o- Z
  15. * This program is free software; you can redistribute it and/or2 d8 t' _2 ]! b- @" ]' w
  16. * modify it under the terms of the GNU General Public License as* w( r/ \* |9 k1 |! T& S' [
  17. * published by the Free Software Foundation version 2.$ e& P/ e* o( B- v) h
  18. *
    1 _6 n5 c4 g/ M4 K% R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : U$ M+ r: W) Q0 p% h: w& _
  20. * kind, whether express or implied; without even the implied warranty
    2 R! C/ t$ _6 E7 V6 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : G- I4 ^9 S9 x( V2 w
  22. * GNU General Public License for more details.
    ( j( f! I2 y* \- m  V# _
  23. */  m' L& e$ q+ ]2 P

  24. 0 r* u" ^0 \, Q$ U7 Z
  25. #include <linux/module.h>
    ' c. ], T! e( S4 e
  26. #include <linux/init.h>
    ; w4 _7 `8 w) j
  27. #include <linux/errno.h>
    , d7 L+ D9 L$ ?) B9 h
  28. #include <linux/types.h>7 o. t  D& ~  V3 L( m! c4 X
  29. #include <linux/interrupt.h>
    0 _- Q) R8 k, y$ e& V2 ~# N
  30. #include <asm/io.h>- Z! u6 W% P  c9 t8 i6 q" V9 P
  31. #include <linux/moduleparam.h>% t3 Z7 B; B6 g, ^
  32. #include <linux/sysctl.h>8 `9 M! Z7 ?# }. r8 b- w  |6 a
  33. #include <linux/mm.h>  s5 T! h8 l: r4 ?3 L- `
  34. #include <linux/dma-mapping.h># y+ l: J  r* a2 a6 c; O! H

  35. # ~9 i/ `  A7 P( K) [
  36. #include <mach/memory.h>
    % Q9 O3 e. l# B+ Y
  37. #include <mach/hardware.h># ~$ I9 ?+ @+ L3 d/ u- c. G8 n( C' I
  38. #include <mach/irqs.h>
    8 _! m8 _% ^  d0 {# k; F  M3 M
  39. #include <asm/hardware/edma.h>
    " |- J+ o: b6 \, r

  40. 7 O$ h" t& Z* P( w3 j' @! H9 C
  41. #undef EDMA3_DEBUG5 k" b0 M, y. z( o, E5 C. k
  42. /*#define EDMA3_DEBUG*/% B& p# ?& x6 N: m

  43. 6 a( m+ S  K# g" V  m7 j6 l
  44. #ifdef EDMA3_DEBUG
    6 `6 r  B9 Z4 O3 f5 g0 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 ^5 n* g7 K1 T. `( n& q7 M- D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 v* y7 ^7 r9 K  O0 s% I+ V# |) v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) k! f8 m0 r0 o1 X
  48. #else
    6 s- P& R" w. K/ f. e2 D$ @6 L
  49. #define DMA_PRINTK( x... )) E" f5 V6 x/ B
  50. #define DMA_FN_IN
    ; b# X' I1 t4 y. A) j2 S
  51. #define DMA_FN_OUT
    # R, G5 _% I8 F3 h% W
  52. #endif8 C& A4 _: H' g; i/ {  H! B

  53.   }% c# t, _; K; T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / C# q& Y, u8 S/ k$ K. \
  55. #define STATIC_SHIFT                39 \4 ]: o' c" [* Q/ o; Q# t
  56. #define TCINTEN_SHIFT               20# p" E3 T% ^5 I
  57. #define ITCINTEN_SHIFT              21" q1 p% i" z+ c; h
  58. #define TCCHEN_SHIFT                221 S/ ]/ Q/ O- n6 l1 c
  59. #define ITCCHEN_SHIFT               232 ~- u) l+ s- r! L" P& Z

  60. 1 E4 L. E3 X1 C7 h/ j. s
  61. static volatile int irqraised1 = 0;
    0 ^, q0 b7 J  S9 S8 }- w& Q
  62. static volatile int irqraised2 = 0;
    5 r% F: ^8 F! p9 o& }$ }

  63. / o3 q, Y, o( @8 F4 L1 L3 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ c- \8 h3 B* ~4 x( L/ c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  H+ X% K4 p8 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- S" U4 y2 r- n3 B
  67. 6 G. ^) O8 W+ \+ \
  68. dma_addr_t dmaphyssrc1 = 0;  z- u: ?/ o/ m2 v
  69. dma_addr_t dmaphyssrc2 = 0;
    5 E+ [7 t) n0 [! Y
  70. dma_addr_t dmaphysdest1 = 0;/ |  I1 q1 R! {, q
  71. dma_addr_t dmaphysdest2 = 0;2 z7 R. E0 }6 n$ P7 g* J. h
  72. # x' [0 }" d) Z" o6 O8 [- \
  73. char *dmabufsrc1 = NULL;
    ) h5 y2 F: D! v9 x
  74. char *dmabufsrc2 = NULL;
    $ j4 X4 V  {4 @% ]$ e
  75. char *dmabufdest1 = NULL;
    9 f# p3 X- }, j2 N" k% R
  76. char *dmabufdest2 = NULL;
    / F. T: v1 h: X
  77. % F% m  n# H8 z4 W
  78. static int acnt = 512;
    8 v7 l6 o. u6 F
  79. static int bcnt = 8;: E; m! P' _& C0 s+ Y7 R" I
  80. static int ccnt = 8;! t) c2 Y& E; i
  81. ' }! C8 \5 |% U1 y" j: L/ X
  82. module_param(acnt, int, S_IRUGO);
    2 v) N2 K* i7 z$ B' w3 y/ ^9 p7 C
  83. module_param(bcnt, int, S_IRUGO);
    & }8 g+ }* W6 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; E8 G% t" n, S% {
' b7 t( B# z2 Q& ^+ s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 N6 h  ^- c) o" ^9 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: D0 X) ?0 W* k  g0 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 D) G4 x% X7 n* C: f  ?( C
; k7 S2 Y* R6 H9 a; y, S6 I) U1 V! n6 C( |* @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 22:20 , Processed in 0.039786 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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