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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ i0 p: B% B9 @
  1. [code]EDMA sample test application
    ' l! D0 `7 K' {+ \2 T" Q, a  {
  2. /*
    1 W. C7 e5 j% Y  V" `, J- Q9 D$ I
  3. * edma_test.c7 d4 X  G! T( B# Q5 S! w8 ~4 |5 j  f
  4. *) X# t* n" Z1 `4 A: F
  5. * brief  EDMA3 Test Application
    ) V/ s+ k. h4 l; _8 w8 q
  6. ** g5 i7 H& d% m* u1 h; J8 S# H+ A
  7. *   This file contains EDMA3 Test code.
    % e, G- h4 L# J9 @2 U7 v* s/ j
  8. *
      {9 G7 J. y# L0 n1 ~! M; Z  R3 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ D: A0 \  [1 l8 r0 a* x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( C' C" i9 e6 v5 L" ~
  11. *         TO CHANGE.
    / h& d$ M1 U6 n- p( x' V3 C
  12. *
    - `9 n! t/ x$ ?. s  c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% A0 k" q$ I! K+ x/ j$ B
  14. *, a& |% ~1 f# U+ o5 c' I5 V
  15. * This program is free software; you can redistribute it and/or1 g; W; m8 s! O
  16. * modify it under the terms of the GNU General Public License as: C' p! v7 k4 H# Y$ z
  17. * published by the Free Software Foundation version 2., x5 Z% h/ S% U4 [
  18. *4 V& [5 a& j1 p* o- y7 V0 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& ]; L: g7 Z/ J
  20. * kind, whether express or implied; without even the implied warranty2 R" W: p. o) J( u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; e; z2 |2 P2 L. `$ w* P
  22. * GNU General Public License for more details.
    6 b) x# S; ?+ H; p' O% i* p$ }
  23. */" A9 m3 M1 L% F: f: ]0 Z7 W/ K" q

  24. 3 J( L' b5 u, M+ l) w0 M0 H
  25. #include <linux/module.h>1 e9 j: k) T! L+ `, p+ }: L/ p
  26. #include <linux/init.h>
    / r! X( g" u3 [6 T6 L- S. g
  27. #include <linux/errno.h>. q% L# o6 J+ }& J0 N
  28. #include <linux/types.h>
    " ]7 [3 F# R4 K! _
  29. #include <linux/interrupt.h>
    9 P# H3 a. Q3 @7 Z# w) x4 n/ V
  30. #include <asm/io.h>
    3 Y* e0 [1 g) \9 L- z
  31. #include <linux/moduleparam.h>* _- T1 P8 @0 G+ z
  32. #include <linux/sysctl.h>
    ( m5 H2 r) l* J" @# ~: N# s( ?: e
  33. #include <linux/mm.h>
    1 e, m7 ?1 V- Q  q2 ~$ j
  34. #include <linux/dma-mapping.h># p8 Y, K0 o3 Z0 ~4 w+ z
  35. ! r0 D/ M9 w. ~; Y% y; p, R& ?
  36. #include <mach/memory.h>1 c( x- H2 u9 S4 S! g& s) u& v& N  N
  37. #include <mach/hardware.h>
    8 j& R. ]! I/ N8 ~
  38. #include <mach/irqs.h>. F6 v6 }  r$ K6 C8 O2 r, U
  39. #include <asm/hardware/edma.h>6 U0 |/ m7 i" S$ _9 [
  40.   ^8 A) p+ X/ f: k9 q: Y
  41. #undef EDMA3_DEBUG( N* H3 j" r* r( i
  42. /*#define EDMA3_DEBUG*/* C. ~) U7 f. G8 G; r, B. n$ e

  43. 7 U- C- F6 W9 ^9 v' H# c
  44. #ifdef EDMA3_DEBUG
    3 K6 e' o0 M. @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 x6 Q# |  z2 E/ |2 t9 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( H6 X6 ^6 Z: _2 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ f$ P9 E2 y( a' [' J! }. I2 |
  48. #else
    : d- g6 c3 o6 n- a  i  {
  49. #define DMA_PRINTK( x... ). I4 k( {/ @3 A6 B/ ?; Y7 O
  50. #define DMA_FN_IN
    , h( H: R0 r& l$ B3 B. U0 c# ]' d
  51. #define DMA_FN_OUT
    . Z: Y! }4 ]6 u- i  A0 m, c
  52. #endif: O4 i) |+ W; w) W

  53. $ z2 d% }4 Q7 j" _2 U" e5 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & z* a  e1 ^- T: j0 ]2 v# m6 D
  55. #define STATIC_SHIFT                3
    # h/ }, m0 W6 D* g7 D
  56. #define TCINTEN_SHIFT               202 E0 R; I1 {, S3 u. W
  57. #define ITCINTEN_SHIFT              21; ^, |. A7 B4 a0 ^
  58. #define TCCHEN_SHIFT                22' x' i  @! c6 d5 V/ C
  59. #define ITCCHEN_SHIFT               23
    / B  [: @% M! F% a, R+ f7 M
  60. - n4 N  l* J) [3 p4 F0 @0 A7 M
  61. static volatile int irqraised1 = 0;
    , Y. y0 g# @* q+ r# O( {/ @, s
  62. static volatile int irqraised2 = 0;
    6 l! ~' }' F- S, \3 k- I( o& W

  63. * ~/ H& k7 ~, S" \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ [+ m$ u. w# U8 \4 R* c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ^  k2 `5 s- A2 I- O& [& @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & e2 m% q$ Y, y# z" K5 w

  67. ) [! N; v+ ]7 f
  68. dma_addr_t dmaphyssrc1 = 0;9 {- @$ Y. y# Y. t
  69. dma_addr_t dmaphyssrc2 = 0;2 J0 O8 L+ Y) G2 E0 r$ B
  70. dma_addr_t dmaphysdest1 = 0;$ H+ Q: r8 p! c1 U/ i
  71. dma_addr_t dmaphysdest2 = 0;/ ~! k" u5 z  ~8 J
  72. 0 l- e. V# V  Y; A' ^6 {0 q
  73. char *dmabufsrc1 = NULL;
    6 a; }1 k5 M* g; R5 }2 @
  74. char *dmabufsrc2 = NULL;/ i4 }# [$ l+ D' I3 o
  75. char *dmabufdest1 = NULL;
    & s% E: T% y, Y. P) w
  76. char *dmabufdest2 = NULL;
    3 F7 N1 a( M* T3 \) c3 i9 q1 V
  77. ( a$ U7 {3 A5 f; R, S, V
  78. static int acnt = 512;
    2 G! a- P' Y' \8 D* U
  79. static int bcnt = 8;& i5 ~, Z) z7 P1 _2 }. O
  80. static int ccnt = 8;' u! H. c& V+ D! R; d% L
  81. + v. `: q0 o$ G3 H7 V0 f. {& o: a
  82. module_param(acnt, int, S_IRUGO);
    & q  {/ G: U7 [& K
  83. module_param(bcnt, int, S_IRUGO);
    1 O& H$ s) _4 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; E! \  w6 Z% i: y
1 a  P3 ], I# L) H+ a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 G3 P* v. H, F; m3 m0 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ Q8 g0 x4 H; j2 g, \4 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! Y4 H4 y7 S3 j( m3 ]8 P! ?) n; I2 O# S! u8 `8 T  Y' \" x

: H; i/ D& C! ~5 B2 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 00:42 , Processed in 0.039805 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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