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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 d4 `" m; \# C: I% F
  1. [code]EDMA sample test application& p8 b( _* J3 U$ H8 |# D0 r1 M+ i
  2. /*- P0 G8 }4 ?) N: `
  3. * edma_test.c
    ' j5 A* N, ?: V  p' |8 h' R
  4. *
    + Q) b, k+ t6 b# h7 G6 ?
  5. * brief  EDMA3 Test Application
    - d- m" |: K6 U
  6. *
    2 D* V+ N- Y& O0 O/ B0 s
  7. *   This file contains EDMA3 Test code.
    * n. j6 q7 _0 N  `/ i
  8. *
    / L, B2 [1 t# r' a" x+ N; V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 s$ q5 A) l; D; J; f" B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! z# ?  t1 l: J
  11. *         TO CHANGE.* d$ |  P4 e/ A$ U
  12. *6 s" j# d/ F" ^+ A6 J9 c7 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 W6 W6 ?/ P) `
  14. *
    ! k% v. ~4 @2 x: b# o
  15. * This program is free software; you can redistribute it and/or$ `$ M) A3 L  v# n, R& {
  16. * modify it under the terms of the GNU General Public License as
    ) U2 j' x1 C4 f
  17. * published by the Free Software Foundation version 2.' R9 [: N( q  h, O, U
  18. *) i9 c; P# Y. p$ J& }- i% F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 o& M& ^- T% j% s1 W+ j+ p; r
  20. * kind, whether express or implied; without even the implied warranty
    % B/ M+ t, B! V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 n8 b" e  a3 M: q
  22. * GNU General Public License for more details.
    % ]8 S. P( \" V8 x# E) l% d
  23. */
    % Y  |% }4 {7 s* c6 @! a/ N" @
  24. ' n0 p" E6 p+ o; j( Q8 x' j
  25. #include <linux/module.h>
    ( i/ _, l, g( L" \8 W! z
  26. #include <linux/init.h>1 f3 {4 F7 o8 J0 G0 ]) S$ {. X
  27. #include <linux/errno.h>
    ! j) x. A$ Y3 u; y% f4 g8 V
  28. #include <linux/types.h>' k( e6 ~2 j% G- p$ I
  29. #include <linux/interrupt.h>
    $ I. w, J8 Y$ z: c. a( z
  30. #include <asm/io.h>
    5 G# D" ~, Q1 ]0 }. x. z
  31. #include <linux/moduleparam.h>. R. P* D$ p# h
  32. #include <linux/sysctl.h>% Y; A4 ^# |: B2 m+ t
  33. #include <linux/mm.h>
    3 q7 K: G6 }/ X" }% v& U( t% v1 t3 Y
  34. #include <linux/dma-mapping.h>4 L% m" R) u- h7 Q6 i; s
  35. , N/ y$ N2 c4 ^) R6 U) E/ |7 O3 V
  36. #include <mach/memory.h>6 A; F" e) l4 D2 ~7 K
  37. #include <mach/hardware.h>- M. j1 t# m4 k' C' o
  38. #include <mach/irqs.h>& v+ A  q" H5 Y
  39. #include <asm/hardware/edma.h>$ R" ~* ^/ b+ v$ K: t! D
  40. ) {- i) Q8 Y& d# K8 x. m0 s
  41. #undef EDMA3_DEBUG
    3 ]: }1 c& X+ V( ~& O
  42. /*#define EDMA3_DEBUG*/
    2 D, S$ N& ~  Q0 f
  43. 1 ]; M* l5 R) ]* b  y
  44. #ifdef EDMA3_DEBUG* F% h$ \" }7 K9 p' G: w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ J4 {8 H4 {/ m# P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* W: @2 w! w( s; T- ^$ r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 d$ S3 n5 B2 j( B8 X+ e2 g# e
  48. #else. j4 ]5 G0 y2 W/ ^
  49. #define DMA_PRINTK( x... )
    " |- ^/ s/ B! g: w# ]
  50. #define DMA_FN_IN! [. n' ~/ Z$ D0 w8 g5 t5 W' h
  51. #define DMA_FN_OUT
    8 n5 z4 M4 j8 `( B2 A7 V
  52. #endif
    7 ~$ @& O' Q5 K% X: G0 o. o1 Y& G

  53. 8 [3 \" M6 s/ ~6 o- E/ i$ [! d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 }! V5 ~7 y5 f
  55. #define STATIC_SHIFT                3
    / G( T% Q1 d2 u% N' L6 [
  56. #define TCINTEN_SHIFT               205 P* ~7 t& }3 t9 \
  57. #define ITCINTEN_SHIFT              21
    / Q  M! Z5 e5 K( ]. C) N% J' Y
  58. #define TCCHEN_SHIFT                22. g# ?& n  s( K+ e
  59. #define ITCCHEN_SHIFT               23
    " \1 l# E/ L" m% y3 C% G4 J

  60. # p# d; K* U2 w; u) F: R( L
  61. static volatile int irqraised1 = 0;
    ( b, m1 o/ d% T! o
  62. static volatile int irqraised2 = 0;4 p( {" ]- l) _9 A, t

  63. / g; V3 n- z6 f. e* u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 P" b5 i1 i: F5 d# G- g7 |( |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 M8 H/ f, U) z, h9 R: ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 G/ v) s& c' a. e" ?$ r1 H

  67. 8 b' P+ T: B1 W# O- S
  68. dma_addr_t dmaphyssrc1 = 0;5 C3 T; P  `: i- p
  69. dma_addr_t dmaphyssrc2 = 0;: L9 \+ A- P( F8 b
  70. dma_addr_t dmaphysdest1 = 0;4 j' Y( w$ q, U7 l2 [
  71. dma_addr_t dmaphysdest2 = 0;
    ) n% g( I7 Z# T- \
  72.   j1 c2 j# H' a4 U9 k  Z4 \% K
  73. char *dmabufsrc1 = NULL;! s2 O1 X2 s! x1 o7 b: I
  74. char *dmabufsrc2 = NULL;* N# b/ K: F' o( A+ F& I
  75. char *dmabufdest1 = NULL;
    ( k: B+ g4 J$ U6 K
  76. char *dmabufdest2 = NULL;
    ! @. W% _$ m7 q/ z
  77. 2 U* T$ _- @8 Y9 C8 g6 N9 t  K
  78. static int acnt = 512;
    / p" G, p$ B" R
  79. static int bcnt = 8;: o, g* s' V; W- J4 a& |+ U
  80. static int ccnt = 8;
    % }1 A$ l/ t; D3 Z% L# i
  81. 2 i7 z+ A  \5 z2 L1 t
  82. module_param(acnt, int, S_IRUGO);
    ' S- _: B5 k: j0 s5 I
  83. module_param(bcnt, int, S_IRUGO);$ W& R/ o1 f) U5 E( y4 x9 I* k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 m" `# p/ f- o1 g' |6 o& O' L. d8 C- Q  a; @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' ?) k# b: U/ X8 ]( Iarm-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 D& g+ t9 ^* f, r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 e0 w# t( C0 w$ |. M8 q* D) M+ k. M, M! R2 ^
1 t5 P, P- k. v$ ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 08:37 , Processed in 0.036763 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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