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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 F! ]0 K4 G0 C6 a, w  z5 v
  1. [code]EDMA sample test application. Y: H6 I  H8 j) M4 c7 E
  2. /*
    8 \$ Z, m+ c0 e1 e$ W
  3. * edma_test.c
    & W  N3 F0 p+ V4 I1 L
  4. *
    ' k  c5 \$ ]; Y
  5. * brief  EDMA3 Test Application, d) I7 a2 k- T, i8 C* Q
  6. *
    7 K2 [# q* A1 c7 }, b  s; @9 H5 f
  7. *   This file contains EDMA3 Test code.% _' E4 @! u8 m8 N2 J; [9 T
  8. *
    ' T: W7 n; P5 e/ T9 y# x& {7 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! {8 U$ \. x1 @( ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, p$ E% V7 o! Z/ E
  11. *         TO CHANGE.! b1 Q5 P) l! n
  12. *6 A( s3 Q* D: a2 K; q6 x' s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + R0 J8 `3 K! r/ A
  14. *( z/ C9 w  C+ `5 K$ A2 p. p
  15. * This program is free software; you can redistribute it and/or
    . k7 W& e8 s: r/ U& ]
  16. * modify it under the terms of the GNU General Public License as- l3 b3 r3 M/ ]
  17. * published by the Free Software Foundation version 2.& p' I5 x, @/ Y1 `- V3 h. N" z
  18. *, u, I: F$ w2 d$ {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # s) A6 q4 Z- _5 R
  20. * kind, whether express or implied; without even the implied warranty
    # N  l: {) Y% \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) |4 o  s9 I" D9 L4 [* ]( u& x" e. ]: j
  22. * GNU General Public License for more details.
    * J6 Q% i! P- x5 k' z2 Y
  23. */
    9 C) J" A! P# e; {7 J
  24. * }0 m; H/ {4 `# Y9 R0 S, N7 u
  25. #include <linux/module.h>
    : L$ T5 I- L( t
  26. #include <linux/init.h>! z) A9 v. F. g- t  G
  27. #include <linux/errno.h>1 `* M, X: N4 ^9 ]( W: ^9 }
  28. #include <linux/types.h>% b% r) w( k# ~2 [
  29. #include <linux/interrupt.h>$ O/ A; m- F$ _# g$ ~  J
  30. #include <asm/io.h>& u! n6 q) X+ ?# c0 T9 Y: I
  31. #include <linux/moduleparam.h>' u" f4 J5 l$ @$ @( k
  32. #include <linux/sysctl.h>
    : p4 D/ q0 Q3 d4 t! _' E% S3 F8 {
  33. #include <linux/mm.h>0 O& ^4 D; I, N
  34. #include <linux/dma-mapping.h>
      s, G+ s1 r2 C% S! r
  35. ! `3 ^  S( Z) e. }: J
  36. #include <mach/memory.h>! a- S( O. m: q. H) ^* y  c
  37. #include <mach/hardware.h>
    * p, e; x1 _# m2 P. S% W9 U% M9 v
  38. #include <mach/irqs.h>
    $ L$ \' R: v6 H5 K+ X0 P- f5 a" [
  39. #include <asm/hardware/edma.h>+ k- F* G& q, H& Z0 F. O0 F5 F, U( G
  40. . V3 Y% H1 t  Y% y
  41. #undef EDMA3_DEBUG5 a9 m) s- h2 c7 t( }  l
  42. /*#define EDMA3_DEBUG*/6 B1 M' v7 g% \9 `( e
  43. + I* }& s' T4 h" u- m
  44. #ifdef EDMA3_DEBUG' ?. k$ I  a* r8 m/ X" p& j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % a3 s/ T; \- p% w9 Z: @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 C) t2 z0 ]% {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 D9 `5 J7 F) N! o% R( ~
  48. #else
    9 \' q; H# d1 O4 y! L
  49. #define DMA_PRINTK( x... )
    * i- E8 M/ b) t4 U+ t0 j- t3 @
  50. #define DMA_FN_IN
    * X7 Q% S. {# r* r2 Q# D
  51. #define DMA_FN_OUT
    & {5 z: o, @: l  i3 k) ^
  52. #endif
    . i# O* _. e$ K- ?4 H! n

  53. & M( |) @2 q# H  K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), ]  L7 ]2 D) x" ^
  55. #define STATIC_SHIFT                31 Z8 a$ k9 z8 y; @6 I$ h$ I' C
  56. #define TCINTEN_SHIFT               20
    ( U" ^6 ?8 A7 |6 f
  57. #define ITCINTEN_SHIFT              21
    & N: s) X/ v% _% X! W* {
  58. #define TCCHEN_SHIFT                22* s% T; `1 l  a, O1 p) q3 B3 c5 p6 m
  59. #define ITCCHEN_SHIFT               23( r0 B9 ~) A0 C, b3 b! \3 t$ L

  60. & Z( B5 K6 `, o
  61. static volatile int irqraised1 = 0;; l) I7 ?$ O/ ?6 H% e& w
  62. static volatile int irqraised2 = 0;
    " l  P) v( R7 E/ H5 I4 l
  63. - u" w& v! P' \4 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 O* k% n# T# E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " l1 `9 k- u) n8 j  N; }* j' C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ~% p' {$ z# _4 t

  67. 0 s. b7 F. o& {9 s
  68. dma_addr_t dmaphyssrc1 = 0;
    7 q+ |* u' D9 Y& o
  69. dma_addr_t dmaphyssrc2 = 0;
    ! L; w* ]* {4 V4 `& h
  70. dma_addr_t dmaphysdest1 = 0;
    ) u- Z5 `0 N. E* U
  71. dma_addr_t dmaphysdest2 = 0;
    2 u& S3 ]1 k; V% J
  72. 9 H% z5 T/ t- n' W
  73. char *dmabufsrc1 = NULL;7 x' O/ {: v1 i6 w7 B. U/ |
  74. char *dmabufsrc2 = NULL;- g# R( ^* R2 @! \( r: g/ a' y
  75. char *dmabufdest1 = NULL;
    % A6 Z  G* G3 G1 ^' W
  76. char *dmabufdest2 = NULL;
    ( j; Q( c0 ^9 Z2 L* r0 R
  77. ! \4 Y& J# {  l5 x  p3 S+ D
  78. static int acnt = 512;
    : d& w+ M! B: H" b6 y+ r
  79. static int bcnt = 8;& i. s/ c. D6 C* B* a
  80. static int ccnt = 8;- j8 f) |% N3 T0 W
  81. ; D6 a7 u" i  Z7 c; b
  82. module_param(acnt, int, S_IRUGO);9 J2 z  K) |+ C# E$ f) p+ B3 F
  83. module_param(bcnt, int, S_IRUGO);! Z( N$ ?9 ~; o1 L: t/ y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 f; o$ {1 j+ r* d7 b) q
& w7 p' R  Z% m) f3 b) s) q8 {) w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( \' q( ]# X1 X) p2 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 e1 W2 S# N" u( f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' B$ p, S0 {2 _) @" B' n4 ^

. h  G3 a& z5 n1 s
5 s2 g! J5 j2 U8 v  m/ d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 11:38 , Processed in 0.046121 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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