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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( U; J" [) j0 g* r
  1. [code]EDMA sample test application! i" M( h. B/ U8 I; _
  2. /*
    ' L* j9 C& B% M& @; K5 T2 B9 A
  3. * edma_test.c) h- q0 j0 B  I) g5 T" _) M
  4. *9 ~" ]* o) x' A
  5. * brief  EDMA3 Test Application
    * y6 B9 ?* ?9 q, b; j$ R; R# e
  6. *
    + Q# F" w& r. x* X4 L
  7. *   This file contains EDMA3 Test code.% r( `8 m! t3 }/ _9 F5 W% K
  8. *8 F$ v" |5 B: Z' Q4 V) [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! R9 m/ F) @# V9 T) O* d# d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# M0 d& L5 y, [
  11. *         TO CHANGE.! _# m2 x5 E# `  ^
  12. *% ]: F' f3 z2 }. Q+ B8 d8 Q6 n9 S0 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 t. _+ B, x6 w7 M
  14. *) q9 C  @6 f- U+ a% C
  15. * This program is free software; you can redistribute it and/or3 A: r# \1 a8 r& G6 k4 g
  16. * modify it under the terms of the GNU General Public License as
    " {" v8 J% [: d2 y1 q  O; n/ Y  D
  17. * published by the Free Software Foundation version 2.' D: n! ?3 R7 M
  18. *
    9 w& F' A4 {2 t$ R& A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& w0 O0 R, U; ^' p2 w/ d
  20. * kind, whether express or implied; without even the implied warranty
    , H- H; }( J) ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      ]  S/ v/ k0 T$ M1 `
  22. * GNU General Public License for more details.
    # h9 k5 Q( H5 D% A
  23. */
    ' h- t. v9 e2 D5 O& l! W7 @
  24. 7 K0 a6 }8 |6 n1 z0 j
  25. #include <linux/module.h>* |  j6 L* X' {) a: B5 i$ M
  26. #include <linux/init.h>: Q/ L: F' u; W/ S% }! j( [  u9 b1 A
  27. #include <linux/errno.h>- P$ {1 z' h/ q% V8 _' S
  28. #include <linux/types.h>2 ~: c$ K$ e4 Q+ b! `
  29. #include <linux/interrupt.h>
    & V* s  v4 R; F$ }: C' r
  30. #include <asm/io.h>
    " d1 t8 q4 O6 k9 R- M* H; ^
  31. #include <linux/moduleparam.h>
    * I# f0 E% y% O6 C
  32. #include <linux/sysctl.h>
    : J( S4 ^5 w; V! U5 z+ u* f
  33. #include <linux/mm.h>
    ' k+ D8 U1 X5 G% N; Z- F  d
  34. #include <linux/dma-mapping.h>' E. K2 T8 N. d2 S) i* i6 F
  35. 0 p& x8 o* Q0 ~1 `! B. f
  36. #include <mach/memory.h>, Q; @5 }5 L9 [+ t9 y0 Q8 x
  37. #include <mach/hardware.h>
    8 S" o% G# M% c! E3 u) [+ a2 q$ C- d
  38. #include <mach/irqs.h>
    ( W$ ?- z2 V0 S0 D1 f
  39. #include <asm/hardware/edma.h>
    - c& L/ r; B- q! C3 C

  40. 2 i/ }# d9 T! E& q  y4 L
  41. #undef EDMA3_DEBUG
    / m- I0 c! |$ @, Q5 s0 S
  42. /*#define EDMA3_DEBUG*/
    - t, ?6 d4 W3 u0 S) C' @

  43. 0 C$ b& r' x: G. f) T+ g! F; |& s
  44. #ifdef EDMA3_DEBUG0 Z1 N0 T$ i2 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* T3 \) k6 T/ E/ `4 f6 d5 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & N! i  \# L4 C! W0 ~  P) {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 A* C2 `% Z, m% d7 o. B% `; T6 ^
  48. #else
    - U" A3 e* X( w) _! y2 t
  49. #define DMA_PRINTK( x... )% n9 D, [% K! j, V
  50. #define DMA_FN_IN" b& l; I+ s# K* n' f
  51. #define DMA_FN_OUT
    . o+ s& o. ~2 x9 k* e- u% D
  52. #endif4 P% A/ y9 X7 u7 S2 C! J+ [

  53. * @3 S) I3 ?) K/ q  d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ k* `, i! A' O# Y( k' b! \* F" H
  55. #define STATIC_SHIFT                3
    8 h% c" i3 {: c$ r* m7 O
  56. #define TCINTEN_SHIFT               20! r; o/ ~# P, k: a2 C
  57. #define ITCINTEN_SHIFT              21
    5 D( q9 `$ h% D2 o4 Y- `( G7 L" N
  58. #define TCCHEN_SHIFT                22
    % {% w2 O5 r$ A! f- T1 [
  59. #define ITCCHEN_SHIFT               23  Q% f" q" [# x  Y, }0 y* i$ Z: C
  60.   I' C& C, y. [% u5 ?$ Q: H
  61. static volatile int irqraised1 = 0;2 |1 N2 Z% b1 e7 Y! x4 p
  62. static volatile int irqraised2 = 0;
    ; e' L. k  {2 c2 @
  63. 7 Q* q8 @6 w: s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Y! V7 L7 C; l6 l; ~$ T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 S  @9 e' x9 f* X) B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( |/ _( Z% F" A5 ]4 z6 Y! X8 z: {

  67. # d5 s5 C6 d  v( x3 u0 k/ B* a0 E
  68. dma_addr_t dmaphyssrc1 = 0;
    9 P2 g' n/ x' ^, y2 w! i$ Z0 C
  69. dma_addr_t dmaphyssrc2 = 0;
      z7 Y* a8 Q* h3 I
  70. dma_addr_t dmaphysdest1 = 0;' q' P. K) w, ]; P1 I5 Y* h- O
  71. dma_addr_t dmaphysdest2 = 0;. w1 a5 Y, a& e6 x8 M  t
  72. # d2 P9 o5 f6 m2 i8 R
  73. char *dmabufsrc1 = NULL;
    0 ^: H- m0 Z9 u  y2 H8 {& k' x
  74. char *dmabufsrc2 = NULL;. r' \3 f. @, X" S7 Y% \
  75. char *dmabufdest1 = NULL;
    , F9 G6 d  U0 s& g' `+ {
  76. char *dmabufdest2 = NULL;
    . |/ u# ~: J# }! z

  77. " ]9 G" W( o4 U# O8 g
  78. static int acnt = 512;9 R$ \5 b' J/ Q" t  M/ j
  79. static int bcnt = 8;
    : A; t0 I) _% p$ Z2 E% y: b. u
  80. static int ccnt = 8;
    $ h9 _1 O1 \, j& Q0 ^
  81. 5 d8 V' @. G5 X
  82. module_param(acnt, int, S_IRUGO);
    / P( s' Y9 B% O# x5 }
  83. module_param(bcnt, int, S_IRUGO);
    / Z( l# ]' y# |4 F! _" I- c6 o5 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ ?- g: X) ^! M3 K1 C( I7 E
' K9 V, _! i0 C+ I+ v. A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. n& {1 z: [9 H9 M' s* u: Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' m8 h( Y4 T- H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 F" B: g0 A9 [! W" a9 s! ]  t3 F+ \1 g  R6 \4 \0 Y% j6 x

; a' M  m. ^; o8 j4 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-18 19:31 , Processed in 0.039860 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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