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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * U: h& D8 `# i4 \0 V
  1. [code]EDMA sample test application
    + S( Q- t8 N  S% c& o" C! }& A8 ^
  2. /*
    . J1 H9 s) t( k# B- _
  3. * edma_test.c' B+ X1 R) J4 e$ C: a" b
  4. *& l7 F1 q$ d# {$ ?1 d
  5. * brief  EDMA3 Test Application
    * |5 ?+ F  M# \8 o& O) Y# |
  6. *5 U5 n- [: U5 k
  7. *   This file contains EDMA3 Test code.
    ' g. F% z* @, l4 P1 f! ~) Z
  8. *
    4 Q. ^  d$ o* N5 X8 {3 }3 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- m, W; I( ?9 ]; ?" f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ {6 D: v0 ]$ D
  11. *         TO CHANGE." V' A& v+ a3 r0 t8 ]) q
  12. *! M/ j; K# o9 h3 l1 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) Y" P; A  g) }
  14. *
    0 p& e- V" M& K' I7 l: W
  15. * This program is free software; you can redistribute it and/or3 ?# F& e/ m6 z! C8 x: r) P
  16. * modify it under the terms of the GNU General Public License as
    2 U& t/ I3 ]# Z' A( |
  17. * published by the Free Software Foundation version 2.
    4 u9 `. p% o- _4 E+ u- E
  18. *
    % X) s) V; @) ^. d- l  Y+ V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ B0 _& m; a' d
  20. * kind, whether express or implied; without even the implied warranty
    9 A+ u3 r6 ?3 e2 n" s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 L3 ]& N( F7 ^# L6 T
  22. * GNU General Public License for more details.
    ) Q4 m* n* S  O
  23. */
    , C, W6 L8 |+ N  o

  24. 6 A9 s% s1 b* I4 T! q1 D
  25. #include <linux/module.h>  F  M8 @( B" R& |
  26. #include <linux/init.h>
    ( \2 v: B6 }- O. _  a
  27. #include <linux/errno.h>; L* D9 ?" f4 [! q6 N2 V$ x
  28. #include <linux/types.h>/ M: a1 D7 f4 m- p
  29. #include <linux/interrupt.h>
    7 |$ I4 Z9 e  T% V- b/ F" U5 _. n2 S- ?
  30. #include <asm/io.h>
    8 ~6 _( z; i! t0 K, ?
  31. #include <linux/moduleparam.h>
    ) D8 n/ g. s+ [- t; i
  32. #include <linux/sysctl.h>/ V& a# ~9 N! ?( H+ m2 n& b
  33. #include <linux/mm.h>: a" S! y! u4 y8 w" @9 c
  34. #include <linux/dma-mapping.h>! O' _$ b9 K+ K4 `. e  ^* V

  35. 5 G, f; P- W/ z4 e
  36. #include <mach/memory.h>
    8 o, g* ^6 j2 |& a# H
  37. #include <mach/hardware.h>
      y, p" N# X0 c6 k# x$ v5 J' b  v* O5 l
  38. #include <mach/irqs.h>
    6 ]8 R5 w7 f! J* M( o- @& ?+ n: Z
  39. #include <asm/hardware/edma.h>
    - w6 i* I/ j0 D) Q
  40. 3 C  v+ k7 }0 q" m+ x6 Y$ \8 _2 Z
  41. #undef EDMA3_DEBUG
    , x$ h6 b6 X) I6 S) G# ^6 }
  42. /*#define EDMA3_DEBUG*/
    ! p7 p: \6 |4 H3 V6 n) Y- d
  43.   v$ J/ F5 O. ^* G
  44. #ifdef EDMA3_DEBUG
    & j" |% ]7 i0 V; u. {# Y# B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; _3 x! ]: Y$ ?( U5 K7 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 H) o' G7 D7 D/ Y3 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) I% \4 U8 y# m
  48. #else
    2 x0 |& P3 i. ]$ h9 v  R' B# `
  49. #define DMA_PRINTK( x... )* J! K3 a# v1 [) x- T
  50. #define DMA_FN_IN
    5 {; i* |- A* R2 u9 a8 Y8 M3 X
  51. #define DMA_FN_OUT
    3 D0 V$ y* R+ ~! @/ O' ^+ k4 G0 x
  52. #endif, G% q8 y  K0 [4 p/ A5 \- s
  53. % T- `. z0 [9 H3 U. o' P( F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ ~3 S$ [! W8 O
  55. #define STATIC_SHIFT                30 v, [! y/ [3 }% T( |4 C  ~. h7 O
  56. #define TCINTEN_SHIFT               20
    - v/ C; h# z4 M7 T
  57. #define ITCINTEN_SHIFT              21  k- ~' U% }3 \: u6 M/ ?
  58. #define TCCHEN_SHIFT                22. E# H, `) P* ~  M% T2 g6 t
  59. #define ITCCHEN_SHIFT               23
    : j# ]1 q2 l% _# i' c* x
  60. 7 Y  a& o1 ?% U- f3 q( k
  61. static volatile int irqraised1 = 0;+ i# `8 q1 S9 Q, V4 ^( u' q9 A6 I
  62. static volatile int irqraised2 = 0;9 h1 ?- E( l. G5 [8 O7 @) a
  63. 8 u, O1 U8 ~1 s9 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 J' p4 g$ V6 E  _! w. W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r" |  I7 ~4 h9 {( }" U$ W4 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 T( V4 g% |: J3 L. G; }0 Z

  67. . m1 N0 H7 u( H& r$ ?3 U
  68. dma_addr_t dmaphyssrc1 = 0;
    ' Z: G- f- f+ B+ O: y
  69. dma_addr_t dmaphyssrc2 = 0;' Z  _/ ^: l2 w8 e& }9 P# E! d; D9 ~
  70. dma_addr_t dmaphysdest1 = 0;6 W  V1 |* l0 r8 C, _* V9 K
  71. dma_addr_t dmaphysdest2 = 0;& W3 Y  L+ T/ z! u

  72. ! m( o, e; F6 H0 I
  73. char *dmabufsrc1 = NULL;
    ! X: s# c/ t. V# R1 F( |0 C7 l
  74. char *dmabufsrc2 = NULL;
    ( S) i, U+ U/ B/ b9 b4 ]9 R
  75. char *dmabufdest1 = NULL;, h  |! b5 f% g5 e
  76. char *dmabufdest2 = NULL;8 a0 u+ D- q" u& F- m: U# O! ]0 |

  77. 8 e; _/ i* J2 z5 i2 }. T: r
  78. static int acnt = 512;7 K6 w. e$ |  S1 t
  79. static int bcnt = 8;
    ( C! d  W$ G, ^1 Q: G* V
  80. static int ccnt = 8;. J0 M8 d' X& Z4 U

  81. & P* Y1 i6 T# w9 U1 P* D1 c$ ^( G
  82. module_param(acnt, int, S_IRUGO);
    2 h% N+ B* y% S% m2 H
  83. module_param(bcnt, int, S_IRUGO);7 U0 `: {0 Z' `, B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 m4 {. D  w9 j/ U4 C5 Y/ Y" Q7 G# w4 Z' U7 V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# ~5 I2 C2 O; M# k: x2 Z* l
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 g8 |, T( x6 n' o! z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* F1 F  j7 v# F0 k, r
9 L" b5 g, C& G& ^+ g/ H! ^& z5 r
8 q, J0 A$ s4 k) f: K4 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 07:55 , Processed in 0.046639 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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