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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' X$ E0 L% q6 U: s: r5 [
  1. [code]EDMA sample test application: H" N- O8 |2 E, b
  2. /*
    2 L; u1 `0 f: i, e/ `( R4 N
  3. * edma_test.c8 y5 ]$ @$ C# F( E9 f
  4. *2 s- `/ a  \! W3 J
  5. * brief  EDMA3 Test Application
    + P' a; e3 D% t7 V: J
  6. *
    / Q, _! ^$ d% a6 M
  7. *   This file contains EDMA3 Test code./ M' S$ }2 F* C0 v! y9 Y. K- b
  8. *5 r* D8 y2 c, T1 }0 o5 g" q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 @/ R2 ?# o8 U4 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' m  t1 C0 e; ?  A0 X" a
  11. *         TO CHANGE.- g+ `  J+ T2 o+ b! f; r% L
  12. *; A9 d' u. @# I: _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( @8 J4 R  c; [8 o
  14. *
    ) x4 _  m1 [6 g9 q  |
  15. * This program is free software; you can redistribute it and/or0 L3 P& z) x6 G  q1 H1 z
  16. * modify it under the terms of the GNU General Public License as) A" b) r0 n9 S7 b
  17. * published by the Free Software Foundation version 2.
    1 O6 S% U; L9 g- z" z8 Z4 ~2 x, h
  18. *% s0 J+ e! e6 h0 ^. U$ x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & W* ]. A# L* w& Q# }* y- Q
  20. * kind, whether express or implied; without even the implied warranty# T, j' ]- b1 s. ~3 m: v5 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( u" _% m" E$ ?3 I( w5 u, I5 M. G
  22. * GNU General Public License for more details.
    ; D# b' i; c2 p( K5 V
  23. */
    ' L% Z- X: }5 _' M
  24. ! Y+ i+ P' g; x( i2 X7 L, V! }
  25. #include <linux/module.h>6 `& w, ^7 e" \8 x
  26. #include <linux/init.h>% Z5 P0 D9 [$ g5 Z& h
  27. #include <linux/errno.h>
    " b! h& C" G! f8 L1 n/ C
  28. #include <linux/types.h>
      @, Z, d! m$ [3 \
  29. #include <linux/interrupt.h>
    9 E- n! ?( S0 ~+ Y9 {
  30. #include <asm/io.h>
    5 J. z+ d; X3 N, V% w6 Q. U, F
  31. #include <linux/moduleparam.h>! H; Y4 Y8 `% X7 N
  32. #include <linux/sysctl.h>4 h% E% C, B% E! ?& m
  33. #include <linux/mm.h>) b. A6 q* p0 T- l5 F1 m
  34. #include <linux/dma-mapping.h>8 m- b. X7 [1 h  l/ F# p$ {: o
  35. & V* U$ }& R) C! F- t
  36. #include <mach/memory.h>
    4 c8 v) G6 @0 y$ u' F: Y
  37. #include <mach/hardware.h>. O. }/ ~8 z7 U8 H9 a3 c
  38. #include <mach/irqs.h>9 `9 X4 k* m' z- i) c+ _! P3 F
  39. #include <asm/hardware/edma.h>
    1 u. u6 G. q* o
  40. 6 Y- {. `( ?: ^0 [' w" T
  41. #undef EDMA3_DEBUG
    ) i4 U7 B, Y+ X7 x- C
  42. /*#define EDMA3_DEBUG*/
    4 H( r. H/ R9 C; }; {# z$ s6 `; v

  43. 6 X6 ^2 ^, r5 m9 q- `
  44. #ifdef EDMA3_DEBUG
    " Q) z8 D: A# |# j* ?9 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & }7 t/ j% G0 X) W0 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 m3 U5 K1 x' D. W1 d; S+ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 K) Q, s4 O/ m8 R% p
  48. #else# _: ?1 }9 V+ P# u; Y7 D# ^) ~
  49. #define DMA_PRINTK( x... )) P; F3 @$ i9 F* d7 t$ A
  50. #define DMA_FN_IN
    4 R0 D7 ^  L" P" P
  51. #define DMA_FN_OUT7 [: O  C$ e' A0 z2 G4 _( Z. F( R
  52. #endif
    " D5 N1 x6 y" g) a: A) ?
  53. 7 g2 `/ k$ [" M# R! k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* G" b- Y' ], H5 n2 \# b' C
  55. #define STATIC_SHIFT                3( g3 y* K9 U' u6 e* \
  56. #define TCINTEN_SHIFT               20% v) a* E! K3 W2 }2 R+ j, ^
  57. #define ITCINTEN_SHIFT              215 W2 U; ^" N6 H5 H# @3 U) {8 z
  58. #define TCCHEN_SHIFT                22/ N: k7 K7 k& I6 p6 y1 |
  59. #define ITCCHEN_SHIFT               236 f( l, h' ]& W' t' h" L7 x

  60. " \/ H' k. T5 Z0 b& H( \
  61. static volatile int irqraised1 = 0;
    3 w/ h  C) K4 q# Y' @- i
  62. static volatile int irqraised2 = 0;: O5 i. u9 P( {2 Y! f" v
  63. - e" D$ M6 Q; K. R9 ~1 \% m- T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# q6 r, o' G4 g- ~8 [7 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * p0 y: c3 m9 C1 _! \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; i' ^2 h: H- s! `( r) F2 E
  67. ( e/ P- m/ j) _7 ~' D3 ]1 H0 c
  68. dma_addr_t dmaphyssrc1 = 0;
    5 l' ?* T. X3 F7 R8 X
  69. dma_addr_t dmaphyssrc2 = 0;
    ' K+ c. u( K* [4 F2 o4 i! Q1 @  [4 A: |
  70. dma_addr_t dmaphysdest1 = 0;& U  z# P, K' N
  71. dma_addr_t dmaphysdest2 = 0;; \' V  g  M: S1 ^- K7 P) G
  72. ) z0 I7 l3 T4 p: D9 d5 c
  73. char *dmabufsrc1 = NULL;
    + z' S$ x. Z" n" `4 i! I
  74. char *dmabufsrc2 = NULL;
    5 ^9 \) ^3 a/ N) i/ |9 y& F1 {' s7 n& _
  75. char *dmabufdest1 = NULL;
    . q# H5 h& I- I& j
  76. char *dmabufdest2 = NULL;
    ( M' F) |  }0 O2 j% f! d4 E, |
  77. & w5 F, U/ d& J3 v% H. k0 f
  78. static int acnt = 512;
    " v1 C$ O) L; \  h
  79. static int bcnt = 8;2 r, R( r0 S0 ^
  80. static int ccnt = 8;
    0 `" N0 [7 s6 _- j1 N

  81. 9 g" t. x1 ~* c6 I; p; o# c, u
  82. module_param(acnt, int, S_IRUGO);0 Y7 U+ c* |" C# Q
  83. module_param(bcnt, int, S_IRUGO);
    & o' M0 T. a9 H3 O* `% T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( O+ C* X! H' i3 M+ b7 m
- b5 F3 f1 b- k/ y" L2 B% }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! K8 Q( J# P* D! c: z$ ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: [. D- C8 @: Q* n: y" A$ Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  o+ d0 ]9 U0 n2 {+ H$ H$ _+ {( J  a6 @+ x. I

/ ~2 s7 [5 i9 L+ n% z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 05:22 , Processed in 0.045558 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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