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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) t! G. z/ G4 `- _
  1. [code]EDMA sample test application, }4 i; J/ z- i- Z8 p4 L
  2. /*
    1 q1 _& T0 U2 `0 v
  3. * edma_test.c
    1 k+ ]5 _2 j; {" t) I
  4. *
    ' X1 z, A9 ~/ M( V" Q# j9 L( @  F
  5. * brief  EDMA3 Test Application9 Y! ~( i9 Y6 N9 F- @
  6. *( ]1 |$ E1 O( F7 x
  7. *   This file contains EDMA3 Test code.. R, {- f" [8 G# J$ ^1 R
  8. *, t  _  U1 F( D  ^4 b7 F6 J  w( H. v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 G; \+ O# _( h- V2 L" g. [1 n+ W3 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 ?* D" l0 V# A! `! q: p
  11. *         TO CHANGE.
    1 ]  h# G) I+ r% R
  12. *
    5 P, U6 s6 d: |% ~; J0 v. I' h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% g4 b# Q( w+ R* x
  14. *& w$ J( Y, ?0 d" ]. o
  15. * This program is free software; you can redistribute it and/or
    ! t9 \5 V7 q( D, m
  16. * modify it under the terms of the GNU General Public License as, d- n$ z" _' l- h3 t
  17. * published by the Free Software Foundation version 2.
    8 m" T) B/ k% v% C
  18. ** ?; w- J( y. O4 f$ b$ T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& z# E+ }3 N0 [, v
  20. * kind, whether express or implied; without even the implied warranty' q5 @& X& S( o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! }  J) c, B& n8 Q
  22. * GNU General Public License for more details.
    ( l4 G; I0 R) |. W
  23. */
    : f" M- z8 w& [
  24. $ w6 }4 S( c( X3 W$ t9 d/ L
  25. #include <linux/module.h>
    - M0 M/ J% F, [1 P- l& @
  26. #include <linux/init.h>
    ; S9 U" m' Q0 c0 N2 \4 c
  27. #include <linux/errno.h>8 W3 L1 k: r. Y
  28. #include <linux/types.h>4 n) \$ u# I* y  s8 O2 p3 G* g6 x8 l
  29. #include <linux/interrupt.h>
    # z) [1 s* B8 ~8 g, O
  30. #include <asm/io.h>. M, J( `! b  ]
  31. #include <linux/moduleparam.h>
    0 c2 I) N" ]+ Y
  32. #include <linux/sysctl.h>
      @! D" ]) x2 t0 `
  33. #include <linux/mm.h>
    % Y3 s. `1 P7 J" L3 o
  34. #include <linux/dma-mapping.h>. D9 E$ k' {+ \/ s5 q! m0 s2 v
  35. 5 O) z( X) n1 J
  36. #include <mach/memory.h># X8 z7 `! R& G" `
  37. #include <mach/hardware.h>
    3 R! u+ o% g$ H7 t7 x, U
  38. #include <mach/irqs.h>8 T; k; u6 {; d! Y
  39. #include <asm/hardware/edma.h>
    " x. @. _  o$ Z+ q

  40. 0 B) _( s+ P+ O/ w1 S6 K
  41. #undef EDMA3_DEBUG
    ; y" L: o6 G8 R5 _5 R4 z( ^
  42. /*#define EDMA3_DEBUG*/
    # E4 g  s" Y" {- q/ S0 o7 _8 R9 j
  43.   |$ G% Z! e1 m# g
  44. #ifdef EDMA3_DEBUG6 t7 N# V8 }2 B) A; P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  |# F! z. e4 o# `! \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 C& ~8 i4 T* `0 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - ]3 U9 A4 ?+ q
  48. #else- o& o) W  B6 W( v1 t2 y
  49. #define DMA_PRINTK( x... ), ^4 {' M! C2 ]( T+ z' \
  50. #define DMA_FN_IN! E- W; `' b" x5 ]0 B( X4 K# n; N4 _
  51. #define DMA_FN_OUT
    / r6 Z8 n8 Y! u" n- _+ C. ~
  52. #endif
    0 G3 e2 y5 e  u/ b' t

  53. 9 q. G8 G3 S0 R6 R% b3 D0 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), P* J1 s) `& H9 M: F* N
  55. #define STATIC_SHIFT                3# L( ~' a9 t+ d' p# f  u
  56. #define TCINTEN_SHIFT               20
    / E! u5 x* I- z9 M" l1 {; Y( C$ e
  57. #define ITCINTEN_SHIFT              21; V/ P9 f: j3 B. r8 n) \2 g% M
  58. #define TCCHEN_SHIFT                22
    * T$ b% w1 R: s: I7 j/ Z
  59. #define ITCCHEN_SHIFT               23
    / O4 ~! D7 M. U/ z8 s/ V1 k% ~
  60. , t; e  a) W3 M& q7 s
  61. static volatile int irqraised1 = 0;
    + i# e- Q. n) X% m* W4 b1 H
  62. static volatile int irqraised2 = 0;6 l% q2 w4 w, {2 w% ]8 W) H/ ^. t
  63. 7 p6 y! J# L4 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + c. k# c( @9 w' S& g, s, ]0 X. A* H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 J; F, \/ X, g5 [% n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! p3 Y! b4 j' P' d

  67. * `; z! _8 E7 ^
  68. dma_addr_t dmaphyssrc1 = 0;7 i8 T& O+ N3 b
  69. dma_addr_t dmaphyssrc2 = 0;2 f/ S! g* t' o6 t
  70. dma_addr_t dmaphysdest1 = 0;" o0 E, _- l5 w/ }# u0 f' f
  71. dma_addr_t dmaphysdest2 = 0;+ ?+ c, {4 Y" v
  72. 2 q( u! H. c! N; J( _
  73. char *dmabufsrc1 = NULL;  s0 s1 d' V! W6 p, s9 S8 W$ a$ E/ t
  74. char *dmabufsrc2 = NULL;
    " j. x3 l' @7 Q9 Y
  75. char *dmabufdest1 = NULL;6 i3 ~! _' J& s% G3 }
  76. char *dmabufdest2 = NULL;
    ( }! d0 U$ k' X: B
  77. ' D. O& N$ u7 M0 T9 `1 u
  78. static int acnt = 512;7 f8 K1 u! j3 W2 Y% c! g( ?
  79. static int bcnt = 8;/ X6 `4 o9 J0 D* p" L3 p) o& C
  80. static int ccnt = 8;2 T3 i4 M$ N# K4 N8 F1 T5 v

  81. # j% }/ ]9 q+ ]/ G5 P2 M
  82. module_param(acnt, int, S_IRUGO);
    ; L7 O+ Z! Z% ~/ B4 X
  83. module_param(bcnt, int, S_IRUGO);' ]) g, i  A- [+ q' c: b9 D) U; B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 K3 m; M2 Z' A  j: A* h" m0 D& V, p  P' n! T5 m8 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ N3 K: R; ?; K( X* t; S, A. P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 j% k$ U- _( t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( ~1 U( V+ R/ X" U8 V
# L# g, h2 s0 v2 X% k1 v+ _* h3 A" m; G* c& y3 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 03:29 , Processed in 0.039984 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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