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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! C  ~8 j% z, s, w7 @
  1. [code]EDMA sample test application! B2 I; X2 n2 E, n0 w! H
  2. /*
    # S" p( \+ r+ u7 \& j! ~' \9 w
  3. * edma_test.c
    & f% J- D/ I* q% u- g
  4. *
    # _5 Z7 o  u  T+ h9 k- m6 x( I4 O" R$ ^
  5. * brief  EDMA3 Test Application
      ~' Z2 U/ T. Z. _
  6. *
    : B: l7 R  d  {  M6 C
  7. *   This file contains EDMA3 Test code.
    # [+ u% \2 V1 M) E
  8. *& g5 f6 j0 M  U- g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 q0 q  z1 w6 d* Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % m& f& I- w& C; H% v
  11. *         TO CHANGE.7 T0 D( x1 h9 C* b1 b
  12. *2 D, D* q! z5 ?0 N& v3 T$ f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 o- ^: _, O- _
  14. *2 ]) [& T4 D1 [7 i0 _
  15. * This program is free software; you can redistribute it and/or" R1 [7 `2 r; g+ V
  16. * modify it under the terms of the GNU General Public License as" V, |' \4 A1 @3 o' t
  17. * published by the Free Software Foundation version 2.7 c5 _; c( U, P- t* F- Z* ^
  18. *
    5 y, J4 `# `/ \; A3 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 U" @: I1 l6 z& q; `$ D4 ~
  20. * kind, whether express or implied; without even the implied warranty: |: ]2 T$ J2 Y/ @: g0 {6 O! @& `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 u8 S2 f2 a2 b
  22. * GNU General Public License for more details.- _+ E) x2 d# Q' _
  23. */
    $ d; X# q0 ^% o* q) _2 S
  24. " X! |- ]' v" m- H" x
  25. #include <linux/module.h>8 F/ Y8 Y& b3 O; F4 u# s8 `4 o6 t
  26. #include <linux/init.h>8 w: ^! R# s% K" y2 E4 q8 \
  27. #include <linux/errno.h>  l+ Y0 V8 _: N" L
  28. #include <linux/types.h>1 x! ]  B& \' |+ m$ O
  29. #include <linux/interrupt.h>
    8 H. C6 b: `8 {! Y. s1 @7 W
  30. #include <asm/io.h>
    6 o" J  P. i/ F& `
  31. #include <linux/moduleparam.h>4 `$ O& k+ l) a' [4 Q! }# T! [
  32. #include <linux/sysctl.h>
    9 G3 P; B( }0 x3 K
  33. #include <linux/mm.h>
    3 \( t* q; T# H2 h
  34. #include <linux/dma-mapping.h>
    9 p% t; e% D9 l% @, E& K' l

  35. ! ^# \# K. A1 p; ^, h9 o8 I
  36. #include <mach/memory.h>7 ^- g6 U+ ?( M2 m6 `
  37. #include <mach/hardware.h># o0 P4 t9 s& ^: s
  38. #include <mach/irqs.h>3 y: l7 K8 H$ X
  39. #include <asm/hardware/edma.h>: _/ T5 C( p% }, m

  40. & F: V3 L& J1 a
  41. #undef EDMA3_DEBUG
    4 K& t. W: e1 ^
  42. /*#define EDMA3_DEBUG*/+ n6 r' u0 v7 {* a8 g; V1 u. l
  43. 4 b' S; a. k8 p
  44. #ifdef EDMA3_DEBUG& ?5 _7 E+ N- ?' G) R* h# a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 B7 [; y. w" ]% A  `& @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * T; g- t$ C; B. z+ m9 C  \+ b6 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 o( L% V, A% G5 Z% w" U/ C
  48. #else9 G# O# d% K# j' a
  49. #define DMA_PRINTK( x... )- s2 T6 a& f! H- r6 y$ B5 L6 k
  50. #define DMA_FN_IN
    ( a  I. z8 p7 Z# X
  51. #define DMA_FN_OUT
    0 Y& w8 G+ i2 v( \# W$ }$ F; c
  52. #endif+ S/ i5 J! n4 m# G* K
  53. 4 T/ h% {4 |: M) M1 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * _" z( N  L1 b: Y
  55. #define STATIC_SHIFT                3
    1 d0 |6 p8 H( O. H" D. ]: L
  56. #define TCINTEN_SHIFT               20
    6 A! F$ h$ q1 r5 ~; ?, t! L
  57. #define ITCINTEN_SHIFT              21: S! I4 w4 c/ A8 [" ?2 i
  58. #define TCCHEN_SHIFT                222 S/ b0 U8 ^6 o& g6 t5 i; o
  59. #define ITCCHEN_SHIFT               23  S2 \1 ]- u  V9 @/ C$ B1 C

  60. $ a8 K$ V' @+ [9 O4 \8 U. N
  61. static volatile int irqraised1 = 0;( V1 T4 e9 [  Y1 ^+ y0 v1 j) W+ V
  62. static volatile int irqraised2 = 0;' e4 a9 }& u* ?* a- a( h

  63. ' a9 o$ W* _6 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 I" R: Q' W" e0 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 q: A3 V+ @& p1 m. j9 M+ q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( g1 z0 X0 t  ~2 \; o
  67. ' I, r0 d6 _+ k. b* k0 [" r: c
  68. dma_addr_t dmaphyssrc1 = 0;
    : E5 O* x2 y) }3 E$ e
  69. dma_addr_t dmaphyssrc2 = 0;
    * M$ D5 A, P- B% ^6 D5 _
  70. dma_addr_t dmaphysdest1 = 0;
    / X) q% \+ E- f3 Q+ ?
  71. dma_addr_t dmaphysdest2 = 0;
    6 N; L( b# E% }, E' ?
  72. 4 R. n  F4 h& p5 c8 E( G
  73. char *dmabufsrc1 = NULL;
    4 Y) D5 r& [( E: E
  74. char *dmabufsrc2 = NULL;. U; Z, b7 o! ?" y. X& O/ V. O; d0 f
  75. char *dmabufdest1 = NULL;
    1 y, O) U1 Z1 q. l9 P+ c
  76. char *dmabufdest2 = NULL;
    1 V. ^3 `" R7 R
  77. 8 x5 ?. w9 E6 y1 E" M; v. [
  78. static int acnt = 512;
    + y) _* \; d: u! @
  79. static int bcnt = 8;1 k2 v# ~  k7 U! F& C# j7 f
  80. static int ccnt = 8;
    : Z: a9 f3 T% \2 _5 L

  81. 2 D  Q& p2 J: |  b
  82. module_param(acnt, int, S_IRUGO);
    ( h7 N4 D4 ?% s1 A9 p5 S( {4 G
  83. module_param(bcnt, int, S_IRUGO);
    % b# V* h4 I4 {: ]& m8 N% l0 J$ Y8 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ c- l5 t1 @2 _! T" ?
+ ]0 U5 {( @, l& v7 G7 `: T7 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! I& S' C. J, \- p! J5 _( J: H
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 ]. Q" R0 @3 S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" S. s5 a, Q# y1 i, a7 u- s& |% m5 O* k

7 I2 F, w9 J* B- e5 |- P% _. o7 H; z' L" Z6 ^; v/ b3 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 23:03 , Processed in 0.040832 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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