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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + q6 \) g+ b3 Z% \
  1. [code]EDMA sample test application, Z3 L& F9 Q6 j5 n
  2. /*
    7 i. j, _1 o! d, V9 e4 a
  3. * edma_test.c& p$ Q5 v9 b* [& u% f8 Z
  4. *; _/ F  J: M' T: ?
  5. * brief  EDMA3 Test Application
    * M8 J# _6 S6 ]3 I/ }
  6. *& \0 c( t2 V1 C! N# Z
  7. *   This file contains EDMA3 Test code.2 O# G2 y/ g8 j0 S
  8. *. e7 C4 d& s2 P1 u0 r1 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 m: E$ w1 p- X2 E& B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 i8 D. _/ P; {0 X, E" ?4 u' B: L
  11. *         TO CHANGE.; K2 Z) R8 o4 m+ i* y- `/ s
  12. *
    6 |$ Y& S4 i" a/ j. w! {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 p8 g" f. e8 p7 o/ U' R
  14. *3 \$ p7 s) K( ?: c- |/ w& [. b! o/ D
  15. * This program is free software; you can redistribute it and/or
    & J; l) A# {5 A, ^7 r( n$ r8 N: _
  16. * modify it under the terms of the GNU General Public License as. o; x( _# n( l
  17. * published by the Free Software Foundation version 2.; |1 M# }3 F' R7 {7 `& l
  18. *
    1 G! B! }1 T( L7 n3 s8 f$ C7 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  \, [, S' h  R
  20. * kind, whether express or implied; without even the implied warranty
    ! u8 k) ~7 q3 F2 K( J2 _* c+ z+ V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ ?( Y$ K; Q( B/ ]: J& P
  22. * GNU General Public License for more details.' x. F  k3 {6 a  `# R) G
  23. */8 b2 }% P/ W  g2 l9 Z  d- Q

  24. 0 D6 i9 Z  N: m# Y5 X
  25. #include <linux/module.h>
    1 J, R, r. Z' }1 @
  26. #include <linux/init.h>+ i% g  z2 D  J4 O
  27. #include <linux/errno.h>
    8 l* \( F8 ?, d  z6 W9 S; W
  28. #include <linux/types.h>: u) o  K7 j4 d2 h
  29. #include <linux/interrupt.h>$ P" G2 r5 V$ v7 y
  30. #include <asm/io.h>8 w# Y$ ?1 w5 R) r- h0 l5 Z
  31. #include <linux/moduleparam.h>
    " L  W) N# \6 `
  32. #include <linux/sysctl.h>4 C* l/ J% D1 Z# X$ I
  33. #include <linux/mm.h>
    # r1 k0 b- f& `! t. s/ I: F6 {
  34. #include <linux/dma-mapping.h>* T* u7 d: U  T; _/ u! P

  35. $ p6 t" [2 E8 A+ v4 t
  36. #include <mach/memory.h>& q: h5 C* R& R+ b( O
  37. #include <mach/hardware.h>
    ' Z: G* h! D, i5 Q0 z2 Z- Q( E( D) p
  38. #include <mach/irqs.h>
    % S' l2 Z+ [# q8 u( H
  39. #include <asm/hardware/edma.h>& m; M% S+ f4 |; X, @- w. P" @

  40. 2 C  t# }. G4 P) t$ J2 o7 O5 G1 u
  41. #undef EDMA3_DEBUG
    : ]9 `& A" P$ o% D$ v5 {/ x
  42. /*#define EDMA3_DEBUG*// s$ h! v+ T3 M) }. Z

  43. 7 f  g. N/ ~. `6 G/ e2 T$ a
  44. #ifdef EDMA3_DEBUG% ?1 W1 n, F! i% C# R, j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 E$ Y' O, [  ?7 y! N3 J$ w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 z, e" J8 F/ F# b3 x) Q, v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) d+ T0 B8 {- w- J9 X
  48. #else
    0 P( d! |6 ~3 F7 \: H$ Z; X
  49. #define DMA_PRINTK( x... )
    ) u. H) V5 g6 P' \  V# R, y
  50. #define DMA_FN_IN
    : ?  @& P+ i  L) p. X+ p
  51. #define DMA_FN_OUT# I) {) F* `1 P3 e+ Q3 L: l
  52. #endif
    - C1 }' W; X8 i
  53. # x: A% k" P3 z7 [; d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), T) q; e, W7 K$ O
  55. #define STATIC_SHIFT                3
    - b1 u) R. d! ?* O) j5 o
  56. #define TCINTEN_SHIFT               20
    8 m1 _' n# K# X$ g1 L
  57. #define ITCINTEN_SHIFT              219 N' z  n  T* m- J: L# }
  58. #define TCCHEN_SHIFT                22
    * D/ s& ?$ U, z7 M! e' s, {
  59. #define ITCCHEN_SHIFT               23) H5 ?0 F' V5 t; Q* x: c
  60. 1 N. q; p6 [  Y
  61. static volatile int irqraised1 = 0;
    ( J) a% A! v, r/ T" R
  62. static volatile int irqraised2 = 0;* ]; w' v7 M! P

  63. . ~6 R* C3 H* i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 V1 H: i/ b* F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! [, x# D' q8 r7 v) ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! S+ H" K; j( [! p3 {) A" j

  67.   B  a! `& f% K2 k; H& W
  68. dma_addr_t dmaphyssrc1 = 0;
    + ?9 p0 m! s( R; l: G
  69. dma_addr_t dmaphyssrc2 = 0;4 I/ Z" z+ T! w/ E8 I9 W5 t* _
  70. dma_addr_t dmaphysdest1 = 0;4 M6 O9 a5 Y. a9 M% f3 d: {
  71. dma_addr_t dmaphysdest2 = 0;- W5 }) f! f1 n; o, z9 U

  72. & u2 H( C: t; R, D+ M
  73. char *dmabufsrc1 = NULL;
    6 H5 A, t5 [& `6 w; Z+ ~3 S
  74. char *dmabufsrc2 = NULL;
    * o3 K1 O% P' @1 {
  75. char *dmabufdest1 = NULL;$ g  u6 f1 ^$ W$ }
  76. char *dmabufdest2 = NULL;
    $ i" t0 c! C3 b2 O/ `

  77. % j" `# i" |) n5 {" n
  78. static int acnt = 512;
    5 U" E2 H5 l# \+ _5 b
  79. static int bcnt = 8;
    * x8 B% ?" E+ _0 r7 m& ~4 r
  80. static int ccnt = 8;: L% e1 t5 y: R

  81. / h0 Q3 {7 w. l* ], r
  82. module_param(acnt, int, S_IRUGO);4 Q1 y' A, a3 j, r' h% d& m0 F
  83. module_param(bcnt, int, S_IRUGO);
    5 |8 D3 ?- z0 m7 }/ o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 H% u4 |9 {6 v- X& {. g7 E& _  `9 K  R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- V  E# ~; F" l0 A' w: h% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 L+ D2 Q& B8 l1 G! u5 C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; X  C  l* {$ X5 s$ m- l2 O
- ~) I$ H7 P2 S6 K' F7 T: N4 z. \" ?% _" t  v* _6 \) B8 \4 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 20:34 , Processed in 0.048110 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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