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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 G& h' ^2 z3 k) `" C
  1. [code]EDMA sample test application+ x: X+ {0 F+ G4 F9 `( L, H* G
  2. /*
    ! R% p, S9 U7 F3 U, j7 Y
  3. * edma_test.c
    : f; S* P- w! u" K# j) {
  4. *
    2 H9 `) h6 V/ E% v
  5. * brief  EDMA3 Test Application
    - h% v6 \; r- Q! A0 H$ U
  6. *
    - h$ {* @/ V& Y! K) n
  7. *   This file contains EDMA3 Test code.
    # B# Y/ ?- h: }$ r3 I
  8. *
    ( M3 s9 _3 J4 |' `7 N* \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: Q. j: o- v: O3 w2 v2 r, D3 u& X: ~' r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 ]+ t2 d( `1 U$ k
  11. *         TO CHANGE.7 H. G" }7 S+ g2 |5 m! |) d4 d
  12. *
    / N# i$ F  N) T. J5 c* `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ Y2 j9 Q& `' O& q+ V% d
  14. *
    + j0 U/ s+ i) g
  15. * This program is free software; you can redistribute it and/or$ O$ g& ^% D8 X
  16. * modify it under the terms of the GNU General Public License as; Y6 Y8 i- m) o5 x
  17. * published by the Free Software Foundation version 2.2 z4 G6 W# M4 O: o3 o
  18. *
    1 ?7 V3 L; z0 z' d( _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + ?* p. U" p  s. N6 J# ^, n
  20. * kind, whether express or implied; without even the implied warranty
    6 G% G( i9 ]/ D& T+ }# r+ {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 e( P, h$ o7 O- p8 e) {
  22. * GNU General Public License for more details.
    . ?9 v/ E( {- D: x& q( K
  23. */3 Z- D* ?+ ?6 m  [5 F( u6 N
  24. & Z" Y+ e, Y/ I. s6 c$ i
  25. #include <linux/module.h>
    & P5 J9 B& A- y8 V
  26. #include <linux/init.h>, F' M5 G5 m- R+ n% v
  27. #include <linux/errno.h>
    2 d- N0 D& _) n2 G) H0 S( s/ l& {
  28. #include <linux/types.h>2 d3 c, H0 ~* v( f7 F
  29. #include <linux/interrupt.h>
    : j) m! N; `* a0 `6 u
  30. #include <asm/io.h>+ G, k; E& |4 d6 Y
  31. #include <linux/moduleparam.h>
    ) S+ X: ~: W6 I6 [" d) i5 L
  32. #include <linux/sysctl.h>
    " m( R5 M# ^# F
  33. #include <linux/mm.h>( Y: K' T* l; a! W
  34. #include <linux/dma-mapping.h>
    ; E2 Q# u, a7 I9 f4 I
  35. & c9 }' g7 l4 `" p- h- l7 l7 O$ w3 R
  36. #include <mach/memory.h>
    ! H4 |; P5 g% F- c% n
  37. #include <mach/hardware.h>2 G, a9 U( b$ ?
  38. #include <mach/irqs.h>
    * O/ H& B% o" X. D; [
  39. #include <asm/hardware/edma.h>
    ' {2 P1 o: @& `- ?& ?' `7 C

  40. ) b9 x, q& c6 A2 O* \1 K' K2 A% f5 k
  41. #undef EDMA3_DEBUG6 f! T+ T! {8 @& `
  42. /*#define EDMA3_DEBUG*/
    7 G. Q% J% Q$ N0 N0 q

  43. - x1 E  v+ l4 ]
  44. #ifdef EDMA3_DEBUG* f- ^# p. N8 i1 C" G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . X2 ?5 S9 i5 V& F8 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 o5 d# G( @: I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 B4 b) x! W4 l9 @. f6 T
  48. #else3 n- {7 }$ k: O, e# ]
  49. #define DMA_PRINTK( x... )
    7 y* ]2 g6 G# I# s$ `
  50. #define DMA_FN_IN: m, x4 t! {9 R3 }' q. c4 e1 o2 n
  51. #define DMA_FN_OUT
    , k# h! z. I& {
  52. #endif
    4 s( w# i! Q! [& `
  53. * Z. @) ^9 a( e5 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- h4 c4 y' r* t" c1 m0 d
  55. #define STATIC_SHIFT                3# h# Z' D/ Y- |" v; S
  56. #define TCINTEN_SHIFT               20
    2 k9 U7 {' B9 {/ f9 B
  57. #define ITCINTEN_SHIFT              211 r- s; D+ [6 l7 M" t+ R
  58. #define TCCHEN_SHIFT                22. D+ ?  p/ c/ W
  59. #define ITCCHEN_SHIFT               23
    4 ?! D# `$ [) F# C/ o9 P% |: D; i

  60. 7 h( H0 z* X0 x9 H
  61. static volatile int irqraised1 = 0;; d" S2 D6 F: W/ C
  62. static volatile int irqraised2 = 0;
    + S$ @: N: Y  r

  63. ) W' K; ]. V' F% T/ N2 _5 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . R# Y: c' m$ ?, q, A# b) E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 {9 @6 c; E8 f& {" N5 j4 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# _( s( I6 F3 ^  g4 ?- F! v4 f
  67. . x3 e: h7 y5 G% Q  m
  68. dma_addr_t dmaphyssrc1 = 0;
    : Y3 o0 m! U5 X( C* Q
  69. dma_addr_t dmaphyssrc2 = 0;
    0 @. J, x# r4 B! D  K3 f
  70. dma_addr_t dmaphysdest1 = 0;, n# p( b; ~* }1 d
  71. dma_addr_t dmaphysdest2 = 0;# @; O- y  P8 B" t" I

  72. " G& s- l& p" m, }
  73. char *dmabufsrc1 = NULL;
    ) w/ r( A$ I9 V
  74. char *dmabufsrc2 = NULL;
    4 n- [$ M& Y, [- Z" h& L; x. U
  75. char *dmabufdest1 = NULL;
    7 }3 ~7 N+ ]  b% c1 P( }
  76. char *dmabufdest2 = NULL;
    8 @# T+ g, e' i7 H9 \" N( F
  77. , w  P* `4 P( z7 j$ K/ x, r. Z, Y
  78. static int acnt = 512;
    % q8 [6 B7 i$ s" N
  79. static int bcnt = 8;
    : h# c! r& Q$ C6 w; h" v& h
  80. static int ccnt = 8;
    & p1 @$ w) o- f: J2 A2 {. |. d

  81. 8 Y$ I7 t4 z* K# ^
  82. module_param(acnt, int, S_IRUGO);
      c. s; U1 ^2 ~
  83. module_param(bcnt, int, S_IRUGO);- c0 [/ I; T9 z: M! O5 T8 M. R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( L$ l- d, S- e

: x9 b! M$ R, G5 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; h$ [5 `: _! v# [$ c  C1 i2 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) C" N! v9 A# _& G+ H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( l; Y; @6 z. U- k

) T9 y7 {! d# ]6 t3 n6 y6 U. [8 v4 P! p# f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 12:01 , Processed in 0.040836 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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