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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: [8 v) ^# Q- ^, v# N. T; y3 E
  1. [code]EDMA sample test application
    5 }$ k; ~$ U  h+ l% c; s
  2. /*
    / X/ H8 z( v3 @4 o& c; Q* M/ |- ]
  3. * edma_test.c2 S# o5 W  Y& b, |
  4. *
    , w0 l  K" O& o5 y5 s- b4 I
  5. * brief  EDMA3 Test Application
    + y8 ^6 a  G" I( B/ e$ U9 s7 [% v
  6. *% f; l1 `( T. H0 c/ l
  7. *   This file contains EDMA3 Test code.1 s$ x% o4 N1 M) S) f
  8. *
    0 E, f0 R, j' i) {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( V8 Q1 f7 @  W1 j: E6 X) ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 h7 B: r+ n$ p; J8 n
  11. *         TO CHANGE.: o) ~  @3 d2 X# Q* Q; b
  12. *
    8 g$ |7 ^  c/ e8 O  m# ]3 ^/ N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 C) C* `+ b' K% o) D# Q7 K- K- N
  14. *
    + y. F( X* I& C: Z! `
  15. * This program is free software; you can redistribute it and/or1 T! Y7 a3 v& f
  16. * modify it under the terms of the GNU General Public License as# k% C5 B+ F( w# Y
  17. * published by the Free Software Foundation version 2.
    " X1 d8 Y4 p# b+ D' [
  18. *0 e6 v  \4 u# g% K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . E4 i% U0 u; j7 L/ P
  20. * kind, whether express or implied; without even the implied warranty4 k6 ]: g1 d3 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( ]4 D! X' y# S0 h0 [; e6 t
  22. * GNU General Public License for more details.
    7 j1 T: s, X& t% T
  23. */% J/ h3 V( @. e1 _3 W% t( ~

  24. / ^9 q, |' v- s( ^" \  Y
  25. #include <linux/module.h>
    ; u% W, n3 |& w# Q5 R, i, |2 y
  26. #include <linux/init.h>
    ) w- h1 A3 C1 V
  27. #include <linux/errno.h>
    % i1 ?; v7 V: \7 t0 O7 [9 N
  28. #include <linux/types.h>* V! z; R, X) t1 P
  29. #include <linux/interrupt.h>3 ]8 R8 P0 G. {% n' p+ J) u- a
  30. #include <asm/io.h>- k9 C+ j4 F6 Q" i% V3 w; d% t" q
  31. #include <linux/moduleparam.h>4 }3 p3 ~" J% m5 ?4 Q& ~
  32. #include <linux/sysctl.h>  \$ V7 B$ }% g* J" {+ C: ^
  33. #include <linux/mm.h>- Z5 I+ M3 J2 `
  34. #include <linux/dma-mapping.h>0 w  Q) B; A7 _3 m- K4 I
  35. ( X, [. z/ s+ ?  w% m! o: `
  36. #include <mach/memory.h>
    $ e' ~: m6 B4 w& J6 [2 @3 O9 a9 O
  37. #include <mach/hardware.h>
    3 P: _9 J7 j- i9 l2 P& T8 i- A
  38. #include <mach/irqs.h>
    : }2 {8 N7 h9 R/ s+ c
  39. #include <asm/hardware/edma.h>
    ; k) a0 v8 m, F7 Q" }
  40. " k9 o+ L9 U3 e
  41. #undef EDMA3_DEBUG
    * M% g: x% t" a8 [4 m6 N
  42. /*#define EDMA3_DEBUG*/, t5 l, E6 s4 r, u

  43. 5 \& g, g. S& i  K) t) X( [+ q
  44. #ifdef EDMA3_DEBUG/ ?$ f3 I2 q2 e; Y6 {% J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" l  T( _9 }: o9 k( l2 l9 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) [! w$ j8 R5 [  ~3 Q" V* t$ \# v. E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 D! c7 l  x; L
  48. #else1 N% ]1 a9 U7 P2 X  C
  49. #define DMA_PRINTK( x... )5 x( h* L! ]1 h+ U  s
  50. #define DMA_FN_IN
    / B" ~. ?# n. D9 D9 z: `  O
  51. #define DMA_FN_OUT, g2 N7 w# f: m) ?7 }
  52. #endif: C9 Q$ ]; C$ W" n$ t  ?
  53. ' h/ E4 ]2 o8 W$ U) p4 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ r  [3 u& X$ I# u0 [
  55. #define STATIC_SHIFT                3
    * r+ y& }7 g5 s6 s
  56. #define TCINTEN_SHIFT               20
    - _! G. d( ]/ U% X
  57. #define ITCINTEN_SHIFT              215 F, e6 V0 s4 q1 b4 M" F- R. M& y) C
  58. #define TCCHEN_SHIFT                22" T5 D$ ?# w- _5 N. V! V) X9 \
  59. #define ITCCHEN_SHIFT               23
    ; s, i% C( n  k! z  ~" ~7 y

  60. , g3 [* V  V9 p* d
  61. static volatile int irqraised1 = 0;9 X5 V. X* Q, @" [& x
  62. static volatile int irqraised2 = 0;
    8 P  P' O. J7 r3 T/ q' d9 N

  63. # C$ s5 ]* i* X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / `! p+ E1 o7 P3 v. ?: e. s' V- `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 {3 P) Z; E' V: c7 l7 Y' l# t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" v. p' g7 G( U& z
  67. 0 e+ r  s9 J; @$ u" c
  68. dma_addr_t dmaphyssrc1 = 0;) V1 j8 W0 W  n$ U. D6 J; [2 y
  69. dma_addr_t dmaphyssrc2 = 0;
    7 s! u  S9 l, i& r1 L1 I
  70. dma_addr_t dmaphysdest1 = 0;* R, Q$ H2 x8 e7 Q- g
  71. dma_addr_t dmaphysdest2 = 0;
    6 \; ~; V! \- @( M2 N" C# q9 F: z
  72. ; j+ b" R" F  |4 D) B4 l
  73. char *dmabufsrc1 = NULL;, p- f  A% S& j
  74. char *dmabufsrc2 = NULL;
    $ X3 @" C) |# q0 V3 x8 V
  75. char *dmabufdest1 = NULL;
    5 \! A2 ]3 n& e) `
  76. char *dmabufdest2 = NULL;% F: B9 O( `' f; o( |$ {
  77. + E+ X+ t# J) E$ m% v/ A. d
  78. static int acnt = 512;% |% w9 `6 s4 V+ n% C2 H
  79. static int bcnt = 8;
    ) t# N2 S6 m+ B
  80. static int ccnt = 8;" O9 {$ A/ q3 [
  81. ( D6 d+ V; ]% w+ {8 X
  82. module_param(acnt, int, S_IRUGO);, A4 G1 c. p. a/ @9 V
  83. module_param(bcnt, int, S_IRUGO);! o. g" v9 o0 T2 Y1 }- k  P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 s! R$ t8 ]9 M3 v  s- n5 z) L, z5 j# ?$ H% Z( T7 @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' l4 Y* l3 Z9 K; u: g4 D6 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 n$ U1 }: e% ~& A0 w6 C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! b3 m9 O* G# z! R
" l5 [! S* e6 p3 \. {
2 T% T+ m2 _# W4 U& d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 16:57 , Processed in 0.040204 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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