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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % Z4 @/ t: \: P+ {& M* z
  1. [code]EDMA sample test application
    - F/ {: ~2 t# A$ K% D
  2. /*3 ^2 s" `7 S6 S8 q. F
  3. * edma_test.c. a- Q( M5 v8 I( e0 Q& T
  4. *
    0 i5 C  |' M; _" u; `. q6 h
  5. * brief  EDMA3 Test Application" z6 o& O; _4 A/ Q/ o/ F
  6. *: F  e# a' z, g& O6 K
  7. *   This file contains EDMA3 Test code.
    ' c' A& F. C# o! y4 o+ G5 a' y& |7 l
  8. ** C# o  \# o& y' i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " E0 L( B3 e/ ]2 x) j7 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 Z" S' N) \, @
  11. *         TO CHANGE.
    $ T+ |2 R' m# I# f- I' ~# C
  12. *
    0 k& x# J5 z6 I- W  D, U4 `* Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : i- ?2 y, n% F/ x) Z1 a# Q
  14. *
    1 C( B: W. d* c! ?1 n! W
  15. * This program is free software; you can redistribute it and/or
    3 q0 X! g# I; O: o7 R
  16. * modify it under the terms of the GNU General Public License as
    & U+ E; ]& Y0 S) U  p
  17. * published by the Free Software Foundation version 2.
    9 F& C0 A( q3 p+ U5 `+ N' _
  18. *. L) h3 L; B$ H$ @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; X  r9 d7 o' n2 e8 R
  20. * kind, whether express or implied; without even the implied warranty2 u7 s/ h: J" s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' T) x; \, x# t" [! i
  22. * GNU General Public License for more details.$ N4 o& q% l8 ~+ a9 O: |
  23. */
    3 E- n; B! k; w( w; _0 D8 J7 j

  24. & _- a- a1 J$ u) s) v9 [
  25. #include <linux/module.h>
    * z9 z: P- W+ e- {
  26. #include <linux/init.h>: k9 E  ~1 V3 x/ p" P1 k6 o6 G
  27. #include <linux/errno.h>9 z/ p5 z1 B6 R* R' N) o5 p
  28. #include <linux/types.h>& ?- F; }0 ?( a
  29. #include <linux/interrupt.h>/ N+ m: q( @9 I6 v& g* _$ D3 Q
  30. #include <asm/io.h>7 _: @! J/ e- [% ~, H  _4 f+ Y8 Q7 y
  31. #include <linux/moduleparam.h>
    ' H( H2 D$ ~0 ^" F5 y; ~, j
  32. #include <linux/sysctl.h>
    ; b3 a( ~2 _$ `1 Y% `
  33. #include <linux/mm.h>
    $ ?' c& q2 c6 u+ F8 f8 M
  34. #include <linux/dma-mapping.h>
    2 T: C, L- N3 g
  35. ) }* F- L' O% s% a& _2 q
  36. #include <mach/memory.h>
    " b  Q# I! i6 ^( {, R
  37. #include <mach/hardware.h>+ l4 O( q3 w5 ]/ g' e9 H7 L' `+ c; t
  38. #include <mach/irqs.h>2 ^8 g/ g# `% Q& Y2 z9 [  T7 N- m
  39. #include <asm/hardware/edma.h>
    % X2 o7 J5 F5 p3 [4 N7 G

  40. ' ]0 r7 ^: a* C( O' I6 h4 P* \
  41. #undef EDMA3_DEBUG3 r0 J7 W: C, A
  42. /*#define EDMA3_DEBUG*/4 |! L$ y3 ~' `0 E+ w; g) Y! e" A
  43. 9 e3 h3 b; x  y) M! y
  44. #ifdef EDMA3_DEBUG) {; U% _+ L$ @: V( N0 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 n# I1 u; |% J! V7 C, a  g  |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( g9 v4 |1 f( ~# v5 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 |& b0 |: T2 |# W: p
  48. #else
    ' z) X) M8 z* v0 C. C- s1 d: t/ B
  49. #define DMA_PRINTK( x... )
    " ~6 f3 @# F+ d" m( E: T  F6 E
  50. #define DMA_FN_IN
    ( n3 \0 _! v+ i6 z: ?/ z* l
  51. #define DMA_FN_OUT
    0 W' [& y. n$ P) k5 K% C
  52. #endif
      k7 X- t1 ?4 n# {1 C
  53. * ~- l/ f2 ^  C9 H) o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" E. E' y7 @+ N  T4 F. }
  55. #define STATIC_SHIFT                3
    * v9 w3 B% u0 N1 w& _% _
  56. #define TCINTEN_SHIFT               20
    0 p0 Q" k8 w' d
  57. #define ITCINTEN_SHIFT              21
    8 c; ?8 ~% Y: T
  58. #define TCCHEN_SHIFT                22+ ?: w, ~1 k9 D2 i$ C, V) n
  59. #define ITCCHEN_SHIFT               23
    , q! z7 F% r6 K+ l) q' q8 e4 K

  60. 0 D: K5 S0 ~( i7 }* \7 h
  61. static volatile int irqraised1 = 0;
    ; C7 f# o' T# \4 ?
  62. static volatile int irqraised2 = 0;8 w% ?8 A) l2 d( D3 M
  63. ' o* t& b% u! v: T; }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - @4 J% l- d4 h+ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 c$ L2 T) Q* B1 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) \' ?! K( M2 C3 s  n

  67. : g4 |2 x5 F: ~/ y7 i7 n
  68. dma_addr_t dmaphyssrc1 = 0;6 y: Q9 @- b" l- n4 a
  69. dma_addr_t dmaphyssrc2 = 0;
    ( x" v' D$ r) c3 P+ I
  70. dma_addr_t dmaphysdest1 = 0;3 s% O) G3 ~- _) @; p
  71. dma_addr_t dmaphysdest2 = 0;
    . X+ Y! K% {6 @: W2 ~/ `7 h

  72. + E; |# A1 c5 P4 G9 [5 }; g8 Y
  73. char *dmabufsrc1 = NULL;5 s+ |" m4 r2 h. Q0 z
  74. char *dmabufsrc2 = NULL;' }1 E0 x* U6 ~# c" R
  75. char *dmabufdest1 = NULL;
    ( w9 n; m  T! Y- k- }; H
  76. char *dmabufdest2 = NULL;
    $ M3 z1 a: G9 S7 R3 w% _" F2 j

  77. % B4 G2 z; V# G
  78. static int acnt = 512;
    . x* ~0 Z# O* `$ J# [
  79. static int bcnt = 8;% [+ v. K1 j* x
  80. static int ccnt = 8;
    ) \5 r# r( E: D. d

  81. . R; h6 U( P+ I5 M* F, o6 f
  82. module_param(acnt, int, S_IRUGO);" L3 ]' b# ]5 K( W( s
  83. module_param(bcnt, int, S_IRUGO);/ r$ h6 X, s2 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' s  Z1 Z* A; M+ x2 G3 r9 k. {

: }: m. _1 c4 G* T/ W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' N) T8 D; |# i" R% L9 Q  ~7 e; p6 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* T" \7 m: _/ _5 S2 K7 M0 z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! `+ d; ]7 X& C& m0 q( N/ b! l3 ?! ^9 N6 Z
* h6 ~1 f' K) U6 k" J+ ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 00:22 , Processed in 0.037552 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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