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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - u/ p3 m6 h) l- A& Z
  1. [code]EDMA sample test application
    $ R# k1 b! Z# g7 K- M8 K7 m6 O
  2. /** }& I0 a( U7 \. F9 p" @* s
  3. * edma_test.c( f2 I0 `! v9 d
  4. *9 N$ y% y% A* P) S. o
  5. * brief  EDMA3 Test Application+ w, F" p- `  n1 r" T# t1 ^, k4 }
  6. *0 ]/ o8 b: {% h5 a" o9 U
  7. *   This file contains EDMA3 Test code.0 l3 S  n' j9 r
  8. */ j% [; h+ |8 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 Y) |! l0 |+ H$ G+ R! L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 }/ M- \1 M3 D9 i0 K0 o. W
  11. *         TO CHANGE./ m; B# u: [7 y9 z- n. V/ W
  12. *
    6 \& k& c2 I  A* ?2 b8 v. K: {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; f; K' _" h, d- q- `( c
  14. *
    2 d2 a/ V2 h$ ^+ i( S( y" D
  15. * This program is free software; you can redistribute it and/or% |9 E3 L/ V& c2 S0 k
  16. * modify it under the terms of the GNU General Public License as, n8 |  Q$ X# j0 h
  17. * published by the Free Software Foundation version 2.
    0 k) E/ [9 ~/ S) J. [
  18. *
    : a2 k6 S! R- L( m' {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 P* V' m% |6 `7 c
  20. * kind, whether express or implied; without even the implied warranty
    " l5 L! Q3 C9 X& A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % l& @, b7 R3 s
  22. * GNU General Public License for more details.
    ' C" _# G- v2 ?8 z
  23. */
    # u. W! v/ [% v* K- @) _& E
  24. ) R- y) p1 c8 |1 p
  25. #include <linux/module.h>
    " q! |! X) ]9 {+ c7 y. ]5 @9 r
  26. #include <linux/init.h>
    # U1 D9 [! O( q* C5 b
  27. #include <linux/errno.h>
    3 A# R5 P' X1 a; Z5 B& T
  28. #include <linux/types.h>3 O5 ]5 D( g+ G7 }. x! y
  29. #include <linux/interrupt.h>) x1 u, f* P; c$ H# X$ x
  30. #include <asm/io.h>  O3 N0 `2 L7 A+ k
  31. #include <linux/moduleparam.h>
    * y. \( e3 w) ^+ @* g6 z0 P7 f8 z' ?. v
  32. #include <linux/sysctl.h>
    : A0 B7 `/ o$ F- ~  J( m" r
  33. #include <linux/mm.h>
    % g* d0 {, S. q* H' K0 N, c, w3 D
  34. #include <linux/dma-mapping.h>
    1 V  p" s5 A/ N- A
  35. 3 w- p9 Y! Y5 J: o
  36. #include <mach/memory.h>
    # h! \. {- m- r" d; Y8 G6 Q
  37. #include <mach/hardware.h>8 X( V6 C6 d1 q8 Z
  38. #include <mach/irqs.h>
    5 C0 ]) }. A( K+ z# {2 b
  39. #include <asm/hardware/edma.h>. G% S  m' \  x6 a/ o

  40. 7 ]& N) r" x5 a, v
  41. #undef EDMA3_DEBUG
    + @1 X! v, k, I+ u0 k0 s
  42. /*#define EDMA3_DEBUG*/
    & K) ]4 p9 h7 w, x1 c6 m6 H3 l
  43. / D/ ~7 c& d  y2 _5 J
  44. #ifdef EDMA3_DEBUG
    6 f5 |: a, V* M7 ^( m/ O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% R8 U9 T% F- m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      `4 w8 \& i7 m7 B& Y( M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " M8 \2 I+ J$ w% ^; Y9 y* l
  48. #else; j, F" ]+ m' y
  49. #define DMA_PRINTK( x... )" l7 p4 [( [; l' K$ ~
  50. #define DMA_FN_IN
    . t* o3 f, `3 L! B3 J7 J% z
  51. #define DMA_FN_OUT
    ! ?  ~& h4 ^0 G: D
  52. #endif6 G/ ~8 s! H! E$ x" ~
  53. * p$ D: x. v4 r0 P* E2 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / e5 g! U: l% p1 ]$ r
  55. #define STATIC_SHIFT                3( }% {9 }. [; z) [7 c. D
  56. #define TCINTEN_SHIFT               20/ [( W" i9 l2 t7 C# x* |: L0 K
  57. #define ITCINTEN_SHIFT              212 H/ J6 j3 z2 D; s3 [
  58. #define TCCHEN_SHIFT                22
    : I8 n. J+ j- t0 L
  59. #define ITCCHEN_SHIFT               23
    0 }! N# @" \$ r& k
  60. 2 s4 ]% h2 O1 q
  61. static volatile int irqraised1 = 0;
    % N9 U+ @4 r9 K2 y5 s4 Z
  62. static volatile int irqraised2 = 0;5 i# t* {' O. [1 H1 z" u; j, e
  63. 3 E# d" P( H' l5 D! P* m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( b- I/ K5 Q8 e/ l* N3 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 u, {6 w7 z& P$ w* w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / U" M& j9 K9 F- ^7 ?; g! m

  67. " `2 R. ^/ e" ~! h2 U
  68. dma_addr_t dmaphyssrc1 = 0;
      b9 x6 a) q4 a4 f; v9 {* O
  69. dma_addr_t dmaphyssrc2 = 0;
    : V5 ^3 u0 G) x3 M' T! E" h# `
  70. dma_addr_t dmaphysdest1 = 0;
    - i. J5 E9 t+ e1 S( g
  71. dma_addr_t dmaphysdest2 = 0;# W* V$ `. y& h2 A- X. S: h- Z! N
  72. ; B, |- t2 M" b7 l+ B( r: B
  73. char *dmabufsrc1 = NULL;
    * @  T# [$ T" V
  74. char *dmabufsrc2 = NULL;( z) W6 e. g7 e) U- p/ \- m0 K' L
  75. char *dmabufdest1 = NULL;+ m( g1 {; o5 Z
  76. char *dmabufdest2 = NULL;
    & U) l: y) l: |; P! e8 t1 X- G
  77. : {5 t9 f5 p# C: d7 h
  78. static int acnt = 512;
    $ u1 g+ R7 w; e6 P
  79. static int bcnt = 8;% n2 X9 N2 e7 H5 `: D! o
  80. static int ccnt = 8;! M  f( U0 p8 e) m6 l! R
  81. 0 Y6 t, c  q4 A3 ^9 F1 Z" y
  82. module_param(acnt, int, S_IRUGO);& U/ C! |! ?8 k; F4 {9 [7 ^7 B
  83. module_param(bcnt, int, S_IRUGO);% a# _. P9 S1 F! W7 \. Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% `3 t: m1 Q3 J
6 [' V. Y) y! p# J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# d2 M' x1 f5 B/ a( F) }8 c) iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, f! M: T- X5 U) c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; q0 q+ o& o; X* K' c3 C* r8 s" g4 {4 l6 L

* ?2 B5 x8 A/ s, J( Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 10:54 , Processed in 0.038085 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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