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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 x, K4 ~9 ^6 v& X2 x1 |
  1. [code]EDMA sample test application$ r- A% I& z3 e% j$ I9 Y% h) Z
  2. /*
    * i5 Q) z3 ^  G8 r$ j1 L
  3. * edma_test.c0 e1 |/ D$ r+ u- x- k% d7 }
  4. *1 ~! |1 Y. `/ R
  5. * brief  EDMA3 Test Application
    1 [5 c: \, m3 [) R3 n
  6. *) f* {( e& [: m+ @; \
  7. *   This file contains EDMA3 Test code.
    8 @. N: M8 p4 T& s0 e' u" c7 L/ z, X
  8. *
    & }2 `$ q, \% y. y( I  n( C  O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( P  Y% c' D; ]/ j8 I! b& F) ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) n7 N% p$ Y9 j7 y* W6 o
  11. *         TO CHANGE.
    7 x+ v1 m; B, {% C) \$ |
  12. *
    # w% ^7 e6 x# ?2 c+ F" u8 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; y* C0 d9 r) c/ L0 b
  14. *$ s3 B7 q- p+ L6 q  c3 U3 h
  15. * This program is free software; you can redistribute it and/or
    ! K; M9 M" k7 S+ D8 C6 \
  16. * modify it under the terms of the GNU General Public License as6 i8 b: B8 \/ q0 K
  17. * published by the Free Software Foundation version 2.* p/ C* W2 M7 ~; B: Y# n# l
  18. *
    , B& e$ |7 i8 w: l, @' D" T8 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 Z: }0 r; f" u* o: D
  20. * kind, whether express or implied; without even the implied warranty
    ) k& s5 u( l5 K2 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 x) B7 A+ H) A/ l) Z7 `
  22. * GNU General Public License for more details., E7 C. G3 Q, h5 c) C1 ?% @4 K# x. w
  23. */% i( D1 g- c* [' o3 U$ Y0 ~' \6 r

  24. # A0 i& {. `9 H+ W' G
  25. #include <linux/module.h>6 D% J  _0 W1 d
  26. #include <linux/init.h>+ U; F8 E- g8 O7 |3 P1 ~# T( w
  27. #include <linux/errno.h>4 c: l. v$ o7 }0 P( n6 [, c$ e
  28. #include <linux/types.h>
    3 x4 }+ r1 [+ n: j0 _
  29. #include <linux/interrupt.h>
    , M- }7 ]& B2 ?& W9 }5 R" r! G8 [) u
  30. #include <asm/io.h>
    3 X1 R6 O/ z) d( |+ |" G4 v( g& J
  31. #include <linux/moduleparam.h>
    % n' }4 K3 K: Q3 O' \* N8 F
  32. #include <linux/sysctl.h>
    . O& ?- s) w7 {8 C+ \" I7 {# m
  33. #include <linux/mm.h>7 q7 u! L1 y0 R) y& p2 Z6 W8 H
  34. #include <linux/dma-mapping.h>  l; E/ N+ ]1 Z; G  |% S  E

  35. % D5 c) P% X% h$ @3 h7 W9 [/ M7 Q
  36. #include <mach/memory.h>
    * P/ A) H3 x* _4 p% B" z
  37. #include <mach/hardware.h>
    7 K4 l/ Z. A1 c
  38. #include <mach/irqs.h>' e: l5 v* _* i3 x8 Q) N1 K1 b
  39. #include <asm/hardware/edma.h>- G% A* W6 r- K0 u; z  @9 {, s, k' P

  40. / S$ P" }8 b+ s) s; A: }
  41. #undef EDMA3_DEBUG- S+ k4 S, _- M
  42. /*#define EDMA3_DEBUG*/, ]+ }6 d+ j9 J9 ]! e
  43. 3 Q0 y0 P+ Z) {! r
  44. #ifdef EDMA3_DEBUG7 \( v0 _, c0 ~6 b& `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / f' {& f" A8 l7 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 d0 V( ~, e3 [- J. [# J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): T( e4 O# K) A: f4 U
  48. #else! j* F; i  G( C  v$ f$ O
  49. #define DMA_PRINTK( x... )6 M2 ^3 n+ Y4 s
  50. #define DMA_FN_IN
    ! m; m& B- d7 m' C$ N) Z
  51. #define DMA_FN_OUT
    * ?. b) v9 Q1 m: _2 R
  52. #endif
    - |- x& w2 @$ J

  53. + X! V& D/ k: l, E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! _4 A! f8 s6 A/ p! K4 W# `' d
  55. #define STATIC_SHIFT                3. p$ Q, f/ O$ @! n0 G7 O3 t9 t
  56. #define TCINTEN_SHIFT               204 |- T. h' x( T+ @7 Q! [& Q! |
  57. #define ITCINTEN_SHIFT              21& \& i, K! `  [4 g$ Y3 }0 K* ]
  58. #define TCCHEN_SHIFT                22
    & n9 |6 o( t8 A  p6 v- i+ }
  59. #define ITCCHEN_SHIFT               23- g; t5 Q  i: U( l
  60. + ^/ J& t0 R% b3 w2 L
  61. static volatile int irqraised1 = 0;
    - R3 X* k' j  u4 Y9 _% `3 M
  62. static volatile int irqraised2 = 0;$ R: i) G# U2 q2 ?7 Z$ ^
  63. 1 ^4 n( I& q, Z, ~# G5 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / @8 e' c: L  E1 K' q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) x. h4 }1 v* }: Y. h; C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' D3 p$ u0 o# l! j% F9 X# j

  67. 8 _; x9 A% a* t, D  \
  68. dma_addr_t dmaphyssrc1 = 0;
    2 u2 A) o' Y  D* Z/ O$ k
  69. dma_addr_t dmaphyssrc2 = 0;; e; ~. {, `+ `  m6 b$ G
  70. dma_addr_t dmaphysdest1 = 0;" H+ o" C) W* o+ N4 w
  71. dma_addr_t dmaphysdest2 = 0;
    / X2 t2 a7 m/ @5 j& r

  72. % c, D. A5 L. i$ E. q' M
  73. char *dmabufsrc1 = NULL;- L4 N4 s+ f7 n" g3 o
  74. char *dmabufsrc2 = NULL;
    . ~. @( v7 B4 J" k- l0 n2 E& e
  75. char *dmabufdest1 = NULL;
    , i7 J, B% W* O
  76. char *dmabufdest2 = NULL;
    3 f2 v: H) a* d* Y& q

  77. # f% w8 K7 c# X! R1 _
  78. static int acnt = 512;3 B  H* q! e; u/ p7 P: M
  79. static int bcnt = 8;
    5 Z' a3 ?6 T$ i3 q
  80. static int ccnt = 8;
    9 \) M; ~9 E9 c: _

  81. ' ?/ E+ P0 b; L
  82. module_param(acnt, int, S_IRUGO);+ T  b& t: ?! k+ E4 r; u
  83. module_param(bcnt, int, S_IRUGO);8 y* P. w  N6 H0 H; U9 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ O6 Z% H  V- t9 }; N6 S
3 v$ Z& @" V  V$ }0 i5 y/ W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ m$ }4 z  K: N6 a$ ^9 a* |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 {: E% P1 V7 E7 Y5 h, d5 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( H' S* |8 E- l" q  ?, z& Z. J$ O" K* D( R, K
& [; F) R8 z8 D9 |8 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 04:51 , Processed in 0.045056 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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