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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 _4 k" t, f' `' E! ^6 I
  1. [code]EDMA sample test application
    , E1 d, V! |6 E. S. O
  2. /*5 @! q- Q, e# p- X/ E
  3. * edma_test.c9 O1 a( |# _# m4 \4 ^0 X; p
  4. *
    2 S  V6 p5 u: @9 x" f
  5. * brief  EDMA3 Test Application6 O/ J6 ?9 [1 X. T- A0 |
  6. *
    ( v7 W5 H" j* g+ j) t
  7. *   This file contains EDMA3 Test code.% g* S) b7 N  ]! h4 t, P
  8. *" n7 m! c; K/ U7 n, j6 P9 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 l0 F1 [7 `  H8 g, f$ T( D4 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: L& F& j: f; N' U9 R
  11. *         TO CHANGE.
    + S1 k, S4 z$ ^
  12. *$ E! J1 A' D& ~5 O7 g- H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! F+ Y3 y& k3 I* D9 @
  14. *$ p" f) x( r% ]& w1 a6 S1 L1 P
  15. * This program is free software; you can redistribute it and/or
    4 I& f6 n2 x5 y) }- S% k$ z
  16. * modify it under the terms of the GNU General Public License as+ ?% ?. g, U, @
  17. * published by the Free Software Foundation version 2.3 [0 m1 {& y5 a; j) W$ ?
  18. *" \6 ]7 i& ]1 x6 J2 O, [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 @! R0 ^% N+ v2 N  B: v
  20. * kind, whether express or implied; without even the implied warranty
    + t4 {- N2 g3 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: r# V! _6 C1 C. Y
  22. * GNU General Public License for more details.
    & N* @* ?/ m7 m# x' q8 `( G  b' @
  23. */
    , p' G3 X# d6 v7 S% M! o) g

  24. 6 k# M5 Z5 v9 f. T/ B
  25. #include <linux/module.h>
    , c5 x+ \* z( E, t4 X6 v
  26. #include <linux/init.h>7 W' h% w5 m# D- d2 l! y
  27. #include <linux/errno.h>' X' L+ S2 X! Y  Y1 n# L  G
  28. #include <linux/types.h>
    # H6 E% s3 ^( Q3 r. G+ D3 o8 T% @: c
  29. #include <linux/interrupt.h>1 g' D- k# H6 i* x; w  ?2 x+ J( _5 X
  30. #include <asm/io.h>7 J$ }9 q9 j2 ^$ R; m
  31. #include <linux/moduleparam.h>
    % D0 f2 ~: }5 _; B4 ^$ [, B
  32. #include <linux/sysctl.h>
    8 g% g6 }  v& M$ l
  33. #include <linux/mm.h># k0 h) w3 l9 M1 C; a  q
  34. #include <linux/dma-mapping.h>
    # O( I! R# ?) R+ `+ q: w( b- |
  35. 7 y+ O% S; r; u, W
  36. #include <mach/memory.h>
    " c  q: H4 @: ]7 T3 Z
  37. #include <mach/hardware.h>
    5 X  A- p+ E$ F
  38. #include <mach/irqs.h>
    5 x9 ^- _2 s$ F+ v- Q7 b
  39. #include <asm/hardware/edma.h>+ d) i7 ?' a/ X' n8 p7 H
  40. ' C) `: ^( `: A: G+ V* R9 u. }0 W
  41. #undef EDMA3_DEBUG: x1 Z& c" G0 f( s+ T
  42. /*#define EDMA3_DEBUG*/: @$ w+ S8 ^! _7 F# O8 G* W  ]# R8 c
  43. , x. k8 y9 @2 b; ~0 `8 N
  44. #ifdef EDMA3_DEBUG
    - V* f& ~' U' T0 L# y7 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  ?" {: p3 `9 |9 d6 G* S/ [& P; ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * [, I; Z2 N$ D( q) M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ?  I. Q% _* j6 z4 h' W  C
  48. #else% q5 c/ r' F  e3 Z9 P/ y) X# T
  49. #define DMA_PRINTK( x... )
    / }1 Z9 c" Q0 U1 A; ]/ t
  50. #define DMA_FN_IN
    5 i! B6 }- f7 }3 J- G+ _& D
  51. #define DMA_FN_OUT) X6 c, B& [# |+ v
  52. #endif# d+ U5 L1 E4 P
  53. 4 x% E: \" N4 _( r/ n4 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 h! F/ U7 X3 V# E
  55. #define STATIC_SHIFT                3& \! _9 g9 x" T
  56. #define TCINTEN_SHIFT               20
    ! @5 R0 i6 ]+ D5 c3 X
  57. #define ITCINTEN_SHIFT              21
    : R1 H6 z% M( b& I
  58. #define TCCHEN_SHIFT                22
    ' Z3 z0 a: Y3 \1 O. I7 \' }
  59. #define ITCCHEN_SHIFT               23* ~0 I. h* \, Y$ n& k
  60. 3 x2 X+ Z: h# O+ z) ~% s# O  a: W5 r
  61. static volatile int irqraised1 = 0;/ b2 O/ {# R( Q( v3 G# l7 H! Z! s
  62. static volatile int irqraised2 = 0;4 C# |; G- H! z
  63. , I; ]  I, j# m/ L. N. q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 x6 ^/ R8 P* \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C9 |1 ]1 B# N' x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 U; Z' K- e- a
  67. ) u8 x# C4 F- y( F" s
  68. dma_addr_t dmaphyssrc1 = 0;7 G  G+ H  B/ a1 a
  69. dma_addr_t dmaphyssrc2 = 0;
    % H& g2 h# q' ~
  70. dma_addr_t dmaphysdest1 = 0;0 ?5 `/ k$ j& L9 ^8 n5 T( J) c
  71. dma_addr_t dmaphysdest2 = 0;
    5 U4 K" p0 v4 G7 m. d2 @+ f* s  c
  72. % j0 r+ C9 o7 X7 L9 N, U
  73. char *dmabufsrc1 = NULL;: H  P" R8 h& S% {( C0 _' e
  74. char *dmabufsrc2 = NULL;
    - B5 n1 L5 l, A1 J) @* ~, b5 M
  75. char *dmabufdest1 = NULL;, U8 Y! X; L; I0 [# ~; @
  76. char *dmabufdest2 = NULL;0 H) W' a/ ?( e- d
  77. # V2 t! b8 }$ t' p9 \1 Y1 X- ?
  78. static int acnt = 512;
    5 J' F+ J7 \  N
  79. static int bcnt = 8;! Q, W( ~: V/ u9 m" I; p; j
  80. static int ccnt = 8;
    ) M7 E+ C6 E2 r+ E

  81. + e) j% r& G0 g- {& q2 d
  82. module_param(acnt, int, S_IRUGO);
    ( q8 @5 b$ z% C% O, g: T
  83. module_param(bcnt, int, S_IRUGO);
    ; P% I. Z% [- y: q. T4 g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& O7 V( }# P% V. V( S5 D6 u: @7 ?- o, f% y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ ^* N' g. [  c, f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 L# V- A- e! |9 L$ {/ g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 K" z/ ?. t8 H* P7 z6 U% ]4 V. c7 }: R6 I: _* K0 T! E8 ~: N9 O

9 m6 o: l" a  U+ Q$ @# s% B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 01:55 , Processed in 0.040184 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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