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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 s- e: m! \! j2 y, F7 Y$ T9 `9 g  B
  1. [code]EDMA sample test application
    $ [' m/ z6 M! m5 _
  2. /*% G3 F0 f0 |9 q7 Z
  3. * edma_test.c) d; [' E5 Q. P2 N
  4. *
    + Q( q  ?. l5 G% J
  5. * brief  EDMA3 Test Application
    # {! G$ \: m2 p/ N
  6. *# L" \/ h( l: {$ D
  7. *   This file contains EDMA3 Test code.
    * R( M) K6 Z; w5 a4 A% @" U
  8. *7 n- ~: ^% m: p6 J- O4 D" h7 M% Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 p5 F2 z' h2 Q. v$ t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 c' ^6 K4 D: M0 A9 C# p
  11. *         TO CHANGE.
    ( s: G  ~3 I: @1 Y' x# p7 a
  12. *% S" J% I8 V% x& H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" }! M$ X  A) ]3 I0 P
  14. *$ [- F% B, l3 }% T% x: C
  15. * This program is free software; you can redistribute it and/or
    3 L- {  ?9 H* P
  16. * modify it under the terms of the GNU General Public License as
    0 ]' @5 J, f& a; c% W1 I
  17. * published by the Free Software Foundation version 2.7 s& _, c# v) Y5 `9 _  T
  18. *: x3 z  ]3 R2 c2 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 J$ D# V+ B6 B7 R3 j* z. S6 |+ ?
  20. * kind, whether express or implied; without even the implied warranty
    # d$ W  \% j) w8 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - b3 ]' M: ^, p- L; t
  22. * GNU General Public License for more details./ ?) p8 w+ C- I* D9 p$ j5 I: u
  23. */
    $ n3 k+ G# P4 H( f% W  w
  24. $ M& `& E9 W& n$ |2 {8 M6 A- W* Y) `
  25. #include <linux/module.h>+ a  N$ _9 K1 p$ s* z8 j. _" T
  26. #include <linux/init.h>$ _) }* R2 v& w6 |0 j9 K
  27. #include <linux/errno.h>
    " y1 i1 B0 k' O; o6 N% {0 \; ?5 B
  28. #include <linux/types.h>
    % {+ B- {. J0 B# n
  29. #include <linux/interrupt.h>% z/ r2 w+ F; f! X" I3 o
  30. #include <asm/io.h>
    : h5 u+ S# [) P2 ]; G$ }
  31. #include <linux/moduleparam.h>
    . D- s, d# \- W% f
  32. #include <linux/sysctl.h>
    % K0 v7 |: o/ O( L$ _" ~' ~6 b
  33. #include <linux/mm.h>
    ; Q# u) l0 `* t. {
  34. #include <linux/dma-mapping.h>3 ^6 I5 [! F: s" t2 X  j
  35. , X/ ?' B# z& A2 P- D& ^9 O+ D
  36. #include <mach/memory.h>
    $ h# Q! _) f8 {3 ]0 l& o; q: x
  37. #include <mach/hardware.h>, l4 J( w3 t2 Q; i, P% G8 C1 m
  38. #include <mach/irqs.h>
    , K6 |! r% V8 `, B, D9 s
  39. #include <asm/hardware/edma.h>. w' ~7 U, ]/ Z9 O/ z  G+ X5 Q4 F. O

  40. ; B/ G- q" b3 X7 `/ A7 b3 v- N. Z
  41. #undef EDMA3_DEBUG5 `. H/ V5 e) P3 S% d
  42. /*#define EDMA3_DEBUG*/
    " K( R& M7 u- d9 C9 S0 P

  43. 6 o0 B6 V6 C2 J! D. N
  44. #ifdef EDMA3_DEBUG2 u6 c3 b6 A7 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) o5 Y( [5 _; E- q# p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# z8 C) z$ B; A3 P2 f$ \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' N, n7 m4 S4 t9 K' x
  48. #else
    : y5 O: N% j  a* G; U' g* W, S
  49. #define DMA_PRINTK( x... )
    $ q7 q9 q- H1 e( p8 l, j
  50. #define DMA_FN_IN
    ; N: w" u0 e: ~: ^/ @5 g
  51. #define DMA_FN_OUT
    7 ~+ Z; c; Y0 s9 P5 g$ i' a
  52. #endif" T! d7 k5 R& h$ y2 L  z" k
  53. ) }* _; n, {8 ?1 w3 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / g3 v8 r, M1 y- K+ b
  55. #define STATIC_SHIFT                3
    ' A5 B3 o! G1 r; B) G( ^
  56. #define TCINTEN_SHIFT               20, t8 t6 B  k$ L/ ^
  57. #define ITCINTEN_SHIFT              21
    8 K' I. j- b7 ?! v) H
  58. #define TCCHEN_SHIFT                22
    ' d' r. N4 }# j9 D0 \5 e' ]
  59. #define ITCCHEN_SHIFT               230 d* |. B4 J0 f2 }3 V

  60. 4 N/ C% z- f  y' S6 i
  61. static volatile int irqraised1 = 0;! |. }( K" E5 G% y5 [7 _9 p
  62. static volatile int irqraised2 = 0;
    5 _! x1 m, q( s; n! a% @
  63. + I* w7 V" l4 o1 k6 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: R. C- `! z, d9 C, L2 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% r) A1 e8 V& |( |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  k( u% m6 f5 b6 R9 k' @
  67. / |6 g, x7 v% v8 f: @
  68. dma_addr_t dmaphyssrc1 = 0;: V& y& W: l! {- A& Q( q* M
  69. dma_addr_t dmaphyssrc2 = 0;
    4 {, F- }1 |, y) H4 \
  70. dma_addr_t dmaphysdest1 = 0;
    2 L( I( d6 H4 K; f
  71. dma_addr_t dmaphysdest2 = 0;
    # ?) ~$ h. y7 d4 L1 K4 _8 r

  72. 3 t) j& E8 `% }2 z- m% [/ |% j) r
  73. char *dmabufsrc1 = NULL;
    / O: A4 r; a) C9 G
  74. char *dmabufsrc2 = NULL;4 ?/ c# l8 N; n8 h( {  }
  75. char *dmabufdest1 = NULL;9 U5 N; V: i) O
  76. char *dmabufdest2 = NULL;: `" o- y. q; ?) _+ q( K

  77. 5 K" A% k0 _8 I% x, P
  78. static int acnt = 512;0 s" ?+ L' Z7 c! t8 Z* R& d
  79. static int bcnt = 8;, ]. g6 H# V' D2 x
  80. static int ccnt = 8;
    + j+ d1 S2 w* N+ i; }: F
  81. 3 j' B9 t% _# o  C
  82. module_param(acnt, int, S_IRUGO);$ V* D6 y& A7 l2 L0 H3 v5 F- m) p
  83. module_param(bcnt, int, S_IRUGO);! i+ g1 s- _+ V2 o0 {+ U; ~1 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ i( u' b* ~7 A  R3 O0 U( R
/ D( K" f0 I& v  y6 R! t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; O3 S, Q; y( a# R, H: f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% V9 N- n, q; c( ?3 O; e: ^0 E/ L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) n1 A4 ?' @# [# T, M, H
  v8 G. m+ H, k% ?. f' ?5 e! v, d( M& U3 E* _( @; \% \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 17:53 , Processed in 0.037445 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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