OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 ]) r5 c, o4 P7 o3 ]
  1. [code]EDMA sample test application1 K# Q; T" ?" k9 ]5 I0 m
  2. /*+ b  E# M. Z) R' `
  3. * edma_test.c
      ~7 s$ g! O. O& u8 w$ d0 R, {
  4. *- T  ]+ e1 h6 Y! U- F+ s
  5. * brief  EDMA3 Test Application# O3 @- E( O! |. x  n
  6. *
    / O# g: u# k2 W* M* S$ b
  7. *   This file contains EDMA3 Test code.& s$ m( f- `% |/ ]( f' v# `
  8. *
    1 [9 y: H. e# G& @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 t* g$ m5 \" _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 m1 a' f) R2 e, ]4 Y
  11. *         TO CHANGE.
    5 Z0 k" J2 d* V- g
  12. *
    - V8 N: U+ w+ G) E0 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & X6 @* h% w, ~' D2 `1 i4 A9 \
  14. *
    : A- {1 \( w# J
  15. * This program is free software; you can redistribute it and/or
    # V" I1 V6 R9 c6 p+ L9 X
  16. * modify it under the terms of the GNU General Public License as- l5 e0 ^5 W# n: G6 v0 |
  17. * published by the Free Software Foundation version 2.' m$ y- d: E$ g, N8 y
  18. *
    7 y  [+ {5 m) Y$ M3 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . b: n' \6 A" q) f) _1 u1 ^$ Y
  20. * kind, whether express or implied; without even the implied warranty. l. L% B3 {* D* J) ~$ L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ j3 X7 n1 U: [/ c% o
  22. * GNU General Public License for more details.
    0 ?' w1 r- i7 X
  23. */6 n3 ~9 c: [' C

  24. ( ^) L' H* [! _$ e3 R% p$ W
  25. #include <linux/module.h>
    9 u7 H( r3 `& b; j; `
  26. #include <linux/init.h>& T) b2 u9 `+ j4 k$ q0 N! J+ T
  27. #include <linux/errno.h>7 X7 T  f7 |1 o9 ?; ]
  28. #include <linux/types.h>" a" F, m% O9 [/ U/ {7 l5 r7 \+ U
  29. #include <linux/interrupt.h>5 X# Z) M( T/ o& k, d
  30. #include <asm/io.h>
    ; }7 x- U6 V* x
  31. #include <linux/moduleparam.h>
    ' o6 _, F6 n3 d0 W) a; ]1 C4 Y
  32. #include <linux/sysctl.h>- I0 x) \. q7 X( S1 ]6 ]
  33. #include <linux/mm.h>% j: `1 {2 U5 q8 X
  34. #include <linux/dma-mapping.h>
    # h1 G& B) Z" a& T2 {' x7 _
  35. $ b% K7 D  E( f, M: ~- z4 F
  36. #include <mach/memory.h>
    6 D1 o+ ]! x: B" |" w
  37. #include <mach/hardware.h>" p# F* s' m& e" h
  38. #include <mach/irqs.h>
    " I% c* T: k0 W7 j3 a' D
  39. #include <asm/hardware/edma.h>% Y8 Q7 f4 z. ]! N6 o6 L2 u9 _

  40. - [3 E! `2 \* G: K1 g
  41. #undef EDMA3_DEBUG
    % k. w* s: T. r& {/ W
  42. /*#define EDMA3_DEBUG*/
      I5 V- A' W& @! S! C# J

  43. 8 i4 B, W) O7 B- @
  44. #ifdef EDMA3_DEBUG4 Q* c% ^9 c. V$ ?" t2 N+ P/ Y' C* h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 o5 r* C: t. k" u: z4 n- M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % n) B% A2 x$ A' B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' l1 `$ U7 Z+ m+ G# {$ W3 e. c
  48. #else
      O) i  M* X' U2 a3 ~. @
  49. #define DMA_PRINTK( x... )1 A2 ?$ K4 J! @. R8 N9 u8 _
  50. #define DMA_FN_IN+ x7 L4 F" X4 [4 b
  51. #define DMA_FN_OUT/ P9 @4 P+ K4 C3 U- m
  52. #endif# P' Z* @( J# G- ]4 y! f; w! @
  53. : l7 v+ y* z0 b& N8 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); U) M+ Y# z* p6 s& v! O# @
  55. #define STATIC_SHIFT                3
    8 K7 ~9 U& M2 m
  56. #define TCINTEN_SHIFT               20
    , d) r$ I% I4 N. X3 u/ i6 o
  57. #define ITCINTEN_SHIFT              21
    $ E! Z0 F, c" F8 M7 d# f! q
  58. #define TCCHEN_SHIFT                22
    ' d! G2 Q% k/ [9 N7 A5 p
  59. #define ITCCHEN_SHIFT               23: e2 J5 l# }/ V+ c$ V
  60. / y5 E- W! r9 ]$ d0 K* N5 E% ~
  61. static volatile int irqraised1 = 0;
    6 u: ^/ @+ t, a! w- Y6 {% h
  62. static volatile int irqraised2 = 0;/ k8 M4 x" `9 ^" ?+ J0 D( W, _
  63. 9 C: }8 `6 S5 y* I- @7 o* @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) h" R+ n" _" j0 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 Z4 Q8 |/ Z# n" p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 _5 ~3 ^6 q5 f
  67. , Z; l; x0 D# T, |7 M; O8 D) F
  68. dma_addr_t dmaphyssrc1 = 0;0 P8 t# h1 f9 P" a
  69. dma_addr_t dmaphyssrc2 = 0;$ V% t. ?2 a) M; M/ `) `/ y* f
  70. dma_addr_t dmaphysdest1 = 0;& z# ]- E# J: U' z* W% g
  71. dma_addr_t dmaphysdest2 = 0;' J6 M# V! E+ T  [# `3 z# g
  72. ! U/ P$ V7 @+ f3 S$ a. Y  o0 y
  73. char *dmabufsrc1 = NULL;
    ' t' T# [6 q! I0 z  L  r
  74. char *dmabufsrc2 = NULL;
    ' P+ s9 I0 _6 G+ F
  75. char *dmabufdest1 = NULL;
    ! B3 y# M+ V7 x7 e
  76. char *dmabufdest2 = NULL;
    " H8 ~" y" n% {, I/ N

  77. ) Q: `" Z' l% \; u2 @1 Z; @
  78. static int acnt = 512;% v! {: o5 F: b% v$ j7 ]
  79. static int bcnt = 8;- T! h  s7 k; g4 k
  80. static int ccnt = 8;; g& R3 F- K  F- B! \/ F
  81.   O6 H0 K5 s5 P3 x! a( G; f
  82. module_param(acnt, int, S_IRUGO);0 k& Q, t9 ~) z
  83. module_param(bcnt, int, S_IRUGO);
    : i- |; M- R/ J* O9 m( @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 v; Q! J) |  X4 j) u

) \4 Q# T9 B! b9 v  O* T3 }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% _2 n. ^2 A+ F4 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& {4 }6 \; {7 z  c6 o- Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ J% `( s7 }  O
/ B  f( r; t3 E9 M  @: ~5 |8 l4 a9 M
& a" C3 O  \4 o( c$ M5 U! L' g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 11:41 , Processed in 0.038338 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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