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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 ~, m) ^' V* u+ m) j
  1. [code]EDMA sample test application# D- \( C7 l# F. C
  2. /*
    5 _) b2 N/ l8 r' ~+ T& \6 V5 }. f
  3. * edma_test.c
      y5 @, N4 j) v7 J$ D( _
  4. *" K* v+ D+ R  f
  5. * brief  EDMA3 Test Application
    7 {: D+ R8 G9 B6 w3 Z8 k) ?
  6. *& q# S$ w. Z- J4 R8 q9 F
  7. *   This file contains EDMA3 Test code./ k2 b( K2 _0 z
  8. *5 k- F. B' O2 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 _" `8 `9 B0 [/ O. Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 P" p- C1 p% q! D( B8 x# w
  11. *         TO CHANGE.7 Z, g6 X6 ^% C, O
  12. *
    6 J& I0 F7 e: Q" f' ^4 `1 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 s- T2 m, b6 A; U  `* K7 F$ Q( @
  14. *
    $ X6 I+ }# r9 J1 L* C1 a
  15. * This program is free software; you can redistribute it and/or, B- J% X$ c6 _# d; ~
  16. * modify it under the terms of the GNU General Public License as
    9 K0 c4 Y6 M7 e& O! g
  17. * published by the Free Software Foundation version 2.0 r, Q1 W0 ~; c! I- C- W/ G' h, [
  18. *
    ! ~% D) Q* J* b2 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " ]: ]/ S0 Q. S% R. K
  20. * kind, whether express or implied; without even the implied warranty: Y, r7 _* `( B6 a) {; O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% ?( \- J6 e* n: o
  22. * GNU General Public License for more details.
    ; U" ^' u0 ?& r7 \  f' p
  23. */
    * i' b: m" T$ m- ]8 x

  24. , R/ T! {$ ]) S
  25. #include <linux/module.h>
    5 N0 W  C9 h! D: d8 J# \7 s. [
  26. #include <linux/init.h>5 o. w0 D) D+ ~; s0 R& P9 E# m
  27. #include <linux/errno.h>
    & o- F7 x% `2 Q7 e3 K6 I; W' `
  28. #include <linux/types.h>
    - {. \% M# v! C( h
  29. #include <linux/interrupt.h>5 _6 G) b- w6 h) R6 ^3 e( N
  30. #include <asm/io.h>1 w1 O) o0 b) U& \9 N
  31. #include <linux/moduleparam.h>
    8 G# v5 V+ u) ?6 x. m
  32. #include <linux/sysctl.h>2 [; H" @5 |; G3 R6 ?
  33. #include <linux/mm.h>
    6 m( C6 D/ a& w. H5 A- L$ `
  34. #include <linux/dma-mapping.h>& n7 P9 L7 c, L% n$ ^  I2 y* z

  35.   g6 N4 T4 l8 _
  36. #include <mach/memory.h>
      t" g+ J/ ~( m! Z: p) v1 o
  37. #include <mach/hardware.h>8 w& |/ E& K% n5 _$ K1 H6 E, T. L5 X
  38. #include <mach/irqs.h>1 S+ u/ u7 }* l5 ?4 d! I0 ~
  39. #include <asm/hardware/edma.h>
    , X7 b$ s+ K/ @; U# k5 P

  40. 4 h6 }% K) d' v' H' z6 M4 E! W- n
  41. #undef EDMA3_DEBUG
    ) F# C/ C3 i7 F' A
  42. /*#define EDMA3_DEBUG*/
    ( _0 H: k2 ^% O* h
  43. 9 o0 E: a5 u/ X) O/ q6 U- _
  44. #ifdef EDMA3_DEBUG1 V' I$ ~9 i3 Q+ x! S2 A7 H. A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' M( Y: A8 Q  @5 k& j: U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : U. D' v+ c& C. j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 J+ d2 Q$ n6 B
  48. #else
    * e; U5 W! R' M
  49. #define DMA_PRINTK( x... )
    ) N( c, s4 r( M$ z: z* j" _! n' `+ q
  50. #define DMA_FN_IN
    3 _( ?5 F8 U. |/ D* F+ g
  51. #define DMA_FN_OUT. h  q1 o  c8 c+ ~/ Q1 O. e
  52. #endif' b; N" \+ t8 W+ v( i& D  e8 V: H
  53. 6 B7 T% O5 v- G; f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( o/ V) x& `4 g5 m3 c
  55. #define STATIC_SHIFT                3# N) G: N$ d9 x8 b' Q' G) A2 E
  56. #define TCINTEN_SHIFT               20+ E8 P4 x" q, o2 K/ _
  57. #define ITCINTEN_SHIFT              21
    5 z  N+ _  o+ [5 R
  58. #define TCCHEN_SHIFT                223 C1 _* O1 q; h! a8 w! U; I
  59. #define ITCCHEN_SHIFT               23
    2 K+ h. W- @9 }$ R  j9 x

  60. % A  r9 x) D, N. n8 D
  61. static volatile int irqraised1 = 0;- n) C' P7 g( @+ a9 I3 Q
  62. static volatile int irqraised2 = 0;1 E! x( H& T4 V) u0 [6 G1 v0 \# k  I

  63. # W& _. S/ w5 w' ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- |8 l4 `' r# V3 x8 @" a3 L) U( t0 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& U8 Y' H: a% w4 u6 k! S+ q9 z- J# j( W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ]3 y3 H& b; [6 P4 d
  67. ' }+ p. d" m) t1 _. w) r
  68. dma_addr_t dmaphyssrc1 = 0;
    1 }0 F3 @! [2 A; c! o* [/ q8 S5 F
  69. dma_addr_t dmaphyssrc2 = 0;
    ! U! m( m, A* ~3 J$ d
  70. dma_addr_t dmaphysdest1 = 0;; _* G% N& C2 n( U) h
  71. dma_addr_t dmaphysdest2 = 0;% r$ R5 P- V" K2 S+ Z2 _
  72. % ]1 ^0 u7 G  Y$ v
  73. char *dmabufsrc1 = NULL;
    ) H0 o  |0 O* F5 G: P
  74. char *dmabufsrc2 = NULL;
    6 t- O1 ^" O, c: m( F2 K
  75. char *dmabufdest1 = NULL;) V4 l7 A* b. Y
  76. char *dmabufdest2 = NULL;
      ^6 L/ }3 O' j$ N" N; |. |4 i
  77. " ?/ Q0 ]% X: v1 v0 f$ c+ H
  78. static int acnt = 512;: `9 P- ?0 [4 Y% E
  79. static int bcnt = 8;2 w/ D- c3 q' h5 k# U2 J0 l
  80. static int ccnt = 8;5 o7 h$ U9 `5 V

  81. 2 ?# u7 [2 e3 c- \2 I# M/ u
  82. module_param(acnt, int, S_IRUGO);2 {8 D4 }$ [. }5 c: Z7 o, x) I
  83. module_param(bcnt, int, S_IRUGO);5 e4 {" {& @, q! }$ A- g- e! q: t6 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 ~$ F+ \+ \9 O& p3 B, u+ |2 F/ i& l  j# _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. t; |: V! o* v; y4 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 T/ `) W8 M7 P4 S7 }$ x5 t* x' c* n- _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 Q- R7 L, T/ R: |) Y+ d
  l8 Q: N3 n9 P9 h
7 Q  @' O5 u/ X5 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 01:52 , Processed in 0.038009 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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