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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 Z1 S  J( x1 {3 c; F1 c
  1. [code]EDMA sample test application5 g$ B* O0 W* v" G  E& q) ]
  2. /*
    , ~* J: H6 m; h# D3 j6 H+ K
  3. * edma_test.c! w5 p% _) n' A5 O
  4. *
    ( P, R/ G* P5 K! H5 A4 `+ E
  5. * brief  EDMA3 Test Application
    1 X$ ]! m) K+ K1 c( ^7 A1 c
  6. *- s  q. A0 n$ N4 s2 ^
  7. *   This file contains EDMA3 Test code.
    + k: b* e6 `) H$ z# t  h* M
  8. *
    2 B1 x$ r8 M- p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * @! Y$ O+ Z$ f' z4 D. [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! E! ~# A  `4 w8 S: ^
  11. *         TO CHANGE.
    / l( r3 g; P( j/ R6 g, @6 I
  12. ** O  L% r  P' s) M4 A5 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 P" G( Y( \7 _# _1 P7 ^
  14. *& X" p/ U+ f( |3 V. ]
  15. * This program is free software; you can redistribute it and/or
    ( J/ ?' q6 E  u) X2 V
  16. * modify it under the terms of the GNU General Public License as
    + q# l/ B# L6 {& H
  17. * published by the Free Software Foundation version 2.3 W0 i# ]6 p: k/ H
  18. *8 Y$ I0 W8 y) g. Y7 o- q, I* H5 x* y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 D# G" E6 z2 A
  20. * kind, whether express or implied; without even the implied warranty
    3 p/ E$ z* c5 S- B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 v$ l- i: V! Q) S- n
  22. * GNU General Public License for more details.
    7 b6 h5 i9 [; l. i) E
  23. */
    & l6 ?2 k' t1 V3 [- Y7 ]

  24. * d. [$ l2 R* d- E5 I5 {/ ]
  25. #include <linux/module.h>- u* @! y/ `7 Z1 J3 a/ D" ~
  26. #include <linux/init.h>3 o& W( s, @, h
  27. #include <linux/errno.h>1 c# t/ u# C, d0 D- i9 P, t5 I: z
  28. #include <linux/types.h>6 u" g' t; p% e
  29. #include <linux/interrupt.h>
    . _/ j- E4 C$ f; ]' ~+ |* ]
  30. #include <asm/io.h>
    8 j4 w7 h* n" }5 A$ U; g  B
  31. #include <linux/moduleparam.h>1 E8 X8 w6 _8 \+ F* d. J: b
  32. #include <linux/sysctl.h>. J5 v& c, y. T2 M7 p/ @, e
  33. #include <linux/mm.h>
    1 Q/ `4 J1 T9 g" m0 p, f
  34. #include <linux/dma-mapping.h>' l) B, ?4 r/ P. }6 c, v: a3 K' L
  35. 8 C$ ^# _7 a' ]. p7 l
  36. #include <mach/memory.h>
    / e3 e+ P7 {5 ~5 `8 [
  37. #include <mach/hardware.h>
    - k8 T- l2 h% C1 U  c
  38. #include <mach/irqs.h>
    6 N; s/ X5 c" p. t* v& g1 Q0 m6 P# D& N
  39. #include <asm/hardware/edma.h>
    2 `3 m: s9 d( x: I; y
  40. ( T0 V& Q6 h3 x  t2 [
  41. #undef EDMA3_DEBUG
    3 ?' m6 v& l7 p4 I  x5 D8 m
  42. /*#define EDMA3_DEBUG*/% E/ L$ a# l5 c# `

  43. 4 j" e' @9 A! z  S. R
  44. #ifdef EDMA3_DEBUG" ?% d. o, U$ F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 B: C+ S( P/ A) L. s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & j; o9 [) v1 D( r; Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) v+ E+ {+ [& N* l+ x, l( q6 Y
  48. #else
    9 I) l6 M; A4 ^" h' ^$ i
  49. #define DMA_PRINTK( x... )
    5 Z3 @& B+ Z1 a0 G/ P% u
  50. #define DMA_FN_IN
    / f. e0 M! u1 w& s1 I0 Y' Y6 C
  51. #define DMA_FN_OUT- Y. O2 t# E" _( ~
  52. #endif
    1 X: U+ U* z- H1 a2 |+ N: G$ }
  53. ; I8 p( [. ?) i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 T' L+ l1 _9 |5 H* G1 R
  55. #define STATIC_SHIFT                34 N8 A9 i1 O7 r* @$ |
  56. #define TCINTEN_SHIFT               20+ F4 m% ^! \# E
  57. #define ITCINTEN_SHIFT              21
    # H" L1 b" \5 z* N5 Z
  58. #define TCCHEN_SHIFT                22
    * J9 u5 x4 ~7 [( C2 ^
  59. #define ITCCHEN_SHIFT               23
    , B$ |1 C1 m( O/ p4 c% S1 b
  60. & _7 X9 [- i& d9 c* K. |, Q
  61. static volatile int irqraised1 = 0;
    - z. I0 R3 X. t
  62. static volatile int irqraised2 = 0;) m. Z/ c, v- v3 Q% i6 d
  63. + u6 A- ~# Z/ M) E1 X- j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & M$ S0 y( s8 ]" G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # D% J2 o0 q7 |& r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' P- B: ?& m* j

  67. ; j: _6 e8 Z& |1 @8 x5 S
  68. dma_addr_t dmaphyssrc1 = 0;
    ( U0 o, X/ k2 ~& N8 U; E- d2 Y
  69. dma_addr_t dmaphyssrc2 = 0;' y+ x) M. K' Q) j
  70. dma_addr_t dmaphysdest1 = 0;
    - c  q9 N' D4 b& b# U
  71. dma_addr_t dmaphysdest2 = 0;, x4 u9 ?' A6 @
  72. ' Z8 b8 j! X6 o& ~) O9 D3 S
  73. char *dmabufsrc1 = NULL;
    ) [, ^( Q$ |; E+ {# T) T6 I
  74. char *dmabufsrc2 = NULL;
    ' @9 y$ @* Z& q
  75. char *dmabufdest1 = NULL;; t) `, g: y; Y3 `% X' F  y: P
  76. char *dmabufdest2 = NULL;
    2 s" [, n1 _* T& k! w
  77. 7 v- B+ A) g4 M5 {
  78. static int acnt = 512;( F. y& P: ?; i3 Z" e7 B; N; Y% w
  79. static int bcnt = 8;! h. w# x8 x6 r* N2 o- l
  80. static int ccnt = 8;  j/ H* A- a7 R
  81. $ J( |+ I; {- m, ^4 \  K9 B
  82. module_param(acnt, int, S_IRUGO);
    ! t! @( v2 Q% ]6 `
  83. module_param(bcnt, int, S_IRUGO);
    ) {9 |, j7 }* u4 ?2 t3 o& F. Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 `  F2 Z: U- v/ f
" k, M, H! V7 F( n" S0 U" T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- i0 c9 w* k- u- t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 u4 `  f( y# U+ _$ W5 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, h/ Z7 w: b2 Y3 a) A. a+ ~4 i, K0 b6 T
/ B+ J" E* R( l8 e% J" @. C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 16:40 , Processed in 0.039059 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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