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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   Y+ h7 h# J" `
  1. [code]EDMA sample test application
    ) }0 B" w. H  G$ \# q6 h
  2. /*- j3 B, w" b; V0 \6 ?
  3. * edma_test.c
    ; d9 S( g, }2 Z/ d3 {
  4. *
    7 B( I# [1 _: z& |9 q: j5 e/ b
  5. * brief  EDMA3 Test Application
    * f0 h9 @  G. @5 @2 f
  6. *
    & D4 n$ e- ?; v
  7. *   This file contains EDMA3 Test code.7 W( ?! L/ r) U$ W  |/ G
  8. *
    1 g$ q! C# _3 C5 ?  {( A6 T1 _- d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 n1 }. O+ ]1 k/ c) [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ M- J# Z" Z7 N. y* Y; E+ f
  11. *         TO CHANGE.; D) U/ w, s% H% i4 }! v0 _2 x
  12. *5 J4 H4 O' M. ]. W0 H9 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 E9 K" K# ?9 R; p1 j6 q9 N
  14. *. z5 c" G0 @1 {; ^2 P4 o, W
  15. * This program is free software; you can redistribute it and/or
    : o. Z' f/ Z2 F2 X* i1 ?
  16. * modify it under the terms of the GNU General Public License as$ v7 W( J2 c# `0 ?4 i
  17. * published by the Free Software Foundation version 2.
    ) n# x# A6 D0 O1 H
  18. *
    5 k4 b5 k! g& u, P7 R/ d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % c0 Q9 f* k! L, P  j
  20. * kind, whether express or implied; without even the implied warranty
    2 Y- U. N% U& y& `8 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, d9 q  f5 D1 J/ b& |! v/ X
  22. * GNU General Public License for more details.
    ! m; F! w0 }5 i+ u0 _" c
  23. */
    + r" t+ S/ r" L$ R7 E

  24. ) c, {: f: p% I7 n+ n
  25. #include <linux/module.h>
    # B1 d$ S: @2 Z( l) }4 P
  26. #include <linux/init.h>9 S+ M- n% P- \1 [5 B
  27. #include <linux/errno.h>
    * F$ E: [5 c$ E: W
  28. #include <linux/types.h>
    3 f; k8 Z6 G: K9 K
  29. #include <linux/interrupt.h>. m. ~9 B' ]; ]) `9 b, S6 A" W
  30. #include <asm/io.h>* w! c6 b. k5 E
  31. #include <linux/moduleparam.h>9 s( B& i7 I8 O8 L( F6 t3 `
  32. #include <linux/sysctl.h>
    ; a9 ^6 k9 g4 V3 c8 J
  33. #include <linux/mm.h>0 @5 w. q* [+ A, |6 s* ]1 E
  34. #include <linux/dma-mapping.h>3 H% L) |+ U0 ]8 r: f, H

  35. 0 G& M7 e+ r( Y7 d
  36. #include <mach/memory.h>' A5 a  i) o7 q) a# o# U  Y
  37. #include <mach/hardware.h>
    5 H4 g" I. y6 q! x% {) K2 d
  38. #include <mach/irqs.h>
    8 n2 d; O0 G% v  O& R% p, i9 T# \; ]
  39. #include <asm/hardware/edma.h>
    : a: @) \. N( R3 w4 l

  40. : c; p+ g. b, c
  41. #undef EDMA3_DEBUG9 i, b3 G, Y1 i! [1 ^) J' u1 {" A
  42. /*#define EDMA3_DEBUG*/3 I; j3 v5 ]! ^0 x

  43. 9 H. L" }; D" I. ]4 r$ L  ~
  44. #ifdef EDMA3_DEBUG2 s! h0 [1 V$ W$ j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : m/ v" |! T: {: s; c% D# [: p1 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' v1 B% T8 [& w. L5 \2 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). f# {& ~/ i; w
  48. #else, z# s5 k4 Y: X2 U! Z. ~
  49. #define DMA_PRINTK( x... )5 U% R0 q( z: J! ?
  50. #define DMA_FN_IN
    ; o+ E% e$ l( d' t$ k! ?: ~9 g7 V
  51. #define DMA_FN_OUT+ J4 Z* g$ _# p. Y
  52. #endif
    ' ?9 T4 Z4 F9 o7 P3 J& w6 k

  53. * H9 d5 n& B7 H  v% U% E; F; O& `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! Y  u4 C2 u8 i. q* v: z/ l
  55. #define STATIC_SHIFT                3! {$ i( d5 v& }" J0 M
  56. #define TCINTEN_SHIFT               20$ W+ r3 R0 f+ N" e, t7 A' p3 w0 D
  57. #define ITCINTEN_SHIFT              21* q# b% A# x2 a/ s5 G; K- M" N
  58. #define TCCHEN_SHIFT                222 F) D, e2 i% w8 f0 v9 b
  59. #define ITCCHEN_SHIFT               23
    ' q/ l6 t: Y3 ~- R0 h

  60. 2 B: z3 |  p8 b7 P
  61. static volatile int irqraised1 = 0;, c$ [% v6 {/ r/ M, O* O3 z2 p
  62. static volatile int irqraised2 = 0;& _$ t- K3 E/ c- k, d  E  M% s

  63. 9 U9 S; f5 U, o  L6 W9 d/ p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ?1 v5 q) n% e2 S6 X: s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E( R. a4 F- l; B. r# w' g1 G+ G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 B0 _) H" F0 S6 E7 u6 F: u
  67. ; _3 @; I7 D3 @. d- t! E
  68. dma_addr_t dmaphyssrc1 = 0;/ x$ Q* @2 B  a: r9 l. E
  69. dma_addr_t dmaphyssrc2 = 0;
    0 F0 F7 u: i: i( i
  70. dma_addr_t dmaphysdest1 = 0;! s4 w$ E  |# l" [3 R
  71. dma_addr_t dmaphysdest2 = 0;
    1 s$ ^9 \8 U+ C
  72. 8 Z" X6 H* l* T/ h
  73. char *dmabufsrc1 = NULL;
    3 j9 p# g' g( K! a4 |
  74. char *dmabufsrc2 = NULL;
    9 v& t" ]$ A* s0 Q4 c9 P7 D# K
  75. char *dmabufdest1 = NULL;
      Y) a1 s8 O( M' [
  76. char *dmabufdest2 = NULL;
    6 \4 \* x! v, k* W

  77. 9 `( C+ m. D! b8 A; {* k3 ?
  78. static int acnt = 512;
    . V6 U, P2 T4 S- ?  ~! c1 o
  79. static int bcnt = 8;
    - z+ Y+ j2 S- O" @7 I" s
  80. static int ccnt = 8;6 n0 M5 \& H* O% e, ]8 Z# R# g
  81. ! c5 e5 \- x2 J( s3 G# d" S' d6 S
  82. module_param(acnt, int, S_IRUGO);7 o- K3 N" ^. i' _0 N
  83. module_param(bcnt, int, S_IRUGO);% B$ ]* X4 S3 i1 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 M6 ]5 K: }) C% Q8 M

6 L" D- t1 b. ?. S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' f# @/ V: O  n+ |* n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 s' t- k- J9 V' D( }2 a( l. ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 X  Q8 g% z$ X$ w8 F: z0 L( x7 w' M. v5 S& i
, P! a  N, ~, ~$ E5 W; V/ K: a; O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 09:18 , Processed in 0.037942 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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