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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( t. D7 X& H# F. b# i, i
  1. [code]EDMA sample test application3 X: H2 p4 L9 ]6 G3 X5 p
  2. /*; T) v; q8 i' t
  3. * edma_test.c" Z% B5 c( r$ a  c* z+ K* \; c
  4. *
    7 }7 W6 X/ V" E
  5. * brief  EDMA3 Test Application
    7 ]1 o1 J( C6 z3 ?- O" C
  6. *
    ( l: Y7 {# @1 ?1 g! b
  7. *   This file contains EDMA3 Test code.0 t% Q* ^( \- I, T0 v7 O' H
  8. *
      P+ l  n0 \* h% S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 T# e7 C% t, b) D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - j2 N4 h+ e8 y2 `
  11. *         TO CHANGE.% c9 X% G7 B2 p# W. c8 o
  12. *, `1 Q$ Z$ W4 |2 P4 S$ z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ W0 Z/ C% M* @
  14. *5 _- O2 W" J6 t/ \1 q  j: [
  15. * This program is free software; you can redistribute it and/or
      l( M- m# [# \6 U2 [% I. Z9 N
  16. * modify it under the terms of the GNU General Public License as
    . b- I  _* t1 s2 `
  17. * published by the Free Software Foundation version 2.
    * P, p0 k, p# e* K1 T
  18. *
    3 h' @9 S. a) W8 r6 a% J* f* I! v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 j% m: i" V  s: j5 ^5 z
  20. * kind, whether express or implied; without even the implied warranty# V0 G! u, X! _: ?. F( w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 H5 n6 X, A5 `3 N( h" r
  22. * GNU General Public License for more details.
    : v4 f. E" Z' j: \& b$ f3 @1 p1 @
  23. */6 B+ x/ \0 j; w! a$ C/ e! y8 I
  24. / I8 z# t& I/ [; U7 h
  25. #include <linux/module.h>  |6 Q6 M' M) I' ?; C0 V% I
  26. #include <linux/init.h>% ], h, s/ m, g  _4 I1 I6 ?
  27. #include <linux/errno.h>
    3 \7 X5 m* f. H% G2 ]: P6 l; ^. n
  28. #include <linux/types.h>
    2 @' _/ ]% s* ~1 q0 r" K
  29. #include <linux/interrupt.h>0 |; C6 q( L# ^6 V/ |
  30. #include <asm/io.h>- ~( X3 ]& I& a# ^: l, C0 k$ _
  31. #include <linux/moduleparam.h>
    9 h7 z1 c( b6 W! t
  32. #include <linux/sysctl.h>- h: {' a2 Y7 q! W
  33. #include <linux/mm.h>" I& Z0 O4 }! k5 U
  34. #include <linux/dma-mapping.h>
    ! _# T1 g  A: ~6 ^5 G8 F
  35. , D. S% t* ?: }, D; k6 |
  36. #include <mach/memory.h>! S5 {6 D/ S# X
  37. #include <mach/hardware.h>+ I$ Z% \9 M. ^+ [* ^0 m
  38. #include <mach/irqs.h>- q* y" N* ]2 C/ m8 N
  39. #include <asm/hardware/edma.h>: ]8 Y9 Q8 `/ e! q- P$ ~- K
  40. 5 c1 P* z  R: w* s: _. q
  41. #undef EDMA3_DEBUG
    % m2 b( @! g9 N, |; h% x
  42. /*#define EDMA3_DEBUG*/
    9 M1 y% Z; ]4 `& p: \* g( l+ D- Z

  43. * u' u7 Z. f) G% |/ T
  44. #ifdef EDMA3_DEBUG
    9 e' b+ }6 M. k  @1 t1 ^% j$ ?8 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - I" F) ?; _9 V% R6 F4 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% s; t; e  h7 C$ a. _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; n% q6 w6 K% t7 |: S' K; H
  48. #else
    $ b0 [: C3 x- z  d
  49. #define DMA_PRINTK( x... )0 Q- P- Y5 a- m
  50. #define DMA_FN_IN8 T* l9 q7 C) t3 T0 t
  51. #define DMA_FN_OUT
    ( {5 N, G5 c5 K; u4 g- h/ U) K5 l! m/ l; h
  52. #endif& a% J+ `' P7 A! o& F
  53. / n) J6 T, J& j3 F7 v- V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! {# |7 J7 }8 ~* Y/ q
  55. #define STATIC_SHIFT                37 b4 b2 W0 a4 G" L+ k  O; I; d
  56. #define TCINTEN_SHIFT               20
    : i; E7 o* w0 n7 E9 H
  57. #define ITCINTEN_SHIFT              21
    ; h% n! v- }' L0 S7 x
  58. #define TCCHEN_SHIFT                22
    / [3 |9 v/ @6 z
  59. #define ITCCHEN_SHIFT               233 m) i# ~' W2 |; n8 K& ?( E& c

  60. , {/ M" _  w; k' Z
  61. static volatile int irqraised1 = 0;: U9 \8 J$ G' V7 x" o, V
  62. static volatile int irqraised2 = 0;
    % c/ o. e  f: [! H
  63. 0 h' z7 N% b" d: D; [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 A  \: k' ]$ O3 u3 m6 V) N$ I' Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 T" T) S/ A0 ]3 N2 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) I' W& |4 _; \; ~  ^

  67. ; i9 m4 E0 Z! C# _& t9 c8 _
  68. dma_addr_t dmaphyssrc1 = 0;
    7 i1 A& G6 \: _3 C
  69. dma_addr_t dmaphyssrc2 = 0;
    / I% ~5 C  J' x* [5 ]
  70. dma_addr_t dmaphysdest1 = 0;
    % _0 v6 w1 V1 u$ T. T# x& r2 h' O* i
  71. dma_addr_t dmaphysdest2 = 0;
    & f' q3 R" T( T, Q. d: d4 l! {
  72. $ f+ N# u/ n, v6 _
  73. char *dmabufsrc1 = NULL;
    / b' K0 q5 ]; I- s$ x1 z, _
  74. char *dmabufsrc2 = NULL;
    1 o% x" U0 i5 }% L
  75. char *dmabufdest1 = NULL;2 L& O/ p+ q0 f% U: T
  76. char *dmabufdest2 = NULL;
    0 T) @1 f7 q5 U5 p
  77. 3 G" ?% @  O7 l7 F6 S
  78. static int acnt = 512;
    " x1 G) K5 \* ?9 c8 W" }, L- a4 W
  79. static int bcnt = 8;) s) [  @$ p( f) z7 k: M+ R. r9 N) ^
  80. static int ccnt = 8;
    ! T! j3 A" E" ^7 |; `. p- ]6 H
  81. ! ~  |+ z9 ~( T! h+ }, e
  82. module_param(acnt, int, S_IRUGO);
    * j  P/ C0 i; p2 _
  83. module_param(bcnt, int, S_IRUGO);! T( ?# r$ c' U  J# a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; ~: f2 U0 J5 h( M
& n1 r# r, {5 M& m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" \' [5 i" m8 D; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% }/ H. T  ^$ [: V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 U5 c, j  P. b

' y" f: c% ~  I& T( {1 s, x4 Y
4 l8 K; s! q( E1 U( B3 H( _) y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 22:23 , Processed in 0.039909 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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