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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 r1 m% N* D1 d, g+ x& G
  1. [code]EDMA sample test application1 f+ K$ }9 s) ~; ?& j9 r
  2. /*
    8 q5 F: G. P' ^5 j5 L; N* d/ S* _/ b5 v
  3. * edma_test.c  R" W' F8 A8 r0 T% o* I- E3 M" }
  4. *
    $ t3 U5 X7 Y( z6 i1 L$ p$ }
  5. * brief  EDMA3 Test Application' n  b9 D; D1 j2 `7 }' T  m
  6. *
    ) e# P* D* G! A
  7. *   This file contains EDMA3 Test code.
    - }# [' E  b/ y# v5 z: H
  8. *9 [8 c3 z9 c" e+ }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 b/ d7 X( u- p$ ]! w8 m7 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + N: R; @0 Q9 V* B6 U) {( M8 _. \
  11. *         TO CHANGE.
    0 d' O3 f, b8 A. C5 B9 [
  12. *7 f/ n  E4 u" C, I' x9 e5 f$ I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 w7 `0 }4 g  @3 j( q
  14. *
    & |5 p3 {4 c; y; j! _' _* Q7 m
  15. * This program is free software; you can redistribute it and/or9 B$ }3 U/ ]- X+ e* J
  16. * modify it under the terms of the GNU General Public License as3 D3 s( Z3 W4 A0 V! [4 U6 K+ y+ \
  17. * published by the Free Software Foundation version 2.
    : z& z+ O' e; S; ^+ B. z
  18. *) _  a9 W7 ]* Q! y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( n" A6 o+ Z7 h" M) I$ \
  20. * kind, whether express or implied; without even the implied warranty
    % W; ?( Z7 J, H% \6 X" B  A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 m' `/ w* n( ~! K0 j
  22. * GNU General Public License for more details.
    + p, u; |- r: G$ a9 n- \2 Y. T
  23. */
    0 |  \" q$ Y( \  J. t( T* U* ]
  24. : q) q$ D. ~1 A7 o
  25. #include <linux/module.h>
    1 F- z9 g6 s+ p2 \
  26. #include <linux/init.h>$ W1 s( T3 l* f2 y0 ]
  27. #include <linux/errno.h>2 d" x0 x  q: S* x( o
  28. #include <linux/types.h>, J+ Y2 H% `9 y' _. \. J" R  b
  29. #include <linux/interrupt.h>
    2 w- J! N; o; C1 b$ m! N
  30. #include <asm/io.h>) c( g) @2 g4 m2 v) B
  31. #include <linux/moduleparam.h>
    ( ?0 P& n# x, T( z# y, |* {; q
  32. #include <linux/sysctl.h>
      \* i8 [2 G6 Q7 r
  33. #include <linux/mm.h>8 F  |" H* I& b8 U. U
  34. #include <linux/dma-mapping.h>
    + r' b8 P5 l4 g2 X( V
  35. ' n; ~2 M+ k- Z  v# N
  36. #include <mach/memory.h>* o( V  i- q5 `
  37. #include <mach/hardware.h>
    9 q9 l% Y$ @  C& G9 d0 x
  38. #include <mach/irqs.h>
    6 i- X  ]4 O  m7 C" p2 K- q
  39. #include <asm/hardware/edma.h>
    ' d$ y1 Y7 z7 r
  40. # R( _2 I" R" u, v1 d5 a  D, d: b
  41. #undef EDMA3_DEBUG7 N0 Z2 N3 s' q4 O7 v( E
  42. /*#define EDMA3_DEBUG*/+ x( v, ?- u% f0 b  P
  43. * y- K4 B% g: I! f+ P, @
  44. #ifdef EDMA3_DEBUG
    5 e) a8 H( A8 q" B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 A# [- a" @3 k; P1 c" W; e% r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ w4 l2 x# m4 z$ ?. V( ~% C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); e! P* ^- r+ \7 o
  48. #else
    * Q& c* E( @3 U" ~
  49. #define DMA_PRINTK( x... )
    - G3 c/ Y$ @5 }8 t
  50. #define DMA_FN_IN
      ~/ x  K; @4 ]. a
  51. #define DMA_FN_OUT
    # Z! v) W+ A( k3 T; ~4 ]
  52. #endif! |+ f+ f8 ?. Q2 U: E2 h

  53. ; e2 v+ w8 A1 l/ }( x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 Q+ A* F4 ~9 f+ I" F% x5 V* e
  55. #define STATIC_SHIFT                3
    . H1 c! k8 `. s0 o& Z7 X( X0 a. e* v& W' ~
  56. #define TCINTEN_SHIFT               20
    8 X7 d3 D; H' d& X1 h  [* `  _8 P' g
  57. #define ITCINTEN_SHIFT              21
    8 `( V* i3 R4 P4 N" s3 ~
  58. #define TCCHEN_SHIFT                22+ o# `+ s- ?8 D% T
  59. #define ITCCHEN_SHIFT               23
    - z/ u) _6 F7 W/ T8 b8 o5 `  P

  60. ' Z, v- p% n' m' x+ V: x
  61. static volatile int irqraised1 = 0;( F( M; W/ e2 d3 V* ?) _# H7 C8 Q# o
  62. static volatile int irqraised2 = 0;
    & _' a5 o8 E5 j" l

  63. 7 ~9 D) G2 f7 D$ |* P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X2 N! }) v6 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) T) G6 n1 }+ @" a5 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ z/ o3 e, e1 K& m

  67.   d9 ^, f. e3 E( |: c. N' t: l' d
  68. dma_addr_t dmaphyssrc1 = 0;
    9 T8 B& P$ C: N$ \8 @0 }% g
  69. dma_addr_t dmaphyssrc2 = 0;0 G1 R; z9 u4 @  M' o- e2 T: Q
  70. dma_addr_t dmaphysdest1 = 0;: v4 \2 b$ @: r$ D% f# a
  71. dma_addr_t dmaphysdest2 = 0;
    1 B6 v& T& t9 e7 z0 u8 h

  72. 3 _+ O8 P5 ^- F4 V
  73. char *dmabufsrc1 = NULL;
    1 U/ `( v! n" ^2 y; F8 Y8 M; B: ~
  74. char *dmabufsrc2 = NULL;
    # R% w/ r9 `' w; [0 @  V; R5 @7 T
  75. char *dmabufdest1 = NULL;% i$ C6 Q  }  y+ p6 z
  76. char *dmabufdest2 = NULL;
    4 Y  ], U, @! K

  77. " n/ F2 k# q( _9 s0 u4 q: o
  78. static int acnt = 512;! A" R( q2 }5 k: S
  79. static int bcnt = 8;, k! M# Z  E3 L. \
  80. static int ccnt = 8;
    7 k9 s" I  X! i
  81. 1 Z9 _! W* {- A3 a- w
  82. module_param(acnt, int, S_IRUGO);4 o) T6 A" W& ]: V( w: N
  83. module_param(bcnt, int, S_IRUGO);
    ' u3 C  N- G+ N* \) l  w0 @% u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 o3 }: i7 V. S+ @) F. B
) V  ]4 @" ~1 a, T% m5 T5 x7 z, N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! d# {" y% W& f8 K- L0 w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" f4 X* j8 l( b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ^1 M+ Q* f  x* @7 C& }( ~: J3 ^' D3 ]8 O; \% c
6 H; i+ ^# p: e4 K9 t, ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-14 11:48 , Processed in 0.045690 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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