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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 x+ u2 r! |# ]; d1 |
  1. [code]EDMA sample test application
      |1 S1 _& a" x  Y
  2. /*; [) V$ z3 V1 W0 M& l; o
  3. * edma_test.c# N+ g9 t+ W% t3 T
  4. *3 R- w7 k4 |/ i& u0 l
  5. * brief  EDMA3 Test Application8 b  p# k+ t& t* d7 K& t6 Q+ |
  6. *0 ?6 u! K- |+ ]- k% K6 `2 h
  7. *   This file contains EDMA3 Test code.6 G" @- @: ^( A# v& {/ Q7 g; ]
  8. *, x1 I5 p; Z8 O9 M0 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 ?  @: t, Q" e4 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 R4 J: P1 F4 V( C+ W* P
  11. *         TO CHANGE.
    : b" C" y6 C! F1 e) L* R& M" b8 J
  12. *. L* J, X- q0 r# m" ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 ?7 i- H; @' ^( U1 x0 Z$ x
  14. *- q4 g% p. {( }' U
  15. * This program is free software; you can redistribute it and/or
    / x4 p0 F# U$ `: z
  16. * modify it under the terms of the GNU General Public License as! X5 o1 p3 A. z* Q
  17. * published by the Free Software Foundation version 2.
    5 h& }1 I. {& _
  18. *
    ! s7 @# V& o( U* R# ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' N3 a- o5 e; F7 [/ D7 |4 E( E& z
  20. * kind, whether express or implied; without even the implied warranty
    - ]& d% h3 m) e$ i5 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' Y% T1 Z7 S! t6 |
  22. * GNU General Public License for more details.5 t. d4 {4 o  e8 n5 J1 D
  23. */. y" I! T* [) Y! e% J2 }. l

  24. 2 ?/ D, T8 F0 n' Q6 Z# ]( a
  25. #include <linux/module.h>
    5 X# V2 A+ y8 x4 i5 v6 V# R6 d$ G
  26. #include <linux/init.h># s2 k- l0 y+ U- z6 x
  27. #include <linux/errno.h>, w9 K+ W( s8 w( e
  28. #include <linux/types.h>, {$ z, b4 h# P3 C
  29. #include <linux/interrupt.h>
    ! \' h+ J1 v) \, H1 N
  30. #include <asm/io.h>
    / q" G4 x3 X8 _1 n& e1 P1 n& n  d
  31. #include <linux/moduleparam.h>& g- g9 z9 ]* ~! O$ _5 o: h% j" G
  32. #include <linux/sysctl.h>
    % X# T3 ^7 [9 ~- |) m& x7 B  ^) ?
  33. #include <linux/mm.h>
    % m$ W0 L4 Y9 |
  34. #include <linux/dma-mapping.h>1 V% B. G/ a: U7 y

  35. 9 J( L2 V/ J$ d' Z& D0 [$ d
  36. #include <mach/memory.h>. L2 f/ H; s$ J3 F+ K
  37. #include <mach/hardware.h>
    7 T6 r7 J6 w$ A  V1 N
  38. #include <mach/irqs.h>
      k0 m/ f$ O' L
  39. #include <asm/hardware/edma.h>
    2 v- ~9 ~9 E5 }4 h4 q; H5 I
  40. ) {5 j8 V# U) O; |7 u3 x2 t1 a. d& P
  41. #undef EDMA3_DEBUG9 }* Y" H% b8 p  ?7 ?+ \
  42. /*#define EDMA3_DEBUG*/& }5 R1 d( d+ U% [
  43. 0 K' A: e5 o: f* _
  44. #ifdef EDMA3_DEBUG9 a6 L: A: K! Z% }! t& I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 U0 l# L# z# y7 ?& S  v! ~; ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! X  a' h6 H  ~; \3 A) s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      c9 Y( c9 `% U. c( j* P/ f; D
  48. #else9 d: e* Y7 W$ b
  49. #define DMA_PRINTK( x... )
    7 R) o2 G/ a& g2 C
  50. #define DMA_FN_IN
    % D  b# ]4 v% I1 ?# w
  51. #define DMA_FN_OUT
    : f/ j4 N# z: n) P
  52. #endif
    2 `$ j; V/ H+ z% b2 e/ k. ^
  53. 5 Z# u  [* S) h6 G" V2 _3 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 T6 [% S+ K3 ?
  55. #define STATIC_SHIFT                3  @! ]7 C4 S, ~9 i2 X' l6 a
  56. #define TCINTEN_SHIFT               20+ ]+ \  b  [4 r% r8 D. @
  57. #define ITCINTEN_SHIFT              21
    2 w9 K) H7 e& @( R- ?) o
  58. #define TCCHEN_SHIFT                22
    8 U7 i5 ~! t2 U' Y
  59. #define ITCCHEN_SHIFT               23' C* w- c/ m, |* [

  60. 1 ^& e& S7 r, ^* I$ c% d$ L  Z
  61. static volatile int irqraised1 = 0;
    $ |' v* ^; S, W  ^, V' L; p
  62. static volatile int irqraised2 = 0;7 u9 X, Q# L# `8 ^; ?
  63. 5 c/ R0 _- g; ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' D8 E" }; `1 |& E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - `$ s, M& X" X+ `4 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) B3 g% U, t6 D, Z/ H% ]$ G! ]
  67. ) ?6 A# C6 b4 B) \9 I8 S
  68. dma_addr_t dmaphyssrc1 = 0;
    ' g3 D9 ^; Z  |4 A/ ~. U8 ~" S
  69. dma_addr_t dmaphyssrc2 = 0;
    " G! \+ C' C- [; U8 v* P1 m& c
  70. dma_addr_t dmaphysdest1 = 0;4 t+ {' \6 ~1 ~1 d5 \+ ?
  71. dma_addr_t dmaphysdest2 = 0;! m' H) l( _5 |; L8 A1 F, F- h

  72. 5 K' ^; D1 d" A, f
  73. char *dmabufsrc1 = NULL;/ M' g$ e$ V# d1 l0 T
  74. char *dmabufsrc2 = NULL;; ^8 K2 E) c; D+ P: C
  75. char *dmabufdest1 = NULL;  v) W) u( K  n  \% a
  76. char *dmabufdest2 = NULL;4 u- e1 E: H8 V
  77. ' S) P& T3 {( y) e! l/ V2 I
  78. static int acnt = 512;" s' b" P8 u# S) j$ A! x( I
  79. static int bcnt = 8;6 L1 a5 [7 A7 {7 n9 l( Z5 ?& S
  80. static int ccnt = 8;
    5 T; k6 @  q9 v  Y

  81. / d. f% [* ]- E8 U7 S5 d# O
  82. module_param(acnt, int, S_IRUGO);+ i7 q# f5 |# k2 G) S5 `( t
  83. module_param(bcnt, int, S_IRUGO);
    % G' X: M/ K; ~* {, i5 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  |+ ^( @8 @% G) X4 ^: R1 F) n% v1 B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ h  i( @) o5 u- Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& w5 q4 D' @% P' C3 D& x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ n5 c: Y* |& {5 b" t' p' e/ F+ d1 j, M. }% W4 |4 |* l
0 W% n# y, ^8 Z% ^* R9 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 13:42 , Processed in 0.051917 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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