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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , C$ d3 S. [' w7 q7 {  ~+ _8 b
  1. [code]EDMA sample test application
    ! s' ~4 J3 R$ p2 R- q5 _
  2. /*- E$ t* ]4 |7 A/ l% N6 f
  3. * edma_test.c8 f+ h! J  d1 M
  4. *4 W* P9 u: J* }3 v: |8 o& G
  5. * brief  EDMA3 Test Application
    - v' p( m) \+ j- E
  6. *
    5 W9 Y& f: ^# e5 {
  7. *   This file contains EDMA3 Test code.
    ) [3 @( T4 C# a* Q1 A4 M& E
  8. ** J% y8 F  i( e# _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) e+ g  z; T# L" \) j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: l$ n: n5 I, ~5 o
  11. *         TO CHANGE.
    + r8 n) S: P) F& i) q
  12. *2 o& w8 |% ?" L* q  i; h6 T. O6 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' v  j& f( l+ B
  14. *% Z2 c9 P7 B% A
  15. * This program is free software; you can redistribute it and/or
    8 J! _3 x7 o2 P* E3 k& D5 ^1 m1 B
  16. * modify it under the terms of the GNU General Public License as5 T  |5 N1 G3 g( i. P6 l, h
  17. * published by the Free Software Foundation version 2.
    , G) N+ u2 d' |; @: h# T: c
  18. ** V( R! X) X& J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 J  L4 G2 ]3 I; U
  20. * kind, whether express or implied; without even the implied warranty
    + r8 H5 i3 E, \3 ^5 D% U) c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + _, H. _+ I6 ^# C6 i6 q
  22. * GNU General Public License for more details.
    & [/ J8 ]  H* Z6 Y  c  T1 f9 W" M
  23. */: E( |6 j+ I: I; u0 s9 b! F

  24. 4 B+ y5 O0 O) W# t
  25. #include <linux/module.h>
    , L  z" k( b$ s
  26. #include <linux/init.h>
    + x9 n* w! Z" l
  27. #include <linux/errno.h>
    ; e& j  Y& A$ r, j+ W
  28. #include <linux/types.h>! `- ~4 j, k/ ^+ P
  29. #include <linux/interrupt.h>1 S" d1 M9 V: F& i$ Z2 a6 E1 x
  30. #include <asm/io.h>/ X5 w1 u, }. ~7 {! [: i2 }+ Z
  31. #include <linux/moduleparam.h>( ?7 ?% h) I* R, B$ z5 D
  32. #include <linux/sysctl.h>: y2 k. D+ ?; l; \. z
  33. #include <linux/mm.h># W" t. h% M# ?7 Z
  34. #include <linux/dma-mapping.h>
    + c' S& D. @4 @7 m8 v

  35. ( e2 H* u6 C& d; ^4 _4 e
  36. #include <mach/memory.h>7 Z$ \- a# L3 W/ h) {
  37. #include <mach/hardware.h># B  ?0 I0 E  \/ V( q' [
  38. #include <mach/irqs.h>
    ( _" |* c" r& Q
  39. #include <asm/hardware/edma.h>
    . p$ O0 c6 Y: f! }  _" [( V/ D
  40. 0 k: z8 c' A: t' g
  41. #undef EDMA3_DEBUG/ a: b  f5 w2 W! O/ S/ L3 c8 \+ f* v
  42. /*#define EDMA3_DEBUG*/
    8 k7 E, S  o6 m/ ^$ E
  43. 8 o3 n5 T2 I! g* R6 ^
  44. #ifdef EDMA3_DEBUG
    5 O% g7 |- ^: }3 }0 o4 D+ @1 T" C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Y, E5 ~; \( P" e8 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + G. V1 D0 ]  ], E' [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * g) N6 c( [/ q, G0 c+ \
  48. #else9 Z. i9 d- F; x! X* r9 l
  49. #define DMA_PRINTK( x... )* G, ]* T; }: }, x7 C( O* A. _
  50. #define DMA_FN_IN
    # _" y8 y  e+ O  d* f* z
  51. #define DMA_FN_OUT( t" Q- C" k, m& g5 o6 S
  52. #endif
    6 X0 G+ _( Q. c/ F+ e6 p2 w

  53. ) }* e+ a/ S- s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 p5 }4 b8 t+ j
  55. #define STATIC_SHIFT                3, m9 V% T; E. Z2 K( q' ?1 \4 ~, T
  56. #define TCINTEN_SHIFT               20
    % H2 p5 f) A6 b! O: o
  57. #define ITCINTEN_SHIFT              21
    3 D+ c4 M0 i: x' O. |
  58. #define TCCHEN_SHIFT                22
    ' p0 Q& u2 v2 [& x) e& ?9 K/ W
  59. #define ITCCHEN_SHIFT               23
    % {2 x* P. _! y! A8 c
  60. 7 l4 ~% |5 l2 U2 Q
  61. static volatile int irqraised1 = 0;
    % o7 S2 O# A5 d; h
  62. static volatile int irqraised2 = 0;
    ) G' n$ j2 j" V6 O' ^3 J+ u0 A
  63. + a" O. Z2 v5 n) X8 f$ A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ m: ?6 c# R% {' `4 l3 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 y! I# h* f2 N) i6 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 _8 T9 W1 L. b5 X" E. T; _

  67. ' w9 L: L: K; n; {8 a; ~" E
  68. dma_addr_t dmaphyssrc1 = 0;
    4 s9 R5 B- t3 h; F( {3 X6 l
  69. dma_addr_t dmaphyssrc2 = 0;
      j% l" `+ W) Z% m3 {! W( B; X3 _! ?
  70. dma_addr_t dmaphysdest1 = 0;1 c1 Y" L/ T* x% R, Y
  71. dma_addr_t dmaphysdest2 = 0;
    8 J. t3 l" ?8 F3 t* M2 [1 M

  72.   a- C4 N  A$ s& K6 F: c' p
  73. char *dmabufsrc1 = NULL;
    . h% i( A7 u+ @: g8 T4 A4 Y
  74. char *dmabufsrc2 = NULL;
    # `4 @' f3 U) X* E+ ?
  75. char *dmabufdest1 = NULL;  D/ V& o7 [0 l3 s% q8 P& @1 i
  76. char *dmabufdest2 = NULL;
    & S/ \! ]6 C& F3 {9 _
  77. , t$ E9 a; ~! e
  78. static int acnt = 512;& e3 R- g& Y: G% c" ?
  79. static int bcnt = 8;
    ! X) k4 X, A- R
  80. static int ccnt = 8;
    6 m8 e2 D9 ~0 [; q
  81. ! |- D  m7 Q; P+ T. }
  82. module_param(acnt, int, S_IRUGO);% u- i0 g5 P  v. x
  83. module_param(bcnt, int, S_IRUGO);+ n& N1 G' H" b- o4 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' ?. h, i' D1 i/ Q2 l- g! n" M& u( ~- j: c, l# m) L8 h7 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ E$ |9 \! F. z6 g0 x0 P8 \  U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. ]  E, E  P0 q# Q" X; H3 a" i3 ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 G* p5 U& J5 f. V. v
* {' ~1 z5 d8 Q( G$ a: y, s5 C- ^, H7 T4 ~) X  f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-20 15:01 , Processed in 0.038888 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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