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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Q. N/ ~, T, z+ x
  1. [code]EDMA sample test application- S# C9 I4 d3 z) S
  2. /*
    - C& @* _2 N, N1 b: M
  3. * edma_test.c
    ' K, a2 ?( V  u4 L! J* {
  4. *
    ' x& Y1 S/ y  d% i2 I
  5. * brief  EDMA3 Test Application
      F1 ^" m+ }  @0 _: k  j
  6. *, n7 L' N4 k0 _( \( J/ o: l. N6 s7 p
  7. *   This file contains EDMA3 Test code.
    % {" r# v0 T! a, u/ K% }6 x
  8. *
    1 W7 M* R/ v- e8 l4 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 g/ p% W* L* i5 E, E4 f% Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ h5 h0 I: V. o& B2 t
  11. *         TO CHANGE.  b! x9 H9 k4 P+ h
  12. *
    # x% G' q: f  w* y* J' v+ ~  |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! @% w/ [" B2 ~
  14. *6 O9 G% j7 U: ?" I5 ]
  15. * This program is free software; you can redistribute it and/or
    5 ^1 ^/ ~- f3 x/ I1 R8 P. I) I& p
  16. * modify it under the terms of the GNU General Public License as/ ~" d' l% h' T+ X$ g) {
  17. * published by the Free Software Foundation version 2.$ O6 Q: U$ X' H/ ^9 U4 A7 X' N
  18. *% {6 `8 M+ `. B9 |2 {2 [3 u: P1 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 a/ O7 u# u; [/ e+ p: x
  20. * kind, whether express or implied; without even the implied warranty( K/ ~- L0 n6 V0 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 g+ k( A7 t7 e) _/ Y; @
  22. * GNU General Public License for more details.
    ' z/ F3 w) S! I$ m4 Y. U2 X
  23. */
    % N5 O% ~3 E. G, {
  24. 7 L7 F* R- S# D5 M
  25. #include <linux/module.h>, @$ h( d8 o2 x5 Q5 e; s
  26. #include <linux/init.h>- R& b! d! ?  y' s
  27. #include <linux/errno.h>. F  I$ T+ v, K1 D$ }
  28. #include <linux/types.h>
    $ p; W8 ?2 o  [7 k  U/ Q5 _) I
  29. #include <linux/interrupt.h>7 D# I) v. a  _  y/ `; f# f" o9 k- |
  30. #include <asm/io.h>; }0 C1 s. {2 Y( d$ |) q% `
  31. #include <linux/moduleparam.h>
    1 s, U8 v& [! ~3 S6 z5 u
  32. #include <linux/sysctl.h>
    % z: n" i; q7 a& ^
  33. #include <linux/mm.h>
    % C# @! w4 f& }# k8 ^) ^1 m
  34. #include <linux/dma-mapping.h>
    * j$ V8 l! Q' l" F
  35. 1 Z1 \* Z/ D# y4 O, k
  36. #include <mach/memory.h>. W$ F! s$ q' s0 U
  37. #include <mach/hardware.h>+ X2 N: @# _% N, G  X
  38. #include <mach/irqs.h>6 k1 R" p* S) Q! S+ Z* c. e; q
  39. #include <asm/hardware/edma.h>
    2 F. u3 y7 V; _- ^+ ^: b6 I
  40. 6 b% q& o9 Z, M4 n8 K, h  w7 d# q
  41. #undef EDMA3_DEBUG
    " k+ @) T" M; w3 a
  42. /*#define EDMA3_DEBUG*/
    & J$ `. W7 z5 y  ~

  43. & ^6 q9 s6 Y2 Z$ V6 b- S/ L/ ^" S
  44. #ifdef EDMA3_DEBUG# V) a; O3 e: J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 k2 i) u' V5 n) n9 u. ]9 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 B9 B" s3 }( k) G6 J% U* V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  G2 W" c$ c* {, `
  48. #else1 J( }* ~% X  g0 E. I
  49. #define DMA_PRINTK( x... )
    5 ^3 X8 x, B0 L- P& H
  50. #define DMA_FN_IN
    8 d6 [8 H5 Z. \7 y# r5 w
  51. #define DMA_FN_OUT
      ~6 V% F6 r- S$ W/ O( Z4 }
  52. #endif/ e% \' [' {( d8 k
  53. ' z5 ~6 X4 [9 O% e) C& M6 I+ a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / p6 H0 e, y* O3 L* p! g. g
  55. #define STATIC_SHIFT                3
    2 w5 z5 g& N/ z5 k
  56. #define TCINTEN_SHIFT               20# d1 w( y+ a- s) u- \0 @  M
  57. #define ITCINTEN_SHIFT              21
    . v9 S& y" t' W
  58. #define TCCHEN_SHIFT                22
    ( ~3 y9 }' O+ g. [7 N9 K/ T
  59. #define ITCCHEN_SHIFT               23- T: x& ?( U7 `+ }$ m; h# q4 r5 P

  60. ; ]( Y* ]! \3 O6 d& K8 v$ ?
  61. static volatile int irqraised1 = 0;$ E- a) [% e' H( y: y
  62. static volatile int irqraised2 = 0;* J) o9 \4 R) S" x+ x" [

  63. 4 a; s$ I- R4 {4 E. j2 H; |1 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* w9 u2 ~& S. ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , }# M# L+ q' ]$ a) W; [8 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + g+ V  H/ g# P  W" D9 h
  67. 3 r' X0 Y5 \2 ~: |
  68. dma_addr_t dmaphyssrc1 = 0;$ x) q( _" ]+ o' J# S- w
  69. dma_addr_t dmaphyssrc2 = 0;& z' m4 X% N6 X2 A7 I
  70. dma_addr_t dmaphysdest1 = 0;
    3 F9 E" x3 [' `/ }& V. q
  71. dma_addr_t dmaphysdest2 = 0;) K+ `* C* T; ~. W# i  r2 k3 r( e
  72. * h4 P4 S$ N8 |  J. u
  73. char *dmabufsrc1 = NULL;
      X' q, ~3 R. v; n! r4 C
  74. char *dmabufsrc2 = NULL;# u8 d3 B8 q( W( r' J2 M- a
  75. char *dmabufdest1 = NULL;: Q1 V+ S: M2 b: k$ t+ E; @  m, ~  l
  76. char *dmabufdest2 = NULL;3 u6 m% O1 U& q, V

  77. 3 u% ^5 K" e: E  ~/ E/ ^4 h
  78. static int acnt = 512;; h) w; A2 T! u( A  ~
  79. static int bcnt = 8;
    . L/ W* L; W1 l  y9 t9 `9 E1 b
  80. static int ccnt = 8;
    1 U% n( i0 q0 t* l0 l, a

  81. # l. c2 k+ ^5 }7 A
  82. module_param(acnt, int, S_IRUGO);
    # P  g8 {/ @# u( p1 N. ]8 W
  83. module_param(bcnt, int, S_IRUGO);4 j9 t' y  y6 x' [# j2 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. u, Y: e5 Q( X* J! c+ r* z/ ?+ F
1 s8 i- j" F2 R, X# c5 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( ~7 _0 L$ ?4 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 C7 N5 V4 Y& z0 o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 @; t5 m0 f& m8 \* Z

, o, o( C; i$ w% n% d4 P0 u9 y! V" M. S9 Z1 \7 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-9 07:35 , Processed in 0.033927 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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