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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' U" G" N& K0 q: ^& w$ h6 l
  1. [code]EDMA sample test application& W' S7 @# q: D! Q; Z! b
  2. /** b4 z5 `; Q+ L, n. G
  3. * edma_test.c7 P8 ~" e, y$ m. _) F
  4. *+ a, D( S1 _# G
  5. * brief  EDMA3 Test Application+ z& V* }+ H+ Q0 R. x- w
  6. *. h$ F: B, j; F. n2 s
  7. *   This file contains EDMA3 Test code.1 i" K# {" {! X! b4 I
  8. *4 W  E! Q" q- G+ S+ U) h( e/ D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 R+ h& E' c* P  }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( R$ ~8 M- D: H3 O7 Q4 r5 O9 R
  11. *         TO CHANGE.# }- I" E6 }* x3 ~/ ~; F) Q
  12. *" P8 V4 r3 T+ ~+ ]* ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' p* y; U/ Q# t* @9 l
  14. *, T( l/ {7 p3 Y- t. G( j5 R3 [
  15. * This program is free software; you can redistribute it and/or) p! {$ S8 |1 E* |9 C0 N
  16. * modify it under the terms of the GNU General Public License as1 p! m+ p  X. w# n1 u
  17. * published by the Free Software Foundation version 2.# v* W# ?) X* A  s0 T
  18. */ U8 Z" F6 `8 J) j. X8 h; ?; ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , p4 ?  [, O0 u# `: p; f
  20. * kind, whether express or implied; without even the implied warranty
    ' M- Z: Y) y0 Q+ b' G( \/ M1 b+ r& D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% K$ V1 K* i- x4 R7 [$ h
  22. * GNU General Public License for more details.
    0 D0 E- M6 t/ b0 S. g
  23. */) U5 }( P, O: C0 u* `
  24. % @. b$ R+ E, r' m) E
  25. #include <linux/module.h>( d& _: Y  B# C, }; t) z
  26. #include <linux/init.h>' N- x! |6 g8 l2 `, A: h$ I
  27. #include <linux/errno.h>
    ' `& c0 E* q, M* ~  E: \: R; Y
  28. #include <linux/types.h>
    3 e! K9 V1 V4 t! D
  29. #include <linux/interrupt.h>
    1 N1 \; m- K* X- x
  30. #include <asm/io.h>
    - h9 k7 T" P9 r  M8 Y0 p6 v
  31. #include <linux/moduleparam.h>
    $ m3 s9 {  D0 \9 b, [8 S1 [/ O& w
  32. #include <linux/sysctl.h>
    8 \  k  H0 c& k9 l
  33. #include <linux/mm.h>
    , }+ E8 R# q/ s8 S" p7 ?3 S
  34. #include <linux/dma-mapping.h>
    2 J0 Q6 {1 A, B& F3 F( q  {
  35. 0 b( N1 i% |& V* ?" i4 e
  36. #include <mach/memory.h>
    ( \8 K( c* V. R9 d
  37. #include <mach/hardware.h>
    ' T$ |5 l. v$ N
  38. #include <mach/irqs.h>3 x2 F8 [3 n; A( \! o
  39. #include <asm/hardware/edma.h>
    : t' I2 V  l7 X6 x. ]9 E
  40. ; P0 ^8 l9 d+ F* t9 p8 N
  41. #undef EDMA3_DEBUG) T! ~& n! w1 Z0 Y
  42. /*#define EDMA3_DEBUG*/9 v6 Y6 B* `2 q+ b  a8 w$ g6 k: N; a

  43. " b( d4 _' z& C/ Y5 u
  44. #ifdef EDMA3_DEBUG9 I9 Z) k+ t, x  M, n9 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * D8 I0 u4 Q- d% J& O& ^  |3 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ v& ^9 }: N) I3 A$ [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- G7 V1 h/ w' U+ ]' b: U
  48. #else
    $ f0 T0 x1 d5 \6 O- I# U/ p4 u
  49. #define DMA_PRINTK( x... )1 Z0 Z4 N, d9 y$ b4 e
  50. #define DMA_FN_IN1 }3 m! w9 u& A! o" Q: ^6 d& d& m
  51. #define DMA_FN_OUT* P: a5 M$ t/ V6 I
  52. #endif
      w9 X! ]* w, T

  53. 2 J% I' z9 j8 Y4 {& U& \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 |1 ?% O% K. \! I" u* V- o
  55. #define STATIC_SHIFT                3- e. x1 y+ B3 G3 k7 O+ L6 \' Q
  56. #define TCINTEN_SHIFT               20
    / a' i3 [! \1 c  e$ H
  57. #define ITCINTEN_SHIFT              21
    7 _8 t3 Q2 f3 n9 |
  58. #define TCCHEN_SHIFT                221 \- W* k( j: E0 Z) y5 L
  59. #define ITCCHEN_SHIFT               23, F/ s( I/ t8 I: {
  60. . I* s5 r- J0 C5 \# e# d
  61. static volatile int irqraised1 = 0;; l* t; @" d/ ~0 s: @+ n" K
  62. static volatile int irqraised2 = 0;
    " y! c, b' y! t3 X# P0 D  q

  63. 1 H# Q  L% Z2 C7 i" S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # d% U1 s3 U% {1 L. T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 k) ]$ l% p0 H% }% U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' y- R" F! H: x* k8 n; c; @7 Q
  67. - t9 }) b9 o- i6 C. ~: m
  68. dma_addr_t dmaphyssrc1 = 0;7 @7 g# m5 v$ x5 s9 z
  69. dma_addr_t dmaphyssrc2 = 0;2 N9 T0 V- i: |! F  m! V
  70. dma_addr_t dmaphysdest1 = 0;& |& p  V9 E. s
  71. dma_addr_t dmaphysdest2 = 0;  H" M3 V$ N! n

  72. + S! U( W$ D' ~* H7 X3 ]0 c1 t
  73. char *dmabufsrc1 = NULL;
    3 [! b0 D$ E* ~
  74. char *dmabufsrc2 = NULL;
    - R9 H3 ^! U# C) J" O: A
  75. char *dmabufdest1 = NULL;
    4 R/ N! z8 V4 ]  _8 ?. g
  76. char *dmabufdest2 = NULL;5 m3 C7 ^) a, s% O4 y& n
  77. ! n* P$ U6 g- M" c; U) B* c
  78. static int acnt = 512;5 T, t( w# G( N
  79. static int bcnt = 8;
    8 l2 r) U5 C7 f- m, G
  80. static int ccnt = 8;. v5 ?7 {1 f/ T" N

  81. * N; `3 N$ ]8 |2 ^% b3 f- }$ r
  82. module_param(acnt, int, S_IRUGO);
    , H" z- F3 m* _! p
  83. module_param(bcnt, int, S_IRUGO);
    # a* [# j' l- q! E5 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 t9 o0 a3 r( L% {4 h
! y% \; [4 Y( V1 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& {5 N; d- @# Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, O2 m2 v; A$ N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: a& t# l2 E; R* C+ j! a3 E
% A- v" p4 ~/ C. S" y$ I2 ?: N5 @' a# i
$ A* U& a) U! ]$ V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-28 08:49 , Processed in 0.048208 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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