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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , N$ S6 E# C  P" L% @( |1 J3 U9 H
  1. [code]EDMA sample test application7 ?) }" @2 D) S5 `5 Q
  2. /*. b6 a1 g4 P- w7 Z3 o5 R
  3. * edma_test.c
    # g3 f4 y% p1 b' p8 ~( q3 i# A+ H6 T
  4. *7 H' u0 }& R$ Q% F8 C8 z
  5. * brief  EDMA3 Test Application
    + e2 O; t  w. }% l& W. b( o
  6. *
    6 n) ^) S' N* B9 I8 h4 F9 `  J4 {- R
  7. *   This file contains EDMA3 Test code.- d! Y& }- N' @7 ~& R7 }
  8. *$ P2 y. g9 U, Z9 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! T5 `* h& K( a. l7 }% r' s8 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% \2 E6 J/ g6 B4 C6 H4 g0 D
  11. *         TO CHANGE.$ V7 f3 N( }4 q- z/ G* V* z  |
  12. *$ f; x! }; V# x: w( k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # `" [9 F- O8 Y3 q4 y; w. g3 [
  14. *1 h* V  b- ^+ G0 H+ b
  15. * This program is free software; you can redistribute it and/or9 c3 m" H* C+ x( m! o
  16. * modify it under the terms of the GNU General Public License as
    $ N  D, I1 L- L0 F+ s
  17. * published by the Free Software Foundation version 2.4 u: |/ h; C4 H& c" h
  18. *5 t3 b3 l/ F! O0 H1 w4 q' O- B0 w- \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: o) B7 t7 Y6 [, u# y8 l+ `
  20. * kind, whether express or implied; without even the implied warranty
    : o% B- f8 O( @+ `& j0 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , c8 B( q6 M- R$ B
  22. * GNU General Public License for more details.7 ^! f4 J+ \8 Y: N/ I$ z# K
  23. */8 X& _* N8 W0 v# k

  24. . g1 M. U/ E8 H9 p* c& X. ?& y
  25. #include <linux/module.h>, `6 Z( A* ?4 m
  26. #include <linux/init.h>
    8 M. z% `: R2 @& w
  27. #include <linux/errno.h>  B+ @5 i) I( R  L' E% o
  28. #include <linux/types.h>
    7 E/ s; d  e8 E( g/ q! i
  29. #include <linux/interrupt.h>
    # D# a" E' S+ j5 ^3 j& h7 a4 h
  30. #include <asm/io.h>& Z: s4 ^5 ]2 J) a# e8 r* [& y: R
  31. #include <linux/moduleparam.h>8 e4 u3 P6 ]% p- P' m! r4 x; X
  32. #include <linux/sysctl.h>+ B4 ?% O* B* b" S) \/ x+ J5 [/ H
  33. #include <linux/mm.h>
    0 }, J  w1 @3 O. x  ^
  34. #include <linux/dma-mapping.h>
    " P& v0 v0 E( {) S5 v( u6 X0 J
  35. : Z. V) b, C$ |, ^5 q& D- V$ q% i
  36. #include <mach/memory.h>
    5 Q$ e& C8 C* D* }
  37. #include <mach/hardware.h>, }& ~" @) w" L" o
  38. #include <mach/irqs.h>  l/ Z% z+ P. _' l6 Y& K
  39. #include <asm/hardware/edma.h>
    5 Q; [2 J- [/ C/ |, h: V& |

  40. 6 W1 n2 ^3 v$ ~1 {* s
  41. #undef EDMA3_DEBUG
    ; q$ S" d# f8 Y% w
  42. /*#define EDMA3_DEBUG*/2 l2 g: u' u7 g) l& y. p1 k
  43. $ N: ~: u5 E; @" n4 P' e+ h
  44. #ifdef EDMA3_DEBUG
    ) l& ^# Q& w, n: I" D5 p+ j" A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! F0 u0 K. |2 n8 b3 r1 Z/ w9 K# y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # E/ l, g9 c" {  u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & Q9 [8 d3 o; ^3 d  `" z7 D7 j
  48. #else# D" e1 s/ C' M  g( z
  49. #define DMA_PRINTK( x... )
      k/ B5 h/ `3 i" \; g5 E
  50. #define DMA_FN_IN
    + B7 H# O: U, X8 H+ I% ?$ F) V
  51. #define DMA_FN_OUT
    8 s4 k9 w0 R5 I. A% p+ V5 g
  52. #endif
    $ ?2 \2 e0 ^* h$ R, {1 V
  53. & y3 t' H- `0 |# _% S7 d! r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : ^6 N3 B* ]# j) I& `& U# V
  55. #define STATIC_SHIFT                3
    * A( K2 i/ R% s6 m
  56. #define TCINTEN_SHIFT               20
    2 G. v  g. f4 h
  57. #define ITCINTEN_SHIFT              21$ r2 A+ `* h6 I4 V) k* N5 {
  58. #define TCCHEN_SHIFT                227 U  }. K4 l7 }. \& L  \' w
  59. #define ITCCHEN_SHIFT               23
    ' ~0 m2 n6 F7 D2 o, b$ y. x1 g

  60. 3 `- t. q6 c/ E
  61. static volatile int irqraised1 = 0;, O0 m8 q3 W2 r! C1 d3 L
  62. static volatile int irqraised2 = 0;
    5 @$ Z4 n6 }- ^# @. {8 |0 ~* D6 ^0 m& S

  63. 9 k2 z) y9 ~4 ]! N/ w, c+ }: [' h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 @9 @/ H& v2 z5 U) l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 x% D  G* |: B" R; W6 `3 I. B9 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 I* T7 ?# {) w7 }$ j( r0 {' _% h3 |( F

  67. 7 P5 B8 H5 |; c% j5 p& w) }
  68. dma_addr_t dmaphyssrc1 = 0;' x+ U9 v6 Q+ j
  69. dma_addr_t dmaphyssrc2 = 0;: y: v  y; f% n1 ^7 O# v& j% ~% M
  70. dma_addr_t dmaphysdest1 = 0;  T* y  S5 Y' {! }/ M
  71. dma_addr_t dmaphysdest2 = 0;
    & J0 I6 `- i. [" p* O1 U
  72. , E1 B8 c/ G! ?4 q" L7 i6 D
  73. char *dmabufsrc1 = NULL;* \; O% }; T/ Q7 v- f
  74. char *dmabufsrc2 = NULL;. @9 i9 g+ [: @" S
  75. char *dmabufdest1 = NULL;
    / b  Y! C4 ?. U/ c; J- T
  76. char *dmabufdest2 = NULL;
    ! l5 D. c/ `7 x9 X  g5 g5 O' P
  77. 5 n# m, k+ y' }' n1 ^& N
  78. static int acnt = 512;' r( ]  N1 h& z# s$ {
  79. static int bcnt = 8;, u3 E  J8 ^/ l3 u+ S! E& a
  80. static int ccnt = 8;
    " D7 P4 M# V# U3 f- u

  81. : |+ M* ^. \/ X/ d' @$ R
  82. module_param(acnt, int, S_IRUGO);
    : U- H& c4 |, a( D9 A
  83. module_param(bcnt, int, S_IRUGO);, t% ^, {* C% Y$ e) u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 u4 j" V5 G* B9 @
; g- E' O/ N1 q; K% p: [* X) M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 e5 l5 L5 @2 ^9 b" N* uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 b% u. k, R2 b0 s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# p7 E' J! s4 R/ K7 W

- _! A2 ~6 i( z& k3 p2 i) ~- a" @( i: K5 `; |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 12:30 , Processed in 0.038962 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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