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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ l: w$ F/ R- s/ g4 v
  1. [code]EDMA sample test application' c/ ?0 I3 B: Z
  2. /*- U9 N  o, ?! A' `
  3. * edma_test.c
    : o6 k# F3 W2 d
  4. *
    5 |! x9 j$ @3 K
  5. * brief  EDMA3 Test Application6 m$ G; L' T* a
  6. *
    - ]$ ~9 H" E4 e3 V7 ^4 b
  7. *   This file contains EDMA3 Test code.% M9 J% r. o5 `* B( D" x7 ~- w
  8. *7 y( K/ s0 m/ @6 \& M: A9 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; O# X- m4 \" [) _2 @+ m7 K) W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * |$ S  y2 z6 s& T" Y+ v, {
  11. *         TO CHANGE." [, E8 ?+ s% O( M
  12. *- ]2 S, [7 M. @% o7 L$ |- \  ?- \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ a# |* I3 |0 j  S
  14. *
    6 T. ]$ x" I& G5 o* s& B" g7 V* T
  15. * This program is free software; you can redistribute it and/or
    ' u% s( c1 t% Q! Z0 {/ O
  16. * modify it under the terms of the GNU General Public License as% b- s2 y/ p* Y. F
  17. * published by the Free Software Foundation version 2.
    6 [) E& {9 B! X3 I
  18. *0 {+ i  y. j9 H# j" e6 P9 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, w0 h3 d: q# \6 B: L
  20. * kind, whether express or implied; without even the implied warranty$ i9 c) V" \2 X* Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / Y: o. }/ |' y6 v
  22. * GNU General Public License for more details.) `& \3 C" J4 Q* ^  S* j% i* b8 d* X
  23. */
    + j% M' `6 g) o) l% E
  24. ! V, Z8 o0 U# I
  25. #include <linux/module.h>
    ' I3 a% W) m2 K
  26. #include <linux/init.h>
    + b5 A1 g! |8 j, ?* r+ L
  27. #include <linux/errno.h>
    ; [. [5 e. @4 J( C- x* N
  28. #include <linux/types.h>
    2 g) h7 p. ~+ l7 q9 }! i
  29. #include <linux/interrupt.h>/ P/ G1 U8 \: c6 U- l' y
  30. #include <asm/io.h>6 o" j: u0 X/ Q8 p
  31. #include <linux/moduleparam.h>' k, m/ Z2 B9 R8 X- G
  32. #include <linux/sysctl.h>$ @+ s1 G$ C5 {( V: [
  33. #include <linux/mm.h>
    ; h* R1 M% B* r7 h
  34. #include <linux/dma-mapping.h>+ l! H$ D: k- X
  35. ; f; ]/ R/ X' k  |) {1 Z3 N% z! y
  36. #include <mach/memory.h>4 U( Y1 [+ I, C4 J0 [
  37. #include <mach/hardware.h>* T7 f; R- u. V) ]0 A7 Y
  38. #include <mach/irqs.h>
    " v1 C& p" _- j& g* |/ J1 M& E
  39. #include <asm/hardware/edma.h>
    8 z: A( B* p, G+ w7 X
  40. - ^0 x  ^* I2 f
  41. #undef EDMA3_DEBUG
    ' [( |/ ]& w' v, _2 K+ i
  42. /*#define EDMA3_DEBUG*/" }* |% o( L8 g! G; b7 t- Q$ u
  43. * e3 v$ e5 D8 t
  44. #ifdef EDMA3_DEBUG
    , l# P  P: M9 Q, L3 O* }9 x0 }1 V- C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 b; z6 s$ [0 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 N, c4 F+ y! s1 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ T( J) I# z4 S" E, U6 }1 }# z! R
  48. #else
    4 {; u; s& J0 m7 [" }1 {0 V
  49. #define DMA_PRINTK( x... )
    1 r4 A, o5 T3 _6 i" M
  50. #define DMA_FN_IN
    5 z! P$ p, i2 q
  51. #define DMA_FN_OUT" x4 a. ]  r2 W3 f0 e
  52. #endif2 G4 `. v% G( P3 r

  53. : b; d1 j1 F* ~5 s) n( e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 N* F! G" q: A, g
  55. #define STATIC_SHIFT                3" h3 f3 r9 U3 l: S, y4 a# p/ b
  56. #define TCINTEN_SHIFT               20) w. B0 a; l) _9 p' V
  57. #define ITCINTEN_SHIFT              21& G0 ~0 V* E8 Q, R
  58. #define TCCHEN_SHIFT                22
    * v  L9 w2 j! d* v1 H
  59. #define ITCCHEN_SHIFT               23( V. @6 J5 x/ S1 |

  60. ! I" \6 [$ @; i+ a
  61. static volatile int irqraised1 = 0;" M' p' f* q, X5 b6 k
  62. static volatile int irqraised2 = 0;1 J, A  f$ n8 g

  63. 7 x! O; e' j6 X0 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 y5 V1 U3 c4 S; C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 _- y. w' }0 _% D# N7 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . b! Z5 s$ ~7 _% o: y. f; g
  67. ' B7 U8 Z+ h2 Y/ ~
  68. dma_addr_t dmaphyssrc1 = 0;4 r) W4 r" G# R* I
  69. dma_addr_t dmaphyssrc2 = 0;
    & q; o1 l- @. v& y0 @- X
  70. dma_addr_t dmaphysdest1 = 0;
    , K: x. X0 z1 P4 M: Q
  71. dma_addr_t dmaphysdest2 = 0;
    1 O0 M+ H  R- Q9 d. Y
  72. $ s: b5 t  e9 U; z8 O( J9 ]; v* {" ^
  73. char *dmabufsrc1 = NULL;
    % C) _$ c5 W7 V1 M) ]7 g5 s! d
  74. char *dmabufsrc2 = NULL;3 G( H! u6 d: }: @1 D! V9 B% D
  75. char *dmabufdest1 = NULL;2 ]- v+ k: O0 V
  76. char *dmabufdest2 = NULL;
    % L6 e# H: f( K2 C- \
  77. 1 _; Z6 k9 H4 \; S- a; M
  78. static int acnt = 512;
    # B( J, Q' o$ m0 t
  79. static int bcnt = 8;
    9 M4 R. I2 B6 r5 H2 g
  80. static int ccnt = 8;
    ' l- ?9 V. r: |9 B' j, b8 S0 Q6 [
  81. ) u4 c0 L. x5 G
  82. module_param(acnt, int, S_IRUGO);( o. M+ L: G4 K. X0 `5 @
  83. module_param(bcnt, int, S_IRUGO);
    8 T* p; ]7 q( L, \( e6 B9 c# m6 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: t6 ~5 A/ x+ |

$ I" {; e5 ~% z5 i4 w3 U+ L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' N* W) Q- x- F8 b# e# y5 N  o* Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* M% P9 o. G: u$ D% @% C* `' U9 _& G  ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 I' J+ b! v5 r6 j$ g/ Z7 Q+ s# n. Y
& o* S5 k# t$ P7 a; @5 Y# W2 c# W7 B1 J, @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 01:48 , Processed in 0.054982 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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