OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - N% V8 R+ S' a+ ^
  1. [code]EDMA sample test application
    : E" }: Y! b2 w9 e( W
  2. /*
    + p- m+ {5 D5 n
  3. * edma_test.c1 n! y% y! V1 g) T* s
  4. *% e) K% q- N" y3 f. W4 n: d
  5. * brief  EDMA3 Test Application
    . Z$ i+ b  N, @* A2 p
  6. *
    4 c7 L. t0 o) c$ g
  7. *   This file contains EDMA3 Test code.; V# ^' [8 T, w# I+ |+ F
  8. *# x# ^* D" J. a) c, d( G8 _$ j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / h) d' ?5 m# u6 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 D0 p/ I% u& |
  11. *         TO CHANGE.* j6 f3 n" Z  W6 f( l
  12. *- s1 L) h2 H- o1 T, |6 y6 M9 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " ~7 T! O% w) P* X* W" A* q
  14. *( e1 D% n* e" e& A1 W7 a1 X
  15. * This program is free software; you can redistribute it and/or
    , ]! S$ k5 n" [; t. d) ?
  16. * modify it under the terms of the GNU General Public License as
    # y$ G: n* E: [% Z
  17. * published by the Free Software Foundation version 2.# S  g! ^* |* d# k/ t
  18. *
    # M( y' r( r; X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* [, j) y! Y9 t
  20. * kind, whether express or implied; without even the implied warranty
    # k" x! h3 B8 k5 U( x+ ^( C3 U; Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# t, u; u# J$ V6 o$ x. @% B! H" G) a1 K
  22. * GNU General Public License for more details.
    % ?& p( a0 m% f! W
  23. */
    7 n2 {- q& o4 B, M9 C3 j

  24. 4 Z  I  W# i; _6 t' w( v
  25. #include <linux/module.h>3 `# z/ d. J0 l, ?/ ?
  26. #include <linux/init.h>0 [# s! E5 C! b$ O4 V
  27. #include <linux/errno.h>
    9 g3 d: }- {! N/ ]
  28. #include <linux/types.h>
    4 V/ N0 Y  c* ]2 c5 |7 F6 |
  29. #include <linux/interrupt.h>
    ! r  Q5 o( Z! v4 w& d9 j+ I8 @
  30. #include <asm/io.h>9 L6 u# h0 I  Y" l5 h- n) F! k
  31. #include <linux/moduleparam.h>
    , K) S+ L6 G8 p4 b$ U: w4 }% r# e4 i
  32. #include <linux/sysctl.h>* U% ?, N1 E( v: ?  w; `- o
  33. #include <linux/mm.h>
    ) h1 X+ ?6 z* s
  34. #include <linux/dma-mapping.h>" k0 L+ V- q9 |1 w

  35. 0 ]* X8 f& ?& _0 m9 I2 \4 K" @
  36. #include <mach/memory.h>
    " _& w1 x: u5 u
  37. #include <mach/hardware.h>  w% ]; X6 G$ o7 P0 w5 t* s% `* X
  38. #include <mach/irqs.h>1 l; p; {, C! p$ V
  39. #include <asm/hardware/edma.h>
    ' x9 l0 l2 D6 ]0 v+ [5 \0 J1 y% e
  40. 5 K5 P) J) x; u0 I- \" d6 v
  41. #undef EDMA3_DEBUG$ q) i' _' V6 ~0 X: v+ {
  42. /*#define EDMA3_DEBUG*/
    4 [8 U7 u& s: v, O* b3 U3 ^
  43. # g- O  Y$ d$ e+ P+ c- ~% R+ s
  44. #ifdef EDMA3_DEBUG
    * E% g/ L/ @8 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* n# d* _& Z7 w- }& }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 o2 M/ E, S0 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 C' S) P3 F, _- z
  48. #else
    9 _  x( `0 l$ t& `/ u
  49. #define DMA_PRINTK( x... )- z6 H: u& G; M0 G7 w  A
  50. #define DMA_FN_IN
    : w3 B6 D, \! N$ t0 Q
  51. #define DMA_FN_OUT. r$ b) v1 b! X
  52. #endif2 L( n" z0 {! Q& ~, O) G# R
  53. - L8 m, M. A2 I" ], m+ ]: s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( X+ {) H6 p* K1 q3 R- m0 M8 V' W& _
  55. #define STATIC_SHIFT                3
    % _) A) B! ?, B3 d# Q' `
  56. #define TCINTEN_SHIFT               20
    9 X) O1 j- y3 h3 u: a
  57. #define ITCINTEN_SHIFT              21/ f2 T1 a- b: f: }
  58. #define TCCHEN_SHIFT                22
    + E# Y% }- p8 h6 v2 ^% G8 u
  59. #define ITCCHEN_SHIFT               23& [, b* ~. F' `( M' u, U* t
  60. + S' q. f6 |' @& m, ?, H
  61. static volatile int irqraised1 = 0;. R" |! W& P5 k
  62. static volatile int irqraised2 = 0;* x% d; r* {5 ?, z1 T" c: M6 g

  63. * j, L; U- S- o; x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ r( A! v; A. D. }8 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: d- k. U& v- [. p& k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) f$ b1 T% u( M
  67. 4 T/ J! Z8 H0 ?# t! t, r
  68. dma_addr_t dmaphyssrc1 = 0;
    0 _) d- E# O' q: F" Y
  69. dma_addr_t dmaphyssrc2 = 0;. r: [' h' W9 a# Z1 T& c$ n8 ^2 l
  70. dma_addr_t dmaphysdest1 = 0;
    * v) _8 E; F. z  d! V! C8 y5 _. o
  71. dma_addr_t dmaphysdest2 = 0;
    4 G' W6 L( s. R* {

  72. " m  o4 B$ J5 F3 {
  73. char *dmabufsrc1 = NULL;% _9 w% a3 g& ^' Q3 N* z7 E5 |% c
  74. char *dmabufsrc2 = NULL;
    , F8 c4 B8 F% L9 r0 `
  75. char *dmabufdest1 = NULL;
    7 \9 x+ g7 n; R6 K; q' |
  76. char *dmabufdest2 = NULL;; w; A; d! y! O9 ]0 v' J

  77. . g+ ?% V# v8 |7 F4 [3 U
  78. static int acnt = 512;
    7 [( j& {6 ?* m; E% z& `. P
  79. static int bcnt = 8;' c+ a. j" ]( Z7 S+ L
  80. static int ccnt = 8;
    * A) z6 P' Q1 i3 d8 e: D3 i
  81. 8 _! G( O8 Q! U
  82. module_param(acnt, int, S_IRUGO);* U6 t3 O: F1 T' q
  83. module_param(bcnt, int, S_IRUGO);3 \3 F7 Z6 x/ X7 Q# C3 }' C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 N- u; t( B: w) q; E; `9 Q1 e
/ c+ k/ u" i' _$ X" _+ B; Q$ F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 b7 b% u9 L, p" H4 W( D3 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  _; ]1 T' V( Z" a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 g, W$ ~6 ]8 g; o+ _7 y
* ?2 Q1 m  `: g$ d
- t3 d' W0 R3 C$ w+ G0 a2 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-3-13 17:02 , Processed in 0.051075 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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