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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: K$ I) M$ ]: ?
  1. [code]EDMA sample test application; H, x1 b' t% R% n% o  ^4 [
  2. /*
    $ \0 M# K8 u; [% `* v0 |
  3. * edma_test.c( c3 b& @" c8 a0 H5 n8 }! V
  4. *
    2 a# e3 ^( d0 R  M8 E7 B
  5. * brief  EDMA3 Test Application4 [- c3 L- ~: Z1 r
  6. *
    6 w: p' C; C( w& U, W5 E" }
  7. *   This file contains EDMA3 Test code.9 e( e5 |$ E- r: E5 J3 P
  8. *
    ; n( ^% l) q7 v% x7 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & j/ K! a4 w6 S6 S3 x# H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ @+ V9 l' J- x! X* b0 i
  11. *         TO CHANGE.% Z( R2 }( I* S
  12. *4 n+ ]+ q4 @$ p- z/ n8 o: S& D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; P3 i% ^" Q! G! [
  14. *
    , G5 \9 `/ a# u( W8 o" q
  15. * This program is free software; you can redistribute it and/or% I  x  Q4 b; ~5 h% i+ G
  16. * modify it under the terms of the GNU General Public License as9 [7 i: c  H  j# R- ]
  17. * published by the Free Software Foundation version 2.
    ) C, a# X1 z" n3 |# H* v
  18. *
    ) Z* r. W0 P& `' @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 G/ E1 ]2 H6 X% N* f
  20. * kind, whether express or implied; without even the implied warranty
    ; |" W* B, K0 F; Y/ B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* V5 Z% A0 D" v- b
  22. * GNU General Public License for more details.1 e5 e& q# O3 u: L/ e. ?# _* p' Z
  23. */+ t& }1 K3 u: I$ b( ^
  24. 2 y: m! Q( L) h8 K3 l
  25. #include <linux/module.h>
    * r& e" `& n7 C, U. G- \; r* Q9 E
  26. #include <linux/init.h>  M' j* Q: ]0 p+ v! v+ [2 i
  27. #include <linux/errno.h>; l" T0 V7 A1 U* N
  28. #include <linux/types.h>( z1 y; y3 J7 O
  29. #include <linux/interrupt.h>4 c- P( n# M* e+ s
  30. #include <asm/io.h>
    8 W+ ~) p) K8 a% @* ^: o
  31. #include <linux/moduleparam.h>) [6 p% j& C# K" O1 e8 n8 Q- |0 ^
  32. #include <linux/sysctl.h>
    # z3 \+ A1 {0 l# \1 d* a4 c
  33. #include <linux/mm.h>, q+ C) [4 B0 ]+ x  n% s
  34. #include <linux/dma-mapping.h>
    * w( S% T! m& K6 Y9 [4 k# L
  35. 8 f3 G2 ^8 N7 q& S" u7 O
  36. #include <mach/memory.h>
    6 H+ G4 s: O6 P( o
  37. #include <mach/hardware.h>" N- @" W- A$ i
  38. #include <mach/irqs.h>9 [3 L) L) |, h& X; {& h
  39. #include <asm/hardware/edma.h>3 l4 P) }& s" \3 x5 ?3 V  p% {' r; q3 }
  40. % F9 c4 ^* X- \& ~  H) k1 t" q# V
  41. #undef EDMA3_DEBUG) q( R2 V( [  F- X$ J. z
  42. /*#define EDMA3_DEBUG*/9 ]* g. G& Z( d* _8 x4 m8 o& \* k
  43. 8 x& f1 e7 y, L2 M0 y
  44. #ifdef EDMA3_DEBUG
    ) V0 t5 q' b( S, @  Q# c) S* G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 I# `+ [. _- C% {! e/ {4 R% b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 D2 h5 L6 c, E& X( Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . b! h6 e; f( t" z1 C0 e8 k
  48. #else3 ^3 m0 Z: I# y/ c! T6 H  g( i+ x
  49. #define DMA_PRINTK( x... )
    . s! W) Z1 [9 c) A
  50. #define DMA_FN_IN
    $ X+ ^' U& S% m
  51. #define DMA_FN_OUT
    0 n& K& u/ O  G/ c; f
  52. #endif' c9 X* g( l1 T! D* P( D' W; M1 Q4 m

  53. , `/ R4 b6 K: d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % {/ z3 m& }$ I1 q0 h2 \
  55. #define STATIC_SHIFT                3
    1 q; _3 E; S2 A: G( b) G/ N* j
  56. #define TCINTEN_SHIFT               20
    ) Q" F* M# F) ~: x4 A5 g5 j
  57. #define ITCINTEN_SHIFT              21
    ! }2 t4 G3 e. O( |
  58. #define TCCHEN_SHIFT                22' k& C3 p$ F$ U1 n
  59. #define ITCCHEN_SHIFT               23
    , `: M5 v, R$ {* i( m9 D
  60. : v7 u6 S5 T/ c5 u
  61. static volatile int irqraised1 = 0;+ G2 [! p# M+ Y7 n
  62. static volatile int irqraised2 = 0;' ~& @. D! g9 @4 e! J* B7 w0 ]  U3 W

  63. 9 k  }0 B3 {# A3 \: ^+ Q* B2 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, y1 h3 e( o. _+ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! T+ ]& q8 K# V$ x) n5 j' r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 V" J) s% T" R& `6 S$ W4 l& i) ]% R! o
  67. 3 N2 Q) p; y9 W  G6 T
  68. dma_addr_t dmaphyssrc1 = 0;( K: c9 P8 {7 R, h
  69. dma_addr_t dmaphyssrc2 = 0;4 Q7 Z4 G7 o" x1 y: j3 |
  70. dma_addr_t dmaphysdest1 = 0;2 f9 J) W; J0 L6 }2 O' B
  71. dma_addr_t dmaphysdest2 = 0;
    , B4 z: g3 z2 ~# ]: J3 V% Z" |0 }! C

  72. ' K% ~+ V3 r/ I, ]
  73. char *dmabufsrc1 = NULL;
    5 W$ R* _4 h+ _8 \) E8 Q. h! `
  74. char *dmabufsrc2 = NULL;
      K# ?4 W: h0 d  p
  75. char *dmabufdest1 = NULL;7 n/ x' Y) D+ F7 M
  76. char *dmabufdest2 = NULL;
    3 v& u$ f! v2 {. y/ }4 X9 f

  77. ' c6 \& Q% c- w
  78. static int acnt = 512;, \1 s3 K+ E9 W2 B2 K* Z# M  O
  79. static int bcnt = 8;: L; q9 \  V+ S& y/ \
  80. static int ccnt = 8;; ~$ Z9 t9 Q# B8 W+ ?, E8 z
  81. + l$ o! |" {1 [8 f
  82. module_param(acnt, int, S_IRUGO);  g+ E2 u- ]3 u. N  B
  83. module_param(bcnt, int, S_IRUGO);
    , x' A# R3 M3 F* _- {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  _& R6 v( d; H% I

3 H. {6 M" u$ `/ i8 T& B- [8 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" R" t, |8 H: t# S! P4 w3 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 j  c- t+ Q- f* d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ _/ `$ F0 t6 g% G  Q' M: w3 B6 G+ t4 H/ S/ p8 C

+ K; H/ \3 {* p3 n+ T. w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 22:01 , Processed in 0.041100 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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