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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; j4 M5 z- L$ g# n0 V" J
  1. [code]EDMA sample test application3 Z4 Q% X- h4 N6 F2 z7 E
  2. /*# l0 q3 ^1 v' B, b
  3. * edma_test.c/ M' j$ D# N1 ^: v1 b
  4. *
    - ~/ N3 D$ p( ^! n1 k, H& @
  5. * brief  EDMA3 Test Application/ j& Y- }8 f  `- a6 E/ _9 n$ A
  6. *3 \( M* o6 R4 `
  7. *   This file contains EDMA3 Test code.9 P3 i* f& A1 h, D
  8. *
    * `9 m' v5 ]5 D) u, l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 k+ A$ H+ N+ N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; P. V% e6 y+ p3 ^" U
  11. *         TO CHANGE.3 K  r* U. v$ W5 I4 M; d
  12. *
    1 X  a# u7 I) b+ x9 g5 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! I+ d8 k: P% |% p
  14. *
    6 C$ D2 C4 I, D4 G+ z
  15. * This program is free software; you can redistribute it and/or
    - I& z/ i+ f% U3 V& d; g, e& O4 d
  16. * modify it under the terms of the GNU General Public License as
    ; b, _: v6 N! c1 H
  17. * published by the Free Software Foundation version 2.
    " T  e! H- H0 q6 t4 y! ]) `
  18. *
    , M: u0 W  `3 v6 p. C- h* B% d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 }% t# d$ w7 c* ~& \
  20. * kind, whether express or implied; without even the implied warranty
    + o; O! ?6 L  U8 b* n' [* l" ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; ~" a2 V4 ~2 f6 \# N" i3 B
  22. * GNU General Public License for more details.
    : R0 Y4 D$ w% J7 I
  23. */
    - g0 L  F* l& H5 ^" ]7 A# I

  24. ) I- l, {% [. P# b5 u
  25. #include <linux/module.h>
    " l( y6 p& H" L2 q) k  j  U
  26. #include <linux/init.h>
    / d0 e" D- ]( ?9 w) z. k
  27. #include <linux/errno.h>, {  H4 j, u; o( D, ?% V
  28. #include <linux/types.h>
    ( h2 r- ~+ |( z5 j$ T
  29. #include <linux/interrupt.h>
    $ H5 A2 a1 G7 G4 z7 m
  30. #include <asm/io.h>
    , {. W1 l( X, p, I7 C/ v
  31. #include <linux/moduleparam.h>  {- Q$ Q4 L7 }" o' `0 `
  32. #include <linux/sysctl.h>
    6 {3 k% c) X$ Y" L2 j
  33. #include <linux/mm.h>
    ! _* Q6 K- P! H' c! T( J, V8 d
  34. #include <linux/dma-mapping.h>
    " F3 R3 j( R9 O& O$ ?" l

  35. 2 [1 g  p: x, o, c! ~. w
  36. #include <mach/memory.h>+ L' f7 w) Z8 D& J' ~
  37. #include <mach/hardware.h>$ s* P) g- f8 q# X8 T. [
  38. #include <mach/irqs.h>
    & w4 t! b0 b' ~4 [3 \0 x1 \4 @
  39. #include <asm/hardware/edma.h>
    + f7 c" v- |7 I" |3 I

  40. 0 c2 y4 m( y* _1 f0 g* y' v, g
  41. #undef EDMA3_DEBUG5 v2 H4 l! v9 f1 m2 e
  42. /*#define EDMA3_DEBUG*/8 ~. n( b6 ~% G. A. x+ n# R
  43. 8 g* B) F; |7 j9 W
  44. #ifdef EDMA3_DEBUG
    7 Q- Q, D, Z( z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 Z6 _# b2 v+ I# r$ F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' ]: }/ x: C  z$ O0 E- \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ j! ]- b6 R  s' F/ `) @
  48. #else/ H$ f) Q" F1 e! N( C/ ~0 l: S' b
  49. #define DMA_PRINTK( x... )
    , ]3 b' ]7 C: r. g; C
  50. #define DMA_FN_IN
    * O* t# h- f( u* m& x
  51. #define DMA_FN_OUT8 d( M  I6 f6 C7 ?" \" Y
  52. #endif
    + z0 z; J! f6 R4 K3 n
  53. / ~. V) p: g5 b1 |5 H, g+ q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 T- t& Q! F  L3 M
  55. #define STATIC_SHIFT                3
    5 r/ e) U  u# `# E3 N2 _+ k$ v. H
  56. #define TCINTEN_SHIFT               20
    ' p/ x, ]3 V* S, e4 _# ~( t7 G
  57. #define ITCINTEN_SHIFT              21
    ) W( a0 p& |! R( F) H, o
  58. #define TCCHEN_SHIFT                22
      [) |) ]' W0 y4 l5 k4 j5 B
  59. #define ITCCHEN_SHIFT               23
    * ]8 O: A3 X) v
  60. " i+ o& R, A! S; C- {6 e: a
  61. static volatile int irqraised1 = 0;9 \( J- e4 k1 ]- C. _, H. T8 s
  62. static volatile int irqraised2 = 0;. Q  T& R/ ^; O) c/ N

  63. ! O1 d3 j) K' s4 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `) E0 Y. W  e  o5 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 _, z1 L& L# \" j5 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % D9 r& w6 H4 T. s7 G4 R

  67. # M6 s) S, T- H+ u' z. L8 H: z
  68. dma_addr_t dmaphyssrc1 = 0;3 n# n" C6 |: S" |! T% z$ ]* m
  69. dma_addr_t dmaphyssrc2 = 0;
    & }3 o4 X' J8 q/ A  a( v
  70. dma_addr_t dmaphysdest1 = 0;4 v1 V7 b3 o; |# i0 V+ V2 Y
  71. dma_addr_t dmaphysdest2 = 0;& V5 G' K$ ?9 `0 O* X5 U8 y  D0 D

  72. # ~" k& G0 @5 y) P1 x1 n* l4 f
  73. char *dmabufsrc1 = NULL;: o& Y% n- R" K: |, G4 M  s
  74. char *dmabufsrc2 = NULL;! c% ~. v* c1 ~! w
  75. char *dmabufdest1 = NULL;6 P. z3 k# [9 V! q" |7 z, A3 `
  76. char *dmabufdest2 = NULL;
    ( U) o, a. L$ V. _
  77. ' g: p3 U. W1 {  U3 ~2 L
  78. static int acnt = 512;9 H* F( M) Z; f( o
  79. static int bcnt = 8;6 Y' p% ]7 v8 n7 S! ^. t  N( l9 f
  80. static int ccnt = 8;
    - e$ B$ U% o& L; H* X) Q
  81. . ~: ~) C" L$ G! A- a# l, v7 n+ I% m
  82. module_param(acnt, int, S_IRUGO);
    ; [+ g) ?1 w. v' W, U
  83. module_param(bcnt, int, S_IRUGO);
    , Y# Q1 E1 Q) Y, Y, W4 l- {* v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- d$ m# Z- J0 a9 a, t& ?8 M6 f% R
. {# D5 s- ^+ D* c2 u  i* J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! a7 C# t" {/ ]! j' }% {0 xarm-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 [1 r& H, ~) l! ^+ T) g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: m! C: K/ _- U
8 X( b" B2 f& `2 `! G! S
! P/ F: P: ^: M$ g$ u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-17 19:13 , Processed in 0.044390 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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