OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) D. b8 G! Y- u  g* @1 w
  1. [code]EDMA sample test application
    " P. [7 w1 p) i' e& N1 z
  2. /*
    / `3 ]1 _9 a+ f5 v( W( O# S7 O
  3. * edma_test.c
    % E: ]% }8 R  K$ @, S0 Q
  4. *: I- L% Y) R; A
  5. * brief  EDMA3 Test Application  V" {  R" B! l. c. R7 @) T8 z: L
  6. *
    * P  }% n3 i! Z9 \! j
  7. *   This file contains EDMA3 Test code.( x% D2 ?/ f$ R
  8. */ y5 ]1 l* X" j  `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" Z% U  p* \- ^; W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 o' o; q7 a! j5 q5 {  i
  11. *         TO CHANGE.
    5 k& H) n! a. _2 \2 k5 X* e
  12. */ W; C( A# Q+ Z9 l2 ~0 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' a2 K. J: \& b$ q
  14. *
    + z- g2 ~5 e4 N- X9 ]9 m
  15. * This program is free software; you can redistribute it and/or
    ; g% Z4 X7 e0 R9 S) j
  16. * modify it under the terms of the GNU General Public License as
    7 O4 F4 |7 M& c7 `
  17. * published by the Free Software Foundation version 2.# W- ?2 [$ V4 V
  18. *
    : d* v8 e/ ], R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( u& q5 x) N2 n" P' h4 ?- Y% @
  20. * kind, whether express or implied; without even the implied warranty) y( e' h, G1 v+ I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 d8 V" Q( Z, O& x. _
  22. * GNU General Public License for more details.
    . l$ ]( Y; d1 m
  23. */
    5 a- d$ t$ m0 B- f; W

  24. / r7 z$ z: g' q" Q! t3 T
  25. #include <linux/module.h>  a' U; Y; P2 [( K( Z! W
  26. #include <linux/init.h>
    ( b, ]/ i5 g4 i- G4 ?7 F
  27. #include <linux/errno.h>
    # U# ^5 j9 f: G
  28. #include <linux/types.h>: E1 w9 K( v3 B# e
  29. #include <linux/interrupt.h>" W  Y) W+ ^9 B. T
  30. #include <asm/io.h>
    ; \3 _7 m4 X6 K. r
  31. #include <linux/moduleparam.h>9 c5 j6 u1 ]1 Z' H. C3 Y# y: e+ U5 ]
  32. #include <linux/sysctl.h>9 u& F5 t: j6 }7 x# Y0 ]1 @8 K3 e
  33. #include <linux/mm.h>, n. u5 J$ A. m0 Z) H
  34. #include <linux/dma-mapping.h>
      Q3 W7 X4 W0 g* I  y8 ?5 }& I3 f

  35. & ]& [! c. K0 j& Q5 W, ~+ {
  36. #include <mach/memory.h>
    ! O4 O- `: X- I( m$ \) _
  37. #include <mach/hardware.h>
    ! e$ S0 I4 S) K8 G5 V
  38. #include <mach/irqs.h>
    ! \8 ]  p. o' A
  39. #include <asm/hardware/edma.h>0 ^5 I3 {) C! X$ O" h8 r7 a
  40. # G# |6 p) W7 J8 _7 g" ^( e
  41. #undef EDMA3_DEBUG
    ( X( o7 k  V+ K* _) {# {
  42. /*#define EDMA3_DEBUG*/
    4 G/ a% \7 o7 a( q
  43. 5 L, _& _- j* Y  X) b6 j( z
  44. #ifdef EDMA3_DEBUG
    ; R4 O* p* j& g1 X6 n  w( `( g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 X. ]- e$ E6 t2 j% T+ e3 X* m, y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : t' {3 w* G' k; Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 D$ O$ |! v9 T
  48. #else0 b5 }: r( h) x+ i: _! b
  49. #define DMA_PRINTK( x... )& `# ]) v9 e7 q/ f* E( z5 {
  50. #define DMA_FN_IN
    9 U$ f: G% j! W( p0 z7 N
  51. #define DMA_FN_OUT/ a- ^8 y4 Q: h2 F6 \: N0 v
  52. #endif' p: k$ L& q: b- d

  53. ' }4 v4 W$ S7 Q/ P0 G& h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! @! S5 p0 e2 k
  55. #define STATIC_SHIFT                3, S- g9 n* U) X! u% b, S! `
  56. #define TCINTEN_SHIFT               206 g* l7 \5 R4 T; b& Z1 |1 f, j
  57. #define ITCINTEN_SHIFT              214 e5 m/ H. F9 a4 C' R
  58. #define TCCHEN_SHIFT                22
    " P4 T& Q0 y: X) g- I
  59. #define ITCCHEN_SHIFT               23+ B4 C8 b% M6 Y  H
  60. 4 U* E" ^* n- M% _8 ?8 K
  61. static volatile int irqraised1 = 0;
    2 c- Y; z0 ~: N4 b) p* W' g% E
  62. static volatile int irqraised2 = 0;( \7 L/ Z  |  z$ n% A  `

  63. 2 r8 a/ W7 q9 _9 n! n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . `" I/ b5 v, K8 h0 i) Y, E- z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; [* e0 H/ E1 y9 @! `4 L7 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / e0 f" U3 j- f% m- f4 o( Y
  67. + _2 F; R2 G+ }* u; Q) V% D
  68. dma_addr_t dmaphyssrc1 = 0;8 R8 I/ r' F. {7 [& ^9 L/ Y
  69. dma_addr_t dmaphyssrc2 = 0;2 b( h" @3 v1 k6 K4 Q
  70. dma_addr_t dmaphysdest1 = 0;8 I: v- n$ `/ j/ ~  z5 D& g, @8 l
  71. dma_addr_t dmaphysdest2 = 0;
    ! @' v6 h1 Y3 h. h% @( S
  72. ! p" ~6 O" e) m; ?
  73. char *dmabufsrc1 = NULL;
    ! X2 M; l' M5 D% J
  74. char *dmabufsrc2 = NULL;# u$ W" V8 e3 c  G8 A# A
  75. char *dmabufdest1 = NULL;' I( z' ?9 }; }) |% R1 P. a$ ^
  76. char *dmabufdest2 = NULL;- O7 s$ y* N* a1 y  V! P' l
  77. ' D3 y$ x/ {% H  O
  78. static int acnt = 512;
    . Q. \' |8 b# _; l$ L& _
  79. static int bcnt = 8;
    8 {( M1 W/ w# l( o& K( S5 r' z8 C' _
  80. static int ccnt = 8;
    7 Z, d- ~9 D" p! n! b3 o/ w
  81. . @) R0 K) R, ^# B
  82. module_param(acnt, int, S_IRUGO);$ z( c$ N% @; y+ g
  83. module_param(bcnt, int, S_IRUGO);6 l; J# r4 M" H6 P8 }% I( J/ ~% E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 I4 n4 b) A& n" G" W! u0 a  f: F; I/ ?) n$ F% |) y9 h# f: i. @. i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) d) O0 f. Z( O' Z0 A' t- E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 m3 |3 E. s' m, `. [3 ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 }8 ?" p4 J$ t% l

. a- _4 Q% L; s) ^$ ~! A6 ^$ x: ~( n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 21:05 , Processed in 0.038580 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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