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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- f* o8 Q( Y7 W7 u2 |! G
  1. [code]EDMA sample test application
    - L% h* E% w9 K1 z$ W
  2. /*( a; s  s! L. N" G+ J- f0 V
  3. * edma_test.c
    / `5 r$ i0 u; M# j: I) A! z) J& g
  4. *
    . N, g2 c! P0 i+ Q
  5. * brief  EDMA3 Test Application
    " f8 p! I( E7 p1 `; X
  6. *3 x0 h# H# X. V, ?% F
  7. *   This file contains EDMA3 Test code.
    ( n2 V" \7 w8 p$ l- z
  8. *+ d% N( j* E  v# i9 e" R4 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! s. W2 b# k! |4 c) U& d  `4 W5 j9 P* C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 X$ c/ U# \* ^7 e6 E8 d4 P
  11. *         TO CHANGE.: j. v3 M" J! l  x6 U7 w6 I
  12. *" ?! v: x% S: F- Q3 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # ]' T- w# R' w9 t" E
  14. *
    6 V- n. w( C' h# c
  15. * This program is free software; you can redistribute it and/or
    0 O, N) P# u* h7 I
  16. * modify it under the terms of the GNU General Public License as
    4 U8 J. ?. D  A) f
  17. * published by the Free Software Foundation version 2.
    * L# s+ n" v; G
  18. *
    ' v5 D% e' l9 u& d4 u9 j6 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * t- w7 Z( P8 t$ Q; b
  20. * kind, whether express or implied; without even the implied warranty; z, a- k. \( W: D+ P' s5 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 `. C$ h; o9 A( h
  22. * GNU General Public License for more details.) ]! A. I6 u: B# @( w% p% n
  23. */
    / y% ~" p$ [) _0 S, t. f

  24. : Y4 G8 j, z( `4 w) \. @
  25. #include <linux/module.h>
    : T+ B, l8 E5 g; |' U, N: Z& \
  26. #include <linux/init.h>
    % v, G$ }% I/ h! b& @
  27. #include <linux/errno.h>
    % j' _$ x( }* s
  28. #include <linux/types.h>
    6 _0 O. ?, F6 u+ C3 Q6 t
  29. #include <linux/interrupt.h>
    : I5 h! ^  W5 ^* ]5 ]
  30. #include <asm/io.h>
    , k# J' g; d: \9 Z
  31. #include <linux/moduleparam.h>
    4 E( b4 |" b- M2 M
  32. #include <linux/sysctl.h>
    + {  e# Y6 N2 s9 Z2 U4 F" s* E
  33. #include <linux/mm.h>
    & m# O7 h/ \, s& R: b/ o
  34. #include <linux/dma-mapping.h>
    ) a5 |6 L+ T" z1 |7 ]2 @9 l8 ?

  35. # ^* _5 k& n9 ?4 x5 P* Z, K
  36. #include <mach/memory.h>
    8 a7 M  D" x/ r2 B" G1 }
  37. #include <mach/hardware.h>
      f7 o! G9 G( E3 _
  38. #include <mach/irqs.h>5 w  B9 I! V0 Q  @
  39. #include <asm/hardware/edma.h>
    $ M- Z/ p! d0 w2 i( p2 G
  40. - j. G; K$ m- i3 n
  41. #undef EDMA3_DEBUG# h$ v* e! W3 [, T% E+ N: L
  42. /*#define EDMA3_DEBUG*/
    / ^6 f1 t2 e: b* U7 J) y2 \1 v
  43. 3 D6 {' W. x4 }; N' ]
  44. #ifdef EDMA3_DEBUG# q- G7 y4 ]0 f: I; T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 g. w" E8 x  V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# y% q" R+ z: U$ d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , z* j$ g  E5 i$ U
  48. #else
    7 d6 T1 r' t" I8 z
  49. #define DMA_PRINTK( x... )
    . C' W5 o5 W3 ]/ b+ X% Q' X( n8 ~
  50. #define DMA_FN_IN
    ) t- x+ a& x2 l
  51. #define DMA_FN_OUT
    ! X2 Q4 N4 K2 `  l9 p% L( X" m6 [6 h
  52. #endif
    0 N4 O; \4 O2 L) a3 Y1 h

  53. # ^2 q+ c" z/ [3 K: T/ Z4 K  L$ S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 T3 u0 a5 J5 G, c2 f
  55. #define STATIC_SHIFT                3! N9 Q. P, z& h2 a" @
  56. #define TCINTEN_SHIFT               20* d; o8 A+ j* H+ @
  57. #define ITCINTEN_SHIFT              21
    # B/ m) o6 @) `& |
  58. #define TCCHEN_SHIFT                22/ S! P' X' Y  r, p' V  N
  59. #define ITCCHEN_SHIFT               230 S. f+ k1 w7 Q  Q+ A

  60. 8 g  v+ T3 H+ M' n2 u
  61. static volatile int irqraised1 = 0;* c$ Y, U! K9 T; l* j$ s" t
  62. static volatile int irqraised2 = 0;: A, l7 B7 a5 F1 v4 ]

  63. 9 m0 }0 }9 {1 O8 f. j! U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# t* ]" `$ o6 ]" \# q+ J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ {4 M& A; ?: O* T8 M/ U+ H5 r( F/ G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) n& w' l+ q+ r: [, o

  67. + T9 l/ |$ V5 A0 {7 X, A: S8 p
  68. dma_addr_t dmaphyssrc1 = 0;. `" T5 R3 \& X" B" x, S) d
  69. dma_addr_t dmaphyssrc2 = 0;8 `2 q0 h8 D( H5 s
  70. dma_addr_t dmaphysdest1 = 0;
    " G6 K. W* i+ ~$ ]$ Y& b
  71. dma_addr_t dmaphysdest2 = 0;$ ]( |: `" |4 _& x- W- |
  72. 7 ]9 d, c' u% W. z; C1 x
  73. char *dmabufsrc1 = NULL;" M8 G3 [5 j1 N
  74. char *dmabufsrc2 = NULL;
    7 e4 M* k0 }$ E* n- p3 o1 v/ }& o
  75. char *dmabufdest1 = NULL;
    0 Q8 p/ e; \# Y6 \' y' Q
  76. char *dmabufdest2 = NULL;" k5 n# }1 T5 r: e  I: C6 @8 C) A
  77. 2 q" i8 h/ `3 i4 o$ m# M. F
  78. static int acnt = 512;
    & c7 c( Z6 O4 ?/ A2 [
  79. static int bcnt = 8;
    % ]* T) {8 ~! d+ E
  80. static int ccnt = 8;
    , v; I3 d0 B" }2 g7 }& Q. w: A

  81. ; @+ k- E% o9 o
  82. module_param(acnt, int, S_IRUGO);
    4 R1 J" {, B$ w( Y
  83. module_param(bcnt, int, S_IRUGO);( ?9 t/ r5 `* o+ S" c8 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! z/ L2 A2 M' I. I
' }# |$ z$ w0 k6 ~9 o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' A! r9 d5 H6 q( y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! x8 s' n+ G5 O2 x7 }6 x5 c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 L1 L. ?( S! k, K' U8 U1 ^+ f

% Y% x* l# V, W6 S
% v0 b+ ~. w( `8 B9 @% W& Q) @- I' Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 19:20 , Processed in 0.036794 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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