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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  {3 Y0 f/ z9 o# ], _6 {; C3 i) f
  1. [code]EDMA sample test application
    5 F! h; L( H: s6 x! D
  2. /*
    3 s7 b: A" ?0 ]0 [* a5 g$ z
  3. * edma_test.c
    1 ], y3 J- c- Q: ]; X6 Q) _$ h: u
  4. *
    3 f7 V- y; K4 W9 d
  5. * brief  EDMA3 Test Application
    2 y& t5 H9 A! x) K7 ^8 x2 r+ w2 \
  6. *2 `6 I# y* a# H* [
  7. *   This file contains EDMA3 Test code.
    2 b7 F) m% w9 y& l1 h1 o( r
  8. *
    - k0 h! p0 n+ `) ^9 r& A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 t' ~* M7 j( ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ e+ |  W$ ^, ^" z, w- @
  11. *         TO CHANGE.
    . w+ T0 i0 H/ Y7 d
  12. *
    # f  S, f; U/ P- S6 u8 H) }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 ^& S- D! e0 O' R) L! M8 Q
  14. *: R( u' \. q" S; A0 U* I
  15. * This program is free software; you can redistribute it and/or4 p0 Y* O) b3 R6 W. T) G1 j
  16. * modify it under the terms of the GNU General Public License as
    0 c8 u# G4 `9 n6 w( u9 V
  17. * published by the Free Software Foundation version 2.
    / X: ^% n  Q' u9 z1 i
  18. *0 O$ }; v3 V) \  Y/ Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 n" f/ h, I, l: L+ ?! x
  20. * kind, whether express or implied; without even the implied warranty1 p6 X+ l0 p: ]1 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* r1 M5 }( m- s7 L' S! j5 a5 F
  22. * GNU General Public License for more details.
    9 n2 f& s* w! B0 |
  23. */
    : g% a! `  B& d# k/ v0 [
  24. & Y/ i+ z6 }  s( p) S' x5 y6 X2 _8 H
  25. #include <linux/module.h>+ V/ d  @" s0 v& N( E" }# @3 @
  26. #include <linux/init.h>5 d( U+ S0 C+ V
  27. #include <linux/errno.h>7 s/ n9 S' o/ ~" |
  28. #include <linux/types.h>
      s) q5 S. S) M& ?! ?' }/ _
  29. #include <linux/interrupt.h>" r/ j9 J  M- n& F
  30. #include <asm/io.h>6 k' j- Y' }0 @" i# j- }
  31. #include <linux/moduleparam.h>2 ^* I# h7 _& f$ j5 \3 {: t
  32. #include <linux/sysctl.h>
    6 H8 v$ D* [; t3 T, i
  33. #include <linux/mm.h>
    3 p7 N- u7 p) U5 W0 k
  34. #include <linux/dma-mapping.h>; m$ x, _: |$ t0 \

  35. * o( c* e: s, n
  36. #include <mach/memory.h>  W. T1 g4 ?3 S- f7 {4 v
  37. #include <mach/hardware.h>
    ( j! I0 j" X; y9 g9 l5 Q
  38. #include <mach/irqs.h>, s0 G6 ~5 e- Q- n! z
  39. #include <asm/hardware/edma.h>
    / D" H: ^9 t) _+ p

  40. 6 [% d) ~5 F4 T1 t
  41. #undef EDMA3_DEBUG
    / v7 Z5 v# C/ |7 q" q0 `
  42. /*#define EDMA3_DEBUG*/
    , _6 ~- \1 g+ ?9 K4 B8 L
  43. - G' |) H8 E9 C7 a0 a9 ^
  44. #ifdef EDMA3_DEBUG% V  U' s! N# S& a7 p1 n* x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : K/ @; m) R3 I! o! _7 n' {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' \5 u. K+ L. n4 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : F' R. B$ k- ?3 D8 }
  48. #else
    # u7 ~  m: f% X0 m) c- J% i6 B- l
  49. #define DMA_PRINTK( x... )
    - }* r2 i: u1 R( N4 ~; A, b5 ?( \
  50. #define DMA_FN_IN
    ) @) T. P& f/ \% q6 u# f
  51. #define DMA_FN_OUT
    / e' y/ M- B& ?4 [$ @$ {- z5 p$ P
  52. #endif
    & o+ W4 R$ h8 v. v4 N

  53. ! U5 I2 @, n5 |7 ^& \2 l% S, t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; ?: l0 S& k9 G9 ^0 F6 }
  55. #define STATIC_SHIFT                3
    * M1 |! C& r4 j' ~* h
  56. #define TCINTEN_SHIFT               20
      F: w; n1 w" P" C+ t
  57. #define ITCINTEN_SHIFT              21/ f: y0 l: X; {1 ]
  58. #define TCCHEN_SHIFT                225 q2 B. t& w2 K7 o9 G- o- B  |$ |! _
  59. #define ITCCHEN_SHIFT               23
    # f4 _0 f/ N* j; N; c+ l" T# V
  60. - ~4 |, G% ]% l6 ~, B% K. y% N
  61. static volatile int irqraised1 = 0;+ v3 M" J2 j: b% x5 V5 F* }) g
  62. static volatile int irqraised2 = 0;
    7 ~: I+ T3 I) r- G* ~
  63. - a8 x2 E' g6 {& k6 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 }5 E+ j3 S% I/ A1 t) m3 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 i5 F# J; @- |* o  r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 I8 b- m, s( b% A% b3 B3 k, O

  67. ( `) d4 E% \- T8 v% t3 z! j! U6 n3 g
  68. dma_addr_t dmaphyssrc1 = 0;. ]9 m( R& T) w* u$ J1 r
  69. dma_addr_t dmaphyssrc2 = 0;
    $ D# o1 ]$ j( A3 R# _4 S
  70. dma_addr_t dmaphysdest1 = 0;
    8 w3 r& C3 E0 l4 j/ y( Z/ {
  71. dma_addr_t dmaphysdest2 = 0;
    / Y* b1 w* ^! E

  72. ! Y. Z8 @/ i9 t+ S: d
  73. char *dmabufsrc1 = NULL;
    : S, T9 G4 F2 V. X% T  o
  74. char *dmabufsrc2 = NULL;
    7 X- y  f% K! h/ I( X
  75. char *dmabufdest1 = NULL;
    " p% t8 x" j' a
  76. char *dmabufdest2 = NULL;" ^; x6 T& `6 T% C$ {5 ^# w1 m) v

  77. $ G% y* b- b- N! X
  78. static int acnt = 512;
    * d7 Z1 Y: x* M' G& j
  79. static int bcnt = 8;$ e4 Y+ b. U& P( _+ s# p+ r
  80. static int ccnt = 8;0 \$ `, H7 R+ Y# M& I0 P

  81. & J8 r) a! k/ z, L% e
  82. module_param(acnt, int, S_IRUGO);# M% o' O% s4 O' o% `
  83. module_param(bcnt, int, S_IRUGO);* b" _; Y  X& o. w2 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. Q3 ~% o! V3 R& l1 w# `) i7 P
0 z2 M+ x' X' A! F/ p, W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 l. q2 v8 z$ X5 t3 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; T/ T0 l2 y' A, T1 q0 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ Z# C# u, p0 h* n- J
- T) N, Q. h; L. @" s( r1 t0 t8 ^- Q; k
- F$ V2 ^) Z/ O% o! ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 18:18 , Processed in 0.040540 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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