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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 `: G% @8 Q) T7 W* S
  1. [code]EDMA sample test application) U  M6 D8 m  e' z, G
  2. /*7 X0 g6 m! M" T- ]5 K% W
  3. * edma_test.c" G3 f- g2 X8 p' q" {
  4. *
    * [2 Q7 `- R0 ]
  5. * brief  EDMA3 Test Application5 l& P* X2 {- ]- R0 U" O# e
  6. *
    / p$ [( c0 C2 }# X1 E
  7. *   This file contains EDMA3 Test code.
    ' D: ~4 }8 I: W; Z
  8. *& P# {- c" r  ~' v" j" \8 w: Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 \: ~2 A0 q9 {6 m( _7 |9 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 |+ @* ~- J: ?) F
  11. *         TO CHANGE.
    7 C/ p1 a  l6 t% z2 e+ k3 |
  12. *
    " r+ b0 K* Y1 j" p& V* P; w9 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 _; Z$ `. `3 p4 H  C0 z
  14. *, c* w) J6 D0 j
  15. * This program is free software; you can redistribute it and/or; }  U0 \8 C: d. w2 Z
  16. * modify it under the terms of the GNU General Public License as
    ) Y; N0 Z+ b4 p) o  }
  17. * published by the Free Software Foundation version 2.
    7 x3 L$ z; D( d+ f% Y
  18. *$ K- J  O, p" `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& w1 `9 Z( K4 s, u
  20. * kind, whether express or implied; without even the implied warranty
      m1 v: e6 N7 @7 {( R; U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 y/ Z* C# y! v" w, t5 ^
  22. * GNU General Public License for more details.
    . ~- q. N1 y* S7 f1 q6 v+ D6 @5 E
  23. */
    3 G& ~, N, L" w& n

  24. ; n: H: E0 H; M$ O! X
  25. #include <linux/module.h>+ l* L  J" m) |  t
  26. #include <linux/init.h>
    ! I4 z8 w4 T- ?- U- N( D$ ]
  27. #include <linux/errno.h>  h# `) ^/ ]: O9 W
  28. #include <linux/types.h>
    # |  W% |6 L6 j" ?) }% I& {
  29. #include <linux/interrupt.h>
    1 w' J* l2 v$ V3 ^9 Q
  30. #include <asm/io.h>
    . x5 h1 R* d6 {, W; t3 {% _
  31. #include <linux/moduleparam.h>
    ' _$ f6 b5 w0 T
  32. #include <linux/sysctl.h>0 ]# a. W3 g/ G7 `
  33. #include <linux/mm.h>8 `3 {" ?% d" J! j& @$ h
  34. #include <linux/dma-mapping.h>3 t% ]3 d7 H7 c% J( p/ t
  35. ; A- Q9 _' i3 E- p* A  @) u0 d
  36. #include <mach/memory.h>
    ; Z% k9 I9 @6 q/ D* b! e$ r
  37. #include <mach/hardware.h>5 C7 J: g6 }. u8 z( A& B2 ]/ J7 z
  38. #include <mach/irqs.h>; W# V% P& u. R, H, U) F
  39. #include <asm/hardware/edma.h>, C+ s: r3 e: T' I# G8 s
  40. ' r# c- [4 n" k4 ?* w% M
  41. #undef EDMA3_DEBUG- t* M, h. r- l2 ^; s; U
  42. /*#define EDMA3_DEBUG*/
    1 P/ v  Y! d; I
  43. 8 t3 x8 I, J* K, u
  44. #ifdef EDMA3_DEBUG
    : w1 d' t: o6 r( A! H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): E4 C  P" e* R  V" Q9 i4 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 g0 P, |/ s* w2 h2 R: L8 B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' I( y; F0 T" \" P" S2 o$ b4 `
  48. #else4 k+ Q+ S/ @7 C- b/ i( F, C
  49. #define DMA_PRINTK( x... )
    ( [; ?- M4 \- s1 T: }4 r
  50. #define DMA_FN_IN
    8 S" f" K7 |3 X  a9 T0 {  S; e
  51. #define DMA_FN_OUT# U) R1 S. n3 K/ L" }
  52. #endif# w( A7 X  W7 @1 R8 w+ b
  53. ( ?8 O# T7 J. W& s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): F2 A' G. |& d, v; h; \. ~
  55. #define STATIC_SHIFT                3# V% `5 y  l0 K4 {
  56. #define TCINTEN_SHIFT               208 o2 X# p% X% ]  T! V
  57. #define ITCINTEN_SHIFT              21
    % e. ?8 e) b$ ~2 U! S
  58. #define TCCHEN_SHIFT                221 i4 ?! u, N' P, Y7 M" x' A  v$ q" u
  59. #define ITCCHEN_SHIFT               23- Q" I4 g1 ?0 b$ z

  60. 1 n; w8 l1 {' S0 \6 w9 I
  61. static volatile int irqraised1 = 0;
    ' }: ~9 W' t; d$ P" O
  62. static volatile int irqraised2 = 0;1 X$ W) t. `- [; s
  63. 4 S" J. l! Y! [4 m6 N; `0 ~0 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) U* K! o5 R6 M6 r0 s* m! G) \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 X* S! @- y% ], J3 S, Y9 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) B: J% B: R. w; m5 Y

  67. ' y& s% `0 i9 L$ k, o( |
  68. dma_addr_t dmaphyssrc1 = 0;
      P! p1 S5 p& A
  69. dma_addr_t dmaphyssrc2 = 0;8 [, U3 ^6 F/ N7 b  v
  70. dma_addr_t dmaphysdest1 = 0;
    + y/ e( ?) p0 Y' {
  71. dma_addr_t dmaphysdest2 = 0;9 ^; ~. f! u7 s( z* E+ Y3 S3 q

  72. . k$ c+ Q4 y( g, n
  73. char *dmabufsrc1 = NULL;
    ; s4 U8 ^2 W- N: J) x
  74. char *dmabufsrc2 = NULL;
    ) c) N9 h5 ~" M& n) Q* G2 y
  75. char *dmabufdest1 = NULL;1 B/ z) ]- S9 _
  76. char *dmabufdest2 = NULL;
    7 h/ ]  H% t& y; M; b3 K, [
  77. 7 ^/ M/ c; v" J
  78. static int acnt = 512;
    . C+ o4 D0 H, X& @  a4 K
  79. static int bcnt = 8;( J1 n2 ^# p# @
  80. static int ccnt = 8;: P3 b/ W# @8 _) K5 r8 {1 {
  81. 0 C6 g+ U2 ?* W- N) X2 Y' k- Y
  82. module_param(acnt, int, S_IRUGO);
    : W6 H$ Z( v  s( q8 }+ f- p
  83. module_param(bcnt, int, S_IRUGO);% W: m# O- v  K$ k/ f- i. G" z1 u- ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" g9 w9 o  W6 Z. A9 E

( _, ^7 ]' H/ \, N2 \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ^6 |* H* j  x, r- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) N4 p+ ?/ E* ?% H9 l% _- d( y7 ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 {% \( ~9 f3 c# H6 A! {
/ J% C; W- r: j
7 e$ n$ \% Q+ n% n* Y! x) Y- z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 03:19 , Processed in 0.038960 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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