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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ ^5 V0 ?" E: G: d
  1. [code]EDMA sample test application; p! o; D: _6 Z8 F  b5 t- i
  2. /*: \* i! D, i; y0 Y6 o
  3. * edma_test.c
    : @6 E. [/ I0 }  k
  4. *
    5 z8 D) s7 p& c- P$ Z
  5. * brief  EDMA3 Test Application
    * a/ K: |; X4 t+ h/ |; x
  6. *
    5 y9 z2 P# z1 j, E& G$ y
  7. *   This file contains EDMA3 Test code.. z" e- T1 J! s7 u
  8. *' @$ j3 e5 ]) X$ h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, f! D/ S: O  d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ j8 t2 _: I7 V/ e. D
  11. *         TO CHANGE.
    + M4 f- x. M, ?6 ?# g2 p" R3 G
  12. *
    . Y9 [) c4 ?1 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! W8 S0 ?  l2 x% M9 O. s
  14. *
    6 o9 f6 r! r/ d+ T# Y
  15. * This program is free software; you can redistribute it and/or) q3 r: y" i- l
  16. * modify it under the terms of the GNU General Public License as- ]8 L6 |' l. o
  17. * published by the Free Software Foundation version 2.0 S; |4 _! p+ o3 e7 z
  18. *
    6 c) F/ r" j0 O8 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 J9 M8 V+ T, _2 P, S! q; o
  20. * kind, whether express or implied; without even the implied warranty2 O0 m  z4 t! W' I# z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 _  Y2 R0 j$ Z* \; @: G2 h
  22. * GNU General Public License for more details.
    ( y, C: p( [2 A" c) x$ M; u1 ?3 l( D6 C
  23. */; g7 M+ S: }1 s. G2 a0 }- q

  24. & x8 d. E* R; f$ b# A1 `. ^
  25. #include <linux/module.h>
    7 E( ^1 o: R- B: l) L* b* H' u
  26. #include <linux/init.h>; P* ~; I" I8 o' N9 i& A
  27. #include <linux/errno.h>& K0 J  T6 Z; J8 H$ e  G
  28. #include <linux/types.h>6 l) }) V  l% x6 Q
  29. #include <linux/interrupt.h>
    ! b! r! ?; L5 j' [- Y5 N
  30. #include <asm/io.h># p6 c  q0 j' @1 r; d! m
  31. #include <linux/moduleparam.h>3 Y( d7 _  h0 E5 }1 f
  32. #include <linux/sysctl.h>
    : @# }" r2 F& [3 n
  33. #include <linux/mm.h>1 W8 R" \9 M; p- m; T/ b
  34. #include <linux/dma-mapping.h>: @9 l2 H4 M9 r, @) t5 f2 o- D

  35. 6 @/ }) d' \/ B
  36. #include <mach/memory.h>
    8 h) ^6 m' C/ M0 U
  37. #include <mach/hardware.h>, Z7 D7 Y8 e( [) @% c
  38. #include <mach/irqs.h>
    - L, w  S  K1 z3 b  t" t: O
  39. #include <asm/hardware/edma.h>
    / m; k: w3 s2 F3 G* n. n# ?
  40. ! @+ ]( D  a4 n  G9 L0 u: c
  41. #undef EDMA3_DEBUG5 _+ E& K, k4 g; g' Q7 f
  42. /*#define EDMA3_DEBUG*/0 S* Z% P% x' ~+ J6 ?; q+ F
  43. : Q5 ]7 B, ^' {- @2 B
  44. #ifdef EDMA3_DEBUG) e' J5 N) p4 t0 W3 k1 Z3 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( Z( f% r/ \1 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); G+ ^. @; \; P$ W# F7 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' K% d; _4 B6 U
  48. #else
    5 m% u6 j. h  l- i! V
  49. #define DMA_PRINTK( x... )# R' v' Y+ F. P8 K$ e
  50. #define DMA_FN_IN2 |7 }; ?1 G, T2 }# H$ |5 }* C9 x
  51. #define DMA_FN_OUT" C3 d  Y7 y3 N- |6 X
  52. #endif7 n, @% Y" F! U" a, ~8 [) s/ p

  53. 4 p" n1 s. t- X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 J2 B. f, W3 E, K" h
  55. #define STATIC_SHIFT                3
    : _$ W3 S5 _5 Y; |0 \9 X' v9 U) q
  56. #define TCINTEN_SHIFT               20
    2 Z2 q% l6 j3 Z9 l( c) n) H
  57. #define ITCINTEN_SHIFT              21! A/ D* E. X: n& F, H! S. x8 v- T% _6 U
  58. #define TCCHEN_SHIFT                229 g1 V; O0 r& v( @2 B! X4 g
  59. #define ITCCHEN_SHIFT               23$ r! \& H8 D- Q8 D# C& c

  60. : b( O2 [, j. @6 M2 p# X
  61. static volatile int irqraised1 = 0;
    * \; P/ i0 c+ M( @, n, ~
  62. static volatile int irqraised2 = 0;7 i6 s7 Z: E+ p0 a

  63. ' L4 i$ A% O' v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 W$ p+ O1 a! |, }. D1 D7 B) v  c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% `# s' h5 ]- J1 m' z1 G% e+ }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 s( F" R1 A1 K7 D3 h  d
  67. ' c2 d) O+ u8 O7 ]: e
  68. dma_addr_t dmaphyssrc1 = 0;# F; B0 [  Y7 c0 q! I' o* T
  69. dma_addr_t dmaphyssrc2 = 0;3 @3 K9 U/ d1 ~; K; ~
  70. dma_addr_t dmaphysdest1 = 0;
      L+ S9 s9 t% e: ~* O
  71. dma_addr_t dmaphysdest2 = 0;
    / E* z0 A! L: z3 ]

  72. ( w7 N& s- v  N7 n5 H
  73. char *dmabufsrc1 = NULL;
    - v9 U- m! x! K5 N
  74. char *dmabufsrc2 = NULL;, E/ i0 M0 |$ i6 q8 I
  75. char *dmabufdest1 = NULL;
    $ X4 i$ s& P6 f0 ?- W- C9 G" ~2 ~
  76. char *dmabufdest2 = NULL;7 _2 \0 D7 E3 h0 z5 `! v+ B5 e
  77. ; r- m) Y/ u% h  h- n2 d
  78. static int acnt = 512;# d5 `4 q# N- u" V7 P6 l% v5 i
  79. static int bcnt = 8;! L$ Q) V8 T; [- H' F9 y! T5 J- r
  80. static int ccnt = 8;
    - P# ^: F$ m6 t  {& D' i
  81. 5 E7 @& j+ j* \5 Z" k7 P2 y
  82. module_param(acnt, int, S_IRUGO);
    ' |. j! U; d8 \4 t# A
  83. module_param(bcnt, int, S_IRUGO);
    8 [' p$ _( l. H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ d+ ?4 y/ U  ~/ C9 v4 F# e& d2 E& W2 e) M) f; a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% T7 ~6 I9 Z2 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! E4 Q$ x* n0 Q  p! M) A& T6 A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 \5 h2 Q0 H+ P4 F' ?

, b9 }5 m* K# C- b) n3 E4 @
: y' x8 G9 y1 B  p/ |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-29 02:34 , Processed in 0.038758 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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