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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: a. e2 W! Q( y, I0 t
  1. [code]EDMA sample test application
    ) R7 J! a1 D: ]+ C6 O# a! J
  2. /*  h8 G& q6 \9 s6 P) q
  3. * edma_test.c& }, G; I/ I2 C1 J  [& i9 u" |
  4. *
    / f1 G8 I: Z* H+ L! C
  5. * brief  EDMA3 Test Application4 N! @) B0 [/ {6 T. o/ [( A
  6. *
    % o1 q9 \# f9 J# Z
  7. *   This file contains EDMA3 Test code.
    ! }6 I; a' V4 d; M' M
  8. *+ Q% U: E& g! l3 }& |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 c6 h' j8 b5 G2 s' e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  X7 w0 O* F) }+ F6 D. ?6 J
  11. *         TO CHANGE.
    " P( m. |! K$ b8 |& d9 e
  12. *
    + Z# w9 h. ~2 G0 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # \  t2 b- N% p4 h- q" K  T
  14. *
    8 j' b8 z+ M2 V* K$ l
  15. * This program is free software; you can redistribute it and/or8 d: l/ [! O7 }9 I  l5 R: }
  16. * modify it under the terms of the GNU General Public License as( E  Y+ g  s% i
  17. * published by the Free Software Foundation version 2.
    5 L2 B+ s* a' K( M1 g' m' D
  18. *
    5 |: X3 p; ]0 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - j9 w# t- K, U& j$ V2 _9 m# x5 K
  20. * kind, whether express or implied; without even the implied warranty
    5 c: D" k0 W; \) M+ X6 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 p$ Q; u; e' \; }0 K
  22. * GNU General Public License for more details.( G% I" t0 `: V) `" C. o
  23. */
    , F! H: N0 f7 h) G8 P* y- W- H2 q

  24. % U& V( W! u: v5 s3 D4 `" g
  25. #include <linux/module.h>1 e$ a+ E6 {, h8 W
  26. #include <linux/init.h>/ J% l% l9 Q6 \. v  S
  27. #include <linux/errno.h>
      J9 s. W* V0 z* y
  28. #include <linux/types.h>( S, o  k% X& c8 [* `1 k  q
  29. #include <linux/interrupt.h>
    4 [3 w2 R4 p0 _& {
  30. #include <asm/io.h>
    6 ^9 w+ E6 `5 x( P( G) @
  31. #include <linux/moduleparam.h>$ J9 P: N$ P: y9 B2 j
  32. #include <linux/sysctl.h>
    7 C, O5 y! a/ m6 W
  33. #include <linux/mm.h>
    ' M' n0 y1 @4 _, m: W
  34. #include <linux/dma-mapping.h>  x: i) k; j! `: E7 Y  w9 F
  35. ( r$ }# A9 u$ Q. [2 S& e
  36. #include <mach/memory.h>
    : J* \5 g" ]. ~# U; p$ p, H
  37. #include <mach/hardware.h>5 `- z9 ~+ \+ A  _
  38. #include <mach/irqs.h>
    # v! X. I! T. L7 o: e3 b
  39. #include <asm/hardware/edma.h>
      n0 k. ^- V$ ]

  40. # |3 B" r9 |0 z
  41. #undef EDMA3_DEBUG
    ) h4 R+ Q8 e* x8 h4 J
  42. /*#define EDMA3_DEBUG*/
    8 u- \1 e4 T. l+ u" H6 A) ]) ^2 ?3 a
  43. * k# T  M  C+ M
  44. #ifdef EDMA3_DEBUG
    - D$ ]# v0 {( b6 b1 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 _  V" E" z1 f, F' K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) G0 A: h* f! S0 d" {7 X7 V0 s. T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 W* @: w3 G( z' p5 g  r
  48. #else
    5 x1 Y" }1 t- r* I; f, ]
  49. #define DMA_PRINTK( x... )
    $ H2 P8 x9 F. K
  50. #define DMA_FN_IN
    / {. D- D/ `# }  K* H2 R2 t
  51. #define DMA_FN_OUT
    0 Z! D7 C' Q& |& ]2 U8 G4 L+ ?
  52. #endif0 ~& z8 ^0 X' A4 O: n) a4 ~: V  H

  53. 1 Q' }4 @& o, S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  B& b1 o* @; D8 i4 R! t3 _
  55. #define STATIC_SHIFT                38 u3 O; i* R! {% e/ U/ t! X9 H8 T
  56. #define TCINTEN_SHIFT               20) |) B3 u: J, w% Q$ [% ^& J
  57. #define ITCINTEN_SHIFT              213 Y6 b9 ?1 G3 P: c* _. A) B
  58. #define TCCHEN_SHIFT                22
    1 Z% D7 f5 l0 ?4 q6 B
  59. #define ITCCHEN_SHIFT               23
    . b4 ?* @- E7 P2 d0 V9 ^

  60. 5 F& t, |/ z* x9 `, V
  61. static volatile int irqraised1 = 0;
    6 ^+ P$ M- S4 c) R
  62. static volatile int irqraised2 = 0;
    " B/ n9 ?1 \# [# d0 U
  63. 5 M: F' A+ g, j$ V5 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " y  R+ h9 j+ o1 B, P- u0 L+ z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 V( k$ w2 _% a! F  k: L7 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* C6 |  ^) E5 \, M( m* k. w
  67. ; t" K  i2 H& [# Z- |: y
  68. dma_addr_t dmaphyssrc1 = 0;6 `1 w' x, @3 g2 B
  69. dma_addr_t dmaphyssrc2 = 0;# s2 H/ H( z( f& L; E
  70. dma_addr_t dmaphysdest1 = 0;
    4 Q* f8 y0 c/ C6 \( s0 D8 c7 Q
  71. dma_addr_t dmaphysdest2 = 0;- s% S. ?7 V/ _9 U" x. ^
  72. + ^4 D8 T/ |! D& V4 o
  73. char *dmabufsrc1 = NULL;: z- S/ L& T5 _7 E1 C2 Z( G
  74. char *dmabufsrc2 = NULL;; }# D; }( S7 Y! [
  75. char *dmabufdest1 = NULL;( M4 ^4 |0 K2 i, d' y$ a7 A
  76. char *dmabufdest2 = NULL;: `* E% N- g: r2 G$ L) ^8 U
  77. 4 i& N* J0 c/ p6 U; C. ~
  78. static int acnt = 512;( V- P, {+ Y+ n0 l7 u
  79. static int bcnt = 8;6 Z  W5 u" [1 r) X2 P
  80. static int ccnt = 8;
    7 S- n' _7 M) w3 C9 o

  81. " }: _/ s* s7 P9 {* A- a) k
  82. module_param(acnt, int, S_IRUGO);9 F% B* x4 |' {$ w2 @
  83. module_param(bcnt, int, S_IRUGO);( Y) Q7 g" r* I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# K- g% ?" M5 m# O6 V& k" a- w; t& c0 Q' n" G4 t- ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 k3 Q( I* A+ ~, K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  R9 J* P1 U  B) M" V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 j" n* X) g/ f

( t# Y0 D  m9 f( u3 e  }7 ]. k" T8 Z& J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-20 08:18 , Processed in 0.036489 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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