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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 v! v& U8 l; k8 x# B
  1. [code]EDMA sample test application* s" J! d" _* `. A) k6 c& X% X
  2. /*+ B, c' B  ?8 A# y8 W* O" V
  3. * edma_test.c
    8 l  Y% [* M7 C7 |% |& h
  4. *( h5 y) Q2 D4 j' ^% K
  5. * brief  EDMA3 Test Application6 H) u' J1 V$ _0 O, Z. k
  6. *
    ' R9 Q. |& j& z; u1 ^, S# b
  7. *   This file contains EDMA3 Test code.6 p- Y- [% ?9 f) N/ @- D( ]
  8. *
    3 e$ {" ~) s5 h# ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 j: s+ `, c, E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " \/ C( \- n( A' h* \! ~/ ~
  11. *         TO CHANGE.
    ' r0 a, Q$ m. y2 u8 B
  12. *& @# n. S0 c8 Z4 S3 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 A6 Q% ^! x( v5 a6 I5 p
  14. *
    4 M* ^; u, x6 k& q
  15. * This program is free software; you can redistribute it and/or5 H% ^+ d- b- n$ M  ~5 o2 R8 ?
  16. * modify it under the terms of the GNU General Public License as- c' r3 @5 w" s; @; E: a7 ?
  17. * published by the Free Software Foundation version 2.6 f& V5 i$ ^: `4 Y+ J, E% H
  18. *# ?" L) [; Q" P$ O  [; r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 R6 z# Z, n, L$ Y3 _
  20. * kind, whether express or implied; without even the implied warranty
    + P( A4 \& O4 U& S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ p4 P; i$ v/ G( ?: Y1 n
  22. * GNU General Public License for more details.
    1 y# W7 i4 F. s1 q
  23. */( g5 J: m- d$ m: o6 L: P! g
  24. * N, E% b8 T% O3 p9 k+ l! ]
  25. #include <linux/module.h>
    ; L" R3 t: R  S8 w( I4 Q  Y
  26. #include <linux/init.h>
    7 `6 e/ R' q- O
  27. #include <linux/errno.h>& ~% x- v+ {0 W8 b: u6 T" l
  28. #include <linux/types.h>7 X( {* Q0 P1 C$ T
  29. #include <linux/interrupt.h>1 x; s6 q, Y3 J# H. W; a" F
  30. #include <asm/io.h>. }. Y. F5 f1 s7 d
  31. #include <linux/moduleparam.h>
      M6 G' W8 H- t1 e" ?
  32. #include <linux/sysctl.h>
    : I( D% {" A8 |8 w: A7 x  K" f! ^
  33. #include <linux/mm.h>
    5 m8 g  l) A0 X! \$ f& A% X, u
  34. #include <linux/dma-mapping.h>- t# O$ X$ C, h) W

  35. - [2 g. z+ j1 t& |" {0 I# S
  36. #include <mach/memory.h>& X* w. \: P6 x% a' D" O. K7 B
  37. #include <mach/hardware.h># O5 K+ Z6 y! I. L
  38. #include <mach/irqs.h>
    # D0 L9 \5 \/ y: g: \
  39. #include <asm/hardware/edma.h>6 E3 V/ l8 z& {% V

  40. " d1 Y/ l' Q" ]' Z% Z; ]
  41. #undef EDMA3_DEBUG
    8 I- i  {! \! u& ^! Y
  42. /*#define EDMA3_DEBUG*/+ ^, J9 X/ c  a: b4 x6 N4 T8 r- C
  43. - R2 x5 f1 d5 C- C
  44. #ifdef EDMA3_DEBUG! _1 \+ e4 R4 p8 r% T  A) R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 I" H% [1 c+ a5 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 x) V3 W% ~% Z. F4 X6 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " l9 g0 G  k$ N! N  I  g) D( D
  48. #else" ?. }$ d( C& ~
  49. #define DMA_PRINTK( x... )
    " i+ F+ ?9 P. H9 e- g1 `
  50. #define DMA_FN_IN9 S. }8 j/ V+ \/ E
  51. #define DMA_FN_OUT
    # R3 D: Y8 f4 N9 _6 h
  52. #endif9 G# p) n. a1 i6 Q
  53. 0 W$ h/ F$ S* j; p6 B# [. K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 D* [* l" c! t" f3 }
  55. #define STATIC_SHIFT                3
    ( S4 G" M; ~) d% _4 |" F2 v. F1 z
  56. #define TCINTEN_SHIFT               202 w% U# u* t' f* y& q$ Q
  57. #define ITCINTEN_SHIFT              215 a( R; v5 S8 R1 G' N7 g7 X- _
  58. #define TCCHEN_SHIFT                22& Y% d8 [* y  z2 A% {0 |
  59. #define ITCCHEN_SHIFT               23
    , N7 n% {# n: ?1 T: u9 U

  60. : X. g1 @' r+ ?/ a
  61. static volatile int irqraised1 = 0;+ o2 f% h8 S. P% z
  62. static volatile int irqraised2 = 0;
    1 J* {$ Y* a+ c6 [! i: l/ e
  63. # r" N0 Q5 g- g$ R# p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , d) i; \, H: e. B1 a3 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( `- c3 w: B& r2 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 l' m+ T2 D0 Q( Y# n# P. U5 G
  67.   D) Q$ O8 w  g7 f& R# t  l1 g
  68. dma_addr_t dmaphyssrc1 = 0;' ]3 A0 f# P# `
  69. dma_addr_t dmaphyssrc2 = 0;
    / W8 {+ I( u! ~. A- |5 v5 i, U+ ]
  70. dma_addr_t dmaphysdest1 = 0;
    ' Z+ t2 A; j3 c* E- e5 W8 Q
  71. dma_addr_t dmaphysdest2 = 0;0 j8 k4 B0 c& e1 T5 w$ o  t3 D

  72. : m# L4 F2 H  |1 ~
  73. char *dmabufsrc1 = NULL;4 w. _* f: }' d3 m* L$ w
  74. char *dmabufsrc2 = NULL;
    ( R/ r/ d! e6 d3 g
  75. char *dmabufdest1 = NULL;
    " Z' H; I& j5 x0 k
  76. char *dmabufdest2 = NULL;% H% R( V8 X0 r, W

  77. 9 I4 [: j3 m) `! l; Z
  78. static int acnt = 512;
    5 D/ v1 \7 _4 M- _4 w; [& {5 B
  79. static int bcnt = 8;
    ; p" b% F; F/ \
  80. static int ccnt = 8;
    & P' ~3 f2 G  X

  81. 4 m$ z/ T! s3 @2 s8 t
  82. module_param(acnt, int, S_IRUGO);
    . J2 P9 u+ E4 U; r! M6 N
  83. module_param(bcnt, int, S_IRUGO);$ K% @% g9 f& w; f7 X. a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 d( m4 Y) C+ a+ A: w  [( Z& S: ^) U& `: X  h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- P4 {- s7 \" |1 Z- h0 N' D6 Y* ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 C) \/ w2 q8 [7 Z' Y3 y" ^7 E3 U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 H% P6 [$ u/ p; L1 m" ~# B' b
& Z1 F( j3 D% Q# p, [2 ~/ s

) {# M- U* o0 S$ U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-6 19:44 , Processed in 0.037036 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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