OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* v2 ?) S5 [. h" M! c3 @7 j9 U
  1. [code]EDMA sample test application
    . I4 m! F, L6 K& ~( U
  2. /*& H9 S2 V% d. _$ F  T- K9 [9 _
  3. * edma_test.c! G; _( M9 Q. }6 O2 m) s
  4. ** P) w1 o- ?& l
  5. * brief  EDMA3 Test Application
    7 g3 z6 }' W' \3 G
  6. *$ Z. ^6 i: f6 K# }2 O: c5 |+ g) N
  7. *   This file contains EDMA3 Test code.% h0 d+ c3 e' G& H" l/ ~
  8. *% l+ l! D, K( W, |8 n( P% h  N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 @) _5 t" M! o, @5 f; y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) w' R  N$ j3 w# O! H- G. A
  11. *         TO CHANGE.
    : T! }4 y  ?. a4 a
  12. *& |* ~. H6 o1 D5 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) y2 T7 t8 i& o. V# q: ?* ]$ k$ d
  14. *3 j( }  ~. [3 g9 Y
  15. * This program is free software; you can redistribute it and/or& m0 O$ H4 ]* l3 h8 B
  16. * modify it under the terms of the GNU General Public License as
    . e# u/ q7 p+ j* U1 s; J" ~
  17. * published by the Free Software Foundation version 2.
    8 M( L: ]: r- |; z. I5 p4 s
  18. *( W6 o2 A, Z  n7 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* K% h6 x* e. i# C8 @. \
  20. * kind, whether express or implied; without even the implied warranty
    3 R, C2 A% W4 u; w+ t4 ?9 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 C5 t5 |, `1 B" ?# o) s- b6 Z
  22. * GNU General Public License for more details.
    " ]* ]1 R& d( C  `, G  F0 J
  23. */* Y: B5 r! b/ c3 b5 H/ y

  24. . Z6 L9 d( P( j  E/ ]6 e3 t
  25. #include <linux/module.h>
    9 {$ Y5 s# |$ [1 y0 r6 M5 Y
  26. #include <linux/init.h>
    0 ?. F) M9 p' a2 s$ x: P3 ]. ?
  27. #include <linux/errno.h>2 m1 H# c# u$ x- L1 @
  28. #include <linux/types.h>
    % d3 M2 y4 f$ ^& k5 s2 E! h, d5 u
  29. #include <linux/interrupt.h>
    ) n1 C, L5 v. G7 O: A
  30. #include <asm/io.h>2 ]. M* s& Z4 j3 M8 q
  31. #include <linux/moduleparam.h>0 @# A1 U3 H( c# s6 l8 a* E
  32. #include <linux/sysctl.h>
    4 n! v" A' I1 y6 q  u$ ~
  33. #include <linux/mm.h>- C( |8 f0 T& E( X
  34. #include <linux/dma-mapping.h>
      G9 b' ?( W* k$ K/ m

  35. : W% f6 o( A( f+ V  ~. S. A
  36. #include <mach/memory.h>
    3 A' y. @2 n0 b7 n
  37. #include <mach/hardware.h>
    ( ?" d* {2 E+ L8 V2 t6 Q
  38. #include <mach/irqs.h>* J% ]4 v4 T2 J! G! ], r
  39. #include <asm/hardware/edma.h>' ~8 e, h* ?3 Q9 T5 v0 K

  40. ( D0 V, o4 ~% b1 o# @
  41. #undef EDMA3_DEBUG
    " l! l2 J/ ^5 L8 i( d( d1 S
  42. /*#define EDMA3_DEBUG*/
    : Q5 H5 o! U* K3 T0 _$ s7 r
  43. % z7 w* k4 g5 P' ~' p* C
  44. #ifdef EDMA3_DEBUG8 W& l2 _! ?- V& d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & Q7 m1 L: d* \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - O8 @$ t8 p- l$ e+ u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - J+ _+ Y( i; S; c
  48. #else* N3 b9 [3 D' ]; o* ^
  49. #define DMA_PRINTK( x... )
    ; i* V% ]% `1 C
  50. #define DMA_FN_IN
    3 `) m. [. y  r
  51. #define DMA_FN_OUT* {- c$ N3 C8 g5 r
  52. #endif: ?" _. {6 o; w7 W
  53. . f! u% ?$ k9 c% g1 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 w( ?) k1 ?4 L5 }0 T8 b1 s4 i
  55. #define STATIC_SHIFT                3( y. Y+ _' V0 V$ \5 H2 @* c- ~
  56. #define TCINTEN_SHIFT               20
    % v2 [( E4 G& P( U
  57. #define ITCINTEN_SHIFT              21
    4 L  U8 m) n* B8 G; K! {: G
  58. #define TCCHEN_SHIFT                22
    1 W- F; U' w: R! |1 K. P3 X
  59. #define ITCCHEN_SHIFT               23
    , l+ L3 y& c: |  a* W. b
  60. : A/ G1 s# p. N7 A2 ]7 K; C
  61. static volatile int irqraised1 = 0;
    " @* m( f3 I% v2 w+ j! \7 m) k5 Z2 L3 }8 C
  62. static volatile int irqraised2 = 0;. n7 t- W3 ]3 w  a' E
  63. ) S0 b, z8 k6 V) k1 e$ G# J. A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J2 @& J% h  }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 q  L* ]6 l  c# P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ?8 v7 O! N' y% W- b6 _, B

  67. * q8 t. A1 x0 c: l  L" ^
  68. dma_addr_t dmaphyssrc1 = 0;3 p. u) E7 q+ W. }; r  h
  69. dma_addr_t dmaphyssrc2 = 0;' ~  I& @* L& \) [
  70. dma_addr_t dmaphysdest1 = 0;
    / E4 j# j% |! S* t3 G0 J/ Z- z
  71. dma_addr_t dmaphysdest2 = 0;- n. K; c8 _* g9 u
  72. - Z3 l+ Q, [. |' ?6 }) [
  73. char *dmabufsrc1 = NULL;
    , d0 q# e% j  P* {) U7 b
  74. char *dmabufsrc2 = NULL;
    6 Q: {' [, }+ a5 ^+ b
  75. char *dmabufdest1 = NULL;3 x6 ?5 L. o% K$ S! a$ J
  76. char *dmabufdest2 = NULL;$ l' `4 a: T! \) t7 F
  77. - l4 Y7 \7 v3 T
  78. static int acnt = 512;! ^- J1 W" x3 N( L5 b/ Y( V/ b
  79. static int bcnt = 8;
    3 L/ K) Q( ~. F( w
  80. static int ccnt = 8;
    " y" m. f- G# Z

  81. , `/ b% J/ R4 ^( A& V
  82. module_param(acnt, int, S_IRUGO);
    # ?; Q) k' P- D: `0 ^
  83. module_param(bcnt, int, S_IRUGO);5 G& v1 W4 ?/ e8 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# W, }9 O" q2 @# q4 V, K/ `
/ f5 T9 K. {* B* Y& X+ L; B3 z9 N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. S' V9 i0 c0 l/ ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 P0 I0 W- \! ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' d' ^+ Y& n8 I! R

: E! N4 r' f8 q
' n& o3 a0 ~3 }# D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-16 22:30 , Processed in 0.036769 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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