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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & e9 k: @# d9 ~# r. [3 X
  1. [code]EDMA sample test application
    " I4 d* _8 |# C# ^/ L1 |) C
  2. /*
    4 F9 C+ V' E, Y0 J
  3. * edma_test.c* }6 s9 X1 @, }! [# v1 g
  4. *! U" s$ ]2 H, u
  5. * brief  EDMA3 Test Application5 Q. N3 i+ a# s' s% g
  6. *
    # g" e7 q7 X& {1 o! D6 U
  7. *   This file contains EDMA3 Test code.7 n: \; V- _' i% i  a: G& y
  8. *
      e# a2 M& s9 e6 ^: L0 B% C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % r$ v! X$ M7 f3 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# M8 {; g( k6 D  R3 E6 ^- d* u0 R) ?
  11. *         TO CHANGE.
    , o* G( w1 e6 {# b* X' p2 V+ F: p
  12. *
    9 X! A" m8 V" L( P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 \; s' k+ e- C9 _( |/ b( b5 l/ E7 c
  14. *( E. n, Q9 a" L! d3 n0 L  q- p( C7 ~
  15. * This program is free software; you can redistribute it and/or
    3 H; P6 v  j& ?# G! B1 a' b
  16. * modify it under the terms of the GNU General Public License as" |+ Q. f) U! i/ l. [' z
  17. * published by the Free Software Foundation version 2.: M$ b; I. d* g8 a& m% ~( Q
  18. *% Q5 {6 F7 G: L* k1 l- y! ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # D; v2 \9 i3 Z1 R4 G9 A6 h
  20. * kind, whether express or implied; without even the implied warranty9 b" F2 _" I9 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + }& c) s2 n# ]+ \  L! I: U
  22. * GNU General Public License for more details.
    7 S$ Z! V  i& S8 d
  23. */
    6 e5 ~3 t  s  F8 i- b8 e
  24. 1 Y$ M5 P0 {' C1 f2 L' i: u
  25. #include <linux/module.h>
    : `( f7 ~( v" U; O- f5 v& Y
  26. #include <linux/init.h>* B: B6 f# x9 T) l3 e. m
  27. #include <linux/errno.h>, k* }8 ?# \0 P2 P7 |, a- f
  28. #include <linux/types.h>
    " W: ~* c2 |: K% |7 n% V
  29. #include <linux/interrupt.h>3 _" h# |1 r4 @* O' D0 N8 X
  30. #include <asm/io.h>
    4 ^& t% W! g3 E5 D, q
  31. #include <linux/moduleparam.h>
    & m7 ~/ |$ \$ x9 s$ q
  32. #include <linux/sysctl.h>
    ( K3 g% u4 w/ ]! k* I
  33. #include <linux/mm.h>
      a, l9 K/ f1 k3 j2 |! n" u% f
  34. #include <linux/dma-mapping.h>
    ' j$ z5 T0 E; q7 |3 k
  35. 1 e% k2 D  @, M/ r7 V! J
  36. #include <mach/memory.h>" t9 v8 {" x, c6 l# I) t, V5 ~
  37. #include <mach/hardware.h>
    " C8 @/ s4 ]9 N) c7 O* Y
  38. #include <mach/irqs.h>
    3 v$ i! U, }% F5 k: u: @% J
  39. #include <asm/hardware/edma.h>5 e9 H  t# ~: @7 |( _5 S' z
  40. ) L. e7 x/ b/ D% V! n* N
  41. #undef EDMA3_DEBUG
    + d% b: ], i4 w7 S) e
  42. /*#define EDMA3_DEBUG*// u* C' G$ p9 L# ^
  43. - _2 w/ J# f5 ?; h9 |
  44. #ifdef EDMA3_DEBUG, H  d/ x- u! r) n; O6 b9 R. R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 c& F0 r/ G( T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - ~' F# H- X. L* b. }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! p/ m8 M5 \- \0 Y
  48. #else! {5 Z5 J2 U4 L6 k4 m, a( h
  49. #define DMA_PRINTK( x... )5 B  Q0 y* m3 v3 v# ~
  50. #define DMA_FN_IN! C9 G3 w: ]0 Q; x
  51. #define DMA_FN_OUT
    - p+ l! O4 Z# b4 M4 [6 ?, M
  52. #endif# b3 X! r3 G7 B5 {
  53. 7 E: v- R" g% C4 [  f6 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / t0 n2 i, ?" w2 F# D3 M) J1 `
  55. #define STATIC_SHIFT                3
    0 l: S9 G2 l3 \
  56. #define TCINTEN_SHIFT               205 z* t) ^0 d; U8 z1 s/ L
  57. #define ITCINTEN_SHIFT              21
    ! s7 F8 ], }* n& _6 k
  58. #define TCCHEN_SHIFT                22
    5 E, @2 }, P# _+ D6 K, e7 C
  59. #define ITCCHEN_SHIFT               237 Q( W7 B8 N2 ]8 ^2 w( R1 a! r: I7 v
  60. - W9 I8 G- f4 S) R9 |; W, ]$ n' V
  61. static volatile int irqraised1 = 0;8 T4 Y1 W( l& W3 c# x* S' {8 g
  62. static volatile int irqraised2 = 0;* ^* S' ~; i5 t- Y0 Z
  63. 5 d2 F, v& f! z/ ^5 f! Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ]& r: }+ Y" r9 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % W/ L% c; Z+ M2 ]( _! b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 J: V" M9 }- z% \& R- A
  67. $ ^# f( G9 M! I  ~( A
  68. dma_addr_t dmaphyssrc1 = 0;
    1 F8 {$ ^! N2 \! [
  69. dma_addr_t dmaphyssrc2 = 0;
    . ^8 e8 f. Y. z# J& j
  70. dma_addr_t dmaphysdest1 = 0;
    & n4 w; `; _3 C3 k4 V) P( o
  71. dma_addr_t dmaphysdest2 = 0;) e+ B/ N: X+ x3 X, Y. k& U& _

  72. ; h* @! T# G% b  i+ d7 o
  73. char *dmabufsrc1 = NULL;
    " \  v7 }, C+ V3 j  {! n" X
  74. char *dmabufsrc2 = NULL;
    5 L" {8 r( q6 \
  75. char *dmabufdest1 = NULL;) {7 i3 t4 K/ |# r# e* k7 q
  76. char *dmabufdest2 = NULL;5 }  t: S) [# n; p. A* E
  77. " W$ k  L7 e8 F6 K3 s8 B3 [9 V
  78. static int acnt = 512;
    * N* b. y) h& N3 a( c4 K- L
  79. static int bcnt = 8;; f; o; G' H+ j& k
  80. static int ccnt = 8;- o% m+ f& o+ G  [

  81. 0 Y6 x. ^" i6 Y% t" ~2 {& B% O
  82. module_param(acnt, int, S_IRUGO);
    . U) \! G/ B) c) Q, }
  83. module_param(bcnt, int, S_IRUGO);
    2 m  @" ^: n2 y$ m2 J+ g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  m3 R7 S3 |- q2 i$ x6 @# z; j9 ^0 }
3 _( v) L! J, X* E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' C( B( f0 t5 R6 N  e" j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. i' R4 k/ W) q5 s! l- P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 w6 K6 S# n9 o
9 @9 I& S6 I3 _( F4 \0 f/ b6 j7 B0 l; A6 {/ V5 r* Y- C9 ^  S7 O0 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 04:55 , Processed in 0.039091 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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