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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ N7 ?# N' z; Z5 F& g9 N4 e
  1. [code]EDMA sample test application
    % _4 X/ Q) _% L
  2. /*$ D4 L% D9 E$ z  C. h. m! }0 W+ R: t
  3. * edma_test.c
    1 o  g( D4 \8 q9 A6 [
  4. *7 m3 W# Q- Q- v
  5. * brief  EDMA3 Test Application/ q0 Q2 y" W% p+ T7 z% n5 }
  6. *  m9 p9 [+ j+ F. t
  7. *   This file contains EDMA3 Test code.
    5 R0 u- }6 W4 v% B7 }( g# }' u7 C, X
  8. *! y3 w7 b* v. [) k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 B% E# \- D) z  `/ E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 E$ B9 e' s' f1 i4 D" s, o( J
  11. *         TO CHANGE.
    ) m7 O" P% W" ?7 P0 {* c
  12. */ @( |3 V- E7 ^/ t; D; g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % E* i; E( Z. W" I
  14. *
    8 ]  `  q- x9 m
  15. * This program is free software; you can redistribute it and/or4 m- i* K6 n6 s+ e: h( m" U
  16. * modify it under the terms of the GNU General Public License as
    6 F) t" o0 d9 i) P
  17. * published by the Free Software Foundation version 2.
    + K) Z6 t- Q# ?. x0 q3 O  ?
  18. *
      t+ F. s! Y3 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( `) _) S0 z; X9 a0 y
  20. * kind, whether express or implied; without even the implied warranty1 Y. [4 ^5 Z/ F- \5 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / H6 m' a, b3 G5 ?: ^* y# A: u
  22. * GNU General Public License for more details.
    6 ^9 |) C  c: s) w
  23. */$ k9 e$ l$ k/ K
  24. 1 g& e# o' ~3 X! v% [. X" n
  25. #include <linux/module.h>
    " q& x0 _$ ?# A
  26. #include <linux/init.h>
    1 a: J: @  G; f
  27. #include <linux/errno.h>3 p5 ?# n9 u7 w2 k* i6 r+ A( o4 V
  28. #include <linux/types.h>9 D3 i- W) s) i! `( e
  29. #include <linux/interrupt.h>3 s$ c7 W2 l& q
  30. #include <asm/io.h>
    ! @" g! {/ y6 M% }& ?) w( C
  31. #include <linux/moduleparam.h>
    2 \7 u0 x' v. E- j+ s% z( F
  32. #include <linux/sysctl.h>& g$ O8 B, U4 M
  33. #include <linux/mm.h>
    ) f3 o8 \; g% x: N
  34. #include <linux/dma-mapping.h>6 t( J$ G3 k4 W

  35. ! G" P9 O1 e4 a1 y! a
  36. #include <mach/memory.h>
    ! [: h! u: Y$ r' J4 D0 x9 \) A3 d
  37. #include <mach/hardware.h>
    8 ~* d2 y  @2 Z9 d* p- h$ O
  38. #include <mach/irqs.h>4 \/ j- Y2 e# P0 \- ^; }! K' L/ p
  39. #include <asm/hardware/edma.h>) M) U. x. d5 n& Q0 y5 j* I/ N
  40. 4 @7 O' y' {: Z8 L  }: r
  41. #undef EDMA3_DEBUG
    * ^/ d) p/ y# k9 q( p, e
  42. /*#define EDMA3_DEBUG*/
    ; l& z) }  D- ~- T

  43. 0 J# ^  d2 p. Y. E6 R. `% q' R6 e
  44. #ifdef EDMA3_DEBUG4 O; K4 S! h" B' Q/ `% n2 F$ X; v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" G/ V% P2 e* f% Q$ y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% c) e( o" U( ~5 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - Q5 h6 R5 u; [/ T6 U
  48. #else
    ; d* C( _* a4 H
  49. #define DMA_PRINTK( x... )
    & G# g: _1 ?! N' S, I* }
  50. #define DMA_FN_IN
    ( {9 n5 A  r: C( u; c1 V2 a/ g8 r
  51. #define DMA_FN_OUT. I) k) ]' B; O: m/ B
  52. #endif
    6 q% c% M$ t  F8 E: [
  53. 0 z  D2 D4 e, b8 n/ B7 @  C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 ~) @# O% S: G, F. W+ d0 J: [
  55. #define STATIC_SHIFT                3
    7 f8 z  [7 t& c0 j& _$ n% \
  56. #define TCINTEN_SHIFT               20) o4 G* C2 D( j3 @( v9 Q
  57. #define ITCINTEN_SHIFT              213 H# r6 p: q# }8 U) v* t
  58. #define TCCHEN_SHIFT                229 l' U% ?$ a  g& a* R
  59. #define ITCCHEN_SHIFT               23, s! Z) G7 _2 r1 ]. v" V( o. A( Y
  60. 5 E, Q8 E) |0 G9 ?) R* @
  61. static volatile int irqraised1 = 0;
    7 F9 w& }/ o# l- c+ s& N
  62. static volatile int irqraised2 = 0;
    ; V% Q3 |1 O& Y0 H% D

  63. # K8 [3 [- m* |9 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! I+ {( z7 S2 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- g6 y4 u+ v& Z* V4 h5 }0 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 O' i& c* B6 n: H! ?4 g/ n

  67. 9 G$ o, _) O9 f% H* H! f# o
  68. dma_addr_t dmaphyssrc1 = 0;
    % g% F2 x; o. K  Q& F
  69. dma_addr_t dmaphyssrc2 = 0;0 D% F1 [, f) S2 V" a
  70. dma_addr_t dmaphysdest1 = 0;  A* ]6 a7 E3 S4 l# k
  71. dma_addr_t dmaphysdest2 = 0;
    ; g9 H. s  I0 u  g, ^

  72. & n2 [* B. I! S  ?
  73. char *dmabufsrc1 = NULL;
    . W, ~2 m2 r; ^* ^$ e
  74. char *dmabufsrc2 = NULL;. O* U: L/ O4 }2 |' ~/ w+ j
  75. char *dmabufdest1 = NULL;
    4 w! x% o& Z2 {2 J4 E
  76. char *dmabufdest2 = NULL;
    ; I7 n. e* T$ U, X2 w6 F
  77. . M* D" E6 }! j+ f
  78. static int acnt = 512;
    2 ^0 C5 J$ Y2 U  L$ w5 M
  79. static int bcnt = 8;
    ) Q9 a- M3 x8 t* v8 l! W: x
  80. static int ccnt = 8;' z" Y( _9 ~  }9 q# f8 a8 U" `

  81. ( E. r0 Y/ c4 A; o6 x' X/ \" ?
  82. module_param(acnt, int, S_IRUGO);
    + L% f% @% c2 X3 F2 [) Q
  83. module_param(bcnt, int, S_IRUGO);1 y# m5 g5 O# `: q% q5 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 f% r$ n* i) S7 v2 F; g
# s- \& a  S( v$ ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" d5 i7 |7 w) m2 q/ X1 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( m9 l& |+ a% c  s1 B" J( U- _. ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 }8 ]8 M5 A2 P0 \, O* u- x/ g0 V/ V0 I
6 h$ s7 F8 W6 `; K7 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 00:27 , Processed in 0.042028 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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