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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& W, c! c5 P& w* N. _
  1. [code]EDMA sample test application
    ( b  ], {0 {- |
  2. /*
    . K( ]. a  H- L" j' c; q; g
  3. * edma_test.c
      r; ^' n1 U, I: _- ]. c) ^$ T" o
  4. *& E! X4 X/ ~5 |
  5. * brief  EDMA3 Test Application( C8 f  U, |+ o- a- k
  6. *( o9 }& y$ ?/ i, ]9 _# `
  7. *   This file contains EDMA3 Test code.
    . ^! t1 i) p( z) A+ s6 Z
  8. *
    # F4 P; i* Y1 R3 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% ~. A- z7 n/ Q6 x5 @: N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ p% b- X3 b! e$ ?$ `; ?
  11. *         TO CHANGE.
    ( Y" x0 g6 W- g9 E+ Q) i2 j( P
  12. *
    / K3 N1 n% i! H4 D$ J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 n9 Q+ I' Y$ H. h
  14. *1 z$ z- Z* H' t) K9 Z9 L+ a
  15. * This program is free software; you can redistribute it and/or5 V9 i4 d0 e$ K
  16. * modify it under the terms of the GNU General Public License as( a3 \& M/ b) O
  17. * published by the Free Software Foundation version 2.2 u8 I& X. \) Q+ V6 m
  18. *
    9 V/ N! E4 n1 q; S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , I$ a4 V1 J8 ^! C4 |' \
  20. * kind, whether express or implied; without even the implied warranty3 M! {+ Z( L9 `7 q5 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      t! g" I& k7 x" r
  22. * GNU General Public License for more details.
    ! R6 A# u+ s7 e7 ?
  23. */& @2 ?6 x* f: c, Z

  24. " O  k: r* y  I; [) y& F! Z- `
  25. #include <linux/module.h>( ?7 W  i: ?6 o3 L
  26. #include <linux/init.h>
    ) c" J# [5 U8 W! {4 R2 ?
  27. #include <linux/errno.h>
    8 G: ]4 K- \$ a; P# B+ K
  28. #include <linux/types.h>
    - V2 E. x, b# r* u" {
  29. #include <linux/interrupt.h>
    . ]( L0 v+ j9 M2 M1 G* N# J
  30. #include <asm/io.h>
    / i2 W# k0 P/ _5 G! I! U7 R/ t( f' [
  31. #include <linux/moduleparam.h>. x" k, t# f- b. A9 z" O+ _6 U' d  \
  32. #include <linux/sysctl.h>
    3 j/ ~  {9 y! h. Z) O2 {5 Q
  33. #include <linux/mm.h>
    * ~* U; n& V/ [3 n. J
  34. #include <linux/dma-mapping.h>
    ) _' @, R8 o+ @+ e
  35. 3 u- u2 N0 M4 `$ V1 T
  36. #include <mach/memory.h>9 j( _; V  s) s& E- [1 j) f, O
  37. #include <mach/hardware.h>6 c  t3 j5 A; O  B& F5 a% H
  38. #include <mach/irqs.h>
    8 t( U$ ?+ l' z0 w
  39. #include <asm/hardware/edma.h>3 N' z3 s+ \# U. O  U, b% d& B, j
  40. * v; I0 m# t+ E( N- Q
  41. #undef EDMA3_DEBUG& l6 L" d+ U/ W. c  T
  42. /*#define EDMA3_DEBUG*/, k* a) S0 i" j1 x6 T3 h5 o4 X
  43. % v* _1 S# u( m) |/ f
  44. #ifdef EDMA3_DEBUG' Q% V" V& k6 t. J2 J+ X* S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 r" m7 ^2 _/ h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& L! b/ P" L+ \" x7 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : X2 q" z: p/ O6 P. C' R2 I
  48. #else
    4 n% ^4 p( w9 a
  49. #define DMA_PRINTK( x... )2 M* ^2 @* Q3 S( A( E4 J
  50. #define DMA_FN_IN
    5 G% z; k! G0 k  B! Z& F5 |8 L
  51. #define DMA_FN_OUT1 \5 O$ O4 Q+ Y0 y9 {
  52. #endif+ S3 |. K: ?) @9 d# }

  53. , V9 @; K  B4 H' ]0 c; H7 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 v* }) x/ z0 w4 L5 y
  55. #define STATIC_SHIFT                3
    6 X1 h8 i6 H( P% \! S" M
  56. #define TCINTEN_SHIFT               203 }2 O5 ?* @! |+ h/ \
  57. #define ITCINTEN_SHIFT              21
    ) _6 P6 T1 g! I8 T! R( V
  58. #define TCCHEN_SHIFT                22
    % y% Y# s5 F( w: `! h3 D; Y: p
  59. #define ITCCHEN_SHIFT               232 p2 k" _8 [1 P$ T! k  ]: Y

  60. - s# ~+ `1 x; `0 u
  61. static volatile int irqraised1 = 0;. A8 Z' Z7 w" I1 T) _- ?- q4 M2 ]
  62. static volatile int irqraised2 = 0;
    5 m- }. \1 a3 k* @& g3 j4 Q: J
  63. : s5 y  [" }. s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + W" S# h7 f; H4 C7 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a% c1 S; Q, i9 E0 s7 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 G0 c3 d2 r) x

  67. ( e7 S9 m9 ]# H  c$ q
  68. dma_addr_t dmaphyssrc1 = 0;
      F6 n3 [, X* W  ?+ `
  69. dma_addr_t dmaphyssrc2 = 0;6 x- q. _4 O% q
  70. dma_addr_t dmaphysdest1 = 0;
    # M( ]. M4 y! M
  71. dma_addr_t dmaphysdest2 = 0;  T1 I3 o* D# d0 u4 ?6 j& I7 ?
  72. , Z. p6 y  P" ?* Q0 f
  73. char *dmabufsrc1 = NULL;
    # M" Y' C- D4 g
  74. char *dmabufsrc2 = NULL;% g/ v: l: q- P6 p
  75. char *dmabufdest1 = NULL;% I7 Y5 ^% R1 X& A$ o
  76. char *dmabufdest2 = NULL;$ f5 r9 A- X5 w! O

  77. ) l1 f8 Q% `1 l! K
  78. static int acnt = 512;
    0 p% M. u3 S, }5 Q# {* \, s
  79. static int bcnt = 8;0 q. W% s" q) e1 i  |" v
  80. static int ccnt = 8;9 Z6 E: u" z1 O8 C4 h$ E) {
  81. ( @6 o3 I& k+ c9 u% @! ?; O, }7 R0 l
  82. module_param(acnt, int, S_IRUGO);# O; p. {+ \& V1 j3 C  m
  83. module_param(bcnt, int, S_IRUGO);, [1 l! ]% _3 j+ @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! Q$ y- a- n) C$ G7 c
: h7 h+ ^; Z; \# l7 ?/ N, ~/ n6 T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 U+ z2 o- y5 s: g3 o$ q. \, p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: }' w  \& v( f# `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, c* |0 Y4 H. k9 l9 p- \

0 x2 G3 H+ y7 h/ c* a* N3 a9 C( w  I5 ~/ A+ E' P8 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 17:47 , Processed in 0.043420 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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