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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 z; @; w- i- \4 [
  1. [code]EDMA sample test application, N- t+ r- j$ R7 d; j
  2. /*
    / n. W( y& D. P9 m: x! S
  3. * edma_test.c( d7 F) X) D/ A# Q+ j
  4. *
    % Y9 @# e" d* d* B. P
  5. * brief  EDMA3 Test Application
    2 B6 M0 _" y3 u! u" ^% p
  6. *
    6 A1 Y4 c7 K  k$ p
  7. *   This file contains EDMA3 Test code.- W) p( P5 T6 X* X
  8. *
    0 q% `8 F" t" G4 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ l6 J" A2 a, r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 R2 V( U2 s: F% m; z
  11. *         TO CHANGE.4 G9 Y7 g  P1 n5 N( H6 \% X3 W: f
  12. *
    1 t7 ~# k( d) e: U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& v; s: c7 L5 A( G" l
  14. *
    1 f4 r  O2 Q6 e( n/ L% e+ v: v
  15. * This program is free software; you can redistribute it and/or
    & u# f: ~4 [3 z8 X0 i' w% M
  16. * modify it under the terms of the GNU General Public License as; C8 U( q+ J0 l2 W" }1 s
  17. * published by the Free Software Foundation version 2.
    . O6 a2 o$ \. Q9 F3 F+ Y6 K; G/ Z
  18. *3 y5 ^3 f( y$ r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 i8 a2 @* x7 r3 \% J  H5 u
  20. * kind, whether express or implied; without even the implied warranty4 _0 |; M; n' \/ I. ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ b2 b* t$ b3 I, v
  22. * GNU General Public License for more details.' L% @$ @  c- x+ Y: T( l: }/ G
  23. */
    0 Z8 \, h/ Z, P( z
  24. ) l) x/ J1 k6 ?$ f" Q& c
  25. #include <linux/module.h>
    4 H! k4 z  E" P. G9 k) w% p
  26. #include <linux/init.h>* w2 i3 J, h; g3 v+ X$ Q1 K
  27. #include <linux/errno.h>
    7 g8 S  |# _& J# }( `
  28. #include <linux/types.h>- T9 f6 q* L) C) b8 ~1 \, E
  29. #include <linux/interrupt.h>
    ; O3 c. C0 k8 l/ E0 |& m
  30. #include <asm/io.h>
    5 l# [1 S5 J9 P* U  M' B0 V
  31. #include <linux/moduleparam.h>
    4 K% ^! x+ m$ {) I
  32. #include <linux/sysctl.h>
    ) i/ H5 v: Q# A
  33. #include <linux/mm.h>$ k) s# u) _! a) R7 v+ R0 ?
  34. #include <linux/dma-mapping.h>: c: T, i, G0 a& S

  35. : @5 T% P# j( E7 R. V- [
  36. #include <mach/memory.h>
    8 g4 c# I- Z' c) |
  37. #include <mach/hardware.h>5 R- x* w% i0 h
  38. #include <mach/irqs.h>1 k" ?* @- E% w, {& d$ W
  39. #include <asm/hardware/edma.h>
    ! T; W" H: C" E* c( v

  40. 7 _9 G/ T; X) O3 Q, ?
  41. #undef EDMA3_DEBUG
    3 s4 F2 @0 o' P0 c7 b
  42. /*#define EDMA3_DEBUG*/5 f% c5 v1 `% A1 {" K( E
  43. ( o  G4 s0 ?, }6 _2 @+ D, C' e1 U" c9 G
  44. #ifdef EDMA3_DEBUG% L4 Q% L9 q  |5 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# R8 ^! h! l4 ~" M+ N4 L) @+ B. s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); r- l6 G, G: F4 |! _) t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) K6 r$ Z" A( V
  48. #else* M0 ~- W/ G% H
  49. #define DMA_PRINTK( x... )2 C6 ^( l) d/ Y/ `: a
  50. #define DMA_FN_IN6 W" Q. g( `& M% s
  51. #define DMA_FN_OUT
    7 l+ n4 q( _4 w: P0 w3 C) r
  52. #endif
    6 P. P. w0 C1 ?  U: |

  53. ) g. _/ I. |: }4 y$ A; a, f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; }" T1 q- f5 |6 C2 ]
  55. #define STATIC_SHIFT                3
    ( i" P" C% f! u8 K' m8 g
  56. #define TCINTEN_SHIFT               20
    " _" g/ z1 }* m! @& Y
  57. #define ITCINTEN_SHIFT              217 `  p! {0 W$ A
  58. #define TCCHEN_SHIFT                222 ?6 _; c% {* P; v4 J/ R1 e* `9 y
  59. #define ITCCHEN_SHIFT               23! q; K, `# P" s7 G/ N6 F

  60. : C7 a! n. U1 E6 C0 |5 o
  61. static volatile int irqraised1 = 0;
    , S! F: b# U  E- H( ]% M
  62. static volatile int irqraised2 = 0;, F* t/ {$ O, X9 ~, Z% P6 Y5 Q3 M- A3 D' v

  63. 3 @  W" I* I/ G# h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' r  Z6 F& f; c3 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 k) n2 E, T, T, h, O& y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 b( {4 O' [; w) K0 t

  67. % F- g2 H# x" u* _. ?
  68. dma_addr_t dmaphyssrc1 = 0;
      U0 }; l" H& |! }3 x
  69. dma_addr_t dmaphyssrc2 = 0;9 q/ F. t5 P% J4 u% C3 ~$ r
  70. dma_addr_t dmaphysdest1 = 0;* z3 ?, w# d. h" X5 d
  71. dma_addr_t dmaphysdest2 = 0;: u* H$ ?# l  z% Z9 K

  72. 9 j! a$ b: Y/ K( s* r+ z) n! |8 K
  73. char *dmabufsrc1 = NULL;
    & ~/ N3 A  I$ A4 g
  74. char *dmabufsrc2 = NULL;
    - I% z8 p' [* N& D3 e! [% ~
  75. char *dmabufdest1 = NULL;) t& V' U; G! F" }% S
  76. char *dmabufdest2 = NULL;! P: j8 {0 G7 j6 L

  77. 9 v! B* o3 [, O8 v; I4 D
  78. static int acnt = 512;
    & v$ [! q: h: F+ _
  79. static int bcnt = 8;
    + [+ m) u# r  c8 z: q
  80. static int ccnt = 8;' d. j& n5 M* g7 d2 ?& I

  81. 2 E* D) i" o9 ]9 o9 q7 _
  82. module_param(acnt, int, S_IRUGO);4 ~* y' \6 ~& Q3 M
  83. module_param(bcnt, int, S_IRUGO);* @6 s3 m# q3 z  m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ \' ]2 C2 f7 H0 N1 Y' |. F- A1 b4 f: d) P9 i& F3 v0 {" B& w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 F. D6 ^: ?/ x' q( X6 e4 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 }- d2 n* Y6 ^5 K2 _, p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& d$ \! B5 z& S- x  H: U8 d
  @1 I2 [: d! a0 [3 h$ f9 e5 D: D( Z9 u: [. c9 m, s" g7 L& c- V! S4 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-22 21:52 , Processed in 0.040314 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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