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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! X! j( l. \! K8 h( Z# @
  1. [code]EDMA sample test application9 [+ N, [. g) Y0 W$ p$ K0 i2 n
  2. /*4 f  `/ K1 O6 N/ Q3 c; Z0 h9 q/ e
  3. * edma_test.c
    1 y4 K9 f$ c. E
  4. *0 P; H+ d7 F1 Y) b3 ?$ e
  5. * brief  EDMA3 Test Application
    % A: l0 j) @" k. H/ K
  6. *
    9 z5 R  w- ~/ t
  7. *   This file contains EDMA3 Test code.  E) h  E5 q, n
  8. *
    $ d, |: j/ Y" M# l# N; G5 S, v. k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- \* J/ C: g' `7 V  L$ r, k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 C4 \& b$ G" y
  11. *         TO CHANGE.; I& \* s! F/ p8 {
  12. */ Y' N# c( t+ w+ |8 m) _* g; k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      I  ~, x9 Z& s7 v. ]; u" R
  14. *
    & G$ k8 F4 l1 @
  15. * This program is free software; you can redistribute it and/or
    1 W1 O( f# I6 a5 t8 {! y* O
  16. * modify it under the terms of the GNU General Public License as
    ; S/ T* }% [6 V8 J+ K, `3 H
  17. * published by the Free Software Foundation version 2.
    $ s0 M& M' A6 U
  18. *
    " I  L+ H: h5 g* [; \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , T, Z. o% F& Q4 x* t0 l
  20. * kind, whether express or implied; without even the implied warranty
    9 W% @4 E5 I5 C* ?% w6 ^! ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 F) k7 N3 z( T9 V
  22. * GNU General Public License for more details.+ z+ D* E& j% T$ B* D
  23. */$ I/ R. ]6 O% j2 e
  24. ; G/ @7 w& U: M
  25. #include <linux/module.h>
    8 l1 n/ c* b4 L2 m
  26. #include <linux/init.h>
    ! \1 ^7 U5 q  A9 P6 u; m
  27. #include <linux/errno.h>
    1 Y& J" v# \( |
  28. #include <linux/types.h>
    4 L" A8 R/ x% W+ }0 M8 [& o: S( t
  29. #include <linux/interrupt.h>
    . J: I4 c  w+ a- R6 G
  30. #include <asm/io.h>
    $ x- X" j6 L4 w
  31. #include <linux/moduleparam.h>, ]6 e+ Q2 d; [0 t- \8 x. x; t
  32. #include <linux/sysctl.h>
    7 U  p; V9 q3 P' G7 N& y3 i
  33. #include <linux/mm.h>
    , h! D+ r3 V; ~$ V* f2 {
  34. #include <linux/dma-mapping.h>
    ! V* L) D( }; E0 w# f, h

  35. . V( N' Q, Y& ?) R2 }4 F
  36. #include <mach/memory.h>
    1 }! U4 Z8 c& m0 f8 e* o. @1 }+ [
  37. #include <mach/hardware.h>
    4 `" M5 s" Y+ ]8 k$ R" I: @: b# k
  38. #include <mach/irqs.h>4 S7 ~+ i) x, K% ]- U; b
  39. #include <asm/hardware/edma.h>+ c1 D! O0 a- @

  40. $ b8 m/ K' d9 d6 w
  41. #undef EDMA3_DEBUG2 |, w: h/ G6 t" E
  42. /*#define EDMA3_DEBUG*/' E' y2 u  _* G0 W) Y
  43. + e5 g' e' p" {$ V9 t: l6 j
  44. #ifdef EDMA3_DEBUG
    8 L, e6 L( G  j  L, |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & x  D# c' g& v0 q" P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). S" J% f& A" T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 y  R! B9 E$ `  |2 e! c0 f7 x# _
  48. #else# Z, Q5 `5 u# t, [
  49. #define DMA_PRINTK( x... )$ [- L9 e4 t9 O" R# g; E& W
  50. #define DMA_FN_IN
    : ~% {. m/ k1 I: T
  51. #define DMA_FN_OUT! X; E5 i* Q, T7 {* w# P5 E: T3 O
  52. #endif8 }- ]6 S  N! b" k3 I
  53. # H3 O( w  d; g3 o. h, G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 y- F  ~' @1 O. n- [7 L+ J* {$ A
  55. #define STATIC_SHIFT                3$ v2 C- {- \6 l+ i* w: q* m
  56. #define TCINTEN_SHIFT               20! H) k# ~6 v: b0 k( Q, j* I
  57. #define ITCINTEN_SHIFT              21
    6 K. s7 ]5 M/ J' S) {
  58. #define TCCHEN_SHIFT                22
    , p, |- J# L+ c% r, ~* N/ A) P9 i/ k
  59. #define ITCCHEN_SHIFT               23
    + o9 ~3 m# F  t5 L& z8 K

  60. 2 l! {/ r* n/ [
  61. static volatile int irqraised1 = 0;. t- L$ V$ q' c3 w" z- i, Q7 j
  62. static volatile int irqraised2 = 0;$ V. ~( U; L$ q  L3 [
  63. , X5 G: k1 }6 Y% ~/ x+ H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 [5 o) E) b9 [3 X- u5 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ K0 Y6 M0 r3 c8 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # r0 l$ |3 _# N+ k3 z- l
  67. # v9 p; T  v, ^% {
  68. dma_addr_t dmaphyssrc1 = 0;
    ! G: a* K$ s7 n& U2 w. G5 k! |9 a
  69. dma_addr_t dmaphyssrc2 = 0;$ a) B0 [( l- W  Q, [! r
  70. dma_addr_t dmaphysdest1 = 0;1 `. T( z8 c$ V6 [! g  l
  71. dma_addr_t dmaphysdest2 = 0;
    3 m+ P' I0 \/ v% s) U8 g
  72. 6 `6 S; r2 Y9 _9 L
  73. char *dmabufsrc1 = NULL;
    + t/ R- K6 r# e% u% B- A1 H
  74. char *dmabufsrc2 = NULL;% S, I0 `5 h/ U3 B+ ?
  75. char *dmabufdest1 = NULL;  n7 E& C( v8 o3 P. w$ w
  76. char *dmabufdest2 = NULL;, u; i+ ]7 Z5 z# I
  77. - P0 ]8 T& Y. _/ N
  78. static int acnt = 512;  F: P, B1 Q& X% K& O0 w& D
  79. static int bcnt = 8;5 d9 U+ B! Z% v3 w! x5 k
  80. static int ccnt = 8;. s* E: E3 S+ x; u& G" B
  81. 7 d- d2 L  B4 y: o
  82. module_param(acnt, int, S_IRUGO);9 t+ O6 V2 k1 g% Q
  83. module_param(bcnt, int, S_IRUGO);
    , M% A* u6 u6 `& g% t" M+ W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 g* ]- U  g6 j) B- n  t
# E7 W; q# }6 t& l# C5 p; z9 ^6 q" E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 c7 s4 {3 i2 a' H) F) m; V& i- V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 h& Z: {  D7 X0 `4 }9 Z0 v9 s& Y! A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; ^& H- d+ V0 y# d! O9 P! v6 R6 ]. M, v0 X

* E; u- p7 x( L! x5 n- M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 18:53 , Processed in 0.040452 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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