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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 `. E! }& J7 `' ?
  1. [code]EDMA sample test application
    ; J/ \: a! g, v5 c' t8 S1 g
  2. /*
    ( w2 s1 ^: c  L/ ^
  3. * edma_test.c, D/ v! b$ E2 a/ L
  4. *- L. _$ p! C0 C  s4 o
  5. * brief  EDMA3 Test Application4 C2 R& U8 x7 r
  6. *
    , s+ C8 \! ~# s
  7. *   This file contains EDMA3 Test code.
    $ s& X7 Y. D, g8 W
  8. *
    ) T9 m1 X/ f0 b, \' ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 C! ]( ^( o" f, E2 ^$ l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 Q( c5 j7 e/ p& [
  11. *         TO CHANGE.& F2 M, S: N( \
  12. ** s9 a7 Z6 n; _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) Q7 o0 A1 i2 N4 z
  14. *8 O1 S' j+ K/ }4 Y+ @7 ]: J
  15. * This program is free software; you can redistribute it and/or. e3 \# L8 f. G0 l0 s; N
  16. * modify it under the terms of the GNU General Public License as
    4 A: `  o5 t9 E7 H
  17. * published by the Free Software Foundation version 2.5 v' a7 A+ m4 D3 }
  18. *
    8 D! i* J7 }" [! Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ L2 I& ~+ p6 P: r- w8 I
  20. * kind, whether express or implied; without even the implied warranty
    - D, u* n! E4 p3 Z6 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' O( V( h6 W& U5 }6 h
  22. * GNU General Public License for more details.0 k5 n/ G/ m$ X  y* t/ ]. {# b+ m
  23. */
    3 X. R+ F% \# F& K- y4 B1 `
  24. $ n) n, _6 g6 G
  25. #include <linux/module.h>; N- R1 m! k$ [6 Y$ ^* Z) I0 @
  26. #include <linux/init.h>& h1 F' j& Z2 i4 ?4 B- ~. P7 ~
  27. #include <linux/errno.h>6 E$ l/ F# d3 R
  28. #include <linux/types.h>
    8 W/ H) l: L% {8 @) @, m* F: V
  29. #include <linux/interrupt.h>
    # ?8 Z8 O! _7 ?
  30. #include <asm/io.h>9 T; h! q; |: ^! S' k) t  u
  31. #include <linux/moduleparam.h>
    8 s- q, s: ~" @5 j2 e8 O9 T
  32. #include <linux/sysctl.h>" Q: N, Q* p' y; l
  33. #include <linux/mm.h>. B4 G+ W& @% k1 t1 h  ?0 [6 X- S4 P  l
  34. #include <linux/dma-mapping.h>$ @" \( k$ O7 h

  35. , C) ~) ~3 e/ h' U7 @. I
  36. #include <mach/memory.h>
    ( l; r6 K# Z8 s
  37. #include <mach/hardware.h>
    : O' P8 [& a5 _6 d6 a9 j
  38. #include <mach/irqs.h>
    9 W. o3 X1 L" Q% A
  39. #include <asm/hardware/edma.h>
    % E1 I2 ^' v. ?( ^- T& G
  40. 1 h) \/ f6 A4 s, i- h5 s
  41. #undef EDMA3_DEBUG
    4 o- \* ^; C* W3 w( Y! b
  42. /*#define EDMA3_DEBUG*/6 S3 F+ f. q; j. }* {
  43. ! b5 ]% i7 e) s3 R+ U, |
  44. #ifdef EDMA3_DEBUG" n2 x* B. Q' K5 ^+ s, K/ G/ I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 @, C$ P6 ^& J( P5 d. [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( D5 Y/ l* e2 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 r  L7 t4 g& F4 [* q+ a7 j% b
  48. #else6 n; k) m; i1 s) p0 B" y& \
  49. #define DMA_PRINTK( x... )5 m7 @& s+ R) r5 B4 _
  50. #define DMA_FN_IN
    % ~% c5 W( k% \4 O/ x2 q0 w+ k! L
  51. #define DMA_FN_OUT
      W, K' H4 w% Q0 a2 X! B
  52. #endif) Y0 w# c: x3 c+ C! q0 K
  53. 3 L; g, C6 W$ x; ^! s% Q3 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 Y$ F% t* ]! Y4 N
  55. #define STATIC_SHIFT                3
    2 Y7 i1 u( ]7 h
  56. #define TCINTEN_SHIFT               20
    2 M3 ?1 J( \. K1 Z8 M, \' i) k9 v, T
  57. #define ITCINTEN_SHIFT              21* q( t7 R1 Y9 F0 M- w* f3 K
  58. #define TCCHEN_SHIFT                22
    ) B1 B! g  f, u
  59. #define ITCCHEN_SHIFT               23
      Y, {# M/ T: Z, J1 i
  60. # ^/ c# w! M# C7 |
  61. static volatile int irqraised1 = 0;
    ; f# Y3 B2 K8 L6 o3 Z
  62. static volatile int irqraised2 = 0;
    ! i8 A+ |! t" `" a: |8 K6 m, o

  63. * Q% u8 `$ l: O6 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. {/ G6 j, v! C0 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# H' u0 a' f+ N& u. v& p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' G& a" d+ E% O4 X; ], _1 G

  67.   [& M$ R  T0 s& {
  68. dma_addr_t dmaphyssrc1 = 0;1 e7 W% c6 a5 R1 `9 p+ w
  69. dma_addr_t dmaphyssrc2 = 0;! c9 M1 j1 S9 E6 A, ]3 ~
  70. dma_addr_t dmaphysdest1 = 0;; ~) |) v7 \$ x* o( Q
  71. dma_addr_t dmaphysdest2 = 0;. h" S0 q" I# r8 F
  72. % G6 H3 d$ v# c. y4 R  }0 V
  73. char *dmabufsrc1 = NULL;; H2 B. i7 r' F( q: x* I
  74. char *dmabufsrc2 = NULL;
    2 p" n! N+ |- o; z6 d9 I
  75. char *dmabufdest1 = NULL;/ i& ~3 r1 w2 }) @) C7 b9 b, Y
  76. char *dmabufdest2 = NULL;; u$ R4 K6 D4 V7 O2 H

  77.   b1 i% F' C  F& |1 Q5 `
  78. static int acnt = 512;
    $ B) _& V! y. r3 r
  79. static int bcnt = 8;) c: M0 z4 p/ g) O8 i7 m0 V* q3 p
  80. static int ccnt = 8;
    3 f! e8 k# h* J+ o

  81. ' e( {) o/ ?& Q* ?+ L& z
  82. module_param(acnt, int, S_IRUGO);
    . T6 ^# }" N9 K& T- Z! |
  83. module_param(bcnt, int, S_IRUGO);
    0 A7 S7 r# Y4 l, f1 }! L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, A2 q+ e0 A1 b& }5 q
9 W" b5 ?$ j/ t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ]! q$ a4 m) ~5 E: \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( o, }: E0 X. c8 D. [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 P, ^7 q, S% g

6 \% ~1 V8 Q  h% I: L
7 H8 t* d% L7 T5 `$ P: _* |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-17 08:43 , Processed in 0.038369 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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