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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! C3 h- i3 m: e! R1 Q: c. o% E
  1. [code]EDMA sample test application
    & m8 u& x) l% x
  2. /*/ Z- y8 X; d, V$ t
  3. * edma_test.c
    ) a3 ~- n& n7 b0 ^
  4. *( z7 c! I( ^) v, @. b! H
  5. * brief  EDMA3 Test Application  f5 s5 L/ ?; Q) }- [
  6. *
    ! X8 X6 ^0 |2 Z3 t) T
  7. *   This file contains EDMA3 Test code.
    1 s" I' g9 t+ E; b6 U% s9 l7 z
  8. *
    ( ]; K" \& W& {0 Q7 M% Z2 K4 x' A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 c. G6 g5 ?/ j2 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 F) U3 t8 m/ U5 ^2 H; S
  11. *         TO CHANGE.5 Q) {; y5 d1 ?) f
  12. *$ p% K. |9 w& D7 J, Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 Q8 s- F$ L& T2 c" x% S
  14. *
    8 D* b8 D/ @% f  X. w# }6 V3 H
  15. * This program is free software; you can redistribute it and/or
    , ]" X  G! J. y4 e. w; |  `  ^# R
  16. * modify it under the terms of the GNU General Public License as
    1 c( L- _' m4 e# W
  17. * published by the Free Software Foundation version 2.  `) {0 g8 Y7 p8 X  _
  18. *
    0 p9 Z9 n* D' w, c4 J0 r+ I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 w  P7 N$ k6 a; G' Y0 g
  20. * kind, whether express or implied; without even the implied warranty
    : q! C1 `" q0 g& K; T5 Z: \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ c7 Z, _0 {. U: e8 b( i8 b
  22. * GNU General Public License for more details.+ ~. u/ Y7 N, V7 l% Z
  23. */. Z- U& D! \) x7 k, j* H* l
  24. ; B- K9 p$ I3 U4 W+ t7 l
  25. #include <linux/module.h>- h7 ^+ T3 d2 I) t3 m! p/ F" a
  26. #include <linux/init.h>! o, Q4 ^  N6 ?4 b
  27. #include <linux/errno.h>/ p/ u* H% ~4 I8 e2 G
  28. #include <linux/types.h>) }9 d% ?, I) ^
  29. #include <linux/interrupt.h>
    ) k1 z4 w7 \$ t$ b0 n
  30. #include <asm/io.h>
    # K! \6 s2 E. s( K0 t$ p2 M
  31. #include <linux/moduleparam.h>7 R# z- D" S* @6 {4 j6 v
  32. #include <linux/sysctl.h># n2 v6 S1 u4 o
  33. #include <linux/mm.h>
    ( P! b: J# E* ?& l* Z# i+ A* b
  34. #include <linux/dma-mapping.h>
    : R9 ?" ?; L& O6 I) G

  35. 4 V3 \" t3 J. X' y: R3 L- _
  36. #include <mach/memory.h>' y5 s. A( [' x3 D5 ]
  37. #include <mach/hardware.h>
    $ D, y2 D4 V; ^! T" p& G" i
  38. #include <mach/irqs.h>; U8 l2 P$ C; @1 P+ i4 \
  39. #include <asm/hardware/edma.h>
    * [4 X% Y5 f3 H  ?" S5 N

  40. / q6 d2 _& b& l! a% ?9 F  t
  41. #undef EDMA3_DEBUG( }, U( P4 k! Z7 {! _  f
  42. /*#define EDMA3_DEBUG*/0 z* a9 ?- j* o: h5 v+ ~" V
  43. 3 h. T5 |9 r+ C
  44. #ifdef EDMA3_DEBUG
    + k) p. H" x/ D& W4 j% m, N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( _5 \  s8 ]1 M% n- z: Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' `0 u4 X$ \1 `0 O, g" s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& S) V2 u/ s/ G6 d! G
  48. #else
    / T1 |- s+ |8 J, |+ ^8 s
  49. #define DMA_PRINTK( x... )
    : {# F" ~2 B8 s/ i+ v
  50. #define DMA_FN_IN+ u$ b" q2 S6 n* T/ q+ o. A
  51. #define DMA_FN_OUT! T2 E( a$ i/ [/ v5 o
  52. #endif
    / H( R6 F2 A* {$ m- d- ~

  53. ! \0 {' l. p; z' d5 H; R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 l2 w$ J& S4 }& ?# e6 [
  55. #define STATIC_SHIFT                3% ?! o$ s7 B/ `" s; Z
  56. #define TCINTEN_SHIFT               201 o  U( Z* Z+ w+ v* l
  57. #define ITCINTEN_SHIFT              21
    / t. i& r# d# z$ y
  58. #define TCCHEN_SHIFT                22  B! D8 }+ s8 G/ }
  59. #define ITCCHEN_SHIFT               23
    ! F( C$ j' K# k" f' {
  60. + c  z$ G* A) V7 L, B0 f
  61. static volatile int irqraised1 = 0;8 @6 n" ^, `# V' |
  62. static volatile int irqraised2 = 0;9 a% f4 G+ r3 [2 `+ b
  63. 2 Y( M2 l# j% E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : J, E- `& t6 N8 R% w# x" [+ t2 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " D  T' ?8 e9 z: _" D! q3 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; F* k" w8 [8 R- O9 J* d/ U2 P
  67. : I* O; s2 V5 i. S
  68. dma_addr_t dmaphyssrc1 = 0;! ]6 d& L. m8 k5 ^, [! I* w
  69. dma_addr_t dmaphyssrc2 = 0;$ A" N3 F4 b8 K
  70. dma_addr_t dmaphysdest1 = 0;
    7 }5 l+ }8 C# I+ {
  71. dma_addr_t dmaphysdest2 = 0;$ ?; Q  v; Y; o; P' A' n2 S! u
  72. - A8 ?7 f; u  |8 S3 h8 k/ l: K0 ?& A
  73. char *dmabufsrc1 = NULL;: Y* ~) [( T7 G2 [/ o: ~5 m
  74. char *dmabufsrc2 = NULL;
    9 @6 n% I) p% B  U2 G" W: K; B, I
  75. char *dmabufdest1 = NULL;( {" g+ s' [& |. K; ]2 a* M' `
  76. char *dmabufdest2 = NULL;
    3 h$ \: D0 I1 d$ B5 x6 E# ~7 S: r

  77. 5 Z" S" ~* C/ @: X- i
  78. static int acnt = 512;
    $ M9 |6 U0 @! ]6 ~! V
  79. static int bcnt = 8;8 o" ?: u. Y5 ^9 x2 L! s
  80. static int ccnt = 8;5 B! E6 e" u  P' M# X
  81. 5 |" @) X: {/ ]$ }5 i
  82. module_param(acnt, int, S_IRUGO);( g- L8 L  A' c  U
  83. module_param(bcnt, int, S_IRUGO);& j# t( S+ J4 u/ Q3 B# a0 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ P  |/ ^$ A' F" P* m1 O$ s7 L3 [5 P/ ~/ k3 m/ K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 a3 T- o% i9 Z' |5 a. carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. `3 ?  e! @+ c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 g2 u' E3 T( G  [6 N3 Q$ {
" D/ u! K; X; p  x9 w  U" ~
& d6 u- ~' o; l+ b8 I9 |) @; w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 22:51 , Processed in 0.045499 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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