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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ Z5 g& G' M9 ]# v- z0 C: a  Q
  1. [code]EDMA sample test application; Z0 C% @! \5 P( ]5 I- g9 ~% q: E
  2. /*
    4 O* y' u/ b7 F2 k% `% N; y/ r
  3. * edma_test.c
    6 v, Q  m5 R8 E2 K4 \8 d
  4. *& h, ?4 \5 @1 @' a2 k
  5. * brief  EDMA3 Test Application3 v0 E, {* R( d2 l5 _
  6. ** k  A, o2 C' G% C
  7. *   This file contains EDMA3 Test code./ m2 Q' Q6 W. Y/ o
  8. *+ m: L3 H& w7 V3 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 L) O& e" J! m7 ^7 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ ?! z; s" A. }1 R
  11. *         TO CHANGE.% G7 T4 d, w& q5 w, y3 D
  12. ** i, b' a  ~7 V7 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % W6 _/ I4 k1 `2 a
  14. *
    2 I9 e4 n" T( A4 s
  15. * This program is free software; you can redistribute it and/or
    7 l7 U) ~% N9 U3 S) I
  16. * modify it under the terms of the GNU General Public License as
    6 m/ ?3 f* S9 a/ `' P( L+ x
  17. * published by the Free Software Foundation version 2.% s" T! O# c6 I# x% g
  18. *& _  D% Z+ ]6 `/ p' F+ k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 o9 p% B8 |3 O
  20. * kind, whether express or implied; without even the implied warranty5 ^9 T% I, Y: Y$ Y$ G- n' F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* U+ I- s) M- t1 N
  22. * GNU General Public License for more details." d9 r. }+ X& t/ k' O
  23. */  R* j' H+ s# y0 [1 Z  t
  24. 3 _# T1 I$ e  \9 A9 B9 f
  25. #include <linux/module.h>  o/ c7 n1 I" T* G7 i4 t) I
  26. #include <linux/init.h>
    9 E0 d& Z2 v  W, f0 M
  27. #include <linux/errno.h>3 g) X7 h3 Z) A
  28. #include <linux/types.h>8 v- k1 ^9 |7 w' [, q% ~, j
  29. #include <linux/interrupt.h>
    5 x6 q  C+ j& X0 ]
  30. #include <asm/io.h>1 C% \1 a( [: @# i+ I
  31. #include <linux/moduleparam.h>6 e, ^0 {2 y+ m# d- b- w; ^
  32. #include <linux/sysctl.h>
    ( T& J# Z4 a5 a4 N3 K
  33. #include <linux/mm.h>. G1 n# k; r* a4 [0 q6 E5 [
  34. #include <linux/dma-mapping.h>
    7 B) F7 P( z" |
  35. 3 t% ]* _% u3 ]. u+ @: e
  36. #include <mach/memory.h>
    $ R. s9 b" a' P+ N  H5 ~8 \4 y
  37. #include <mach/hardware.h>; x- @1 S2 H, }) _
  38. #include <mach/irqs.h>9 R( R* F" |' R# o; y
  39. #include <asm/hardware/edma.h>
    * K4 U% ~( h6 M( T+ A" f
  40. , A% g0 i* Y* W
  41. #undef EDMA3_DEBUG  k9 z9 F9 a2 t/ W, Y2 e0 m
  42. /*#define EDMA3_DEBUG*/
    ( k! x8 Z, c; H

  43. ! d3 }# _0 F* b( {
  44. #ifdef EDMA3_DEBUG) ^' r) ]0 L+ D) v/ j; @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , G, u2 R/ t- g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- t3 q7 b( i$ K# u  ^" [+ u  I* V3 U3 l* V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 ^3 g2 _9 E" c% h" k) q1 |1 }
  48. #else
    & z, C6 B& w' }# z$ z: u" k2 U
  49. #define DMA_PRINTK( x... )* ]" v$ Y" d" C2 Y2 |/ J' g; p
  50. #define DMA_FN_IN! u! I2 x3 k# b9 l% R
  51. #define DMA_FN_OUT% B6 A$ F, s: c' [- w; s) A# m
  52. #endif
    + x+ ]" H! B$ z: t* O+ h2 v
  53. . X" b  _% K& t% b4 h2 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( u  T0 r3 `1 t; r, G4 j6 k
  55. #define STATIC_SHIFT                3) X8 F& K" U1 W6 d  n
  56. #define TCINTEN_SHIFT               20& b, `+ Z5 d* x. {- }( ~( D( |
  57. #define ITCINTEN_SHIFT              21& n2 m1 z- v, s8 |# }! b( M
  58. #define TCCHEN_SHIFT                22' a* h* S2 ~$ _: p. j5 y2 J# v
  59. #define ITCCHEN_SHIFT               232 ]& M/ A" ^+ A# Q

  60. + p( V( Y4 u/ d0 K7 `9 q
  61. static volatile int irqraised1 = 0;
    # W2 x8 b* b! [: @) e
  62. static volatile int irqraised2 = 0;
    & ?  g0 N6 H9 a, |6 H
  63. / j: M3 X4 c% G9 f6 ^/ ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . n4 d; y( G" X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 S' Q* X& g; i/ e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% k. r; G; {" M1 e# C& ^
  67. : R$ a$ B+ S% o# e& ?
  68. dma_addr_t dmaphyssrc1 = 0;
    , S1 r1 F, P* S9 w# f; N
  69. dma_addr_t dmaphyssrc2 = 0;# R: m. v5 I6 I% g/ c
  70. dma_addr_t dmaphysdest1 = 0;
    6 d/ C$ `0 z$ ^' u: i
  71. dma_addr_t dmaphysdest2 = 0;4 e0 i( Z0 G2 h; N

  72. ) f, R! {3 b1 p: a- r, ]- V. y$ w. s5 E
  73. char *dmabufsrc1 = NULL;' Y" z8 \" Z6 z% F6 |
  74. char *dmabufsrc2 = NULL;
    & C$ r* K9 ~/ B
  75. char *dmabufdest1 = NULL;$ J# w& Z* A  x5 m1 Z
  76. char *dmabufdest2 = NULL;
    $ V$ @( @) c, _6 L

  77. ( H4 N9 J$ z/ @5 O
  78. static int acnt = 512;1 E1 h7 n+ l- L/ @5 W3 {' _
  79. static int bcnt = 8;, Q, d" q3 L5 u
  80. static int ccnt = 8;
    & V% Q3 q% N* V4 B: c; V
  81. 9 M* b! {; U: C+ u
  82. module_param(acnt, int, S_IRUGO);
    " x+ r2 x. V0 J! {+ X# r& a5 C2 R) D
  83. module_param(bcnt, int, S_IRUGO);
    . K- J( K. i. A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 @3 I- C5 W- O- F0 R
) U' D9 v2 @* ^  Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, c9 h8 U. U% B2 h$ h, w$ ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 V2 c! O5 f1 G- R6 H+ i8 H2 v' [- _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 _% |3 d& B7 m2 V7 O

; x. d7 K3 U, h. E6 y1 u* K" {
3 p7 d0 A, \9 g9 T- w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 21:18 , Processed in 0.039263 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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