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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 N$ _: |" U  f3 h! B9 n/ n: L
  1. [code]EDMA sample test application, a. l( R6 N* p+ l3 w- b7 x
  2. /*
    ; z$ q4 F! l$ B4 I1 Z' z7 C
  3. * edma_test.c
    ' w* C0 u: x% M2 R- f
  4. *
    0 P3 H: m0 |3 e7 y6 n# j$ d) Z
  5. * brief  EDMA3 Test Application
    ! {; J3 c' `+ M6 t, r% s
  6. *6 U3 Y( H% f: v" d' r
  7. *   This file contains EDMA3 Test code.1 b2 m5 }& t: ]% e
  8. *
    $ ^6 P, T/ o, \: M$ ]. I1 S  N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ {4 q& C% w) w" Q. M4 S7 ~/ L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; }7 J0 N! k6 T9 [4 h: c
  11. *         TO CHANGE.
    0 Z8 e5 g9 K' s& L) ^& `9 b  y
  12. *" @) P. H# c4 q9 E3 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % g1 Y- X0 {8 D: n% K0 }
  14. *
    . G2 E8 k8 d( [" [: n$ d: X
  15. * This program is free software; you can redistribute it and/or7 B4 k9 i8 S4 |7 x" C- A
  16. * modify it under the terms of the GNU General Public License as
    7 F& I0 {8 |% h: c5 c/ d) P& o
  17. * published by the Free Software Foundation version 2.: |5 @+ ?# H: {# b4 t1 o: n3 f4 l0 J
  18. *
    : `. }1 w/ f0 t9 ?3 [9 D, R+ E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 m, o( Y  F0 `/ T; K. @+ s+ }' m
  20. * kind, whether express or implied; without even the implied warranty
    6 g3 K$ o2 L. E1 O6 h5 \+ m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* X; G1 z- X* \% T+ K0 w
  22. * GNU General Public License for more details.
    ( k/ W2 [! x3 x( T/ m% b
  23. */7 ?% w  e( ?: Z3 p/ [7 I1 e- I

  24. : _. V1 `# Z) p# l: p
  25. #include <linux/module.h>
    $ P% N. }0 c' I0 A- b
  26. #include <linux/init.h>
    / [, |. X/ i* I, @
  27. #include <linux/errno.h>
    1 b" D7 q! d# J. _  Y
  28. #include <linux/types.h>
    - M2 l6 s! {0 M8 U4 A# W
  29. #include <linux/interrupt.h>
    , e; [: m1 a# t/ h+ Q
  30. #include <asm/io.h>
    * s, m+ E# P; \& M9 ], _( o+ x; N
  31. #include <linux/moduleparam.h>
    3 z5 y) K  _/ E- Y% m+ c6 h' _% @) K
  32. #include <linux/sysctl.h>) Q7 ^, M3 [9 w
  33. #include <linux/mm.h>
    # g- D2 o, g( o- Q& J# G
  34. #include <linux/dma-mapping.h>
    $ U1 O2 _) t5 F! N+ a

  35. 3 h" x4 p* L& n! P3 O
  36. #include <mach/memory.h>" f/ C) n1 J% c  r( R% Y
  37. #include <mach/hardware.h>
    - W) H4 M/ l, e9 [: V$ q1 s1 g
  38. #include <mach/irqs.h>
    . u8 p' f; y( z1 O( e1 I: T
  39. #include <asm/hardware/edma.h>4 O' R+ t$ e& k, [
  40. ; V  |* f! y% _# b- `# Y, f
  41. #undef EDMA3_DEBUG+ }; c+ C! r" ]+ z, Y! \
  42. /*#define EDMA3_DEBUG*/3 }: P+ L$ A1 ]1 f

  43. ' K9 Z, s0 d' `' [/ X& Q
  44. #ifdef EDMA3_DEBUG
    ' B1 ~3 z9 P; T1 ^6 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; |6 H1 G9 O* F' ~1 _' f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( C% T0 r4 x0 A. d" Y. K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + ]8 q/ B8 ^/ C! E- _7 f. ~
  48. #else
    ! r# b3 O) }; T) t3 Y( F4 @, w
  49. #define DMA_PRINTK( x... )
    % D: g) q# S2 j
  50. #define DMA_FN_IN
    1 Q0 ]5 {' S  \! \+ [, l3 L- K
  51. #define DMA_FN_OUT) [& L# [4 D; l6 t+ D# O( Z
  52. #endif
    9 `6 r  z- A4 G0 G7 K& @: u4 L2 H" H
  53. $ N) F* Y8 p5 E3 g- r4 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 i2 n2 R' F3 |, W6 p5 S: T
  55. #define STATIC_SHIFT                3
    4 N) Q' x0 O" T
  56. #define TCINTEN_SHIFT               20( W, r- @4 B  h  i! i
  57. #define ITCINTEN_SHIFT              21  m6 E% [4 C) n( E! z6 b6 m; a8 S1 M
  58. #define TCCHEN_SHIFT                22* D2 H0 L: \, z2 g5 S/ K) {
  59. #define ITCCHEN_SHIFT               23# u7 S9 @& q7 @2 h" E: c- d# F5 ]
  60. ' ]' L% x, X* S! Z; ]& D
  61. static volatile int irqraised1 = 0;' k1 @, |, K0 l) j# q: l
  62. static volatile int irqraised2 = 0;8 V$ L$ e5 x" a

  63. & {+ I8 ~7 ^% {+ l8 ?) D$ z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' u6 `7 V* S) w' M* ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 R& g/ @1 l+ }  |5 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' c% L: i- `( X; U4 V: f
  67.   _- K) E  @) [7 x3 Y+ T
  68. dma_addr_t dmaphyssrc1 = 0;+ l* r9 R# }# l
  69. dma_addr_t dmaphyssrc2 = 0;
    : u; R2 v; ^  J8 h5 F3 S
  70. dma_addr_t dmaphysdest1 = 0;0 c, o! s9 d# a8 V7 {; i% ^4 a. I
  71. dma_addr_t dmaphysdest2 = 0;$ S% B) U, C4 x% L4 D
  72. 5 R! D; f( d0 N7 f  i- M
  73. char *dmabufsrc1 = NULL;
    ! E, {* u, ^" I6 @4 U( T! }
  74. char *dmabufsrc2 = NULL;( s# H  v& a* Y' }& J/ a
  75. char *dmabufdest1 = NULL;. }4 u  \% M  N/ @  r
  76. char *dmabufdest2 = NULL;
    3 }; ^; X! B" G# M- `
  77. 6 l$ B. {. Z) A& P
  78. static int acnt = 512;& _9 {$ O% H, f" M; O9 M' `8 H' I
  79. static int bcnt = 8;9 ]$ Z2 D3 c5 w
  80. static int ccnt = 8;
    + G$ j- o/ B# R
  81. " t( b- |7 ~1 a, D
  82. module_param(acnt, int, S_IRUGO);4 R: |* v1 h0 m( L! a0 n+ W* m5 Z
  83. module_param(bcnt, int, S_IRUGO);. e- ~4 Z7 \" K% P& _! B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ s2 c# w5 N! G! r0 h1 T$ ?/ U) ?2 E# f  T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, p1 X6 Z6 p% ]4 {6 Y" {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; b" |) a# Y0 O! S& N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) X# q: ?/ G5 Z6 c# J1 L7 u- B  K4 q$ [/ B5 R; I+ o$ |
) M  W8 n( C; k; h+ V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 16:16 , Processed in 0.047927 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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