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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # _7 _: L3 F; O7 c1 b
  1. [code]EDMA sample test application! e( h9 H: \! A4 W6 v" {" w
  2. /*
    " I' C1 F% ~  a8 {8 X) n$ g7 p
  3. * edma_test.c/ @0 o; O+ ^$ g& `8 a4 X
  4. *
    3 o/ |. L: X- ~0 C( y
  5. * brief  EDMA3 Test Application
    , j) G( u, T, n! J4 R$ t! _
  6. *' K' A1 [% E. y. y  A- T
  7. *   This file contains EDMA3 Test code.3 h  ]& ~' v; w; B4 \+ o
  8. *
    1 \0 g# {# \( P7 [- i. O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 e1 v0 G! E2 I4 @& `* ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * }' b' n- c" ?' k
  11. *         TO CHANGE.
      h+ y9 }2 B# l5 M4 ~
  12. *) F8 R* F3 ~/ }% f* C9 f% L. b. X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 Z; x; l) n% y( I9 Z# J2 m4 s3 {
  14. *
    ) {# M' R; U: x; M7 e
  15. * This program is free software; you can redistribute it and/or
    % D2 M( b0 W7 q% [  a& K. r7 U, E1 d
  16. * modify it under the terms of the GNU General Public License as( L4 m5 o) z7 |( q% ?" o' N
  17. * published by the Free Software Foundation version 2.
    1 K1 O% r/ ^0 M4 n
  18. *
    ! [, s* n% t% T% A: _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( j& S5 W  Z7 T
  20. * kind, whether express or implied; without even the implied warranty
    ' b( ~  ~, B1 f+ a  P. P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 ]0 I7 D  B3 Z: U" y6 @
  22. * GNU General Public License for more details.
    % {( s2 H' `# C
  23. */' W/ s, e2 K) v3 U, [5 x0 p# ]
  24.   f& I2 j8 U" l
  25. #include <linux/module.h>
    # y1 F# l( f* ^. ^! a
  26. #include <linux/init.h>
    & J* Y$ y% C* M$ H! v% Z4 P' g
  27. #include <linux/errno.h>; p, S; \* w, A8 J
  28. #include <linux/types.h>; n# C" }! V- e5 ]+ ~
  29. #include <linux/interrupt.h>0 W  q3 R5 v1 ?" A* T
  30. #include <asm/io.h>
    / k/ n) M: D# z( u. m: u/ i. W
  31. #include <linux/moduleparam.h>
    ! t" a/ \0 c5 z1 ^# W7 w7 P
  32. #include <linux/sysctl.h>
    ; e  O0 \# o) R8 Q) g( E: B5 r( S
  33. #include <linux/mm.h>5 ]. O) W; a" [+ U
  34. #include <linux/dma-mapping.h>
    - l3 w# W4 ?( n1 Q9 M( p$ {
  35. ! w; F. U; N3 @! O2 ~
  36. #include <mach/memory.h>
    7 o: j5 T2 \3 c& e8 V' m
  37. #include <mach/hardware.h>
    9 u# V( p# Z6 q7 Y4 D4 i
  38. #include <mach/irqs.h>
    8 \& p" w3 ^/ D% C
  39. #include <asm/hardware/edma.h>; ~( s: p6 a; z. }2 G; O

  40. / ^$ x' ^1 y- q( h1 O7 i
  41. #undef EDMA3_DEBUG1 a% R% {' Q) T! c# U
  42. /*#define EDMA3_DEBUG*/5 |$ W4 T9 A' }/ G+ Z* x( Q& q
  43. " ]8 V$ i/ n7 }+ r
  44. #ifdef EDMA3_DEBUG% d5 ~" a5 {# i. @" ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% h3 D0 u, m3 K1 a/ T$ ]$ D) _9 A8 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 M# V2 o! O; N: ^; z( ~  v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 u! g" @( P/ h
  48. #else
    . X5 F+ Q9 A1 m& l4 B( P" x* \$ k' r
  49. #define DMA_PRINTK( x... )
    8 _% p( E3 `) ]( V! w! U
  50. #define DMA_FN_IN' F" A0 x1 e1 v# Y" z& l8 q
  51. #define DMA_FN_OUT
    / p& p$ N: X" P1 W" a
  52. #endif: z$ Q' H& o& [8 F& L9 N
  53. ' R6 m  U: l' I$ [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; `' ^( n5 O9 z% c
  55. #define STATIC_SHIFT                3
    ; N7 i( X# L- P" c5 u) g7 o
  56. #define TCINTEN_SHIFT               20
    9 p( b0 {/ R6 n* ]! ~
  57. #define ITCINTEN_SHIFT              219 p2 C: G" z9 Q; O8 l" J% q* B  g
  58. #define TCCHEN_SHIFT                229 K: y. B7 G- h* m2 S% c
  59. #define ITCCHEN_SHIFT               23
    2 S: W/ M! g. ~# d
  60. . O8 o8 [9 {5 d: P9 \
  61. static volatile int irqraised1 = 0;
    / `! g' @7 J2 Z) y
  62. static volatile int irqraised2 = 0;' s& y8 h# w( u/ @* G

  63. 3 J. e5 G1 q$ @/ K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 R# i  e3 d( f( V4 c/ n$ w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( w, ^& e! m) j7 x: l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O$ X1 U1 g" W$ P
  67. 7 k7 y9 B/ f" w, @+ A% S
  68. dma_addr_t dmaphyssrc1 = 0;
    & D# W; F" S6 L5 W) Q2 r/ j
  69. dma_addr_t dmaphyssrc2 = 0;8 W! k5 ~+ t* H1 v3 Z5 P) k7 V& l; o
  70. dma_addr_t dmaphysdest1 = 0;" D6 ?: M2 `4 ^& p& d6 g
  71. dma_addr_t dmaphysdest2 = 0;
    ; m4 f$ \9 p; `! P, i. \+ t1 d8 |

  72. 9 u, O$ m9 e& z4 N* L
  73. char *dmabufsrc1 = NULL;
    ) p9 l! \4 V4 A' z6 p- W
  74. char *dmabufsrc2 = NULL;& a1 I  Z5 S6 g7 W# m( ~0 }% a
  75. char *dmabufdest1 = NULL;
    $ H, ^) _4 R$ H' J# h
  76. char *dmabufdest2 = NULL;# Q+ Z, j& |% m- k! c
  77. # H* ~1 C1 ^: s6 k8 g. s
  78. static int acnt = 512;
    2 H0 ~$ {# n! o$ F; l+ `
  79. static int bcnt = 8;
    : T2 D% e7 |* y) v- V3 m" V
  80. static int ccnt = 8;
    , `2 G4 R9 A. Y3 o& N! @3 M, i
  81. . z9 T' p8 z6 }& P
  82. module_param(acnt, int, S_IRUGO);
    1 k' y5 G9 U+ m! A1 P( U
  83. module_param(bcnt, int, S_IRUGO);5 a% ~( a& F; \! R8 g1 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- z7 |; e1 e9 ]( x0 n5 j- a/ [. P2 W% p6 m# v' s1 l" r0 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) C1 B) b2 v$ _8 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 A$ K$ q- |+ v5 u; K% [  m' ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 b$ j) B+ @- m8 {

( R9 V6 }, f' G4 Q* M2 q7 E( x6 _$ h/ E: i! Y) s/ z+ J/ V+ F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 09:42 , Processed in 0.040677 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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