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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % S- f, H( c3 G+ T
  1. [code]EDMA sample test application0 B" c: A& [, ^7 s! |. A
  2. /*
    ! ], a; M3 _( U( f9 Z
  3. * edma_test.c
    1 j4 h$ f- _% U( ?- f* b9 ]& {
  4. *
    7 j0 Y7 Q1 A3 X% E$ B" U7 ~. w
  5. * brief  EDMA3 Test Application
    # o4 z: [2 D- e  N; F0 P6 K
  6. *7 f/ O5 D/ R/ M) j6 x7 c$ B
  7. *   This file contains EDMA3 Test code.
    # D; @; z' Q/ R
  8. *6 d2 z( k. R! a& [3 ~- x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 o& e( M9 ?7 \3 M" ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" b' ^( \( h( h% q, q, c0 B2 C' |
  11. *         TO CHANGE.& D0 U3 e9 X% b! C+ _" H
  12. *6 o( `5 c2 Q4 V+ y2 n1 E% Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & X; z( ^, {* y8 h& W; Y
  14. *9 K/ T5 f. r% d% [4 [
  15. * This program is free software; you can redistribute it and/or
    ( ?2 r* U' @# _* l
  16. * modify it under the terms of the GNU General Public License as' x! _8 h( r! D% l; W6 R- E
  17. * published by the Free Software Foundation version 2.$ l! k) C/ R7 v8 g5 ^# N2 P9 G! r
  18. *7 x; A5 X. T) U9 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 j4 P, P4 F* l/ A1 ]: [7 E
  20. * kind, whether express or implied; without even the implied warranty) m' H) V3 T- s0 h7 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! w- h  f% m; [
  22. * GNU General Public License for more details.4 n+ h+ d% @' P3 j. i, h* ^
  23. */0 f, S) L& Q$ @4 j( U# P
  24. 2 J/ R6 w% i2 T! P9 F; ]
  25. #include <linux/module.h>
    ! n! h0 q3 n5 H/ O" K. |
  26. #include <linux/init.h>, F4 I* V4 Z9 U  \) f
  27. #include <linux/errno.h>7 F$ y9 l1 R9 h/ l6 w
  28. #include <linux/types.h>4 {0 R1 ?7 M. e, x, S' ^, m
  29. #include <linux/interrupt.h>1 X! H4 V$ x6 {" C7 Z# n5 ~
  30. #include <asm/io.h>; T# t( V5 Z8 t: C( g
  31. #include <linux/moduleparam.h>" y4 m/ b  I) ?# o4 s) D' B
  32. #include <linux/sysctl.h>
    8 B: f0 @, G& W0 h2 Q/ N  }5 c
  33. #include <linux/mm.h>
    ) l( e# Q: h- Q. N7 m, Y! c
  34. #include <linux/dma-mapping.h>  |) ^8 a9 |$ l: k1 v  j
  35. 6 X, x1 n! l2 B  e0 ^$ O
  36. #include <mach/memory.h>4 m7 ?! J( H2 `* X
  37. #include <mach/hardware.h>
    1 g! q$ t" W/ a  h9 u  n$ g2 V$ ]
  38. #include <mach/irqs.h>
    * h# t5 ^1 ]* Q
  39. #include <asm/hardware/edma.h>
    $ W- a' d$ i4 L8 V9 T7 g
  40. % r8 d7 h- |! ?- k; `3 l; ?. q  s
  41. #undef EDMA3_DEBUG
    / O5 P$ z& ]* q
  42. /*#define EDMA3_DEBUG*/
    % h6 b+ ?: B" {7 R  H4 R' Y: Y

  43. 6 Z$ ?! b9 N$ v* E
  44. #ifdef EDMA3_DEBUG) [: @# C/ V3 D4 h9 J* @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( o) i* f4 H' j) P. K  w. Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) O5 S  T$ {3 X& I. Q- Z8 @* `% A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      m. m7 M0 Z4 M. s2 @, P
  48. #else, p1 g! {# _( L
  49. #define DMA_PRINTK( x... )
    " x% n) R# ~) Q+ Z8 j$ ?4 x! Y
  50. #define DMA_FN_IN
    ( b' _# v5 ^: W' r0 J" t' t; A% C
  51. #define DMA_FN_OUT! W+ U/ y$ U7 Q% f
  52. #endif0 d! n3 e1 ^- F+ Z' D% b# i) \& h

  53. * W& @9 ?+ p8 N0 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 O% t( [% M' n% a- C, _
  55. #define STATIC_SHIFT                3
    % L4 H7 z7 U0 o; S; A
  56. #define TCINTEN_SHIFT               20
    % ?$ o6 L5 v% p; A$ A! H
  57. #define ITCINTEN_SHIFT              21
    , E9 r6 T5 u; B# z( ~3 a% ]* l
  58. #define TCCHEN_SHIFT                22% @) w% Q, H3 U: @9 W
  59. #define ITCCHEN_SHIFT               23
    . Q, {& d1 u" i( u; E0 p+ h$ \

  60. 0 [3 F4 n; X  A- z  C1 C
  61. static volatile int irqraised1 = 0;* C  P( J0 A4 ]+ Z5 h$ ~
  62. static volatile int irqraised2 = 0;8 y: t5 S$ N' e; S4 z6 X+ y
  63.   `/ G6 A5 X  x' q( I/ T0 r' P1 e4 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 h! V. k  S' e3 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 O# ], L  b0 o: L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 R( m6 }+ t6 N% a  s2 D' j( f

  67. ; H& x  V, p5 x. E) [/ U% N
  68. dma_addr_t dmaphyssrc1 = 0;. N7 l, f5 [3 D
  69. dma_addr_t dmaphyssrc2 = 0;2 Z) N2 i# y  Y' Y  ~3 r, k" B7 L
  70. dma_addr_t dmaphysdest1 = 0;* W- s2 B; R* q& T  `, Z1 M
  71. dma_addr_t dmaphysdest2 = 0;
    ! t' e( i; ~0 P% F7 }

  72.   M/ M# t. p* |7 i$ e5 ^' h
  73. char *dmabufsrc1 = NULL;
    " W& M9 E# t8 I! m
  74. char *dmabufsrc2 = NULL;+ L! z( }3 ~7 h1 N3 P
  75. char *dmabufdest1 = NULL;: H; k: }  S1 R5 h
  76. char *dmabufdest2 = NULL;
    $ y/ l8 h2 a# Q8 J& H0 r

  77.   b' B4 o4 _7 z( H# ?- W) W! T
  78. static int acnt = 512;
    5 Y1 v( u1 |! Y, x& R9 M4 J
  79. static int bcnt = 8;
    & ]  ^6 K5 @) _5 Y" R* z
  80. static int ccnt = 8;6 ^, U8 _) P8 k/ X* V8 O
  81. 7 [. J1 o$ q8 S7 @: }# S. `7 F
  82. module_param(acnt, int, S_IRUGO);
    - n% j2 V! v7 D' s4 q
  83. module_param(bcnt, int, S_IRUGO);
    ) x9 J& K& I9 j: Y+ C% S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' V/ O1 L. ?9 k4 r
, [. E' A1 K/ @, v, W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( R/ n( s) _2 ~4 ^2 K2 Q  g3 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 ~& D( Q: X  [# g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 N8 a% l( o8 s' M- q' W- d8 V. T/ A3 o+ \# I
+ F: ]3 W. u( M8 U) t' i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 01:58 , Processed in 0.040946 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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