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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 V! H, Q3 K' F) ~0 [/ I3 z' K
  1. [code]EDMA sample test application1 m* U1 ^- f8 ~2 k" N: @
  2. /*7 _# U% J8 C  u' ]+ X. G
  3. * edma_test.c/ D# k" Z) c3 f
  4. *
      e0 |' e7 q2 W
  5. * brief  EDMA3 Test Application
    7 |) n& G: c" p. G; S9 w
  6. *
    7 K  e8 N/ `2 s! K! z
  7. *   This file contains EDMA3 Test code.: e& x! p6 t. I2 ]( w
  8. *
    4 V+ m* l, c4 ?, y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 B8 @6 E' f2 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + |; b* U. U0 K" ]# ?0 T4 H7 C$ v
  11. *         TO CHANGE.
    4 a* {* b( Z' @
  12. *
    6 U8 r9 h1 o2 S! l0 ~  c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' g1 E$ |3 i+ a' S" o3 Z
  14. *
    % {2 _2 `5 |7 j$ Q! g
  15. * This program is free software; you can redistribute it and/or
    : P9 D8 ^! ]) g  R5 v
  16. * modify it under the terms of the GNU General Public License as  o4 n1 x0 Q, p) R- R% f/ v
  17. * published by the Free Software Foundation version 2./ m! j9 b2 j: R$ n9 I" I* |/ }/ X
  18. *
    - I0 j+ R0 `9 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 e; R# F& x- d* p/ }/ j: w
  20. * kind, whether express or implied; without even the implied warranty
    & K  m/ i, L" R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; V) Z2 \- W' V+ `) x% @; ?
  22. * GNU General Public License for more details.
      U7 j% c- u; i# Z
  23. */1 r! x  ]- G# ~" \) N2 K4 E

  24. 5 W4 {4 s8 o% O6 m5 I
  25. #include <linux/module.h>$ g; b: c6 G. W  w  Q6 g
  26. #include <linux/init.h>
    9 G+ q3 j4 l. a' }. u& R3 V
  27. #include <linux/errno.h>7 N. ?0 v  d; A! F2 y" _1 w9 M
  28. #include <linux/types.h>
    % {9 i) A% v# [4 c3 J: Y" q
  29. #include <linux/interrupt.h>
    2 {; v. d2 l& j  n
  30. #include <asm/io.h>9 ~% y7 {+ Y2 }* M2 Y+ [
  31. #include <linux/moduleparam.h>, Z$ U- l% a7 R0 t; T+ G
  32. #include <linux/sysctl.h>
    : F' m1 ]5 y! p' W* r1 l  D1 N
  33. #include <linux/mm.h>
    5 V2 L% `$ d) d; i
  34. #include <linux/dma-mapping.h>" f/ m' t/ i9 c8 p/ L" ?. H9 R

  35. % }" L2 u- H0 h; l9 T
  36. #include <mach/memory.h>
    4 F2 T& q; G7 H" J: U  z1 t% t
  37. #include <mach/hardware.h>
    & J9 d; G( G, P$ O+ t
  38. #include <mach/irqs.h>  ?/ d& ?- b$ X, Z6 T
  39. #include <asm/hardware/edma.h>! o% P% k$ N9 w. q) V% {& t

  40. ' m$ C, c  c3 L; o
  41. #undef EDMA3_DEBUG" m9 V% N- w' J8 v1 x; i
  42. /*#define EDMA3_DEBUG*/: P2 D. N! X# k+ i) L
  43. % W0 c+ M2 G4 |
  44. #ifdef EDMA3_DEBUG$ _- C5 W# z$ \4 d" F0 ~& a1 k9 S6 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - O. {/ `. L) G( v. I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ l5 Q- L) {# H- s  L- E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; K" J$ R( b+ v
  48. #else* E& L7 e! ^/ Y" ^  a
  49. #define DMA_PRINTK( x... )3 u% C% \  N2 @6 Y0 U
  50. #define DMA_FN_IN& x5 E' z$ r- h- @
  51. #define DMA_FN_OUT
    / _2 F8 z" E6 k6 j$ k3 ]
  52. #endif2 J: [* V; ]' O) I# U& @' t* a
  53. ; g7 f3 T: p; _" y$ e5 n8 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 Q8 J: h$ X8 b: z( O
  55. #define STATIC_SHIFT                3" b/ W$ l* u8 E4 i$ Q- F: V6 w
  56. #define TCINTEN_SHIFT               20
    ; P- _- U( O% _# `
  57. #define ITCINTEN_SHIFT              21' i( q, e; U" u. {, E$ {
  58. #define TCCHEN_SHIFT                22
    ; U1 ]8 R) r- h( }7 R: f5 Q/ n
  59. #define ITCCHEN_SHIFT               230 I. y* f0 t7 Z* c/ B

  60. ; }! j$ F* O' n+ f, s2 d; w
  61. static volatile int irqraised1 = 0;
    # L/ n) L, R( z9 V  Z
  62. static volatile int irqraised2 = 0;) ?$ s( r1 z0 X' L0 n7 o
  63. * B+ F) A& U6 H/ }9 w" {; e, V8 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      ?3 F6 d; |- {) B/ j/ n& B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* |0 |! w, E/ C, K, ]) R$ {/ ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 o6 M  v) a( B5 j
  67. " x  S; g" W; y* U" @; u
  68. dma_addr_t dmaphyssrc1 = 0;$ p% F/ f7 G0 H$ D& {( D
  69. dma_addr_t dmaphyssrc2 = 0;
    & Q% c+ n$ |, r" X6 j
  70. dma_addr_t dmaphysdest1 = 0;
    0 u3 `2 x  R" O; M7 Y
  71. dma_addr_t dmaphysdest2 = 0;
    8 H) h8 v0 P* k7 w
  72. " A7 z+ I2 s" q/ m# j$ B6 ?0 E, z
  73. char *dmabufsrc1 = NULL;( d) V: Z6 s8 p5 }  n- r' \3 d5 h" d
  74. char *dmabufsrc2 = NULL;6 n2 ]& o/ l0 p" E' G3 A$ |
  75. char *dmabufdest1 = NULL;
    : y0 p4 Y; E6 ~6 W7 d* R
  76. char *dmabufdest2 = NULL;
    6 L3 e. h5 W6 M1 q# _& s( C

  77. * K6 S0 r# U3 l" S: k, x
  78. static int acnt = 512;
    8 w! U! t6 j) _: L( \* b! e  ]
  79. static int bcnt = 8;
    + S2 O2 i" o2 k6 [& Q
  80. static int ccnt = 8;7 W. S6 ?8 _" I

  81. . B  f0 x4 b; r/ l. ?0 w
  82. module_param(acnt, int, S_IRUGO);( {- h- V) k0 n0 P# k
  83. module_param(bcnt, int, S_IRUGO);3 s$ z! D9 {. H' [; k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' B0 Q3 c" ~( j+ p6 ~5 ]6 N
: }1 a8 p$ p3 S+ m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. `$ {- p' O: n' @' k8 L$ B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 \5 X% ^) \/ Z9 T& [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' z9 [& ~  ^' c- n
8 }) k. _5 b2 z7 t2 H
$ A  r, k; a- r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 00:53 , Processed in 0.038367 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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