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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 i: |2 ^3 c: L1 Y% X0 f! v0 m
  1. [code]EDMA sample test application
    3 r  N) X' m7 j/ X
  2. /*
    7 b- w& {4 O& b+ x% J( P
  3. * edma_test.c
    9 F' Y6 \5 J+ l) \
  4. *
    5 m3 k: o6 i1 r* L: r. ]. @
  5. * brief  EDMA3 Test Application9 m5 a& I# I) F8 U. r
  6. *0 X  s3 h) o) ~) X! R, _
  7. *   This file contains EDMA3 Test code.( c2 A& M* ~/ n
  8. *
    ( }5 r) r* i" h! l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . X2 n: ?/ s& u  c  D% V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % t/ ^2 J7 I! V2 `9 h
  11. *         TO CHANGE.3 H9 P7 K1 p3 o9 {7 B
  12. *1 [! {& w# m. m9 b7 j7 I9 g' O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 c+ F9 O. B9 g) e! e) f: g
  14. *
    % N6 {9 h/ n" A# m/ J$ F
  15. * This program is free software; you can redistribute it and/or2 D$ Q! g+ c. w0 o
  16. * modify it under the terms of the GNU General Public License as
    $ k' f( B: O" c' w6 y* O( R4 q
  17. * published by the Free Software Foundation version 2.
    7 N' Y! J/ m% _( U' X3 T4 E
  18. *
    ) h+ S6 n/ e1 J& K: u! l9 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % `/ x% b8 I+ y1 h" e
  20. * kind, whether express or implied; without even the implied warranty2 @, @" \0 Y6 [. N+ @0 R! W( z5 T: X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & }5 G. F+ A- P" R
  22. * GNU General Public License for more details.4 P, e, R4 b7 ?8 K' {
  23. */7 n8 ~. J2 D' O, u; d" V  ^

  24. 8 A0 J" }! O# n. d. Y4 A; c
  25. #include <linux/module.h>8 Q; B  e! J& ~  C8 K8 h& ~5 k
  26. #include <linux/init.h>
    $ B* c% w$ }4 J; w- }. p
  27. #include <linux/errno.h>
    & R8 ?& j" r/ {
  28. #include <linux/types.h>! G" [- G4 I8 h* X9 D. n
  29. #include <linux/interrupt.h>  |0 ]0 C' I8 f! G: @
  30. #include <asm/io.h>! }( k; ?' b( a
  31. #include <linux/moduleparam.h>
    # z6 r; b5 e) H! O6 F+ P
  32. #include <linux/sysctl.h>) s2 e5 T$ R) q( w7 L
  33. #include <linux/mm.h>4 U& ~# k. Z  G& e9 s% A  [, W
  34. #include <linux/dma-mapping.h>
    $ r5 w7 B& c# m' A+ ]! S$ Z

  35. % A/ l' q6 M4 e1 t0 i  B/ Y
  36. #include <mach/memory.h>  _3 v; o1 Z4 _8 h
  37. #include <mach/hardware.h>
    + M6 p& l8 h# R6 U) ]+ U3 J# j* T9 o
  38. #include <mach/irqs.h>
    2 ^" `2 S& X6 U
  39. #include <asm/hardware/edma.h>* @$ r( i& M! e! i5 t- I  Z) r
  40.   r2 ^4 W1 A/ Y
  41. #undef EDMA3_DEBUG# ?4 O! U% {4 @1 t5 v4 ~
  42. /*#define EDMA3_DEBUG*/& Y! \3 X4 x4 F: ?" d

  43. 5 V! R# N/ ^$ Q" _8 S# O
  44. #ifdef EDMA3_DEBUG
    ! @: O/ a7 C* p1 E' {" e" o- m% I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% T5 P2 R5 A- b  X, p- y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 Q6 w) u! I6 \$ u  T4 Q7 y; A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 K3 m2 \- p/ H/ c
  48. #else* k+ m/ I) b& J0 ?& i" l/ c
  49. #define DMA_PRINTK( x... )
    " h) W: H. D. K! @! y
  50. #define DMA_FN_IN
    5 N0 @- h/ R' m. E
  51. #define DMA_FN_OUT# i2 q7 I$ j  ?
  52. #endif
    * S" [9 A: t# C

  53. ' s0 ~2 z- C5 k+ M' Y1 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : k' ]8 j7 q' V
  55. #define STATIC_SHIFT                3, [1 h. B0 R" v: r+ B/ a( {4 W# s
  56. #define TCINTEN_SHIFT               20' w. \7 f0 s0 Q0 X  O
  57. #define ITCINTEN_SHIFT              21
    & Z4 O" `8 v1 l6 y: o2 p
  58. #define TCCHEN_SHIFT                22
    $ \. B. O  Z7 Y! J% V" i+ y& ^
  59. #define ITCCHEN_SHIFT               23
    0 v7 [  o3 o1 y' F

  60. - L* \: t0 R* L) E6 I/ R/ N
  61. static volatile int irqraised1 = 0;
    9 D- t8 d$ G$ p
  62. static volatile int irqraised2 = 0;+ M: W$ A% C8 f8 _1 g  w# E
  63. % {5 n% x0 i2 U' Z* Y7 A3 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! Z7 R( {6 a  m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ n# e1 p6 S3 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q. e" I# {% i: p9 Q3 q- h; P' N

  67. / p* e" h) i9 q# e* \3 }. W. r5 N
  68. dma_addr_t dmaphyssrc1 = 0;
    " o& X( @8 @4 j2 b3 y# P
  69. dma_addr_t dmaphyssrc2 = 0;
    3 u! n) t' w1 B. w
  70. dma_addr_t dmaphysdest1 = 0;
    % ?: D. {: N3 c/ X/ E
  71. dma_addr_t dmaphysdest2 = 0;2 l/ c7 g9 {+ C& w

  72. . \2 t* s; S% t- E$ N
  73. char *dmabufsrc1 = NULL;
    6 \8 T: F% k" }7 F+ P
  74. char *dmabufsrc2 = NULL;
    9 y' h& r8 o2 e, l
  75. char *dmabufdest1 = NULL;/ {! W7 M2 o" T5 }& p( \
  76. char *dmabufdest2 = NULL;
    - U" S, W- r  l) h3 Q+ z/ ]4 p
  77. & B) F1 r9 B7 ~0 N
  78. static int acnt = 512;/ e2 i; p; Y6 p$ X" ^4 C5 g  a
  79. static int bcnt = 8;% F2 X0 U( j0 [7 r9 t0 K! U0 @# t
  80. static int ccnt = 8;
    ( |% U( Y- S7 x

  81. 0 I: b8 [" R- f' t
  82. module_param(acnt, int, S_IRUGO);9 F$ o2 X. Q9 H, U4 M# L7 n  O
  83. module_param(bcnt, int, S_IRUGO);
    ! S# }2 J# E( s& d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; o& \6 Q$ h5 f5 B0 z
, e- L* p1 Z6 U# f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 q) h9 x! ~0 D, ]! L, Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! V6 r# Y$ m* [' F( H  F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. _  P7 F# K  A$ V

6 G$ r3 k9 m7 X: _5 s% `% q2 [
5 ~- S0 ^  t  ^) X8 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 14:49 , Processed in 0.039764 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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