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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & n, V+ s$ ^* e4 E# v
  1. [code]EDMA sample test application
    3 g% _0 ~; v5 B
  2. /*
    3 W* F7 U1 P' |6 M
  3. * edma_test.c% [/ h3 D, r1 }$ A. }
  4. *6 F3 j0 y0 H; p3 K. x
  5. * brief  EDMA3 Test Application
    0 W# G4 h! w5 q: j' w  i; S
  6. *
    # Y9 A3 }/ g& W1 K3 P* \$ E
  7. *   This file contains EDMA3 Test code.
    ( i  K' X4 p  A) p3 T9 A
  8. *# a' r4 c) O" S% ~; }8 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + ~( z1 s' O" U6 J" L+ M. U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) o% u9 G6 e4 w6 d/ Q- K1 Y& x2 d
  11. *         TO CHANGE.& h; ?# j# Z: B& S% V: O
  12. *7 S; B9 W& V1 K4 F. F( T. j7 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// z: m' V$ d* ~" ^
  14. *3 _0 |) m" q0 K- B- B
  15. * This program is free software; you can redistribute it and/or, f/ C& c) G9 ~9 s, J4 m  f
  16. * modify it under the terms of the GNU General Public License as
    9 A6 P# L% W0 @" _' w
  17. * published by the Free Software Foundation version 2.7 i9 b, O4 ]+ Q8 Y  [! V
  18. *
    1 R( A; _  F! v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , `% _' M. z+ P7 M9 l
  20. * kind, whether express or implied; without even the implied warranty
    ) B: z9 q" t; Y3 @! i: D* [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! [: u2 P, `% Y; I* b0 K8 I
  22. * GNU General Public License for more details.
    7 o/ g9 [5 H: ]2 |" C
  23. */8 X4 l/ }- ^8 @" N
  24. 2 _' C8 H0 a: \* n9 L' S, V
  25. #include <linux/module.h>3 L# t+ y) |9 X. a8 C6 R
  26. #include <linux/init.h>2 c5 }1 O& z+ G' v# ?/ N8 W
  27. #include <linux/errno.h>7 o# k! e# L* N9 Z" W; a9 V
  28. #include <linux/types.h>
    5 x9 x+ D3 ?  i( l" L# j
  29. #include <linux/interrupt.h>
    0 |( j# I+ N8 U0 X3 d
  30. #include <asm/io.h>
    8 p0 y) O+ M, Q' X$ Q
  31. #include <linux/moduleparam.h>
    ( N, l- w( o4 D$ m
  32. #include <linux/sysctl.h>
    2 n! [: e# M! g6 Q6 S/ ?% _
  33. #include <linux/mm.h>8 r) m" h! Z8 K( Q
  34. #include <linux/dma-mapping.h>7 K# K( h5 F/ l; S& \
  35. : U. b# C% ^+ m. W: D) `5 h6 {- h% P
  36. #include <mach/memory.h>* P( \; b  v- ~0 d' S. g1 c( W
  37. #include <mach/hardware.h>
    6 M1 f5 I% B+ L. t3 E) G3 b
  38. #include <mach/irqs.h>* t. F( r4 ]0 @, @9 |- r: M- H+ s: ]- U
  39. #include <asm/hardware/edma.h>2 h, M3 E- C6 H. ]
  40. . D/ s4 S5 A# X6 n! N$ H
  41. #undef EDMA3_DEBUG! t" {7 L% Y- |& \# [; N! L
  42. /*#define EDMA3_DEBUG*/
    $ M. W/ E+ O$ b5 l

  43. . t% B, N0 H6 t8 x7 d4 K' O
  44. #ifdef EDMA3_DEBUG
    3 A+ l# f# f% ~! q$ i' F, [3 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& G  l6 A) R- H. m" t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* g* T- {7 T/ P/ N' K* ^) ]  m$ n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) K3 ?1 G" R( x9 i4 ^% G& z. u
  48. #else
    $ j' C/ w( U9 q1 N% F
  49. #define DMA_PRINTK( x... )) `0 @$ G; {5 _3 u; n* L
  50. #define DMA_FN_IN
    9 Y. U0 i! |: W' X; d3 F
  51. #define DMA_FN_OUT
    / p  z/ |+ L% P( {2 V0 k3 U7 Z6 U8 N7 X9 ~
  52. #endif
    ; l: [; m0 K0 h  [5 \% P( H2 [
  53. - D6 |& f& R: i& o. y! V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 C% A. g- ?9 v5 {9 }
  55. #define STATIC_SHIFT                31 \; d3 s0 ^8 H% e0 d: ^0 N
  56. #define TCINTEN_SHIFT               20
    * ~3 U$ a9 w' h6 V! O  S' f
  57. #define ITCINTEN_SHIFT              21
    * l; a( L% t) H7 G' V/ T& |
  58. #define TCCHEN_SHIFT                228 ]! _- `5 W* Q( D
  59. #define ITCCHEN_SHIFT               237 n+ s; _+ ^/ l% Z4 t: u3 v( b! `+ ?
  60. " P" v/ i0 ?8 s  I
  61. static volatile int irqraised1 = 0;* t  Z: x4 x, D$ ~
  62. static volatile int irqraised2 = 0;) Q' `! G3 @( E& I. n/ C  i! N. B

  63. $ T. |+ M4 V- d6 ~# {$ @2 ]3 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& I: `& w7 I1 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      G) Y$ {; z( o1 B# q$ }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Y7 |' P4 |3 Q5 _9 F/ f

  67. ; c/ ]7 K/ t3 v- X4 q& U: Q
  68. dma_addr_t dmaphyssrc1 = 0;; M$ u3 c7 |5 B9 e* U  G
  69. dma_addr_t dmaphyssrc2 = 0;
    6 o  E: H4 h1 e, D
  70. dma_addr_t dmaphysdest1 = 0;
    6 c- c; ~& ?2 N) v
  71. dma_addr_t dmaphysdest2 = 0;9 }5 h2 |$ j! a  Q$ h" Q7 }( T

  72. & l3 D* G9 J% N4 H; u; W
  73. char *dmabufsrc1 = NULL;1 c9 x4 i9 a( }/ i8 c
  74. char *dmabufsrc2 = NULL;8 i1 A4 ]! c4 H& V) O9 @
  75. char *dmabufdest1 = NULL;
    ( E. _: Q0 D; _" n" y: }
  76. char *dmabufdest2 = NULL;
    ( J3 l! }  l6 y% a4 `
  77. / B$ w- T8 V' i* `, F
  78. static int acnt = 512;
    , P4 M* c8 ?) v" C* Y" J: j
  79. static int bcnt = 8;
    * f6 o  o4 x5 H! [$ P
  80. static int ccnt = 8;
    ; b9 l0 g% N5 c& o

  81. * ]5 m5 o4 }# j# N5 ^" B
  82. module_param(acnt, int, S_IRUGO);
    % e( F6 ^+ p  o% `; Q. E  e
  83. module_param(bcnt, int, S_IRUGO);* O  J5 j  V: Z# R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% P! |7 `5 E3 \; I: M- p/ B& H( b
* O3 k- K3 X" r) v4 \9 l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 H9 a! ?0 d8 _0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ s8 X) P5 S$ x6 z( `2 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& }2 K/ o# c8 @. j. `- t
' T& t; S  I; u4 T3 }1 C% b$ ]9 a1 i' `3 v$ Q3 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-22 18:39 , Processed in 0.036132 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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