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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( ?0 }0 P4 J$ }$ i& }
  1. [code]EDMA sample test application& G2 x. }0 d) y4 o% H9 C, e( i
  2. /*
    2 e, O) T  x5 a
  3. * edma_test.c
    * H/ M) n+ F5 C5 K# b. Q
  4. *- S2 A% K! O$ X9 j) _
  5. * brief  EDMA3 Test Application* p" A9 E# p& Z: F3 ?. ]$ |
  6. *' c; E0 N; Q" F7 @) |
  7. *   This file contains EDMA3 Test code.4 ^+ E0 [; M" O5 S* ?
  8. *
      U. Q2 b6 Z* Y3 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! e: i7 e; {: g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & R# S/ @: W. K/ D5 Y" V! j6 V
  11. *         TO CHANGE.8 l; f4 {6 u) Q5 |9 H
  12. *
    4 O" Y: t: v) }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ X) @, @2 {& O7 m4 T3 w
  14. *
    ! ~& k+ L. z1 y5 |5 W, `$ B
  15. * This program is free software; you can redistribute it and/or7 ~9 q" h$ {! Z& A1 v! ~
  16. * modify it under the terms of the GNU General Public License as( @5 Q) L9 h2 n
  17. * published by the Free Software Foundation version 2., x. I. D$ r4 Z. k8 p7 ?  A$ A2 L
  18. *8 I$ q# c$ w' J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 R! m$ A  @+ t5 [6 z2 E0 C
  20. * kind, whether express or implied; without even the implied warranty
    : M! z8 N2 Z; }6 m) B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 D4 z  f, \$ O- d
  22. * GNU General Public License for more details.0 f# S; D. z! r9 Q
  23. */
    3 l2 b3 k4 T4 U3 }. H2 V
  24. $ Q, R  O" t0 Q! `* E' \7 p4 w- @
  25. #include <linux/module.h>
    ! b% e8 {( I* o4 }
  26. #include <linux/init.h>
    8 a: {! z: v7 J& R# h+ W6 U3 }
  27. #include <linux/errno.h>
    2 n7 `" ^6 ^( B# O5 p# k
  28. #include <linux/types.h>
    7 ^* o: ?; d3 f: C
  29. #include <linux/interrupt.h>. w5 A- O& l) d" u, E
  30. #include <asm/io.h>
    7 x( e$ g* w- k+ L& X# ^' S% x! K
  31. #include <linux/moduleparam.h>
    8 a5 L1 n. o9 M( ~- p, ^
  32. #include <linux/sysctl.h>
    7 t- J# ]9 e+ a, @% v. K8 V, R
  33. #include <linux/mm.h>) G2 d$ j. L5 o9 ~$ `8 @
  34. #include <linux/dma-mapping.h>1 i  C4 V6 N# `2 X

  35. / C& p2 H: Y% c, P2 P
  36. #include <mach/memory.h>+ f. t$ u( a; T" W
  37. #include <mach/hardware.h>/ e, ?( `8 c6 Q# P3 A3 c! B0 z
  38. #include <mach/irqs.h>
    * @4 h. J7 h* c8 w" c) Y* l3 G  ~
  39. #include <asm/hardware/edma.h>& L6 I* I/ d. O$ O
  40. ) f" c" Q# ], w( l' x9 ]
  41. #undef EDMA3_DEBUG
    $ Z; E- i! G" Q, |: O7 Y
  42. /*#define EDMA3_DEBUG*/
    6 l5 u5 S# {' a. x+ ]4 j% |

  43. ( U0 ]/ ?9 y/ Z! X
  44. #ifdef EDMA3_DEBUG( m/ C4 x% f  l1 f& T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). V! n" o4 H7 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), ]& B, N9 f& y7 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), w% _% d/ g: a) r( p2 f
  48. #else
    ( h% q6 f; u* S. ?4 m, D
  49. #define DMA_PRINTK( x... )
    " u% d5 b; h" B2 V$ a& ^+ r# U
  50. #define DMA_FN_IN
    ( ^  \# S  i  g( g/ c4 K
  51. #define DMA_FN_OUT. E( G6 @3 g2 h
  52. #endif
    ( j$ w8 Z& u' }0 A
  53. ( ^: W) H$ j% s3 x, G9 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 e9 s. q8 e5 B1 S  {
  55. #define STATIC_SHIFT                3% j* O) Y# U8 K
  56. #define TCINTEN_SHIFT               20  G  p1 K! U9 ^+ u! f; f& W
  57. #define ITCINTEN_SHIFT              214 f  @" V+ Z- b5 }: k- ?) d
  58. #define TCCHEN_SHIFT                22
    * p" y3 W8 U- M$ i* ^
  59. #define ITCCHEN_SHIFT               23' j9 A8 m3 t! G1 H( B3 O/ n
  60. ( C: r% `7 x6 p
  61. static volatile int irqraised1 = 0;
    3 A7 Q6 r! j. }# S& |5 n* u  f$ ]8 P& q
  62. static volatile int irqraised2 = 0;3 A9 \  n/ `! J# S/ b
  63. ( T0 c! S. m; g" N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ]$ N+ C. B+ i% g* @4 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 T9 Y4 a, v6 l; X, @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ e; K* \$ d- i7 l& y

  67. & D& P1 N; Q6 ~
  68. dma_addr_t dmaphyssrc1 = 0;
    / N4 M( T% z: k
  69. dma_addr_t dmaphyssrc2 = 0;
    7 ?5 O' \" a; i$ V( W* K1 Y$ q8 W
  70. dma_addr_t dmaphysdest1 = 0;
    - m/ ?" [4 d, t+ ?9 x- V7 o6 w
  71. dma_addr_t dmaphysdest2 = 0;
    + ~( W9 O9 s5 K) j4 c. T
  72. , J0 C& l5 o- Q3 [# H
  73. char *dmabufsrc1 = NULL;
    $ E. A/ X6 T3 p" t% M( |+ d3 J
  74. char *dmabufsrc2 = NULL;
    / m+ `. e% y6 Q. D; ^: d( F) D
  75. char *dmabufdest1 = NULL;: C% u/ i# t5 W3 N, M
  76. char *dmabufdest2 = NULL;
    ; V1 A$ z4 B" l

  77. 7 s3 A6 @% a* T" ^" K, ]; S" r
  78. static int acnt = 512;
    * U0 n1 Z' [3 i: k) s$ D  m
  79. static int bcnt = 8;5 f1 ], `7 L: Y, u$ t+ q
  80. static int ccnt = 8;2 h( }" A  Y6 T* u3 w5 W0 x

  81. . a  w5 w1 H! r5 z
  82. module_param(acnt, int, S_IRUGO);( }) x* X* b6 s# P* X( \% E4 ^
  83. module_param(bcnt, int, S_IRUGO);
    . Y* Q" ~8 r" K3 c3 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# J+ a5 F3 |3 }
# [/ a, w7 G" L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 ^2 c$ }0 I4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 S' t3 J! T( l0 `+ W* X! K" t. ]% M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: V8 g0 X7 `% N+ y9 D4 |

$ A) u6 M, _( d( i5 G% [; C
% h4 x  r" \& s" |4 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-11 19:18 , Processed in 0.039548 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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