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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 x8 ]! H1 Q) [6 C# E# W( L! U
  1. [code]EDMA sample test application1 K$ m4 Y' R( U, @; Q0 I8 ]( G
  2. /*/ @. Q1 G# |+ a# b
  3. * edma_test.c8 |. V+ K9 c0 W# t; u5 {
  4. *
    # y2 H$ ], X5 {1 G. F1 I
  5. * brief  EDMA3 Test Application5 r- R* X' j7 Y. ~- x
  6. *+ V& H, p; ~6 l3 L/ E" W% Q
  7. *   This file contains EDMA3 Test code.2 T1 y5 s8 N  s  X2 `
  8. *9 y* F* W+ j! m' c1 z) W) j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : [" l" J/ j1 @7 X* z# W' u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & V5 v  R. g! |4 i2 a
  11. *         TO CHANGE.# h" Z. F0 x% F) E! g( R- [# X+ ?: i
  12. *, g! M! b+ h- R% F, n2 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' e; x/ f- |- X9 Y! ?/ }2 w% s7 |' s
  14. *
    ; y7 ^5 E5 M1 b/ k6 J9 k
  15. * This program is free software; you can redistribute it and/or
    , t% t2 m/ p5 k# ~' a
  16. * modify it under the terms of the GNU General Public License as9 V6 q% y) j( |7 ?
  17. * published by the Free Software Foundation version 2.
    - E' s/ f( K* T/ P. y/ A1 o( ]
  18. ** Y; S- n, Y2 y, w! A. r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 o' h$ j( N# l8 u; x# P( |
  20. * kind, whether express or implied; without even the implied warranty1 \4 P" c8 e" p1 q4 _1 t' O6 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  p8 \7 m; O& Q8 h, p8 Y( `- c, m( a
  22. * GNU General Public License for more details.- J$ P8 s% s" w0 F, o! D
  23. */
    # k( d: g" Z# x+ Q; I

  24. " }& ], }8 G, a! {( o) K- h7 P9 }
  25. #include <linux/module.h>
    ; L' B* O$ J3 U6 }" @
  26. #include <linux/init.h>$ `0 W  B/ i4 `0 @; C
  27. #include <linux/errno.h>. k" I1 p: J- y2 K' S3 w
  28. #include <linux/types.h>5 E. a3 I% z* a
  29. #include <linux/interrupt.h>
    1 @3 G* g0 ?0 C) u: ?" N; S
  30. #include <asm/io.h>
    ) Y  c- s+ w1 e8 @1 v( }
  31. #include <linux/moduleparam.h>/ @; ]* S- b$ B1 j( l
  32. #include <linux/sysctl.h>! ?0 G% c6 j! l, h
  33. #include <linux/mm.h>/ N) r- `9 ]2 N6 j  E
  34. #include <linux/dma-mapping.h>1 `. c0 {9 c8 i( \; @4 l

  35. # N+ X) i/ n( j
  36. #include <mach/memory.h>" a/ y+ A4 V3 S5 o
  37. #include <mach/hardware.h>
    2 u, w- b6 h6 v
  38. #include <mach/irqs.h>
    6 G6 \# }" U, R, }  Z) p' A" h
  39. #include <asm/hardware/edma.h>
    5 Y% Y8 C1 ^; t; G; l2 e, I

  40. ! z7 u" v/ H5 w7 O& p
  41. #undef EDMA3_DEBUG
    ! H* r9 h+ e" }, L' a5 `: h) @; R% r
  42. /*#define EDMA3_DEBUG*/: G% V, Z/ V; f; B1 }, g7 m
  43. ( ]3 _0 @7 H! W! {! ^* F& z
  44. #ifdef EDMA3_DEBUG
    ! n4 C) f5 @3 d1 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 W- _  J% {( n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 K1 W  i1 {' `; `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % T  L: t5 h3 x! M$ u# V! m( G
  48. #else! O4 g3 V' O) K4 r2 k! q# {' Y
  49. #define DMA_PRINTK( x... ), b5 e2 a# Z8 G: T& D5 o3 L$ ^9 s9 L
  50. #define DMA_FN_IN/ [: G# H- l) H) C
  51. #define DMA_FN_OUT
    ) w5 Z: `6 B; J# |! H- F$ b4 _8 `; n
  52. #endif
    0 N+ k5 X8 A9 l, I& N

  53. $ }: o4 ~; N" `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 [6 v: {4 f& E2 s; w, }3 Z
  55. #define STATIC_SHIFT                3
    7 ?: g& x% F; l
  56. #define TCINTEN_SHIFT               20
    % J7 b: B9 ]0 t* ~. }9 p9 H, A
  57. #define ITCINTEN_SHIFT              21, r, W  }% d- `2 a
  58. #define TCCHEN_SHIFT                22
    5 V, l0 X$ z1 ?( ?! Y# G8 w; J) R9 W
  59. #define ITCCHEN_SHIFT               23: q% F: ^! ^1 e4 U  H% b
  60. 3 `  n! A: B! s
  61. static volatile int irqraised1 = 0;% P: s( s, v. [, N
  62. static volatile int irqraised2 = 0;
    % E5 a" s& f9 A# p( t/ t8 C

  63. ( W  d/ S$ Q% b2 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; R4 Q) p5 |2 r, p9 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 h* m% N5 `' h; Z) l; G" O1 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) \  U1 I0 A/ v8 Q
  67. 5 b1 e5 \; {# V9 D  I
  68. dma_addr_t dmaphyssrc1 = 0;; t& g) |6 C  G% U0 u" J! a4 q( ?  w
  69. dma_addr_t dmaphyssrc2 = 0;& L  l0 e5 t; {: K0 {) M6 R* ]  x
  70. dma_addr_t dmaphysdest1 = 0;
    4 R1 Y" H  Z! H4 O1 O
  71. dma_addr_t dmaphysdest2 = 0;: r, {* J' b0 Y  `6 {4 C
  72. 2 D4 c; y2 H# A  v* F: ~! X1 p9 {
  73. char *dmabufsrc1 = NULL;* b5 i7 g( P  n' p
  74. char *dmabufsrc2 = NULL;- s9 y1 J3 m, j
  75. char *dmabufdest1 = NULL;
    & Q1 Z  K7 _8 q# m( r
  76. char *dmabufdest2 = NULL;$ z4 b: o/ T+ U4 M- s  z
  77. : e$ b! L5 E2 p6 _2 r. k! f
  78. static int acnt = 512;
    0 Z3 U- g, W& s; Q5 R
  79. static int bcnt = 8;1 y" e7 ]; O( T8 N3 n4 O
  80. static int ccnt = 8;& I3 T2 J% }" }$ k
  81. ! b9 m/ M; g. Z( ~2 z( G- m* Q
  82. module_param(acnt, int, S_IRUGO);
    + ?" Z6 G& [; |3 K/ p6 O
  83. module_param(bcnt, int, S_IRUGO);
    8 s  X2 }! U% v0 D3 _7 Y1 s$ L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 v2 x- ?  w5 W
0 d) C5 B8 U4 h% l1 u1 q$ ?- E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" E$ b3 _2 V" j7 K3 b$ J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 W1 i0 j! S0 c+ z9 `9 r0 }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 e2 e) q% L5 T
6 _' x- H" B/ I# @& S' s$ Z0 D
  e5 P$ \5 ^, U* n  u2 S  _: v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-23 12:55 , Processed in 0.041308 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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