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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Z* h* D7 s3 }- h' q
  1. [code]EDMA sample test application- }% ?9 {7 |$ `' @% S
  2. /*
    0 o, L4 {. w* ^5 r! k
  3. * edma_test.c, M5 c, e+ m( |/ X' w/ D
  4. *1 i. C9 @0 [9 X, G" _; Q; P! m
  5. * brief  EDMA3 Test Application+ q! B- Y' D9 a. r2 ^
  6. *4 H; ^4 ]& t' k; l
  7. *   This file contains EDMA3 Test code.4 X9 s! A- `& l
  8. *
      i2 D/ Y* `8 @3 s/ H' Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + ?* N3 ~! V9 f" c7 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 `! ^! t8 W4 c. f# X  T
  11. *         TO CHANGE.1 {- L7 }- I- ^: V' B$ B
  12. *1 R! U! H3 j( ^9 |% I* \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 Z" c) ^3 S, x& G
  14. *
    - d$ f$ J+ C4 M3 }" M
  15. * This program is free software; you can redistribute it and/or
    7 w. i5 q! U& E' L! @/ p$ Q- O
  16. * modify it under the terms of the GNU General Public License as
    % A; I& Z! N# z* B  f
  17. * published by the Free Software Foundation version 2.. d8 h+ T0 N/ x$ b* T' m
  18. *
    - p6 W2 f9 x- k$ F2 `7 z, X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - j9 `- v4 h' t4 X8 D7 z; l/ {
  20. * kind, whether express or implied; without even the implied warranty
    * e( }3 z, n+ k# S9 C* R$ _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + w1 q  I* v1 h1 N4 K/ @' J. J
  22. * GNU General Public License for more details.3 q1 \! m" w- v/ `3 p
  23. */
    + j/ j3 `  i; }1 h

  24. 5 ]! f, o6 b: I9 `! ?# |$ G" o
  25. #include <linux/module.h>
    & _* Y$ h' w& Z
  26. #include <linux/init.h>" ~( L  @6 w) y! y& M3 _9 t
  27. #include <linux/errno.h>; r$ i, T0 c5 r
  28. #include <linux/types.h>
    / b1 k' X5 ~" P7 F* Q: Z
  29. #include <linux/interrupt.h>
    $ i' c' R, k  v# g$ Q: }
  30. #include <asm/io.h>
    ( q7 N* j2 ~9 _8 q* D  S$ y9 x
  31. #include <linux/moduleparam.h>
    , j& H( z6 c* `
  32. #include <linux/sysctl.h>
    / B" K3 U  U6 I7 N0 D5 i
  33. #include <linux/mm.h>
    1 S9 A0 h5 \7 N. W7 w; D
  34. #include <linux/dma-mapping.h>
    ; P, U3 a; m4 J4 h4 S! G

  35. & G' Q7 Q/ M! F0 v$ q& h* k
  36. #include <mach/memory.h>! H7 @& C# ~! g8 G/ b  Q$ H8 }
  37. #include <mach/hardware.h>$ e% |! u# a# c+ T
  38. #include <mach/irqs.h>* U# c# `' {. W2 X' |$ g9 h* w9 _5 D
  39. #include <asm/hardware/edma.h>
    ) Y: f/ H; Y' N. w  x6 T
  40.   `. z% |% \' j1 F9 |' Z' a  x
  41. #undef EDMA3_DEBUG$ B( o* e  A3 b' w) `( f: a* X
  42. /*#define EDMA3_DEBUG*/: n" B% ?1 C3 C4 ?. q
  43. ! f/ a7 V' p; M2 B
  44. #ifdef EDMA3_DEBUG
    : }. X% S8 J4 Q, j8 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 I! \% B; ~- |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + ]( ^6 O2 O* |4 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ I$ V% u) w& X: k  ]0 r
  48. #else
    - U' o8 O' Y5 o! ]) L* }6 J
  49. #define DMA_PRINTK( x... )
    4 e8 j) B+ w! l# Z: T8 I; Y  e
  50. #define DMA_FN_IN2 m6 {$ R2 s. N
  51. #define DMA_FN_OUT5 e1 ^; d, c  `1 |) N) O  S: W
  52. #endif
    8 E& c! u3 ?, n& _  m$ S
  53. % O6 z6 V7 _1 A& a- ~8 R4 Y8 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 q5 S2 g5 s6 o, z
  55. #define STATIC_SHIFT                32 t$ S: u2 m" x: p, p
  56. #define TCINTEN_SHIFT               202 o1 o$ @" k' q- [/ e; L* ~! y
  57. #define ITCINTEN_SHIFT              21; G' p4 r. a/ \; @' e/ d( s
  58. #define TCCHEN_SHIFT                22
    ; Z: g( {; i' v( s
  59. #define ITCCHEN_SHIFT               23" O% W! F; w( J- |) C
  60. & B4 S8 G  w: U( X
  61. static volatile int irqraised1 = 0;
    : J8 T" r  O9 X9 ]$ d
  62. static volatile int irqraised2 = 0;
    , B; X# L* K( ?( h3 k

  63. 0 j! l5 j4 W' w! h8 `2 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M. h" x7 s( ^: J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ V. m: X8 A) ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 e' `. J% T0 F

  67. ; c) z9 {3 n! A) @5 a2 N' B7 C
  68. dma_addr_t dmaphyssrc1 = 0;
      I0 Q" x3 v" _2 ^9 [9 p/ p# U1 t
  69. dma_addr_t dmaphyssrc2 = 0;
    0 F1 k! W: Q9 U2 _
  70. dma_addr_t dmaphysdest1 = 0;: k, E' u# p7 n* I! z  h
  71. dma_addr_t dmaphysdest2 = 0;8 q8 @9 `3 N. @; s' V6 U5 V( U1 W4 ]

  72. 5 }- |# E( L9 k. a, M: X
  73. char *dmabufsrc1 = NULL;
    7 e9 i0 P9 @6 l: W. g
  74. char *dmabufsrc2 = NULL;
    : V0 `3 n9 T. u. g
  75. char *dmabufdest1 = NULL;
    " D1 H6 h' O7 O% H% K, z9 h0 @1 |
  76. char *dmabufdest2 = NULL;% B( f! A/ c$ t7 ?
  77. 0 _5 H9 y! P8 ^  ^, F6 _" U
  78. static int acnt = 512;2 q1 o7 a8 g' D) j9 D# S
  79. static int bcnt = 8;
    & A% R. b% V! M: G
  80. static int ccnt = 8;
    1 S8 d9 M1 C7 ^: ?: I

  81. 2 M% g2 z2 x9 w0 k& e
  82. module_param(acnt, int, S_IRUGO);
    : T1 Z* [/ F# G$ E6 q
  83. module_param(bcnt, int, S_IRUGO);
    / l, a1 B9 W1 [- Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ h& U; |5 D) S0 ~! J5 R' b. F

& q  S, y# f3 @& ]/ Q8 A, P% @# b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  {7 O% Q8 F. t  n7 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ P; e" Y! W- w8 ~& R; O9 ~. z4 O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# e- \& P2 z- |; b2 r9 ]
2 Z3 h7 i, z7 k; l9 a
, n6 E/ r' M5 \9 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 16:30 , Processed in 0.037840 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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